-
Notifications
You must be signed in to change notification settings - Fork 433
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
feat: Add support for Google Gemini #115
Conversation
❌ Deploy Preview for chatgpt-demo-v2 failed.
|
I'll try it and possibly suggest some changes, thanks for contributing! |
src/providers/google/api.ts
Outdated
method: 'POST', | ||
body: JSON.stringify({ ...body }), | ||
} | ||
return fetch(`https://generativelanguage.googleapis.com/v1beta3/models/text-bison-001:generateText?key=${apiKey}`, initOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might want to use models/gemini-pro
instead of models/text-bison-001
?
See https://ai.google.dev/models and curl:
curl https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent?key=$API_KEY \
-H 'Content-Type: application/json' \
-X POST \
-d '{ "contents":[
{ "parts":[{"text": "Write a story about a magic backpack"}]}
]
}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies. This URL points to PaLM2 instead of Gemini Pro, I'll fix it ASAP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for my mistake of using PaLM2 as the Gemini API.
I take those words back:
Google Gemini currently does not support Chinese.It does support Chinese. API Doc.- Also Gemini API has decent dialog capabilities.
Description
- Remove the PaLM2 model because it've become a legacy. Now users can select
gemini-pro
for a chat. - Modified the process of using the Gemini API conversation.
Additional context
- It looks like the number of lists passed in must be odd, not even, for multi-round conversations. Another Repo Issue. The corresponding code is in the src/logics/conversation.ts
- The Gemini api also supports passing in parameters such as
temperature
,topk
, etc.. I will add them in the future.
Thanks! I've made a few changes, mainly migrating the logic of translating the OpenAI message structure to Google Gemini inside the provider, leaving the I think some things can be done in the short term, including passing parameters and supporting stream output, but it's fully functional for now. I will merge it if there are no more problems. |
Description
Add support for Google Gemini Pro API. Link
Linked Issues
None.
Additional context
There are a few points to note:
gpt-3.5-turbo
based on my test.