Skip to content

Commit 6d582d4

Browse files
committed
fix(go/samples): move Vertex Claude 4.6 flows to modelgarden sample
Keep the basic sample focused on canonical framework usage by moving the new Vertex Model Garden Claude 4.6 flows into the dedicated modelgarden sample. Also align the 4.6 model labels with existing Anthropic naming conventions. Made-with: Cursor
1 parent 07e6fe4 commit 6d582d4

3 files changed

Lines changed: 38 additions & 42 deletions

File tree

go/plugins/vertexai/modelgarden/models.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ var AnthropicModels = map[string]ai.ModelOptions{
7070
Supports: &internal.Multimodal,
7171
},
7272
"claude-sonnet-4-6": {
73-
Label: "Claude Sonnet 4.6",
73+
Label: "Claude 4.6 Sonnet",
7474
Supports: &internal.Multimodal,
7575
},
7676
"claude-opus-4-6": {
77-
Label: "Claude Opus 4.6",
77+
Label: "Claude 4.6 Opus",
7878
Supports: &internal.Multimodal,
7979
},
8080
}

go/samples/basic/main.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@ package main
3434

3535
import (
3636
"context"
37-
"errors"
3837
"fmt"
3938
"log"
4039
"net/http"
4140

42-
"github.com/anthropics/anthropic-sdk-go"
4341
"github.com/firebase/genkit/go/ai"
4442
"github.com/firebase/genkit/go/genkit"
4543
"github.com/firebase/genkit/go/plugins/googlegenai"
4644
"github.com/firebase/genkit/go/plugins/server"
47-
"github.com/firebase/genkit/go/plugins/vertexai/modelgarden"
4845
"google.golang.org/genai"
4946
)
5047

@@ -57,7 +54,6 @@ func main() {
5754
// practice.
5855
g := genkit.Init(ctx, genkit.WithPlugins(
5956
&googlegenai.GoogleAI{},
60-
&modelgarden.Anthropic{},
6157
))
6258

6359
// Define a non-streaming flow that generates jokes about a given topic.
@@ -100,42 +96,6 @@ func main() {
10096
},
10197
)
10298

103-
// Vertex Model Garden - Claude Sonnet 4.6.
104-
genkit.DefineFlow(g, "claudeSonnet46VertexModelGardenFlow", func(ctx context.Context, input string) (string, error) {
105-
if input == "" {
106-
input = "airplane food"
107-
}
108-
m := modelgarden.AnthropicModel(g, "claude-sonnet-4-6")
109-
if m == nil {
110-
return "", errors.New("claudeSonnet46VertexModelGardenFlow: failed to find model")
111-
}
112-
return genkit.GenerateText(ctx, g,
113-
ai.WithModel(m),
114-
ai.WithConfig(&anthropic.MessageNewParams{
115-
MaxTokens: 1024,
116-
}),
117-
ai.WithPrompt("Share a joke about %s.", input),
118-
)
119-
})
120-
121-
// Vertex Model Garden - Claude Opus 4.6.
122-
genkit.DefineFlow(g, "claudeOpus46VertexModelGardenFlow", func(ctx context.Context, input string) (string, error) {
123-
if input == "" {
124-
input = "airplane food"
125-
}
126-
m := modelgarden.AnthropicModel(g, "claude-opus-4-6")
127-
if m == nil {
128-
return "", errors.New("claudeOpus46VertexModelGardenFlow: failed to find model")
129-
}
130-
return genkit.GenerateText(ctx, g,
131-
ai.WithModel(m),
132-
ai.WithConfig(&anthropic.MessageNewParams{
133-
MaxTokens: 1024,
134-
}),
135-
ai.WithPrompt("Share a joke about %s.", input),
136-
)
137-
})
138-
13999
// Optionally, start a web server to make the flow callable via HTTP.
140100
mux := http.NewServeMux()
141101
for _, a := range genkit.ListFlows(g) {

go/samples/modelgarden/main.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,41 @@ func main() {
5050
return text, nil
5151
})
5252

53+
// Vertex Model Garden - Claude Sonnet 4.6.
54+
genkit.DefineFlow(g, "claudeSonnet46VertexModelGardenFlow", func(ctx context.Context, input string) (string, error) {
55+
if input == "" {
56+
input = "airplane food"
57+
}
58+
m := modelgarden.AnthropicModel(g, "claude-sonnet-4-6")
59+
if m == nil {
60+
return "", errors.New("claudeSonnet46VertexModelGardenFlow: failed to find model")
61+
}
62+
return genkit.GenerateText(ctx, g,
63+
ai.WithModel(m),
64+
ai.WithConfig(&anthropic.MessageNewParams{
65+
MaxTokens: 1024,
66+
}),
67+
ai.WithPrompt("Share a joke about %s.", input),
68+
)
69+
})
70+
71+
// Vertex Model Garden - Claude Opus 4.6.
72+
genkit.DefineFlow(g, "claudeOpus46VertexModelGardenFlow", func(ctx context.Context, input string) (string, error) {
73+
if input == "" {
74+
input = "airplane food"
75+
}
76+
m := modelgarden.AnthropicModel(g, "claude-opus-4-6")
77+
if m == nil {
78+
return "", errors.New("claudeOpus46VertexModelGardenFlow: failed to find model")
79+
}
80+
return genkit.GenerateText(ctx, g,
81+
ai.WithModel(m),
82+
ai.WithConfig(&anthropic.MessageNewParams{
83+
MaxTokens: 1024,
84+
}),
85+
ai.WithPrompt("Share a joke about %s.", input),
86+
)
87+
})
88+
5389
<-ctx.Done()
5490
}

0 commit comments

Comments
 (0)