Skip to content

Commit 63a5297

Browse files
authored
chore(go): replace gemini-1.5* and gemini-2.0* references with gemini-2.5* (#3761)
1 parent 203ce51 commit 63a5297

File tree

20 files changed

+41
-43
lines changed

20 files changed

+41
-43
lines changed

go/genkit/genkit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func WithPromptDir(dir string) GenkitOption {
138138
// // Assumes a prompt file at ./prompts/jokePrompt.prompt
139139
// g := genkit.Init(ctx,
140140
// genkit.WithPlugins(&googlegenai.GoogleAI{}),
141-
// genkit.WithDefaultModel("googleai/gemini-2.0-flash"),
141+
// genkit.WithDefaultModel("googleai/gemini-2.5-flash"),
142142
// genkit.WithPromptDir("./prompts"),
143143
// )
144144
//
@@ -637,7 +637,7 @@ func GenerateWithRequest(ctx context.Context, g *Genkit, actionOpts *ai.Generate
637637
// Example:
638638
//
639639
// resp, err := genkit.Generate(ctx, g,
640-
// ai.WithModelName("googleai/gemini-2.0-flash"),
640+
// ai.WithModelName("googleai/gemini-2.5-flash"),
641641
// ai.WithPrompt("Write a short poem about clouds."),
642642
// ai.WithConfig(&genai.GenerateContentConfig{MaxOutputTokens: 50}),
643643
// )

go/plugins/googlecloud/generate_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ func TestGenerateTelemetry_PipelineIntegration(t *testing.T) {
2929

3030
// Create span using the TracerProvider - this triggers the full pipeline
3131
ctx := context.Background()
32-
_, span := f.tracer.Start(ctx, "googleai/gemini-2.0-pro-flash")
32+
_, span := f.tracer.Start(ctx, "googleai/gemini-2.5-pro")
3333

3434
span.SetAttributes(
35-
attribute.String("genkit:name", "googleai/gemini-2.0-pro-flash"),
35+
attribute.String("genkit:name", "googleai/gemini-2.5-pro"),
3636
attribute.String("genkit:metadata:subtype", "model"),
3737
attribute.String("genkit:path", "/{chatFlow,t:flow}/{generate,t:action}"),
3838
attribute.String("genkit:input", inputJSON),
@@ -74,11 +74,11 @@ func TestGenerateTelemetry_MetricCapture(t *testing.T) {
7474
name: "successful generation captures all metrics",
7575
attrs: map[string]string{
7676
"genkit:type": "action",
77-
"genkit:name": "googleai/gemini-2.0-pro-flash",
77+
"genkit:name": "googleai/gemini-2.5-pro",
7878
"genkit:metadata:subtype": "model",
7979
"genkit:path": "/{chatFlow,t:flow}/{generate,t:action}",
8080
},
81-
inputJSON: `{"model":"googleai/gemini-2.5-flash","messages":[{"content":[{"text":"Hello world"}],"role":"user"}]}`,
81+
inputJSON: `{"model":"googleai/gemini-2.5-pro","messages":[{"content":[{"text":"Hello world"}],"role":"user"}]}`,
8282
outputJSON: `{"message":{"content":[{"text":"Hello! How can I help you today?"}],"role":"model"},"usage":{"inputTokens":12,"outputTokens":8,"inputCharacters":11,"outputCharacters":33,"inputImages":1,"outputImages":0},"latencyMs":342.5}`,
8383
expectMetrics: true,
8484
expectedStatus: "success",
@@ -98,11 +98,11 @@ func TestGenerateTelemetry_MetricCapture(t *testing.T) {
9898
name: "failed generation captures error metrics",
9999
attrs: map[string]string{
100100
"genkit:type": "action",
101-
"genkit:name": "googleai/gemini-2.0-pro-flash",
101+
"genkit:name": "googleai/gemini-2.5-pro",
102102
"genkit:metadata:subtype": "model",
103103
"genkit:path": "/{errorFlow,t:flow}/{generate,t:action}",
104104
},
105-
inputJSON: `{"model":"googleai/gemini-2.5-flash","messages":[{"content":[{"text":"Invalid prompt"}],"role":"user"}]}`,
105+
inputJSON: `{"model":"googleai/gemini-2.5-pro","messages":[{"content":[{"text":"Invalid prompt"}],"role":"user"}]}`,
106106
outputJSON: `{"usage":{"inputCharacters":14}}`,
107107
expectMetrics: true,
108108
expectedStatus: "failure",
@@ -116,11 +116,11 @@ func TestGenerateTelemetry_MetricCapture(t *testing.T) {
116116
name: "generation with video and audio captures multimedia metrics",
117117
attrs: map[string]string{
118118
"genkit:type": "action",
119-
"genkit:name": "googleai/gemini-2.0-pro-flash",
119+
"genkit:name": "googleai/gemini-2.5-pro-flash",
120120
"genkit:metadata:subtype": "model",
121121
"genkit:path": "/{multimediaFlow,t:flow}/{generate,t:action}",
122122
},
123-
inputJSON: `{"model":"googleai/gemini-2.5-flash","messages":[{"content":[{"text":"Analyze this video and audio"}],"role":"user"}]}`,
123+
inputJSON: `{"model":"googleai/gemini-2.5-pro","messages":[{"content":[{"text":"Analyze this video and audio"}],"role":"user"}]}`,
124124
outputJSON: `{"message":{"content":[{"text":"Analysis complete"}],"role":"model"},"usage":{"inputTokens":5,"outputTokens":3,"inputCharacters":26,"outputCharacters":17,"inputImages":0,"outputImages":1,"inputVideos":2,"outputVideos":0,"inputAudioFiles":1,"outputAudioFiles":0},"latencyMs":1250.3}`,
125125
expectMetrics: true,
126126
expectedStatus: "success",

go/plugins/googlegenai/cache_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func TestGetContentForCache_Invalid(t *testing.T) {
7979
},
8080
},
8181
}
82-
err := validateContextCacheRequest(req, "gemini-1.5-fash-001")
82+
err := validateContextCacheRequest(req, "gemini-2.5-fash")
8383
if err == nil {
8484
t.Fatal("expecting error, system instructions are not supported with Context Cache")
8585
}
@@ -89,7 +89,7 @@ func TestValidateContextCacheRequest_HasTools(t *testing.T) {
8989
req := &ai.ModelRequest{
9090
Tools: []*ai.ToolDefinition{{Name: "someTool"}},
9191
}
92-
err := validateContextCacheRequest(req, "gemini-1.5-flash-001")
92+
err := validateContextCacheRequest(req, "gemini-2.5-flash")
9393
if err == nil {
9494
t.Fatal("expected error if Tools are present")
9595
}
@@ -100,7 +100,7 @@ func TestValidateContextCacheRequest_HasTools(t *testing.T) {
100100

101101
func TestValidateContextCacheRequest_Valid(t *testing.T) {
102102
req := &ai.ModelRequest{}
103-
err := validateContextCacheRequest(req, "gemini-1.5-flash-001")
103+
err := validateContextCacheRequest(req, "gemini-2.5-flash")
104104
if err != nil {
105105
t.Fatalf("did not expect error, got: %v", err)
106106
}

go/plugins/googlegenai/googleai_live_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestGoogleAILive(t *testing.T) {
6666
ctx := context.Background()
6767

6868
g := genkit.Init(ctx,
69-
genkit.WithDefaultModel("googleai/gemini-2.0-flash"),
69+
genkit.WithDefaultModel("googleai/gemini-2.5-flash"),
7070
genkit.WithPlugins(&googlegenai.GoogleAI{APIKey: apiKey}),
7171
)
7272

@@ -359,7 +359,7 @@ func TestGoogleAILive(t *testing.T) {
359359
ai.WithMessages(
360360
ai.NewUserMessage(
361361
ai.NewTextPart("do you what animal is in the image?"),
362-
ai.NewMediaPart("image/jpg", "data:image/jpg;base64,"+i),
362+
ai.NewMediaPart("image/jpeg", "data:image/jpeg;base64,"+i),
363363
),
364364
),
365365
)
@@ -396,7 +396,7 @@ func TestGoogleAILive(t *testing.T) {
396396
ai.WithMessages(
397397
ai.NewUserMessage(
398398
ai.NewTextPart("do you know who's in the image?"),
399-
ai.NewDataPart("data:image/jpg;base64,"+i),
399+
ai.NewDataPart("data:image/jpeg;base64,"+i),
400400
),
401401
),
402402
)
@@ -408,7 +408,7 @@ func TestGoogleAILive(t *testing.T) {
408408
}
409409
})
410410
t.Run("image generation", func(t *testing.T) {
411-
m := googlegenai.GoogleAIModel(g, "gemini-2.0-flash-preview-image-generation")
411+
m := googlegenai.GoogleAIModel(g, "gemini-2.5-flash-image")
412412
resp, err := genkit.Generate(ctx, g,
413413
ai.WithConfig(genai.GenerateContentConfig{
414414
ResponseModalities: []string{"IMAGE", "TEXT"},
@@ -641,8 +641,8 @@ func TestCacheHelper(t *testing.T) {
641641

642642
func fetchImgAsBase64() (string, error) {
643643
// CC0 license image
644-
imgUrl := "https://pd.w.org/2025/07/896686fbbcd9990c9.84605288-2048x1365.jpg"
645-
resp, err := http.Get(imgUrl)
644+
imgURL := "https://pd.w.org/2025/07/896686fbbcd9990c9.84605288-2048x1365.jpg"
645+
resp, err := http.Get(imgURL)
646646
if err != nil {
647647
return "", err
648648
}

go/plugins/googlegenai/vertexai_live_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ func TestVertexAILive(t *testing.T) {
4444

4545
ctx := context.Background()
4646
g := genkit.Init(ctx,
47-
genkit.WithDefaultModel("vertexai/gemini-2.0-flash"),
47+
genkit.WithDefaultModel("vertexai/gemini-2.5-flash"),
4848
genkit.WithPlugins(&googlegenai.VertexAI{ProjectID: projectID, Location: location}),
4949
)
5050

51-
embedder := googlegenai.VertexAIEmbedder(g, "textembedding-gecko@003")
51+
embedder := googlegenai.VertexAIEmbedder(g, "gemini-embedding-001")
5252

5353
gablorkenTool := genkit.DefineTool(g, "gablorken", "use this tool when the user asks to calculate a gablorken",
5454
func(ctx *ai.ToolContext, input struct {
@@ -267,7 +267,7 @@ func TestVertexAILive(t *testing.T) {
267267
if location != "global" {
268268
t.Skipf("image generation in Vertex AI is only supported in region: global, got: %s", location)
269269
}
270-
m := googlegenai.VertexAIModel(g, "gemini-2.0-flash-preview-image-generation")
270+
m := googlegenai.VertexAIModel(g, "gemini-2.5-flash-image")
271271
resp, err := genkit.Generate(ctx, g,
272272
ai.WithConfig(genai.GenerateContentConfig{
273273
ResponseModalities: []string{"IMAGE", "TEXT"},
@@ -332,7 +332,7 @@ func TestVertexAILive(t *testing.T) {
332332
t.Skipf("thinking in Vertex AI is only supported in these regions: [global, us-central1], got: %q", location)
333333
}
334334

335-
m := googlegenai.VertexAIModel(g, "gemini-2.5-flash-preview-05-20")
335+
m := googlegenai.VertexAIModel(g, "gemini-2.5-flash")
336336
resp, err := genkit.Generate(ctx, g,
337337
ai.WithConfig(
338338
genai.GenerateContentConfig{
@@ -364,7 +364,7 @@ func TestVertexAILive(t *testing.T) {
364364
t.Skipf("thinking in Vertex AI is only supported in these regions: [global, us-central1], got: %q", location)
365365
}
366366

367-
m := googlegenai.VertexAIModel(g, "gemini-2.5-flash-preview-05-20")
367+
m := googlegenai.VertexAIModel(g, "gemini-2.5-flash")
368368
resp, err := genkit.Generate(ctx, g,
369369
ai.WithConfig(
370370
genai.GenerateContentConfig{

go/samples/basic-gemini-with-context/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func main() {
3636
// Define a simple flow that generates jokes about a given topic with a context of bananas
3737
genkit.DefineFlow(g, "contextFlow", func(ctx context.Context, input string) (string, error) {
3838
resp, err := genkit.Generate(ctx, g,
39-
ai.WithModelName("googleai/gemini-2.0-flash"),
39+
ai.WithModelName("googleai/gemini-2.5-flash"),
4040
ai.WithConfig(&genai.GenerateContentConfig{
4141
Temperature: genai.Ptr[float32](1.0),
4242
}),

go/samples/cache-gemini/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package main
1919
import (
2020
"context"
2121
"errors"
22-
2322
"os"
2423

2524
"github.com/firebase/genkit/go/ai"
@@ -37,7 +36,7 @@ type duneQuestionInput struct {
3736
func main() {
3837
ctx := context.Background()
3938
g := genkit.Init(ctx,
40-
genkit.WithDefaultModel("googleai/gemini-2.5-flash-preview-04-17"),
39+
genkit.WithDefaultModel("googleai/gemini-2.5-flash"),
4140
genkit.WithPlugins(&googlegenai.GoogleAI{}),
4241
)
4342

go/samples/code-execution-gemini/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"context"
1919
"errors"
2020
"fmt"
21-
2221
"strings"
2322

2423
"github.com/firebase/genkit/go/ai"
@@ -35,7 +34,7 @@ func main() {
3534

3635
// Define a flow to demonstrate code execution
3736
genkit.DefineFlow(g, "codeExecutionFlow", func(ctx context.Context, _ any) (string, error) {
38-
m := googlegenai.GoogleAIModel(g, "gemini-2.5-flash-preview-04-17")
37+
m := googlegenai.GoogleAIModel(g, "gemini-2.5-flash")
3938
if m == nil {
4039
return "", errors.New("failed to find model")
4140
}

go/samples/coffee-shop/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ type testAllCoffeeFlowsOutput struct {
9999
func main() {
100100
ctx := context.Background()
101101
g := genkit.Init(ctx,
102-
genkit.WithDefaultModel("googleai/gemini-2.0-flash"),
102+
genkit.WithDefaultModel("googleai/gemini-2.5-flash"),
103103
genkit.WithPlugins(&googlegenai.GoogleAI{}),
104104
)
105105

106-
m := googlegenai.GoogleAIModel(g, "gemini-2.0-flash")
106+
m := googlegenai.GoogleAIModel(g, "gemini-2.5-flash")
107107
simpleGreetingPrompt := genkit.DefinePrompt(g, "simpleGreeting2",
108108
ai.WithPrompt(simpleGreetingPromptTemplate),
109109
ai.WithModel(m),

go/samples/files-api-vision/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func main() {
6363
// Use Files API URI directly with Genkit (now supported!)
6464
fmt.Println("Analyzing image with Genkit using Files API URI...")
6565
resp, err := genkit.Generate(ctx, g,
66-
ai.WithModelName("googleai/gemini-2.0-flash"),
66+
ai.WithModelName("googleai/gemini-2.5-flash"),
6767
ai.WithMessages(
6868
ai.NewUserMessage(
6969
ai.NewTextPart("What do you see in this image?"),

0 commit comments

Comments
 (0)