examples/groq: fixup groq example (#1385)

This commit is contained in:
Travis Cline
2025-08-29 15:48:02 +02:00
committed by GitHub
parent f1213d92d8
commit 7cbb9b05f7
3 changed files with 2 additions and 13 deletions
+1 -4
View File
@@ -2,10 +2,7 @@ module github.com/tmc/langchaingo/examples/groq-completion-example
go 1.24.3
require (
github.com/joho/godotenv v1.5.1
github.com/tmc/langchaingo v0.1.14-pre.3
)
require github.com/tmc/langchaingo v0.1.14-pre.3
replace github.com/tmc/langchaingo => ../..
-2
View File
@@ -6,8 +6,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/pkoukk/tiktoken-go v0.1.6 h1:JF0TlJzhTbrI30wCvFuiw6FzP2+/bR+FIxUdgEAcUsw=
github.com/pkoukk/tiktoken-go v0.1.6/go.mod h1:9NiV+i9mJKGj1rYOT+njbv+ZwA/zJxYdewGl6qVatpg=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
@@ -6,21 +6,15 @@ import (
"log"
"os"
"github.com/joho/godotenv"
"github.com/tmc/langchaingo/llms"
"github.com/tmc/langchaingo/llms/openai"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Fatalf("Error loading .env file")
}
apiKey := os.Getenv("GROQ_API_KEY")
llm, err := openai.New(
openai.WithModel("llama3-8b-8192"),
openai.WithModel("moonshotai/kimi-k2-instruct"),
openai.WithBaseURL("https://api.groq.com/openai/v1"),
openai.WithToken(apiKey),
)