Skip to content

Commit caf23ea

Browse files
genai: updated go sdk from 1.6.0 to 1.17.0, fix broken test & update models (#5353)
* updated genai go sdk from 1.6.0 to 1.17.0 and fix broken test * genai:updated go sdk from 1.6.0 to 1.17.0 and fix broken test * genai: PR comments addressed * genai: go mod tidy * genai: textgen_with_routing test case commented out * genai: textgen_with_routing test case commented out --------- Co-authored-by: Brian Dorsey <briandorsey@google.com>
1 parent aab38df commit caf23ea

25 files changed

+28
-28
lines changed

genai/content_cache/contentcache_create_with_txt_gcs_pdf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func createContentCache(w io.Writer) (string, error) {
3737
return "", fmt.Errorf("failed to create genai client: %w", err)
3838
}
3939

40-
modelName := "gemini-2.0-flash-001"
40+
modelName := "gemini-2.5-flash"
4141

4242
systemInstruction := "You are an expert researcher. You always stick to the facts " +
4343
"in the sources provided, and never make up new facts. " +
@@ -86,7 +86,7 @@ func createContentCache(w io.Writer) (string, error) {
8686
// {
8787
// "name": "projects/111111111111/locations/us-central1/cachedContents/1111111111111111111",
8888
// "displayName": "example-cache",
89-
// "model": "projects/111111111111/locations/us-central1/publishers/google/models/gemini-2.0-flash-001",
89+
// "model": "projects/111111111111/locations/us-central1/publishers/google/models/gemini-2.5-flash",
9090
// "createTime": "2025-02-18T15:05:08.29468Z",
9191
// "updateTime": "2025-02-18T15:05:08.29468Z",
9292
// "expireTime": "2025-02-19T15:05:08.280828Z",

genai/content_cache/contentcache_use_with_txt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func useContentCacheWithTxt(w io.Writer, cacheName string) error {
3636
}
3737

3838
resp, err := client.Models.GenerateContent(ctx,
39-
"gemini-2.0-flash-001",
39+
"gemini-2.5-flash",
4040
genai.Text("Summarize the pdfs"),
4141
&genai.GenerateContentConfig{
4242
CachedContent: cacheName,

genai/controlled_generation/ctrlgen_with_enum_schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func generateWithEnumSchema(w io.Writer) error {
3535
return fmt.Errorf("failed to create genai client: %w", err)
3636
}
3737

38-
modelName := "gemini-2.0-flash-001"
38+
modelName := "gemini-2.5-flash"
3939
contents := []*genai.Content{
4040
{Parts: []*genai.Part{
4141
{Text: "What type of instrument is an oboe?"},

genai/controlled_generation/ctrlgen_with_nullable_schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func generateWithNullables(w io.Writer) error {
3535
return fmt.Errorf("failed to create genai client: %w", err)
3636
}
3737

38-
modelName := "gemini-2.0-flash-001"
38+
modelName := "gemini-2.5-flash"
3939
prompt := `
4040
The week ahead brings a mix of weather conditions.
4141
Sunday is expected to be sunny with a temperature of 77°F and a humidity level of 50%. Winds will be light at around 10 km/h.

genai/controlled_generation/ctrlgen_with_resp_schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func generateWithRespSchema(w io.Writer) error {
6060
},
6161
Role: "user"},
6262
}
63-
modelName := "gemini-2.0-flash-001"
63+
modelName := "gemini-2.5-flash"
6464

6565
resp, err := client.Models.GenerateContent(ctx, modelName, contents, config)
6666
if err != nil {

genai/count_tokens/counttoken_compute_with_txt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func computeWithTxt(w io.Writer) error {
3636
return fmt.Errorf("failed to create genai client: %w", err)
3737
}
3838

39-
modelName := "gemini-2.0-flash-001"
39+
modelName := "gemini-2.5-flash"
4040
contents := []*genai.Content{
4141
{Parts: []*genai.Part{
4242
{Text: "What's the longest word in the English language?"},

genai/count_tokens/counttoken_resp_with_txt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func generateTextAndCount(w io.Writer) error {
3636
return fmt.Errorf("failed to create genai client: %w", err)
3737
}
3838

39-
modelName := "gemini-2.0-flash-001"
39+
modelName := "gemini-2.5-flash"
4040
contents := []*genai.Content{
4141
{Parts: []*genai.Part{
4242
{Text: "Why is the sky blue?"},

genai/count_tokens/counttoken_with_txt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func countWithTxt(w io.Writer) error {
3535
return fmt.Errorf("failed to create genai client: %w", err)
3636
}
3737

38-
modelName := "gemini-2.0-flash-001"
38+
modelName := "gemini-2.5-flash"
3939
contents := []*genai.Content{
4040
{Parts: []*genai.Part{
4141
{Text: "What's the highest mountain in Africa?"},

genai/count_tokens/counttoken_with_txt_vid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func countWithTxtAndVid(w io.Writer) error {
3535
return fmt.Errorf("failed to create genai client: %w", err)
3636
}
3737

38-
modelName := "gemini-2.0-flash-001"
38+
modelName := "gemini-2.5-flash"
3939
contents := []*genai.Content{
4040
{Parts: []*genai.Part{
4141
{Text: "Provide a description of the video."},

genai/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.23.0
44

55
require (
66
github.com/GoogleCloudPlatform/golang-samples v0.0.0-20250201051611-5fb145d1e974
7-
google.golang.org/genai v1.6.0
7+
google.golang.org/genai v1.17.0
88
)
99

1010
require (

0 commit comments

Comments
 (0)