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

Support extra field regex in OpenAI API #172

Merged
merged 2 commits into from
Feb 11, 2024
Merged

Support extra field regex in OpenAI API #172

merged 2 commits into from
Feb 11, 2024

Conversation

comaniac
Copy link
Collaborator

@comaniac comaniac commented Feb 9, 2024

close #171

This PR adds an extra field regex in OpenAI protocols. Since OpenAI SDK 2.0, it allows arbitrary fields to be specified in the following approaches:

  1. OpenAI SDK:
response = client.chat.completions.create(
    ...
    extra_body={"more_param": more_param_value},
)
  1. CURL:
curl http:https://localhost:5000/v1/chat/completions?more_param=more_param_value ...

The extra parameter (i.e., regex) will be ignored by OpenAI models (e.g., gpt-3.5-turbo, gpt4, etc), but our SRT OpenAI API server will forward it correctly.

cc @remixer-dec

@merrymercy merrymercy merged commit 50afed4 into main Feb 11, 2024
@merrymercy merrymercy deleted the cody/openai_regex branch February 11, 2024 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAI compatible API and JSON schema enforcing
2 participants