Agent not actually executing the instruction #5253
redmage123
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all,
I have written some Python code with langchain to attempt to create a blog post on the topic 'Tree of Thoughts'. Unfortunately, the agent doesn't actually seem to perform the action, instead, it tells me what I ought to do to create the blog post. Here's the Python code
import os
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
topic = input("Topic: ")
prompt = PromptTemplate(input_variables = ['topic'],
template = '''
You have been given access to a search tool.
Please gather information about
the AI algorithm topic {topic}, and write a thousand word blog post on this topic.
'''
) os.environ['SERPAPI_API_KEY'] = ''
llm = OpenAI(model = 'text-davinci-003',temperature = 0.7,openai_api_key = "")
tools = load_tools(['serpapi'])
agent = initialize_agent(tools, llm, agent = 'zero-shot-react-description', verbose=True)
foo = agent.run(prompt.format_prompt(topic=topic))
print (foo)
f = open("new_post","w")
f.write(foo)
f.close()
Here's the output:
A blog post summarizing the Tree Of Thoughts AI algorithm should include information on the algorithm's benefits, disadvantages, and applications.
Additionally, the blog post should explain how the algorithm advances model reasoning by a whopping 70% and how it is a plug in and play version, c
onnecting seamlessly to other components.
What's going on here? Why is it telling me what to do rather than actually doing the action requested?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions