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

Move model parameter above input/messages/file to make downstream clients more efficient for OpenAI API implementors #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neoq
Copy link

@neoq neoq commented Jul 8, 2024

At $WORK we offer an OpenAI compatible API and route based on the model parameter.
Some clients, like the openai-python client, are generated from this API spec, so the python client always sends the input before the model.
This leads to us buffering the whole input, before being able to parse the model and route to the correct machine hosting that model. I filed an issue with the python client, but it would be hard to change there and it may not be the only project relying on the order of the API spec.

Someone would have to confirm, that this change actually changes the order in requests of openai-python. I tried but did not get far, since they use stainless in a github action.

I think it would be good to change the order of the parameters in the API spec to an improved order, so that downstream clients adopt it. Then, providers of the OpenAI API will be able to route larger requests and with less overall latency.
I wrote some more details in the openai/openai-python#1525 issue.

I changed the spec how I am imagining it currently only for CreateChatCompletionRequest, CreateEmbeddingRequest, CreateTranscriptionRequest, and CreateTranslationRequest. Those are the ones that I have looked into, but the issue may apply to other requests as well, and to other "meta" parameters apart from model.

for CreateChatCompletionRequest, CreateEmbeddingRequest, CreateTranscriptionRequest, CreateTranslationRequest
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.

1 participant