Skip to content

Commit

Permalink
examples: replace deprecated agents.Initialize (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
treywelsh authored Sep 13, 2024
1 parent c362f8a commit 71f5789
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
13 changes: 5 additions & 8 deletions examples/mrkl-agent-example/mrkl_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@ func run() error {
tools.Calculator{},
search,
}
executor, err := agents.Initialize(
llm,

agent := agents.NewOneShotAgent(llm,
agentTools,
agents.ZeroShotReactDescription,
agents.WithMaxIterations(3),
)
if err != nil {
return err
}
agents.WithMaxIterations(3))
executor := agents.NewExecutor(agent)

question := "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?"
answer, err := chains.Run(context.Background(), executor, question)
fmt.Println(answer)
Expand Down
11 changes: 3 additions & 8 deletions examples/zapier-llm-example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,10 @@ func main() {
agentTools = append(agentTools, tks...)

// Initialize the agent
executor, err := agents.Initialize(
llm,
agent := agents.NewOneShotAgent(llm,
agentTools,
agents.ZeroShotReactDescription,
agents.WithMaxIterations(3),
)
if err != nil {
panic(err)
}
agents.WithMaxIterations(3))
executor := agents.NewExecutor(agent)

// run a chain with the executor and defined input
input := "Get the last email from [email protected]"
Expand Down

0 comments on commit 71f5789

Please sign in to comment.