Last active
March 10, 2023 16:14
-
-
Save HelloElisaRose/428f62035e590c087b5deb0a3900b449 to your computer and use it in GitHub Desktop.
langchain-article-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from langchain.agents import initialize_agent, load_tools | |
from langchain.llms import OpenAI | |
llm = OpenAI(temperature=0) | |
tools = load_tools(["llm-math"], llm=llm) | |
agent = initialize_agent(tools, llm) | |
answer: str = agent.run( | |
"How old is the current Dalai Lama? " | |
"What is his age divided by 2 (rounded to the nearest integer)?" | |
) | |
print(answer) # The current Dalai Lama's age divided by 2 is 43 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment