Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add Support for Content Filter Response Deserialization OR Expose Raw Response in OpenAI Kotlin Client #294

Open
gh-abhay opened this issue Jan 12, 2024 · 0 comments · May be fixed by #300
Labels
enhancement New feature or request

Comments

@gh-abhay
Copy link

Feature Description

The current OpenAI Kotlin client lacks the ability to deserialize the Content Filter response returned by the Azure OpenAI API (Content Filter Documentation). Additionally, the client does not expose the HTTP headers, body of the response, or a way to disable deserialization of the response. This makes it impossible to use the client to call the Azure OpenAI API when we want to use the Content Filter feature.

Problem it Solves

This feature request aims to address the inability to use the Content Filter feature of the Azure OpenAI API with the current OpenAI Kotlin client. Currently, there is no workaround for this issue, which limits the functionality and usability of the client. Developers are unable to filter content as per their requirements, which can be a crucial feature for many applications.

Proposed Solution

There are two potential solutions to this problem:

  1. Add a content filter parameter as optional in the current Chat Completions and Completions response. For example:
@Serializable
public data class ChatCompletion(

    // all existing properties
    // ...

    /**
     * Content filtering results for zero or more prompts in the request. In a streaming request,
     * results for different prompts may arrive at different times or in different orders.
     */
    @SerialName("prompt_filter_results")
    val promptFilterResults: List<ContentFilterResultsForPrompt>? = null
)
  1. Expose the ability to get raw response from the client, so that we can deserialize the response ourselves. This would provide more flexibility and control over the response handling, and allow developers to handle the response as per their specific requirements.

Additional Context

The Azure OpenAI API provides a Content Filter feature that is currently unusable with the OpenAI Kotlin client due to the issues described above. Implementing either of the proposed solutions would greatly enhance the functionality and usability of the client, and allow developers to fully leverage the capabilities of the Azure OpenAI API. This would be a significant improvement for developers who need to use content filtering in their applications.

@gh-abhay gh-abhay added the enhancement New feature or request label Jan 12, 2024
@gh-abhay gh-abhay linked a pull request Jan 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant