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

feat: add new models for gemini translation #571

Merged
merged 36 commits into from
Jun 5, 2024

Conversation

Jerry23011
Copy link
Collaborator

@Jerry23011 Jerry23011 commented May 28, 2024

closes #559

The settings pane is now finished and working.

I set the default model as gemini-1.5-flash as it has the same quota with 1.0 and offer better performance.

However, I don't know how to realize query type and display available models in the query view

@Jerry23011 Jerry23011 requested a review from tisfeng May 28, 2024 14:14
@tisfeng tisfeng marked this pull request as ready for review May 28, 2024 14:48
Copy link
Owner

@tisfeng tisfeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a model button here, enable to change Gemini models quickly.

image

@tisfeng
Copy link
Owner

tisfeng commented May 28, 2024

Actually, we can easily enable LLMStreamService to change models quickly cc78117

image

@Jerry23011
Copy link
Collaborator Author

Actually, we can easily enable LLMStreamService to change models quickly cc78117

image

That's nice

@Jerry23011
Copy link
Collaborator Author

Speaking of built-in ai, I noticed it's using gemini pro 1.5 flash latest. Do we use latest for gemini too? Or do we stick with the stable build?

@tisfeng
Copy link
Owner

tisfeng commented May 28, 2024

Currently Gemini has only one translationPrompt, which can only be used for translation.

Please refer to BaseOpenAIService to add prompt for querying sentences and words.

image

@tisfeng
Copy link
Owner

tisfeng commented May 28, 2024

Speaking of built-in ai, I noticed it's using gemini pro 1.5 flash latest. Do we use latest for gemini too? Or do we stick with the stable build?

Just keep it this way. I noticed that gemini-1.5-flash is also used in the official documentation.

I use gemini-1.5-flash-latest in the built-in AI service because the gemini-1.5-flash API from Google was not yet available before, and using it directly would result in an error 😓

@Jerry23011 Jerry23011 requested a review from phlpsong May 30, 2024 09:05
@Jerry23011
Copy link
Collaborator Author

I'll take a look at these

@tisfeng
Copy link
Owner

tisfeng commented Jun 4, 2024

I have improved the code, replace all AI const stored keys with dynamic variables a6dcd5d .

This code can be optimized later, as well as removing unused const keys.

tisfeng
tisfeng previously approved these changes Jun 4, 2024
@Jerry23011
Copy link
Collaborator Author

So we need to replace all the strings 😂

@tisfeng
Copy link
Owner

tisfeng commented Jun 4, 2024

Note that gemini-1.0-pro model does not support system instruction google-gemini/generative-ai-python#328

So I change system prompt to user prompt for gemini-1.0-pro model, see in 22bf492 and 67a63f1 .

image

@Jerry23011
Copy link
Collaborator Author

Note that gemini-1.0-pro model does not support system instruction google-gemini/generative-ai-python#328

So I change system prompt to user prompt for gemini-1.0-pro model, see in 22bf492 and 67a63f1 .

Got it, thank you :)

Copy link
Owner

@tisfeng tisfeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@tisfeng tisfeng merged commit 8420e58 into tisfeng:dev Jun 5, 2024
5 checks passed
@tisfeng
Copy link
Owner

tisfeng commented Jun 5, 2024

@Jerry23011 I haven't looked closely at the Gemini API, does it support canceling stream requests? Like this #577

@Jerry23011
Copy link
Collaborator Author

@Jerry23011 I haven't looked closely at the Gemini API, does it support canceling stream requests? Like this #577

I didn't find any, so I submitted an issue google-gemini/generative-ai-swift#178

@tisfeng
Copy link
Owner

tisfeng commented Jun 5, 2024

Good, their developers are very proactive, and next, we just need to wait for them to implement this feature 😃

@Jerry23011 Jerry23011 deleted the gemini-update branch July 18, 2024 10:22
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.

2 participants