Skip to content

Instantly share code, notes, and snippets.

@HelloElisaRose
Last active March 10, 2023 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HelloElisaRose/428f62035e590c087b5deb0a3900b449 to your computer and use it in GitHub Desktop.
Save HelloElisaRose/428f62035e590c087b5deb0a3900b449 to your computer and use it in GitHub Desktop.
langchain-article-1
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