diff --git a/exp/agent/agents.go b/agents/agents.go similarity index 97% rename from exp/agent/agents.go rename to agents/agents.go index 105438c0..18bed11f 100644 --- a/exp/agent/agents.go +++ b/agents/agents.go @@ -1,5 +1,5 @@ // Package agents defines the types for langchaingo Agent. -package agent +package agents import ( "context" diff --git a/exp/agent/doc.go b/agents/doc.go similarity index 95% rename from exp/agent/doc.go rename to agents/doc.go index 9c7c9115..b65a944b 100644 --- a/exp/agent/doc.go +++ b/agents/doc.go @@ -4,4 +4,4 @@ // a response corresponding to an “action” to take and a corresponding // “action input”. Alternatively the agent can return a finish with the // finished answer to the query. -package agent +package agents diff --git a/exp/agent/executor/doc.go b/agents/executor/doc.go similarity index 100% rename from exp/agent/executor/doc.go rename to agents/executor/doc.go diff --git a/exp/agent/executor/errors.go b/agents/executor/errors.go similarity index 100% rename from exp/agent/executor/errors.go rename to agents/executor/errors.go diff --git a/exp/agent/executor/executor.go b/agents/executor/executor.go similarity index 93% rename from exp/agent/executor/executor.go rename to agents/executor/executor.go index a05ea175..b37ea492 100644 --- a/exp/agent/executor/executor.go +++ b/agents/executor/executor.go @@ -4,16 +4,16 @@ import ( "context" "fmt" + "github.com/tmc/langchaingo/agents" "github.com/tmc/langchaingo/chains" - "github.com/tmc/langchaingo/exp/agent" - "github.com/tmc/langchaingo/exp/tools" "github.com/tmc/langchaingo/memory" "github.com/tmc/langchaingo/schema" + "github.com/tmc/langchaingo/tools" ) // Executor is the chain responsible for running agents. type Executor struct { - Agent agent.Agent + Agent agents.Agent Tools []tools.Tool MaxIterations int @@ -23,7 +23,7 @@ var _ chains.Chain = Executor{} // New creates a new agent executor with a agent, the tools the agent can use // and the max number of iterations. -func New(agent agent.Agent, tools []tools.Tool, maxIterations int) Executor { +func New(agent agents.Agent, tools []tools.Tool, maxIterations int) Executor { return Executor{ Agent: agent, Tools: tools, diff --git a/exp/agent/executor/executor_test.go b/agents/executor/executor_test.go similarity index 87% rename from exp/agent/executor/executor_test.go rename to agents/executor/executor_test.go index 147f7b99..158a7b5f 100644 --- a/exp/agent/executor/executor_test.go +++ b/agents/executor/executor_test.go @@ -7,11 +7,11 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tmc/langchaingo/agents/executor" "github.com/tmc/langchaingo/chains" - "github.com/tmc/langchaingo/exp/agent/executor" - "github.com/tmc/langchaingo/exp/tools" - "github.com/tmc/langchaingo/exp/tools/serpapi" "github.com/tmc/langchaingo/llms/openai" + "github.com/tmc/langchaingo/tools" + "github.com/tmc/langchaingo/tools/serpapi" ) func TestMRKL(t *testing.T) { diff --git a/exp/agent/executor/initialize.go b/agents/executor/initialize.go similarity index 89% rename from exp/agent/executor/initialize.go rename to agents/executor/initialize.go index b541ce48..9b2caa99 100644 --- a/exp/agent/executor/initialize.go +++ b/agents/executor/initialize.go @@ -1,10 +1,10 @@ package executor import ( - "github.com/tmc/langchaingo/exp/agent" - "github.com/tmc/langchaingo/exp/agent/mrkl" - "github.com/tmc/langchaingo/exp/tools" + "github.com/tmc/langchaingo/agents" + "github.com/tmc/langchaingo/agents/mrkl" "github.com/tmc/langchaingo/llms" + "github.com/tmc/langchaingo/tools" ) // AgentType is a string type representing the type of agent to create. @@ -47,7 +47,7 @@ func WithMaxIterations(maxIterations int) Option { // Initialize is a function that creates a new executor with the specified LLM // model, tools, agent type, and options. It returns an Executor or an error -// if there is any issue during the creation process. +// if there is any issues during the creation process. func Initialize( llm llms.LLM, tools []tools.Tool, @@ -58,7 +58,7 @@ func Initialize( for _, opt := range opts { opt(&options) } - var agent agent.Agent + var agent agents.Agent switch agentType { case ZeroShotReactDescription: diff --git a/exp/agent/mrkl/doc.go b/agents/mrkl/doc.go similarity index 100% rename from exp/agent/mrkl/doc.go rename to agents/mrkl/doc.go diff --git a/exp/agent/mrkl/markl_test.go b/agents/mrkl/markl_test.go similarity index 100% rename from exp/agent/mrkl/markl_test.go rename to agents/mrkl/markl_test.go diff --git a/exp/agent/mrkl/mrkl.go b/agents/mrkl/mrkl.go similarity index 97% rename from exp/agent/mrkl/mrkl.go rename to agents/mrkl/mrkl.go index cfa970eb..6b899bac 100644 --- a/exp/agent/mrkl/mrkl.go +++ b/agents/mrkl/mrkl.go @@ -8,11 +8,11 @@ import ( "strings" "time" + "github.com/tmc/langchaingo/agents" "github.com/tmc/langchaingo/chains" - "github.com/tmc/langchaingo/exp/agent" - "github.com/tmc/langchaingo/exp/tools" "github.com/tmc/langchaingo/llms" "github.com/tmc/langchaingo/schema" + "github.com/tmc/langchaingo/tools" ) var ( @@ -46,7 +46,7 @@ type OneShotZeroAgent struct { OutputKey string } -var _ agent.Agent = (*OneShotZeroAgent)(nil) +var _ agents.Agent = (*OneShotZeroAgent)(nil) // OneShotZeroAgentOptions is a type alias for a map of string keys to any value, // representing the options for the OneShotZeroAgent. diff --git a/exp/agent/mrkl/prompt.go b/agents/mrkl/prompt.go similarity index 98% rename from exp/agent/mrkl/prompt.go rename to agents/mrkl/prompt.go index 178338b5..4efb4fa7 100644 --- a/exp/agent/mrkl/prompt.go +++ b/agents/mrkl/prompt.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/tmc/langchaingo/exp/tools" "github.com/tmc/langchaingo/prompts" + "github.com/tmc/langchaingo/tools" ) const ( diff --git a/exp/tools/calculator.go b/tools/calculator.go similarity index 100% rename from exp/tools/calculator.go rename to tools/calculator.go diff --git a/exp/tools/doc.go b/tools/doc.go similarity index 100% rename from exp/tools/doc.go rename to tools/doc.go diff --git a/tools/serpapi/doc.go b/tools/serpapi/doc.go new file mode 100644 index 00000000..bad24f6b --- /dev/null +++ b/tools/serpapi/doc.go @@ -0,0 +1,3 @@ +// Package serpapi contains an implementation of the tool interface with the +// serapi. +package serpapi diff --git a/exp/tools/serpapi/internal/serpapi_client.go b/tools/serpapi/internal/serpapi_client.go similarity index 100% rename from exp/tools/serpapi/internal/serpapi_client.go rename to tools/serpapi/internal/serpapi_client.go diff --git a/exp/tools/serpapi/serpapi.go b/tools/serpapi/serpapi.go similarity index 92% rename from exp/tools/serpapi/serpapi.go rename to tools/serpapi/serpapi.go index c2fe4c11..b9785cb9 100644 --- a/exp/tools/serpapi/serpapi.go +++ b/tools/serpapi/serpapi.go @@ -5,8 +5,8 @@ import ( "os" "strings" - "github.com/tmc/langchaingo/exp/tools" - "github.com/tmc/langchaingo/exp/tools/serpapi/internal" + "github.com/tmc/langchaingo/tools" + "github.com/tmc/langchaingo/tools/serpapi/internal" ) var ErrMissingToken = errors.New("missing the serpapi API key, set it in the SERPAPI_API_KEY environment variable") diff --git a/exp/tools/tool.go b/tools/tool.go similarity index 100% rename from exp/tools/tool.go rename to tools/tool.go