MRKL Agent Example π€π
Hello there! Welcome to this exciting example of a MRKL (Modular Reasoning, Knowledge, and Language) agent using the LangChain Go library. This nifty little program showcases how to create an AI-powered agent that can answer complex questions by combining different tools and language models. Let's dive in!
What Does This Example Do? π
This example demonstrates:
- Setting up an OpenAI language model
- Initializing a search tool (SerpAPI)
- Creating a MRKL agent with multiple tools
- Asking the agent a multi-step question
The agent is tasked with answering the following question:
"Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?"
To answer this, the agent needs to:
- Search for information about Olivia Wilde's boyfriend
- Find out his current age
- Use a calculator to compute the age raised to the 0.23 power
How It Works π οΈ
- The program sets up an OpenAI language model and a SerpAPI search tool.
- It creates an agent with two tools: a calculator and the search tool.
- The agent is initialized with a "zero-shot react description" approach, meaning it doesn't require specific examples to understand how to use the tools.
- The question is passed to the agent, which then uses its tools and the language model to formulate an answer.
- The answer is printed to the console.
Running the Example πββοΈ
To run this example, make sure you have your OpenAI API key and SerpAPI key set as environment variables. Then, simply execute the main()
function, and watch the magic happen!
Why This is Cool π
This example showcases the power of combining language models with external tools to solve complex, multi-step problems. It's a great demonstration of how AI can be used to augment human intelligence and automate research tasks.
So go ahead, give it a try, and see how the MRKL agent tackles this intriguing question about Olivia Wilde's boyfriend! ππ§