From 37bf40f04e734c188a58d37f901e1e22549ef1b1 Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Wed, 9 Jul 2025 16:24:35 +0000 Subject: [PATCH 1/5] initial commit --- go/plugins/compat_oai/deepseek/deepseek.go | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 go/plugins/compat_oai/deepseek/deepseek.go diff --git a/go/plugins/compat_oai/deepseek/deepseek.go b/go/plugins/compat_oai/deepseek/deepseek.go new file mode 100644 index 0000000000..d3ba6cebd7 --- /dev/null +++ b/go/plugins/compat_oai/deepseek/deepseek.go @@ -0,0 +1,59 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package deepseek + +import ( + "context" + + "github.com/firebase/genkit/go/ai" + "github.com/firebase/genkit/go/genkit" + "github.com/firebase/genkit/go/plugins/compat_oai" + "github.com/openai/openai-go/option" +) + +const ( + provider = "deepseek" + baseURL = "https://api.deepseek.com/v1" +) + +type DeepSeek struct { + Opts []option.RequestOption + openAICompatible compat_oai.OpenAICompatible +} + +func (d *DeepSeek) Name() string { + return provider +} + +func (d *DeepSeek) Init(ctx context.Context, g *genkit.Genkit) error { + d.Opts = append(d.Opts, option.WithBaseURL(baseURL)) + + d.openAICompatible.Opts = d.Opts + if err := d.openAICompatible.Init(ctx, g); err != nil { + return err + } + + // TODO: define model + + return nil +} + +func (d *DeepSeek) Model(g *genkit.Genkit, name string) ai.Model { + return d.openAICompatible.Model(g, name, provider) +} + +func (d *DeepSeek) DefineModel(g *genkit.Genkit, name string, info ai.ModelInfo) (ai.Model, error) { + return d.openAICompatible.DefineModel(g, provider, name, info) +} From 288eed7048639b1f16ad417ab7fb65371d6f39d9 Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Thu, 10 Jul 2025 22:09:37 +0000 Subject: [PATCH 2/5] feat(go/plugins/compat_oai): Add DeepSeek plugin --- go/go.mod | 3 + go/go.sum | 6 + go/plugins/compat_oai/compat_oai.go | 3 +- go/plugins/compat_oai/deepseek/deepseek.go | 15 +- .../compat_oai/deepseek/deepsek_live_test.go | 229 ++++++++++++++++++ go/samples/compat_oai/deepseek/main.go | 61 +++++ 6 files changed, 314 insertions(+), 3 deletions(-) create mode 100644 go/plugins/compat_oai/deepseek/deepsek_live_test.go create mode 100644 go/samples/compat_oai/deepseek/main.go diff --git a/go/go.mod b/go/go.mod index e2f99b4bca..d0beccd722 100644 --- a/go/go.mod +++ b/go/go.mod @@ -49,9 +49,12 @@ require ( require ( cloud.google.com/go/alloydb v1.16.1 // indirect + github.com/cohesion-org/deepseek-go v1.3.2 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/joho/godotenv v1.5.1 // indirect + github.com/ollama/ollama v0.6.5 // indirect go.opencensus.io v0.24.0 // indirect ) diff --git a/go/go.sum b/go/go.sum index b00792b5ca..774e30ccd3 100644 --- a/go/go.sum +++ b/go/go.sum @@ -69,6 +69,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f h1:C5bqEmzEPLsHm9Mv73lSE9e9bKV23aB1vxOsmZrkl3k= github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cohesion-org/deepseek-go v1.3.2 h1:WTZ/2346KFYca+n+DL5p+Ar1RQxF2w/wGkU4jDvyXaQ= +github.com/cohesion-org/deepseek-go v1.3.2/go.mod h1:bOVyKj38r90UEYZFrmJOzJKPxuAh8sIzHOCnLOpiXeI= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -253,6 +255,8 @@ github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/ github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= @@ -292,6 +296,8 @@ github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/ollama/ollama v0.6.5 h1:vXKkVX57ql/1ZzMw4SVK866Qfd6pjwEcITVyEpF0QXQ= +github.com/ollama/ollama v0.6.5/go.mod h1:pGgtoNyc9DdM6oZI6yMfI6jTk2Eh4c36c2GpfQCH7PY= github.com/openai/openai-go v0.1.0-alpha.65 h1:G12sA6OaL+cVMElMO3m5RVFwKhhg40kmGeGhaYZIoYw= github.com/openai/openai-go v0.1.0-alpha.65/go.mod h1:3SdE6BffOX9HPEQv8IL/fi3LYZ5TUpRYaqGQZbyk11A= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= diff --git a/go/plugins/compat_oai/compat_oai.go b/go/plugins/compat_oai/compat_oai.go index 7e4fec7f11..97e472b981 100644 --- a/go/plugins/compat_oai/compat_oai.go +++ b/go/plugins/compat_oai/compat_oai.go @@ -187,6 +187,7 @@ func (o *OpenAICompatible) ListActions(ctx context.Context) []core.ActionDesc { actions := []core.ActionDesc{} models, err := listOpenAIModels(ctx, o.client) + fmt.Printf("got: models: %#v\n\n err: %v\n\n", models, err) if err != nil { return nil } @@ -199,7 +200,7 @@ func (o *OpenAICompatible) ListActions(ctx context.Context) []core.ActionDesc { "systemRole": true, "tools": true, "toolChoice": true, - "constrained": true, + "constrained": "no-tools", }, }, "versions": []string{}, diff --git a/go/plugins/compat_oai/deepseek/deepseek.go b/go/plugins/compat_oai/deepseek/deepseek.go index d3ba6cebd7..fe6b3583fe 100644 --- a/go/plugins/compat_oai/deepseek/deepseek.go +++ b/go/plugins/compat_oai/deepseek/deepseek.go @@ -16,8 +16,10 @@ package deepseek import ( "context" + "fmt" "github.com/firebase/genkit/go/ai" + "github.com/firebase/genkit/go/core" "github.com/firebase/genkit/go/genkit" "github.com/firebase/genkit/go/plugins/compat_oai" "github.com/openai/openai-go/option" @@ -41,12 +43,11 @@ func (d *DeepSeek) Init(ctx context.Context, g *genkit.Genkit) error { d.Opts = append(d.Opts, option.WithBaseURL(baseURL)) d.openAICompatible.Opts = d.Opts + d.openAICompatible.Provider = provider if err := d.openAICompatible.Init(ctx, g); err != nil { return err } - // TODO: define model - return nil } @@ -57,3 +58,13 @@ func (d *DeepSeek) Model(g *genkit.Genkit, name string) ai.Model { func (d *DeepSeek) DefineModel(g *genkit.Genkit, name string, info ai.ModelInfo) (ai.Model, error) { return d.openAICompatible.DefineModel(g, provider, name, info) } + +func (d *DeepSeek) ListActions(ctx context.Context) []core.ActionDesc { + fmt.Printf("listing actions!!\n\n") + return d.openAICompatible.ListActions(ctx) +} + +func (d *DeepSeek) ResolveAction(g *genkit.Genkit, atype core.ActionType, name string) error { + fmt.Printf("resolving actions!!\n\n") + return d.openAICompatible.ResolveAction(g, atype, name) +} diff --git a/go/plugins/compat_oai/deepseek/deepsek_live_test.go b/go/plugins/compat_oai/deepseek/deepsek_live_test.go new file mode 100644 index 0000000000..70eb8a25e2 --- /dev/null +++ b/go/plugins/compat_oai/deepseek/deepsek_live_test.go @@ -0,0 +1,229 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package deepseek_test + +import ( + "context" + "math" + "os" + "strings" + "testing" + + "github.com/firebase/genkit/go/ai" + "github.com/firebase/genkit/go/genkit" + "github.com/firebase/genkit/go/plugins/compat_oai" + "github.com/firebase/genkit/go/plugins/compat_oai/deepseek" +) + +func TestPlugin(t *testing.T) { + apiKey := os.Getenv("DEEPSEEK_API_KEY") + if apiKey == "" { + t.Skip("Skipping test: DEEPSEEK_API_KEY environment variable not set") + } + + ctx := context.Background() + + // Initialize the DeepSeek plugin + oai := &deepseek.DeepSeek{ + APIKey: apiKey, + } + g, err := genkit.Init(context.Background(), + genkit.WithDefaultModel("deepseek/deepseek-chat"), + genkit.WithPlugins(oai), + ) + if err != nil { + t.Fatal(err) + } + t.Log("genkit initialized") + + // Define a tool for calculating gablorkens + gablorkenTool := genkit.DefineTool(g, "gablorken", "use when need to calculate a gablorken", + func(ctx *ai.ToolContext, input struct { + Value float64 + Over float64 + }, + ) (float64, error) { + return math.Pow(input.Value, input.Over), nil + }, + ) + + t.Run("basic completion", func(t *testing.T) { + t.Log("generating basic completion response") + resp, err := genkit.Generate(ctx, g, + ai.WithPrompt("What is the capital of France?"), + ) + if err != nil { + t.Fatal("error generating basic completion response: ", err) + } + t.Logf("basic completion response: %+v", resp) + + out := resp.Message.Content[0].Text + if !strings.Contains(strings.ToLower(out), "paris") { + t.Errorf("got %q, expecting it to contain 'Paris'", out) + } + + // Verify usage statistics are present + if resp.Usage == nil || resp.Usage.TotalTokens == 0 { + t.Error("Expected non-zero usage statistics") + } + }) + + t.Run("streaming", func(t *testing.T) { + var streamedOutput string + chunks := 0 + + final, err := genkit.Generate(ctx, g, + ai.WithPrompt("Write a short paragraph about artificial intelligence."), + ai.WithStreaming(func(ctx context.Context, chunk *ai.ModelResponseChunk) error { + chunks++ + for _, content := range chunk.Content { + streamedOutput += content.Text + } + return nil + })) + if err != nil { + t.Fatal(err) + } + + // Verify streaming worked + if chunks <= 1 { + t.Error("Expected multiple chunks for streaming") + } + + // Verify final output matches streamed content + finalOutput := "" + for _, content := range final.Message.Content { + finalOutput += content.Text + } + if streamedOutput != finalOutput { + t.Errorf("Streaming output doesn't match final output\nStreamed: %s\nFinal: %s", + streamedOutput, finalOutput) + } + + t.Logf("streaming response: %+v", finalOutput) + }) + + t.Run("tool usage with basic completion", func(t *testing.T) { + resp, err := genkit.Generate(ctx, g, + ai.WithPrompt("what is a gablorken of 2 over 3.5?"), + ai.WithTools(gablorkenTool)) + if err != nil { + t.Fatal(err) + } + + out := resp.Message.Content[0].Text + const want = "12.25" + if !strings.Contains(out, want) { + t.Errorf("got %q, expecting it to contain %q", out, want) + } + + t.Logf("tool usage with basic completion response: %+v", out) + }) + + t.Run("tool usage with streaming", func(t *testing.T) { + var streamedOutput string + chunks := 0 + + final, err := genkit.Generate(ctx, g, + ai.WithPrompt("what is a gablorken of 2 over 3.5?"), + ai.WithTools(gablorkenTool), + ai.WithStreaming(func(ctx context.Context, chunk *ai.ModelResponseChunk) error { + chunks++ + for _, content := range chunk.Content { + streamedOutput += content.Text + } + return nil + })) + if err != nil { + t.Fatal(err) + } + + // Verify streaming worked + if chunks <= 1 { + t.Error("Expected multiple chunks for streaming") + } + + // Verify final output matches streamed content + finalOutput := "" + for _, content := range final.Message.Content { + finalOutput += content.Text + } + if streamedOutput != finalOutput { + t.Errorf("Streaming output doesn't match final output\nStreamed: %s\nFinal: %s", + streamedOutput, finalOutput) + } + + const want = "12.25" + if !strings.Contains(finalOutput, want) { + t.Errorf("got %q, expecting it to contain %q", finalOutput, want) + } + + t.Logf("tool usage with streaming response: %+v", finalOutput) + }) + + t.Run("system message", func(t *testing.T) { + resp, err := genkit.Generate(ctx, g, + ai.WithPrompt("What are you?"), + ai.WithSystem("You are a helpful math tutor who loves numbers."), + ) + if err != nil { + t.Fatal(err) + } + + out := resp.Message.Content[0].Text + if !strings.Contains(strings.ToLower(out), "math") { + t.Errorf("got %q, expecting response to mention being a math tutor", out) + } + + t.Logf("system message response: %+v", out) + }) + + t.Run("generation config", func(t *testing.T) { + // Create a config with specific parameters + config := &compat_oai.OpenAIConfig{ + Temperature: 0.2, + MaxOutputTokens: 50, + TopP: 0.5, + StopSequences: []string{".", "!", "?"}, + } + + resp, err := genkit.Generate(ctx, g, + ai.WithPrompt("Write a short sentence about artificial intelligence."), + ai.WithConfig(config), + ) + if err != nil { + t.Fatal(err) + } + out := resp.Message.Content[0].Text + t.Logf("generation config response: %+v", out) + }) + + t.Run("invalid config type", func(t *testing.T) { + // Try to use a string as config instead of *ai.GenerationCommonConfig + config := "not a config" + + _, err := genkit.Generate(ctx, g, + ai.WithPrompt("Write a short sentence about artificial intelligence."), + ai.WithConfig(config), + ) + if err == nil { + t.Fatal("expected error for invalid config type") + } + if !strings.Contains(err.Error(), "unexpected config type: string") { + t.Errorf("got error %q, want error containing 'unexpected config type: string'", err.Error()) + } + t.Logf("invalid config type error: %v", err) + }) +} diff --git a/go/samples/compat_oai/deepseek/main.go b/go/samples/compat_oai/deepseek/main.go new file mode 100644 index 0000000000..7c01534760 --- /dev/null +++ b/go/samples/compat_oai/deepseek/main.go @@ -0,0 +1,61 @@ +// Copyright 2024 Google LLC +// SPDX-License-Identifier: Apache-2.0 + +// This program can be manually tested like so: +// Start the server listening on port 3100: +// +// genkit start -o -- go run . + +package main + +import ( + "context" + "fmt" + "log" + "net/http" + "os" + + "github.com/firebase/genkit/go/ai" + "github.com/firebase/genkit/go/genkit" + "github.com/firebase/genkit/go/plugins/compat_oai" + oai_deepseek "github.com/firebase/genkit/go/plugins/compat_oai/deepseek" + "github.com/firebase/genkit/go/plugins/server" + "github.com/openai/openai-go/option" +) + +func main() { + ctx := context.Background() + + apiKey := os.Getenv("DEEPSEEK_API_KEY") + if apiKey == "" { + log.Fatalf("no DEEPSEEK_API_KEY environment variable set") + } + ds := oai_deepseek.DeepSeek{ + Opts: []option.RequestOption{ + option.WithAPIKey(apiKey), + }, + } + g, err := genkit.Init(ctx, genkit.WithPlugins(&ds)) + if err != nil { + log.Fatalf("failed to create Genkit: %v", err) + } + + genkit.DefineFlow(g, "basic", func(ctx context.Context, subject string) (string, error) { + dsChat := ds.Model(g, "deepseek-chat") + + prompt := fmt.Sprintf("tell me a joke about %s", subject) + config := &compat_oai.OpenAIConfig{Temperature: 0.5} + // config := &openai.ChatCompletionNewParams{Temperature: openai.Float(0.5)} + foo, err := genkit.Generate(ctx, g, ai.WithModel(dsChat), ai.WithPrompt(prompt), ai.WithConfig(config)) + if err != nil { + return "", err + } + return fmt.Sprintf("foo: %s", foo.Text()), nil + }) + + mux := http.NewServeMux() + for _, a := range genkit.ListFlows(g) { + mux.HandleFunc("POST /"+a.Name(), genkit.Handler(a)) + } + log.Fatal(server.Start(ctx, "127.0.0.1:8080", mux)) +} From b767a90162b5f0d1f9f6a83f20b55aba17355258 Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Thu, 10 Jul 2025 22:47:29 +0000 Subject: [PATCH 3/5] fix live tests --- go/plugins/compat_oai/deepseek/deepsek_live_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/plugins/compat_oai/deepseek/deepsek_live_test.go b/go/plugins/compat_oai/deepseek/deepsek_live_test.go index 70eb8a25e2..d09dfc3e02 100644 --- a/go/plugins/compat_oai/deepseek/deepsek_live_test.go +++ b/go/plugins/compat_oai/deepseek/deepsek_live_test.go @@ -25,6 +25,7 @@ import ( "github.com/firebase/genkit/go/genkit" "github.com/firebase/genkit/go/plugins/compat_oai" "github.com/firebase/genkit/go/plugins/compat_oai/deepseek" + "github.com/openai/openai-go/option" ) func TestPlugin(t *testing.T) { @@ -37,7 +38,9 @@ func TestPlugin(t *testing.T) { // Initialize the DeepSeek plugin oai := &deepseek.DeepSeek{ - APIKey: apiKey, + Opts: []option.RequestOption{ + option.WithAPIKey(apiKey), + }, } g, err := genkit.Init(context.Background(), genkit.WithDefaultModel("deepseek/deepseek-chat"), From 82d700855820c06883eb1140cafeba2f032db231 Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Mon, 14 Jul 2025 22:44:28 +0000 Subject: [PATCH 4/5] fix merge conflicts --- .../compat_oai/deepseek/deepsek_live_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/go/plugins/compat_oai/deepseek/deepsek_live_test.go b/go/plugins/compat_oai/deepseek/deepsek_live_test.go index d09dfc3e02..49f8333555 100644 --- a/go/plugins/compat_oai/deepseek/deepsek_live_test.go +++ b/go/plugins/compat_oai/deepseek/deepsek_live_test.go @@ -23,8 +23,8 @@ import ( "github.com/firebase/genkit/go/ai" "github.com/firebase/genkit/go/genkit" - "github.com/firebase/genkit/go/plugins/compat_oai" "github.com/firebase/genkit/go/plugins/compat_oai/deepseek" + "github.com/openai/openai-go" "github.com/openai/openai-go/option" ) @@ -195,11 +195,13 @@ func TestPlugin(t *testing.T) { t.Run("generation config", func(t *testing.T) { // Create a config with specific parameters - config := &compat_oai.OpenAIConfig{ - Temperature: 0.2, - MaxOutputTokens: 50, - TopP: 0.5, - StopSequences: []string{".", "!", "?"}, + config := &openai.ChatCompletionNewParams{ + Temperature: openai.Float(0.2), + MaxCompletionTokens: openai.Int(50), + TopP: openai.Float(0.5), + Stop: openai.ChatCompletionNewParamsStopUnion{ + OfStringArray: []string{".", "!", "?"}, + }, } resp, err := genkit.Generate(ctx, g, From 43b96745875b972434888d40a99e28143889b23c Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Mon, 14 Jul 2025 23:47:55 +0000 Subject: [PATCH 5/5] update sample --- go/samples/compat_oai/deepseek/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/go/samples/compat_oai/deepseek/main.go b/go/samples/compat_oai/deepseek/main.go index 7c01534760..8e3e2f6255 100644 --- a/go/samples/compat_oai/deepseek/main.go +++ b/go/samples/compat_oai/deepseek/main.go @@ -17,9 +17,9 @@ import ( "github.com/firebase/genkit/go/ai" "github.com/firebase/genkit/go/genkit" - "github.com/firebase/genkit/go/plugins/compat_oai" oai_deepseek "github.com/firebase/genkit/go/plugins/compat_oai/deepseek" "github.com/firebase/genkit/go/plugins/server" + "github.com/openai/openai-go" "github.com/openai/openai-go/option" ) @@ -44,8 +44,7 @@ func main() { dsChat := ds.Model(g, "deepseek-chat") prompt := fmt.Sprintf("tell me a joke about %s", subject) - config := &compat_oai.OpenAIConfig{Temperature: 0.5} - // config := &openai.ChatCompletionNewParams{Temperature: openai.Float(0.5)} + config := &openai.ChatCompletionNewParams{Temperature: openai.Float(0.5)} foo, err := genkit.Generate(ctx, g, ai.WithModel(dsChat), ai.WithPrompt(prompt), ai.WithConfig(config)) if err != nil { return "", err