Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add openai init go plugin from yukinagae, add vision pro model for ve… #927

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions genkit-tools/cli/src/commands/init/init-go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ const templatePath = '../../../config/main.go.template';

/** Model to plugin name. */
const modelOptions: Record<ModelProvider, ModelOption> = {
openai: {
label: 'OpenAI',
package: 'github.com/yukinagae/genkit-go-plugins/plugins/openai',
init: `// Initialize the OpenAI plugin. When you pass an empty string for the
\t// apiKey parameter, the OpenAI plugin will use the value from the
\t// OPENAI_API_KEY environment variable, which is the recommended practice.
\tif err := openai.Init(ctx, nil); err != nil {
\t\tlog.Fatal(err)
\t}`,
lookup: `// The OpenAI API provides access to several generative models. Here,
\t\t// we specify the 4o mini model.
\t\tm := openai.Model("gpt-4o-mini")`,
},
googleai: {
label: 'Google AI',
package: 'github.com/firebase/genkit/go/plugins/googleai',
Expand Down
7 changes: 4 additions & 3 deletions go/plugins/vertexai/vertexai.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ const (

var (
knownCaps = map[string]ai.ModelCapabilities{
"gemini-1.0-pro": gemini.BasicText,
"gemini-1.5-pro": gemini.Multimodal,
"gemini-1.5-flash": gemini.Multimodal,
"gemini-1.0-pro": gemini.BasicText,
"gemini-1.5-pro": gemini.Multimodal,
"gemini-1.5-flash": gemini.Multimodal,
"gemini-pro-vision": gemini.Multimodal,
}

knownEmbedders = []string{
Expand Down
5 changes: 5 additions & 0 deletions go/samples/menu/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func main() {
}
model := vertexai.Model("gemini-1.5-flash")
visionModel := vertexai.Model("gemini-1.5-flash")
visionModelPro := vertexai.Model("gemini-pro-vision")
embedder := vertexai.Embedder("text-embedding-004")
if err := setup01(ctx, model); err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -103,6 +104,10 @@ func main() {
log.Fatal(err)
}

if err := setup05(ctx, model, visionModelPro); err != nil {
log.Fatal(err)
}

if err := genkit.Init(ctx, nil); err != nil {
log.Fatal(err)
}
Expand Down
Loading