You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the OpenAITarget and its variants automatically include an api_version attribute, which defaults to an Azure OpenAI-specific value. This default is appended as a query parameter in API requests, causing failures when using the Google Generative Language API (OpenAI compatibility docs for that here).
OpenAITTSTarget (Likely not an issue as it's not supported by other providers?)
Proposed solution
I'd be very happy to submit a fix for this. A possible approach:
Modify handling of api_version so that setting it to None prevents it from being added to query parameters. Otherwise, the default is maintained to avoid breaking existing usage.
Example:
When you say Google Generative Language API, is that Gemini or something else? I'm not sure aware of their offerings but we've requested an account to be able to add integration tests. I should have that shortly. Do you think you could add one that uses Gemini with a Gemini specific api key? Just to make sure requests go through.
Yes, I am referring to Gemini. That endpoint is what they provide for use with the OpenAI SDK. However, I have found that I need to add "/chat/completions" to that endpoint in order to make it work with Gemini as an OpenAIChatTarget (when using it with the fix in #764).
I would be very happy to add an integration test to confirm Gemini support, I just want to make sure I follow your preferred setup. Should that test go in test_targets_and_secrets.py, or do you prefer a new file?
Sorry, I'm a little behind myself! I wasn't aware that this part of the integration tests existed already. I am actually getting an account today and can add the integration test with that. I would ignore it for your PR. I don't want to add the test before I have the account + key. That said, if I add the secret to our integration test pipeline today I'll confirm here so that you can add the corresponding parametrization to the integration test.
Thanks for confirming that it's Gemini and thanks your PR!
Describe the bug
It looks like the
OpenAITarget
and its variants automatically include anapi_version
attribute, which defaults to an Azure OpenAI-specific value. This default is appended as a query parameter in API requests, causing failures when using the Google Generative Language API (OpenAI compatibility docs for that here).Steps/Code to Reproduce
Expected Results
It should be calling the endpoint as provided.
Actual Results
It is adding an
api_version
query parameter:Part of the traceback:
Setting
api_version=None
does not prevent it from being added. Instead, it results in an empty query parameter:Versions
I see that this parameter is added for the various OpenAI targets:
OpenAIChatTarget
OpenAICompletionTarget
RealtimeTarget
OpenAIDALLETarget
(Likely not an issue as it's specific to DALLE?)OpenAITTSTarget
(Likely not an issue as it's not supported by other providers?)Proposed solution
I'd be very happy to submit a fix for this. A possible approach:
api_version
so that setting it toNone
prevents it from being added to query parameters. Otherwise, the default is maintained to avoid breaking existing usage.Example:
The text was updated successfully, but these errors were encountered: