Skip to content

Support Azure content filters in completion #280

@Sufflope

Description

@Sufflope

Hello,

we currently use async-openai to query Azure OpenAI and we would need support for the new content filters on Azure OpenAI. Basically it's a new content_filter_results field in (Chat)Choice.

I would be happy to work on it, however I read the Contributing section of the README 😄 and I understand you want to stick to OpenAI specs, while this is an Azure extension. But also (thankfully for us) there are already some Azure specific stuff I reckon (e.g. the AzureConfig), although limited admittedly.

What would be the best course of action? I see a few options:

  1. add the support, but make this field optional (it is anyway since you can choose to not enable those filters) so it doesn't break on pure OpenAI
  2. add the support and add an azure feature to the crate and gate Azure-specific stuff behind it
  3. add some sort of "extra fields" to (Chat)Choice where anything extra would be stored as a serde_value::Map (and then people "do their thing" with those extra fields) so it supports "extra features" from providers without being Azure-specific
  4. I can also just fork (a friendly fork! or even just an internal one)

1 would work for me of course, but I think 2 (my preference) would be interesting, to have both pure OpenAI as default, but also support Azure extensions, since I believe Azure is actually a big de facto OpenAI provider, but I understand if you're not interested / willing to. 3 sounds quite hackish. 4 is OK of course as last resort. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    out of scopeRequests which are not related to OpenAI API

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions