From c5b84faa544673edda61a24735f6e70fc9f1a0a1 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 25 Aug 2023 19:14:02 -0700 Subject: [PATCH] callbacks: Include context --- agents/executor.go | 2 +- callbacks/callbacks.go | 22 ++++++++++--------- callbacks/log.go | 21 +++++++++--------- chains/chains.go | 4 ++-- examples/anthropic-completion-example/go.mod | 2 +- examples/anthropic-completion-example/go.sum | 4 ++-- examples/cohere-llm-example/go.mod | 2 +- examples/cohere-llm-example/go.sum | 4 ++-- examples/document-qa-example/go.mod | 2 +- examples/document-qa-example/go.sum | 4 ++-- examples/huggingface-llm-example/go.mod | 2 +- examples/huggingface-llm-example/go.sum | 4 ++-- examples/llm-chain-example/go.mod | 2 +- examples/llm-chain-example/go.sum | 4 ++-- examples/llmmath-chain-example/go.mod | 2 +- examples/llmmath-chain-example/go.sum | 4 ++-- .../llmsummarization-chain-example/go.mod | 2 +- .../llmsummarization-chain-example/go.sum | 4 ++-- examples/local-llm-example/go.mod | 2 +- examples/local-llm-example/go.sum | 4 ++-- examples/mrkl-agent-example/go.mod | 2 +- examples/mrkl-agent-example/go.sum | 4 ++-- examples/openai-chat-example/go.mod | 2 +- examples/openai-chat-example/go.sum | 4 ++-- examples/openai-completion-example/go.mod | 2 +- examples/openai-completion-example/go.sum | 4 ++-- examples/openai-function-call-example/go.mod | 2 +- examples/openai-function-call-example/go.sum | 4 ++-- examples/pinecone-vectorstore-example/go.mod | 2 +- examples/pinecone-vectorstore-example/go.sum | 4 ++-- .../postgresql-database-chain-example/go.mod | 2 +- .../postgresql-database-chain-example/go.sum | 4 ++-- examples/prompts-with-partial-example/go.mod | 2 +- examples/prompts-with-partial-example/go.sum | 4 ++-- .../prompts-with-partial-func-example/go.mod | 2 +- .../prompts-with-partial-func-example/go.sum | 4 ++-- examples/sequential-chain-example/go.mod | 2 +- examples/sequential-chain-example/go.sum | 4 ++-- examples/sql-database-chain-example/go.mod | 2 +- examples/sql-database-chain-example/go.sum | 4 ++-- examples/vertexai-palm-chat-example/go.mod | 2 +- examples/vertexai-palm-chat-example/go.sum | 4 ++-- .../vertexai-palm-completion-example/go.mod | 2 +- .../vertexai-palm-completion-example/go.sum | 4 ++-- examples/zapier-llm-example/go.mod | 2 +- llms/anthropic/anthropicllm.go | 4 ++-- llms/cohere/coherellm.go | 4 ++-- llms/huggingface/huggingfacellm.go | 4 ++-- llms/local/localllm.go | 4 ++-- llms/openai/openaillm.go | 4 ++-- llms/openai/openaillm_chat.go | 4 ++-- llms/vertexai/vertexai_palm_llm.go | 4 ++-- tools/calculator.go | 6 ++--- tools/duckduckgo/ddg.go | 4 ++-- tools/serpapi/serpapi.go | 4 ++-- tools/wikipedia/wikipedia.go | 4 ++-- tools/zapier/zapier.go | 4 ++-- vectorstores/vectorstores.go | 4 ++-- 58 files changed, 114 insertions(+), 111 deletions(-) diff --git a/agents/executor.go b/agents/executor.go index dd9af4f93..df759b81c 100644 --- a/agents/executor.go +++ b/agents/executor.go @@ -86,7 +86,7 @@ func (e Executor) doAction( action schema.AgentAction, ) ([]schema.AgentStep, error) { if e.CallbacksHandler != nil { - e.CallbacksHandler.HandleAgentAction(action) + e.CallbacksHandler.HandleAgentAction(ctx, action) } tool, ok := nameToTool[strings.ToUpper(action.Tool)] diff --git a/callbacks/callbacks.go b/callbacks/callbacks.go index e925ad572..bcccb2120 100644 --- a/callbacks/callbacks.go +++ b/callbacks/callbacks.go @@ -1,6 +1,8 @@ package callbacks import ( + "context" + "github.com/tmc/langchaingo/llms" "github.com/tmc/langchaingo/schema" ) @@ -8,16 +10,16 @@ import ( // Handler is the interface that allows for hooking into specific parts of an // LLM application. type Handler interface { - HandleText(text string) - HandleLLMStart(prompts []string) - HandleLLMEnd(output llms.LLMResult) - HandleChainStart(inputs map[string]any) - HandleChainEnd(outputs map[string]any) - HandleToolStart(input string) - HandleToolEnd(output string) - HandleAgentAction(action schema.AgentAction) - HandleRetrieverStart(query string) - HandleRetrieverEnd(documents []schema.Document) + HandleText(ctx context.Context, text string) + HandleLLMStart(ctx context.Context, prompts []string) + HandleLLMEnd(ctx context.Context, output llms.LLMResult) + HandleChainStart(ctx context.Context, inputs map[string]any) + HandleChainEnd(ctx context.Context, outputs map[string]any) + HandleToolStart(ctx context.Context, input string) + HandleToolEnd(ctx context.Context, output string) + HandleAgentAction(ctx context.Context, action schema.AgentAction) + HandleRetrieverStart(ctx context.Context, query string) + HandleRetrieverEnd(ctx context.Context, documents []schema.Document) } // HandlerHaver is an interface used to get callbacks handler. diff --git a/callbacks/log.go b/callbacks/log.go index b576e4ddc..f309f4620 100644 --- a/callbacks/log.go +++ b/callbacks/log.go @@ -2,6 +2,7 @@ package callbacks import ( + "context" "fmt" "strings" @@ -14,43 +15,43 @@ type LogHandler struct{} var _ Handler = LogHandler{} -func (l LogHandler) HandleText(text string) { +func (l LogHandler) HandleText(ctx context.Context, text string) { fmt.Println(text) } -func (l LogHandler) HandleLLMStart(prompts []string) { +func (l LogHandler) HandleLLMStart(ctx context.Context, prompts []string) { fmt.Println("Entering LLM with prompts:", prompts) } -func (l LogHandler) HandleLLMEnd(output llms.LLMResult) { +func (l LogHandler) HandleLLMEnd(ctx context.Context, output llms.LLMResult) { fmt.Println("Exiting LLM with results:", formatLLMResult(output)) } -func (l LogHandler) HandleChainStart(inputs map[string]any) { +func (l LogHandler) HandleChainStart(ctx context.Context, inputs map[string]any) { fmt.Println("Entering chain with inputs:", formatChainValues(inputs)) } -func (l LogHandler) HandleChainEnd(outputs map[string]any) { +func (l LogHandler) HandleChainEnd(ctx context.Context, outputs map[string]any) { fmt.Println("Exiting chain with outputs:", formatChainValues(outputs)) } -func (l LogHandler) HandleToolStart(input string) { +func (l LogHandler) HandleToolStart(ctx context.Context, input string) { fmt.Println("Entering tool with input:", removeNewLines(input)) } -func (l LogHandler) HandleToolEnd(output string) { +func (l LogHandler) HandleToolEnd(ctx context.Context, output string) { fmt.Println("Exiting tool with output:", removeNewLines(output)) } -func (l LogHandler) HandleAgentAction(action schema.AgentAction) { +func (l LogHandler) HandleAgentAction(ctx context.Context, action schema.AgentAction) { fmt.Println("Agent selected action:", formatAgentAction(action)) } -func (l LogHandler) HandleRetrieverStart(query string) { +func (l LogHandler) HandleRetrieverStart(ctx context.Context, query string) { fmt.Println("Entering retriever with query:", removeNewLines(query)) } -func (l LogHandler) HandleRetrieverEnd(documents []schema.Document) { +func (l LogHandler) HandleRetrieverEnd(ctx context.Context, documents []schema.Document) { fmt.Println("Exiting retirer with documents:", documents) } diff --git a/chains/chains.go b/chains/chains.go index c2658d37f..0efe76e0c 100644 --- a/chains/chains.go +++ b/chains/chains.go @@ -44,7 +44,7 @@ func Call(ctx context.Context, c Chain, inputValues map[string]any, options ...C callbacksHandler := getChainCallbackHandler(c) if callbacksHandler != nil { - callbacksHandler.HandleChainStart(inputValues) + callbacksHandler.HandleChainStart(ctx, inputValues) } if err := validateInputs(c, fullValues); err != nil { @@ -60,7 +60,7 @@ func Call(ctx context.Context, c Chain, inputValues map[string]any, options ...C } if callbacksHandler != nil { - callbacksHandler.HandleChainEnd(outputValues) + callbacksHandler.HandleChainEnd(ctx, outputValues) } err = c.GetMemory().SaveContext(ctx, inputValues, outputValues) diff --git a/examples/anthropic-completion-example/go.mod b/examples/anthropic-completion-example/go.mod index 6e9f2ea1a..09c92a441 100644 --- a/examples/anthropic-completion-example/go.mod +++ b/examples/anthropic-completion-example/go.mod @@ -2,7 +2,7 @@ module anthropic-completion-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/dlclark/regexp2 v1.8.1 // indirect diff --git a/examples/anthropic-completion-example/go.sum b/examples/anthropic-completion-example/go.sum index 1cf20e0bd..964c267ed 100644 --- a/examples/anthropic-completion-example/go.sum +++ b/examples/anthropic-completion-example/go.sum @@ -7,6 +7,6 @@ github.com/pkoukk/tiktoken-go v0.1.2 h1:u7PCSBiWJ3nJYoTGShyM9iHXz4dNyYkurwwp+GHt github.com/pkoukk/tiktoken-go v0.1.2/go.mod h1:boMWvk9pQCOTx11pgu0DrIdrAKgQzzJKUP6vLXaz7Rw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/cohere-llm-example/go.mod b/examples/cohere-llm-example/go.mod index d37589e92..d7d55da44 100644 --- a/examples/cohere-llm-example/go.mod +++ b/examples/cohere-llm-example/go.mod @@ -2,7 +2,7 @@ module basic-llm-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/cohere-ai/tokenizer v1.1.2 // indirect diff --git a/examples/cohere-llm-example/go.sum b/examples/cohere-llm-example/go.sum index 8cf012302..5f8887a1a 100644 --- a/examples/cohere-llm-example/go.sum +++ b/examples/cohere-llm-example/go.sum @@ -11,6 +11,6 @@ github.com/pkoukk/tiktoken-go v0.1.2 h1:u7PCSBiWJ3nJYoTGShyM9iHXz4dNyYkurwwp+GHt github.com/pkoukk/tiktoken-go v0.1.2/go.mod h1:boMWvk9pQCOTx11pgu0DrIdrAKgQzzJKUP6vLXaz7Rw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/document-qa-example/go.mod b/examples/document-qa-example/go.mod index 9bae0bb74..c09be5c0b 100644 --- a/examples/document-qa-example/go.mod +++ b/examples/document-qa-example/go.mod @@ -2,7 +2,7 @@ module document-qa-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/document-qa-example/go.sum b/examples/document-qa-example/go.sum index 64aef84a6..fac53fb64 100644 --- a/examples/document-qa-example/go.sum +++ b/examples/document-qa-example/go.sum @@ -66,8 +66,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= diff --git a/examples/huggingface-llm-example/go.mod b/examples/huggingface-llm-example/go.mod index e2b053fe6..1e9b325a4 100644 --- a/examples/huggingface-llm-example/go.mod +++ b/examples/huggingface-llm-example/go.mod @@ -2,7 +2,7 @@ module huggingface-llm-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/dlclark/regexp2 v1.8.1 // indirect diff --git a/examples/huggingface-llm-example/go.sum b/examples/huggingface-llm-example/go.sum index 1cf20e0bd..964c267ed 100644 --- a/examples/huggingface-llm-example/go.sum +++ b/examples/huggingface-llm-example/go.sum @@ -7,6 +7,6 @@ github.com/pkoukk/tiktoken-go v0.1.2 h1:u7PCSBiWJ3nJYoTGShyM9iHXz4dNyYkurwwp+GHt github.com/pkoukk/tiktoken-go v0.1.2/go.mod h1:boMWvk9pQCOTx11pgu0DrIdrAKgQzzJKUP6vLXaz7Rw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/llm-chain-example/go.mod b/examples/llm-chain-example/go.mod index ec8d55e87..0c9422fa2 100644 --- a/examples/llm-chain-example/go.mod +++ b/examples/llm-chain-example/go.mod @@ -2,7 +2,7 @@ module llm-chain-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/llm-chain-example/go.sum b/examples/llm-chain-example/go.sum index 64aef84a6..fac53fb64 100644 --- a/examples/llm-chain-example/go.sum +++ b/examples/llm-chain-example/go.sum @@ -66,8 +66,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= diff --git a/examples/llmmath-chain-example/go.mod b/examples/llmmath-chain-example/go.mod index ea1c8b097..53f043c59 100644 --- a/examples/llmmath-chain-example/go.mod +++ b/examples/llmmath-chain-example/go.mod @@ -2,7 +2,7 @@ module llmmath-chain-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/llmmath-chain-example/go.sum b/examples/llmmath-chain-example/go.sum index 64aef84a6..fac53fb64 100644 --- a/examples/llmmath-chain-example/go.sum +++ b/examples/llmmath-chain-example/go.sum @@ -66,8 +66,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= diff --git a/examples/llmsummarization-chain-example/go.mod b/examples/llmsummarization-chain-example/go.mod index a52cc62af..e5cd38505 100644 --- a/examples/llmsummarization-chain-example/go.mod +++ b/examples/llmsummarization-chain-example/go.mod @@ -2,7 +2,7 @@ module llmsummarization-chain-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( cloud.google.com/go v0.110.0 // indirect diff --git a/examples/llmsummarization-chain-example/go.sum b/examples/llmsummarization-chain-example/go.sum index ece214c4f..5d1d7f59c 100644 --- a/examples/llmsummarization-chain-example/go.sum +++ b/examples/llmsummarization-chain-example/go.sum @@ -127,8 +127,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= diff --git a/examples/local-llm-example/go.mod b/examples/local-llm-example/go.mod index e888e655e..50f08440a 100644 --- a/examples/local-llm-example/go.mod +++ b/examples/local-llm-example/go.mod @@ -2,7 +2,7 @@ module local-llm-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/dlclark/regexp2 v1.8.1 // indirect diff --git a/examples/local-llm-example/go.sum b/examples/local-llm-example/go.sum index 1cf20e0bd..964c267ed 100644 --- a/examples/local-llm-example/go.sum +++ b/examples/local-llm-example/go.sum @@ -7,6 +7,6 @@ github.com/pkoukk/tiktoken-go v0.1.2 h1:u7PCSBiWJ3nJYoTGShyM9iHXz4dNyYkurwwp+GHt github.com/pkoukk/tiktoken-go v0.1.2/go.mod h1:boMWvk9pQCOTx11pgu0DrIdrAKgQzzJKUP6vLXaz7Rw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/mrkl-agent-example/go.mod b/examples/mrkl-agent-example/go.mod index 81a2431f1..1ce3dbda5 100644 --- a/examples/mrkl-agent-example/go.mod +++ b/examples/mrkl-agent-example/go.mod @@ -2,7 +2,7 @@ module mrkl-agent-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/mrkl-agent-example/go.sum b/examples/mrkl-agent-example/go.sum index 64aef84a6..fac53fb64 100644 --- a/examples/mrkl-agent-example/go.sum +++ b/examples/mrkl-agent-example/go.sum @@ -66,8 +66,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= diff --git a/examples/openai-chat-example/go.mod b/examples/openai-chat-example/go.mod index 5de12713f..8f1486650 100644 --- a/examples/openai-chat-example/go.mod +++ b/examples/openai-chat-example/go.mod @@ -2,7 +2,7 @@ module openai-chat-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/dlclark/regexp2 v1.8.1 // indirect diff --git a/examples/openai-chat-example/go.sum b/examples/openai-chat-example/go.sum index 1cf20e0bd..964c267ed 100644 --- a/examples/openai-chat-example/go.sum +++ b/examples/openai-chat-example/go.sum @@ -7,6 +7,6 @@ github.com/pkoukk/tiktoken-go v0.1.2 h1:u7PCSBiWJ3nJYoTGShyM9iHXz4dNyYkurwwp+GHt github.com/pkoukk/tiktoken-go v0.1.2/go.mod h1:boMWvk9pQCOTx11pgu0DrIdrAKgQzzJKUP6vLXaz7Rw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/openai-completion-example/go.mod b/examples/openai-completion-example/go.mod index da554eb0a..d08d48f74 100644 --- a/examples/openai-completion-example/go.mod +++ b/examples/openai-completion-example/go.mod @@ -2,7 +2,7 @@ module openai-completion-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/dlclark/regexp2 v1.8.1 // indirect diff --git a/examples/openai-completion-example/go.sum b/examples/openai-completion-example/go.sum index 1cf20e0bd..964c267ed 100644 --- a/examples/openai-completion-example/go.sum +++ b/examples/openai-completion-example/go.sum @@ -7,6 +7,6 @@ github.com/pkoukk/tiktoken-go v0.1.2 h1:u7PCSBiWJ3nJYoTGShyM9iHXz4dNyYkurwwp+GHt github.com/pkoukk/tiktoken-go v0.1.2/go.mod h1:boMWvk9pQCOTx11pgu0DrIdrAKgQzzJKUP6vLXaz7Rw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/openai-function-call-example/go.mod b/examples/openai-function-call-example/go.mod index 880d2049c..7740a7534 100644 --- a/examples/openai-function-call-example/go.mod +++ b/examples/openai-function-call-example/go.mod @@ -2,7 +2,7 @@ module openai-function-call-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/dlclark/regexp2 v1.8.1 // indirect diff --git a/examples/openai-function-call-example/go.sum b/examples/openai-function-call-example/go.sum index 1cf20e0bd..964c267ed 100644 --- a/examples/openai-function-call-example/go.sum +++ b/examples/openai-function-call-example/go.sum @@ -7,6 +7,6 @@ github.com/pkoukk/tiktoken-go v0.1.2 h1:u7PCSBiWJ3nJYoTGShyM9iHXz4dNyYkurwwp+GHt github.com/pkoukk/tiktoken-go v0.1.2/go.mod h1:boMWvk9pQCOTx11pgu0DrIdrAKgQzzJKUP6vLXaz7Rw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/pinecone-vectorstore-example/go.mod b/examples/pinecone-vectorstore-example/go.mod index ff20bb852..d150b0e9e 100644 --- a/examples/pinecone-vectorstore-example/go.mod +++ b/examples/pinecone-vectorstore-example/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/google/uuid v1.3.0 - github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 + github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 ) require ( diff --git a/examples/pinecone-vectorstore-example/go.sum b/examples/pinecone-vectorstore-example/go.sum index ecc7845be..1005311d5 100644 --- a/examples/pinecone-vectorstore-example/go.sum +++ b/examples/pinecone-vectorstore-example/go.sum @@ -158,8 +158,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/examples/postgresql-database-chain-example/go.mod b/examples/postgresql-database-chain-example/go.mod index c1510218b..383844dba 100644 --- a/examples/postgresql-database-chain-example/go.mod +++ b/examples/postgresql-database-chain-example/go.mod @@ -2,7 +2,7 @@ module postgresql-database-chain-example go 1.20 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/postgresql-database-chain-example/go.sum b/examples/postgresql-database-chain-example/go.sum index 48f7bff89..2b9cd2f50 100644 --- a/examples/postgresql-database-chain-example/go.sum +++ b/examples/postgresql-database-chain-example/go.sum @@ -74,8 +74,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= diff --git a/examples/prompts-with-partial-example/go.mod b/examples/prompts-with-partial-example/go.mod index 32b049f76..168e90720 100644 --- a/examples/prompts-with-partial-example/go.mod +++ b/examples/prompts-with-partial-example/go.mod @@ -2,7 +2,7 @@ module prompts-with-partial-example go 1.20 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/prompts-with-partial-example/go.sum b/examples/prompts-with-partial-example/go.sum index 204d6b18f..4cd8a5571 100644 --- a/examples/prompts-with-partial-example/go.sum +++ b/examples/prompts-with-partial-example/go.sum @@ -29,8 +29,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= diff --git a/examples/prompts-with-partial-func-example/go.mod b/examples/prompts-with-partial-func-example/go.mod index 3e61903bd..1b29d9a27 100644 --- a/examples/prompts-with-partial-func-example/go.mod +++ b/examples/prompts-with-partial-func-example/go.mod @@ -2,7 +2,7 @@ module prompts-with-partial-func-example go 1.20 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/prompts-with-partial-func-example/go.sum b/examples/prompts-with-partial-func-example/go.sum index 204d6b18f..4cd8a5571 100644 --- a/examples/prompts-with-partial-func-example/go.sum +++ b/examples/prompts-with-partial-func-example/go.sum @@ -29,8 +29,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= diff --git a/examples/sequential-chain-example/go.mod b/examples/sequential-chain-example/go.mod index fc794a55d..2fa2ff3a1 100644 --- a/examples/sequential-chain-example/go.mod +++ b/examples/sequential-chain-example/go.mod @@ -2,7 +2,7 @@ module sequential-chain-example go 1.20 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/sequential-chain-example/go.sum b/examples/sequential-chain-example/go.sum index 64aef84a6..fac53fb64 100644 --- a/examples/sequential-chain-example/go.sum +++ b/examples/sequential-chain-example/go.sum @@ -66,8 +66,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= diff --git a/examples/sql-database-chain-example/go.mod b/examples/sql-database-chain-example/go.mod index 1b6ec1496..1e78afb2a 100644 --- a/examples/sql-database-chain-example/go.mod +++ b/examples/sql-database-chain-example/go.mod @@ -2,7 +2,7 @@ module sql-database-chain-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/examples/sql-database-chain-example/go.sum b/examples/sql-database-chain-example/go.sum index 36fc390dc..d9d1c8192 100644 --- a/examples/sql-database-chain-example/go.sum +++ b/examples/sql-database-chain-example/go.sum @@ -68,8 +68,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg= go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= diff --git a/examples/vertexai-palm-chat-example/go.mod b/examples/vertexai-palm-chat-example/go.mod index 6acf92bbd..33ee825aa 100644 --- a/examples/vertexai-palm-chat-example/go.mod +++ b/examples/vertexai-palm-chat-example/go.mod @@ -2,7 +2,7 @@ module vertexai-palm-chat-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( cloud.google.com/go v0.110.0 // indirect diff --git a/examples/vertexai-palm-chat-example/go.sum b/examples/vertexai-palm-chat-example/go.sum index 6b39af9f5..08399c51f 100644 --- a/examples/vertexai-palm-chat-example/go.sum +++ b/examples/vertexai-palm-chat-example/go.sum @@ -90,8 +90,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= diff --git a/examples/vertexai-palm-completion-example/go.mod b/examples/vertexai-palm-completion-example/go.mod index 2890c9f0d..d29bba120 100644 --- a/examples/vertexai-palm-completion-example/go.mod +++ b/examples/vertexai-palm-completion-example/go.mod @@ -2,7 +2,7 @@ module vertexai-palm-completion-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( cloud.google.com/go v0.110.0 // indirect diff --git a/examples/vertexai-palm-completion-example/go.sum b/examples/vertexai-palm-completion-example/go.sum index 6b39af9f5..08399c51f 100644 --- a/examples/vertexai-palm-completion-example/go.sum +++ b/examples/vertexai-palm-completion-example/go.sum @@ -90,8 +90,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 h1:y4TnpS57FeE5QzBzV2wKysVxWvkuMsha12yGHPVVAFo= -github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849/go.mod h1:8T+nNIGBr3nYQEYFmF/YaT8t8YTKLvFYZBuVZOAYn5E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 h1:7pmW0coaYnLm4evqJ+QR10EgDU1ku+xGOpcHBMuvE7E= +github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0/go.mod h1:fd7jP67Fwvcr+i7J+oAZbrh2aiekUuBLVqW/vgDslnw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= diff --git a/examples/zapier-llm-example/go.mod b/examples/zapier-llm-example/go.mod index e91b51679..1da77bc6e 100644 --- a/examples/zapier-llm-example/go.mod +++ b/examples/zapier-llm-example/go.mod @@ -2,7 +2,7 @@ module zapier-llm-example go 1.19 -require github.com/tmc/langchaingo v0.0.0-20230729231952-1f3948210849 +require github.com/tmc/langchaingo v0.0.0-20230826015154-aa97aec400c0 require ( github.com/Masterminds/goutils v1.1.1 // indirect diff --git a/llms/anthropic/anthropicllm.go b/llms/anthropic/anthropicllm.go index 674714357..82a8da04f 100644 --- a/llms/anthropic/anthropicllm.go +++ b/llms/anthropic/anthropicllm.go @@ -66,7 +66,7 @@ func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOptio func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error) { if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMStart(prompts) + o.CallbacksHandler.HandleLLMStart(ctx, prompts) } opts := llms.CallOptions{} @@ -94,7 +94,7 @@ func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.Ca } if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMEnd(llms.LLMResult{Generations: [][]*llms.Generation{generations}}) + o.CallbacksHandler.HandleLLMEnd(ctx, llms.LLMResult{Generations: [][]*llms.Generation{generations}}) } return generations, nil } diff --git a/llms/cohere/coherellm.go b/llms/cohere/coherellm.go index 3c28d0220..b1b45fd5b 100644 --- a/llms/cohere/coherellm.go +++ b/llms/cohere/coherellm.go @@ -41,7 +41,7 @@ func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOptio func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error) { if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMStart(prompts) + o.CallbacksHandler.HandleLLMStart(ctx, prompts) } opts := llms.CallOptions{} @@ -65,7 +65,7 @@ func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.Ca } if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMEnd(llms.LLMResult{Generations: [][]*llms.Generation{generations}}) + o.CallbacksHandler.HandleLLMEnd(ctx, llms.LLMResult{Generations: [][]*llms.Generation{generations}}) } return generations, nil diff --git a/llms/huggingface/huggingfacellm.go b/llms/huggingface/huggingfacellm.go index 009968b24..940ba596a 100644 --- a/llms/huggingface/huggingfacellm.go +++ b/llms/huggingface/huggingfacellm.go @@ -40,7 +40,7 @@ func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOptio func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error) { if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMStart(prompts) + o.CallbacksHandler.HandleLLMStart(ctx, prompts) } opts := &llms.CallOptions{Model: defaultModel} @@ -68,7 +68,7 @@ func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.Ca } if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMEnd(llms.LLMResult{Generations: [][]*llms.Generation{generations}}) + o.CallbacksHandler.HandleLLMEnd(ctx, llms.LLMResult{Generations: [][]*llms.Generation{generations}}) } return generations, nil } diff --git a/llms/local/localllm.go b/llms/local/localllm.go index 6ce63adc7..3a70dff67 100644 --- a/llms/local/localllm.go +++ b/llms/local/localllm.go @@ -74,7 +74,7 @@ func (o *LLM) appendGlobalsToArgs(opts llms.CallOptions) []string { // Generate generates completions using the local LLM binary. func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error) { if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMStart(prompts) + o.CallbacksHandler.HandleLLMStart(ctx, prompts) } opts := &llms.CallOptions{} @@ -101,7 +101,7 @@ func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.Ca } if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMEnd(llms.LLMResult{Generations: [][]*llms.Generation{generations}}) + o.CallbacksHandler.HandleLLMEnd(ctx, llms.LLMResult{Generations: [][]*llms.Generation{generations}}) } return generations, nil diff --git a/llms/openai/openaillm.go b/llms/openai/openaillm.go index c522e9e6f..681a0007a 100644 --- a/llms/openai/openaillm.go +++ b/llms/openai/openaillm.go @@ -41,7 +41,7 @@ func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOptio func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error) { if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMStart(prompts) + o.CallbacksHandler.HandleLLMStart(ctx, prompts) } opts := llms.CallOptions{} @@ -71,7 +71,7 @@ func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.Ca } if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMEnd(llms.LLMResult{Generations: [][]*llms.Generation{generations}}) + o.CallbacksHandler.HandleLLMEnd(ctx, llms.LLMResult{Generations: [][]*llms.Generation{generations}}) } return generations, nil diff --git a/llms/openai/openaillm_chat.go b/llms/openai/openaillm_chat.go index d6effdf51..f536c67ef 100644 --- a/llms/openai/openaillm_chat.go +++ b/llms/openai/openaillm_chat.go @@ -45,7 +45,7 @@ func (o *Chat) Call(ctx context.Context, messages []schema.ChatMessage, options //nolint:funlen func (o *Chat) Generate(ctx context.Context, messageSets [][]schema.ChatMessage, options ...llms.CallOption) ([]*llms.Generation, error) { // nolint:lll,cyclop if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMStart(getPromptsFromMessageSets(messageSets)) + o.CallbacksHandler.HandleLLMStart(ctx, getPromptsFromMessageSets(messageSets)) } opts := llms.CallOptions{} @@ -131,7 +131,7 @@ func (o *Chat) Generate(ctx context.Context, messageSets [][]schema.ChatMessage, } if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMEnd(llms.LLMResult{Generations: [][]*llms.Generation{generations}}) + o.CallbacksHandler.HandleLLMEnd(ctx, llms.LLMResult{Generations: [][]*llms.Generation{generations}}) } return generations, nil diff --git a/llms/vertexai/vertexai_palm_llm.go b/llms/vertexai/vertexai_palm_llm.go index e53700620..34ca1e21b 100644 --- a/llms/vertexai/vertexai_palm_llm.go +++ b/llms/vertexai/vertexai_palm_llm.go @@ -41,7 +41,7 @@ func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOptio func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error) { if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMStart(prompts) + o.CallbacksHandler.HandleLLMStart(ctx, prompts) } opts := llms.CallOptions{} @@ -65,7 +65,7 @@ func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.Ca } if o.CallbacksHandler != nil { - o.CallbacksHandler.HandleLLMEnd(llms.LLMResult{Generations: [][]*llms.Generation{generations}}) + o.CallbacksHandler.HandleLLMEnd(ctx, llms.LLMResult{Generations: [][]*llms.Generation{generations}}) } return generations, nil } diff --git a/tools/calculator.go b/tools/calculator.go index f3af09db9..4740d66cf 100644 --- a/tools/calculator.go +++ b/tools/calculator.go @@ -30,9 +30,9 @@ func (c Calculator) Name() string { // Call evaluates the input using a starlak evaluator and returns the result as a // string. If the evaluator errors the error is given in the result to give the // agent the ability to retry. -func (c Calculator) Call(_ context.Context, input string) (string, error) { +func (c Calculator) Call(ctx context.Context, input string) (string, error) { if c.CallbacksHandler != nil { - c.CallbacksHandler.HandleToolStart(input) + c.CallbacksHandler.HandleToolStart(ctx, input) } v, err := starlark.Eval(&starlark.Thread{Name: "main"}, "input", input, math.Module.Members) @@ -42,7 +42,7 @@ func (c Calculator) Call(_ context.Context, input string) (string, error) { result := v.String() if c.CallbacksHandler != nil { - c.CallbacksHandler.HandleToolEnd(result) + c.CallbacksHandler.HandleToolEnd(ctx, result) } return result, nil diff --git a/tools/duckduckgo/ddg.go b/tools/duckduckgo/ddg.go index 8d740141a..5be3ad55d 100644 --- a/tools/duckduckgo/ddg.go +++ b/tools/duckduckgo/ddg.go @@ -44,7 +44,7 @@ func (t Tool) Description() string { // Call performs the search and return the result. func (t Tool) Call(ctx context.Context, input string) (string, error) { if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolStart(input) + t.CallbacksHandler.HandleToolStart(ctx, input) } result, err := t.client.Search(ctx, input) @@ -56,7 +56,7 @@ func (t Tool) Call(ctx context.Context, input string) (string, error) { } if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolEnd(result) + t.CallbacksHandler.HandleToolEnd(ctx, result) } return result, nil diff --git a/tools/serpapi/serpapi.go b/tools/serpapi/serpapi.go index 65c24f963..2890c912f 100644 --- a/tools/serpapi/serpapi.go +++ b/tools/serpapi/serpapi.go @@ -46,7 +46,7 @@ func (t Tool) Description() string { func (t Tool) Call(ctx context.Context, input string) (string, error) { if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolStart(input) + t.CallbacksHandler.HandleToolStart(ctx, input) } result, err := t.client.Search(ctx, input) @@ -59,7 +59,7 @@ func (t Tool) Call(ctx context.Context, input string) (string, error) { } if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolEnd(result) + t.CallbacksHandler.HandleToolEnd(ctx, result) } return strings.Join(strings.Fields(result), " "), nil diff --git a/tools/wikipedia/wikipedia.go b/tools/wikipedia/wikipedia.go index 0cebebe24..b0ecf96f1 100644 --- a/tools/wikipedia/wikipedia.go +++ b/tools/wikipedia/wikipedia.go @@ -60,7 +60,7 @@ func (t Tool) Description() string { // the first part of the documents combined. func (t Tool) Call(ctx context.Context, input string) (string, error) { if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolStart(input) + t.CallbacksHandler.HandleToolStart(ctx, input) } searchResult, err := search(ctx, t.TopK, input, t.LanguageCode, t.UserAgent) @@ -92,7 +92,7 @@ func (t Tool) Call(ctx context.Context, input string) (string, error) { } if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolEnd(result) + t.CallbacksHandler.HandleToolEnd(ctx, result) } return result, nil diff --git a/tools/zapier/zapier.go b/tools/zapier/zapier.go index f2c06f6c7..24a23968f 100644 --- a/tools/zapier/zapier.go +++ b/tools/zapier/zapier.go @@ -80,7 +80,7 @@ func (t Tool) Description() string { func (t Tool) Call(ctx context.Context, input string) (string, error) { if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolStart(input) + t.CallbacksHandler.HandleToolStart(ctx, input) } result, err := t.client.ExecuteAsString(ctx, t.actionID, input, t.params) @@ -89,7 +89,7 @@ func (t Tool) Call(ctx context.Context, input string) (string, error) { } if t.CallbacksHandler != nil { - t.CallbacksHandler.HandleToolEnd(result) + t.CallbacksHandler.HandleToolEnd(ctx, result) } return result, nil diff --git a/vectorstores/vectorstores.go b/vectorstores/vectorstores.go index 8927bbf08..69e1778c3 100644 --- a/vectorstores/vectorstores.go +++ b/vectorstores/vectorstores.go @@ -27,7 +27,7 @@ var _ schema.Retriever = Retriever{} // GetRelevantDocuments returns documents using the vector store. func (r Retriever) GetRelevantDocuments(ctx context.Context, query string) ([]schema.Document, error) { if r.CallbacksHandler != nil { - r.CallbacksHandler.HandleRetrieverStart(query) + r.CallbacksHandler.HandleRetrieverStart(ctx, query) } docs, err := r.v.SimilaritySearch(ctx, query, r.numDocs, r.options...) @@ -36,7 +36,7 @@ func (r Retriever) GetRelevantDocuments(ctx context.Context, query string) ([]sc } if r.CallbacksHandler != nil { - r.CallbacksHandler.HandleRetrieverEnd(docs) + r.CallbacksHandler.HandleRetrieverEnd(ctx, docs) } return docs, nil