Merge pull request #8881 from uinstinct/gemini-3-support
chore: add support for gemini 3 pro preview
This commit is contained in:
commit
827ca72bff
8 changed files with 181 additions and 8 deletions
|
|
@ -205,6 +205,7 @@ class CometAPI extends OpenAI {
|
|||
"claude-3-5-haiku-latest",
|
||||
|
||||
// Gemini series
|
||||
"gemini-3-pro-preview",
|
||||
"gemini-2.5-pro",
|
||||
"gemini-2.5-flash",
|
||||
"gemini-2.5-flash-lite",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// core/llm/toolSupport.test.ts
|
||||
import { PROVIDER_TOOL_SUPPORT } from "./toolSupport";
|
||||
import { PROVIDER_TOOL_SUPPORT, isRecommendedAgentModel } from "./toolSupport";
|
||||
|
||||
describe("PROVIDER_TOOL_SUPPORT", () => {
|
||||
describe("continue-proxy", () => {
|
||||
|
|
@ -354,3 +354,140 @@ describe("PROVIDER_TOOL_SUPPORT", () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("isRecommendedAgentModel", () => {
|
||||
describe("OpenAI models", () => {
|
||||
it("should return true for o1, o3, o4 models", () => {
|
||||
expect(isRecommendedAgentModel("o1")).toBe(true);
|
||||
expect(isRecommendedAgentModel("o1-preview")).toBe(true);
|
||||
expect(isRecommendedAgentModel("o3")).toBe(true);
|
||||
expect(isRecommendedAgentModel("o3-mini")).toBe(true);
|
||||
expect(isRecommendedAgentModel("o4")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true for GPT-5 models", () => {
|
||||
expect(isRecommendedAgentModel("gpt-5")).toBe(true);
|
||||
expect(isRecommendedAgentModel("gpt-5-turbo")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for GPT-4 models", () => {
|
||||
expect(isRecommendedAgentModel("gpt-4")).toBe(false);
|
||||
expect(isRecommendedAgentModel("gpt-4-turbo")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("DeepSeek models", () => {
|
||||
it("should return true for DeepSeek R1/Reasoner models", () => {
|
||||
expect(isRecommendedAgentModel("deepseek-r1")).toBe(true);
|
||||
expect(isRecommendedAgentModel("deepseek-r1-0528")).toBe(true);
|
||||
expect(isRecommendedAgentModel("deepseek-reasoner")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for non-reasoner DeepSeek models", () => {
|
||||
expect(isRecommendedAgentModel("deepseek-chat")).toBe(false);
|
||||
expect(isRecommendedAgentModel("deepseek-coder")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Gemini models", () => {
|
||||
it("should return true for Gemini 2.5 Pro models", () => {
|
||||
expect(isRecommendedAgentModel("gemini-2.5-pro")).toBe(true);
|
||||
expect(isRecommendedAgentModel("gemini-2.5-pro-preview")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true for Gemini 3 Pro models", () => {
|
||||
expect(isRecommendedAgentModel("gemini-3-pro-preview")).toBe(true);
|
||||
expect(isRecommendedAgentModel("gemini-3-pro")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for Gemini Flash models", () => {
|
||||
expect(isRecommendedAgentModel("gemini-2.5-flash")).toBe(false);
|
||||
expect(isRecommendedAgentModel("gemini-3-flash")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for Gemini models without pro designation", () => {
|
||||
expect(isRecommendedAgentModel("gemini-2.5")).toBe(false);
|
||||
expect(isRecommendedAgentModel("gemini-3")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for older Gemini versions", () => {
|
||||
expect(isRecommendedAgentModel("gemini-1.5-pro")).toBe(false);
|
||||
expect(isRecommendedAgentModel("gemini-2.0-pro")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Claude models", () => {
|
||||
it("should return true for Claude Sonnet 3.7 and later models", () => {
|
||||
expect(isRecommendedAgentModel("claude-3-7-sonnet")).toBe(true);
|
||||
expect(isRecommendedAgentModel("claude-3.7-sonnet")).toBe(true);
|
||||
expect(isRecommendedAgentModel("claude-sonnet-4")).toBe(true);
|
||||
expect(isRecommendedAgentModel("claude-4-sonnet")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true for Claude Opus 4 models", () => {
|
||||
expect(isRecommendedAgentModel("claude-opus-4")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true for Claude 4-5 models", () => {
|
||||
expect(isRecommendedAgentModel("claude-4-5")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for Claude 3.5 Sonnet models", () => {
|
||||
expect(isRecommendedAgentModel("claude-3-5-sonnet")).toBe(false);
|
||||
expect(isRecommendedAgentModel("claude-3.5-sonnet")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for Claude Haiku models", () => {
|
||||
expect(isRecommendedAgentModel("claude-3-7-haiku")).toBe(false);
|
||||
expect(isRecommendedAgentModel("claude-3.7-haiku")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for older Claude models", () => {
|
||||
expect(isRecommendedAgentModel("claude-3-opus")).toBe(false);
|
||||
expect(isRecommendedAgentModel("claude-2")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("xAI models", () => {
|
||||
it("should return true for Grok Code models", () => {
|
||||
expect(isRecommendedAgentModel("grok-code")).toBe(true);
|
||||
expect(isRecommendedAgentModel("grok-code-beta")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for non-code Grok models", () => {
|
||||
expect(isRecommendedAgentModel("grok-3")).toBe(false);
|
||||
expect(isRecommendedAgentModel("grok-4")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("case insensitivity", () => {
|
||||
it("should handle uppercase model names", () => {
|
||||
expect(isRecommendedAgentModel("GEMINI-3-PRO-PREVIEW")).toBe(true);
|
||||
expect(isRecommendedAgentModel("CLAUDE-4-SONNET")).toBe(true);
|
||||
expect(isRecommendedAgentModel("DEEPSEEK-R1")).toBe(true);
|
||||
expect(isRecommendedAgentModel("O3-MINI")).toBe(true);
|
||||
});
|
||||
|
||||
it("should handle mixed case model names", () => {
|
||||
expect(isRecommendedAgentModel("Gemini-3-Pro")).toBe(true);
|
||||
expect(isRecommendedAgentModel("Claude-Opus-4")).toBe(true);
|
||||
expect(isRecommendedAgentModel("DeepSeek-Reasoner")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("edge cases", () => {
|
||||
it("should return false for empty string", () => {
|
||||
expect(isRecommendedAgentModel("")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for random strings", () => {
|
||||
expect(isRecommendedAgentModel("random-model")).toBe(false);
|
||||
expect(isRecommendedAgentModel("test")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for partial matches", () => {
|
||||
expect(isRecommendedAgentModel("gemini-pro")).toBe(false);
|
||||
expect(isRecommendedAgentModel("claude-sonnet")).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ export function isRecommendedAgentModel(modelName: string): boolean {
|
|||
const recs: RegExp[][] = [
|
||||
[/o[134]/],
|
||||
[/deepseek/, /r1|reasoner/],
|
||||
[/gemini/, /2\.5/, /pro/],
|
||||
[/gemini/, /2\.5|3/, /pro/],
|
||||
[/gpt/, /-5|5\.1/],
|
||||
[/claude/, /sonnet/, /3\.7|3-7|-4/],
|
||||
[/claude/, /opus/, /-4/],
|
||||
|
|
|
|||
|
|
@ -114,20 +114,20 @@ If you prefer to use a model from [xAI](../model-providers/more/xAI), then we re
|
|||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Gemini 2.0 Flash from Google
|
||||
### Gemini 3 Pro from Google
|
||||
|
||||
If you prefer to use a model from [Google](../model-providers/top-level/gemini), then we recommend Gemini 2.0 Flash.
|
||||
If you prefer to use a model from [Google](../model-providers/top-level/gemini), then we recommend Gemini 3 Pro.
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Hub">
|
||||
Add the [Gemini 2.0 Flash block](https://hub.continue.dev/google/gemini-2.0-flash) from the hub
|
||||
Add the [Gemini 3 Pro block](https://hub.continue.dev/google/gemini-3-pro-preview) from the hub
|
||||
</Tab>
|
||||
<Tab title="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Gemini 2.0 Flash
|
||||
- name: Gemini 3 Pro
|
||||
provider: gemini
|
||||
model: gemini-2.0-flash
|
||||
model: gemini-3-pro-preview
|
||||
apiKey: <YOUR_GEMINI_API_KEY>
|
||||
```
|
||||
</Tab>
|
||||
|
|
|
|||
|
|
@ -913,6 +913,20 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
providerOptions: ["gemini"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
gemini3ProPreview: {
|
||||
title: "Gemini 3 Pro",
|
||||
description:
|
||||
"Google's latest Pro model with up to 64k output context. Best for complex tasks involving reasoning.",
|
||||
params: {
|
||||
title: "Gemini 3 Pro",
|
||||
model: "gemini-3-pro-preview",
|
||||
contextLength: 1_048_576,
|
||||
apiKey: "<API_KEY>",
|
||||
},
|
||||
icon: "gemini.png",
|
||||
providerOptions: ["gemini"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
c4aiAyaExpanse8B: {
|
||||
title: "C4AI Aya Expanse 8B",
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -604,6 +604,7 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
|
|||
models.gemini20FlashLite,
|
||||
models.gemini20FlashImageGeneration,
|
||||
models.gemini25ProExp,
|
||||
models.gemini3ProPreview,
|
||||
],
|
||||
apiKeyUrl: "https://aistudio.google.com/app/apikey",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -135,6 +135,15 @@ export const CometAPI: ModelProvider = {
|
|||
},
|
||||
|
||||
// Gemini Series
|
||||
{
|
||||
model: "gemini-3-pro-preview",
|
||||
displayName: "Gemini 3 Pro Preview",
|
||||
contextLength: 2000000,
|
||||
maxCompletionTokens: 8192,
|
||||
description:
|
||||
"Gemini flagship model with high precision multimodal capabilities.",
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
{
|
||||
model: "gemini-2.5-pro",
|
||||
displayName: "Gemini 2.5 Pro",
|
||||
|
|
|
|||
|
|
@ -3,11 +3,22 @@ import { AllMediaTypes, ModelProvider } from "../types.js";
|
|||
// See https://ai.google.dev/gemini-api/docs/models
|
||||
export const Gemini: ModelProvider = {
|
||||
models: [
|
||||
{
|
||||
model: "gemini-3-pro-preview",
|
||||
displayName: "Gemini 3 Pro Preview",
|
||||
description:
|
||||
"Google's flagship frontier model with high precision multimodal capabilities.",
|
||||
contextLength: 1048576,
|
||||
maxCompletionTokens: 65536,
|
||||
mediaTypes: AllMediaTypes,
|
||||
regex: /gemini-3-pro-preview/i,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
{
|
||||
model: "gemini-2.5-pro-preview-05-06",
|
||||
displayName: "Gemini 2.5 Pro Preview",
|
||||
description:
|
||||
"Google's most advanced model with strong reasoning, multimodal capabilities, and advanced coding skills",
|
||||
"Google's advanced model with strong reasoning, multimodal capabilities, and advanced coding skills",
|
||||
contextLength: 1048576,
|
||||
maxCompletionTokens: 65536,
|
||||
mediaTypes: AllMediaTypes,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue