Hi, I faced the problem that the context is lost when using tools. I created a tool that reads the URL and it can answers the first question about it but with the next question it completely loses the previously taken data.
agent = OpenAIAgent.from_tools(
[read_url_tool], llm=llm, verbose=True
)
...
response = agent.chat(query_text, chat_history)
The result:
Is this film scary https://en.wikipedia.org/wiki/Asteroid_City ?
response: The film "Asteroid City" is not categorized as a scary film. It is described as a 2023 American comedy-drama film directed by Wes Anderson. The plot revolves around a play set in a retrofuturistic version of 1955 during a Junior Stargazer convention. The film explores themes related to extraterrestrials, UFOs, and the postwar period of the 20th century. It features an ensemble cast and has received generally positive reviews.
is it suitable for kids?
response: I apologize but I don't know the answer.
So, how to make the agent keep the information obtained earlier and treat it in the same manner as context data? Thanks!
Add. Probably, the problem is I create the agent from scratch with every new question (because my program servers multiple users and can't keep all conversations loaded into memory). So, is there any way to keep the interim data, say, in some temporary context storage? Thank you.