θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content

Refactor Gemini to use OpenAI interface API #3616

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

Merged
merged 5 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GID='1000'

# LLM_PROVIDER='gemini'
# GEMINI_API_KEY=
# GEMINI_LLM_MODEL_PREF='gemini-pro'
# GEMINI_LLM_MODEL_PREF='gemini-2.0-flash-lite'

# LLM_PROVIDER='azure'
# AZURE_OPENAI_ENDPOINT=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export default function GeminiLLMOptions({ settings }) {
{!settings?.credentialsOnly && (
<>
<GeminiModelSelection apiKey={geminiApiKey} settings={settings} />
{/*

Safety setting is not supported for Gemini yet due to the openai compatible Gemini API.
We are not using the generativeAPI endpoint and therefore cannot set the safety threshold.

<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-3">
Safety Setting
Expand All @@ -48,7 +53,7 @@ export default function GeminiLLMOptions({ settings }) {
</option>
<option value="BLOCK_LOW_AND_ABOVE">Block most</option>
</select>
</div>
</div> */}
</>
)}
</div>
Expand Down
16 changes: 1 addition & 15 deletions frontend/src/hooks/useGetProvidersModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,7 @@ export const DISABLED_PROVIDERS = [
];
const PROVIDER_DEFAULT_MODELS = {
openai: [],
gemini: [
"gemini-pro",
"gemini-1.0-pro",
"gemini-1.5-pro-latest",
"gemini-1.5-flash-latest",
"gemini-1.5-pro-exp-0801",
"gemini-1.5-pro-exp-0827",
"gemini-1.5-flash-exp-0827",
"gemini-1.5-flash-8b-exp-0827",
"gemini-exp-1114",
"gemini-exp-1121",
"gemini-exp-1206",
"learnlm-1.5-pro-experimental",
"gemini-2.0-flash-exp",
],
gemini: [],
anthropic: [],
azure: [],
lmstudio: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const ENABLED_PROVIDERS = [
"apipie",
"xai",
"nvidia-nim",
"gemini",
// TODO: More agent support.
// "cohere", // Has tool calling and will need to build explicit support
// "huggingface" // Can be done but already has issues with no-chat templated. Needs to be tested.
// "gemini", // Too rate limited and broken in several ways to use for agents.
];
const WARN_PERFORMANCE = [
"lmstudio",
Expand Down
2 changes: 1 addition & 1 deletion server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SIG_SALT='salt' # Please generate random string at least 32 chars long.

# LLM_PROVIDER='gemini'
# GEMINI_API_KEY=
# GEMINI_LLM_MODEL_PREF='gemini-pro'
# GEMINI_LLM_MODEL_PREF='gemini-2.0-flash-lite'

# LLM_PROVIDER='azure'
# AZURE_OPENAI_ENDPOINT=
Expand Down
3 changes: 2 additions & 1 deletion server/models/systemSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ const SystemSettings = {

// Gemini Keys
GeminiLLMApiKey: !!process.env.GEMINI_API_KEY,
GeminiLLMModelPref: process.env.GEMINI_LLM_MODEL_PREF || "gemini-pro",
GeminiLLMModelPref:
process.env.GEMINI_LLM_MODEL_PREF || "gemini-2.0-flash-lite",
GeminiSafetySetting:
process.env.GEMINI_SAFETY_SETTING || "BLOCK_MEDIUM_AND_ABOVE",

Expand Down
Loading