Skip to content
Draft
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
6 changes: 3 additions & 3 deletions go/plugins/compat_oai/openai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var (

supportedEmbeddingModels = map[string]EmbedderRef{
openaiGo.EmbeddingModelTextEmbeddingAda002: {
Name: "openai/text-embedding-ada-002",
Name: "text-embedding-ada-002",
ConfigSchema: TextEmbeddingConfig{},
Dimensions: 1536,
Label: "Open AI - Text Embedding ADA 002",
Expand All @@ -139,7 +139,7 @@ var (
},
},
openaiGo.EmbeddingModelTextEmbedding3Large: {
Name: "openai/text-embedding-3-large",
Name: "text-embedding-3-large",
ConfigSchema: TextEmbeddingConfig{},
Dimensions: 3072,
Label: "Open AI - Text Embedding 3 Large",
Expand All @@ -148,7 +148,7 @@ var (
},
},
openaiGo.EmbeddingModelTextEmbedding3Small: {
Name: "openai/text-embedding-3-small",
Name: "text-embedding-3-small",
ConfigSchema: TextEmbeddingConfig{}, // Represents the configurable options
Dimensions: 1536,
Label: "Open AI - Text Embedding 3 Small",
Expand Down
5 changes: 5 additions & 0 deletions go/plugins/googlegenai/gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,11 @@ func translateCandidate(cand *genai.Candidate) *ai.ModelResponse {
m.FinishReason = ai.FinishReasonUnknown
}
msg := &ai.Message{}
if cand.Content == nil {
m.Message = msg
return m
}

msg.Role = ai.Role(cand.Content.Role)

// iterate over the candidate parts, only one struct member
Expand Down
18 changes: 9 additions & 9 deletions go/plugins/googlegenai/vertexai_live_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ func TestVertexAILive(t *testing.T) {
if !ok {
t.Skipf("GOOGLE_CLOUD_PROJECT env var not set")
}
location, ok := requireEnv("GOOGLE_CLOUD_LOCATION")
region, ok := requireEnv("GOOGLE_CLOUD_LOCATION")
if !ok {
t.Log("GOOGLE_CLOUD_LOCATION env var not set, defaulting to us-central1")
location = "us-central1"
region = "us-central1"
}

ctx := context.Background()
g := genkit.Init(ctx,
genkit.WithDefaultModel("vertexai/gemini-2.0-flash"),
genkit.WithPlugins(&googlegenai.VertexAI{ProjectID: projectID, Location: location}),
genkit.WithPlugins(&googlegenai.VertexAI{ProjectID: projectID, Location: region}),
)

embedder := googlegenai.VertexAIEmbedder(g, "textembedding-gecko@003")
Expand Down Expand Up @@ -264,8 +264,8 @@ func TestVertexAILive(t *testing.T) {
}
})
t.Run("image generation", func(t *testing.T) {
if location != "global" {
t.Skipf("image generation in Vertex AI is only supported in region: global, got: %s", location)
if region != "global" {
t.Skipf("image generation in Vertex AI is only supported in region: global, got: %s", region)
}
m := googlegenai.VertexAIModel(g, "gemini-2.0-flash-preview-image-generation")
resp, err := genkit.Generate(ctx, g,
Expand Down Expand Up @@ -328,8 +328,8 @@ func TestVertexAILive(t *testing.T) {
}
})
t.Run("thinking enabled", func(t *testing.T) {
if location != "global" && location != "us-central1" {
t.Skipf("thinking in Vertex AI is only supported in these regions: [global, us-central1], got: %q", location)
if region != "global" && region != "us-central1" {
t.Skipf("thinking in Vertex AI is only supported in these regions: [global, us-central1], got: %q", region)
}

m := googlegenai.VertexAIModel(g, "gemini-2.5-flash-preview-05-20")
Expand Down Expand Up @@ -360,8 +360,8 @@ func TestVertexAILive(t *testing.T) {
}
})
t.Run("thinking disabled", func(t *testing.T) {
if location != "global" && location != "us-central1" {
t.Skipf("thinking in Vertex AI is only supported in these regions: [global, us-central1], got: %q", location)
if region != "global" && region != "us-central1" {
t.Skipf("thinking in Vertex AI is only supported in these regions: [global, us-central1], got: %q", region)
}

m := googlegenai.VertexAIModel(g, "gemini-2.5-flash-preview-05-20")
Expand Down
9 changes: 5 additions & 4 deletions go/plugins/ollama/ollama_live_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ import (
ollamaPlugin "github.com/firebase/genkit/go/plugins/ollama"
)

var serverAddress = flag.String("server-address", "http://localhost:11434", "Ollama server address")
var modelName = flag.String("model-name", "tinyllama", "model name")
var testLive = flag.Bool("test-live", false, "run live tests")
var (
serverAddress = flag.String("server-address", "http://localhost:11434", "Ollama server address")
modelName = flag.String("model-name", "tinyllama", "model name")
testLive = flag.Bool("test-live", false, "run live tests")
)

/*
To run this test, you need to have the Ollama server running. You can set the server address using the OLLAMA_SERVER_ADDRESS environment variable.
If the environment variable is not set, the test will default to http://localhost:11434 (the default address for the Ollama server).
*/
func TestLive(t *testing.T) {

if !*testLive {
t.Skip("skipping go/plugins/ollama live test")
}
Expand Down
96 changes: 79 additions & 17 deletions go/plugins/vertexai/modelgarden/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,113 @@ package modelgarden

import (
"github.com/firebase/genkit/go/ai"
"github.com/firebase/genkit/go/plugins/internal"
)

const provider = "vertexai"

// supported anthropic models
var anthropicModels = map[string]ai.ModelOptions{
"claude-3-5-sonnet-v2": {
Label: "Vertex AI Model Garden - Claude 3.5 Sonnet",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude 3.5 Sonnet",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},
Versions: []string{"claude-3-5-sonnet-v2@20241022"},
},
"claude-3-5-sonnet": {
Label: "Vertex AI Model Garden - Claude 3.5 Sonnet",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude 3.5 Sonnet",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},

Versions: []string{"claude-3-5-sonnet@20240620"},
},
"claude-3-sonnet": {
Label: "Vertex AI Model Garden - Claude 3 Sonnet",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude 3 Sonnet",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},

Versions: []string{"claude-3-sonnet@20240229"},
},
"claude-3-haiku": {
Label: "Vertex AI Model Garden - Claude 3 Haiku",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude 3 Haiku",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},

Versions: []string{"claude-3-haiku@20240307"},
},
"claude-3-opus": {
Label: "Vertex AI Model Garden - Claude 3 Opus",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude 3 Opus",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},

Versions: []string{"claude-3-opus@20240229"},
},
"claude-3-7-sonnet": {
Label: "Vertex AI Model Garden - Claude 3.7 Sonnet",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude 3.7 Sonnet",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},

Versions: []string{"claude-3-7-sonnet@20250219"},
},
"claude-opus-4": {
Label: "Vertex AI Model Garden - Claude Opus 4",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude Opus 4",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},

Versions: []string{"claude-opus-4@20250514"},
},
"claude-sonnet-4": {
Label: "Vertex AI Model Garden - Claude Sonnet 4",
Supports: &internal.Multimodal,
Label: "Vertex AI Model Garden - Claude Sonnet 4",
Supports: &ai.ModelSupports{
Multiturn: true,
Tools: true,
ToolChoice: true,
SystemRole: true,
Media: true,
Constrained: ai.ConstrainedSupportNone,
},

Versions: []string{"claude-sonnet-4@20250514"},
},
}
54 changes: 0 additions & 54 deletions go/samples/basic-gemini-with-context/main.go

This file was deleted.

55 changes: 0 additions & 55 deletions go/samples/basic-gemini/main.go

This file was deleted.

Loading
Loading