Replies: 4 comments 8 replies
-
I plan to try it in the next couple of weeks. I'll report back here and if it works as expected it can be added to the documentation as yet another supported provider. |
Beta Was this translation helpful? Give feedback.
-
At the moment I'm unable to use simple-openai as is to access Gemini due to BaseSimpleOpenAI constructor being package-private. |
Beta Was this translation helpful? Give feedback.
-
There is one more issue that is different with Gemini. Its API key is a token that you need to refresh every hour. Currently, when you create an OpenAI instance it takes an API key as a string and uses it for as long as this instance is alive. This can be handled by the user by creating a new instance OpenAI instance periodically. But, this is pretty cumbersome and potentially requires a lot of changes in many call sites if you call site just receive an OpenAI instance at initialization and then just use it. The API key is converted to an auth header passed to CleverClient I can see several ways to address this concern:
I think that using the request interceptor is a valid approach unless this use case of a dynamci API key is something that simple-openai should support as first-class citizen. Note that specifically for Gemini and request interceptor is required regradless because it need to strip the "/v1" version that simple-openai automatically attaches to the base url for some calls. So, extending this request interceptor to handle the auth header too doesn't add a lot of complexity. @sashirestela WDYT? |
Beta Was this translation helpful? Give feedback.
-
@the-gigi It is awesome that you have verified the feasibility of the Gemini API with your POC.
|
Beta Was this translation helpful? Give feedback.
-
See https://developers.googleblog.com/en/gemini-is-now-accessible-from-the-openai-library/
It will be very cool if simple-openai can add Gemini to its supported providers.
According to the example, all it takes is a different base URL and model name. No complex adaptation like Azure OpenAI.
Beta Was this translation helpful? Give feedback.
All reactions