When streaming a chat with a react agent i get some strange results:
def get_react_agent(
vector_store: PineconeVectorStore,
history: List[ChatMessage],
user_id: str,
model: ChatLLM,
) -> ReActAgent:
query_engine = get_query_engine(
user_id=user_id, vector_store=vector_store, model=model
)
query_engine_tool = QueryEngineTool.from_defaults(query_engine=query_engine)
return ReActAgent.from_tools(
tools=[query_engine_tool],
llm=model.value,
chat_history=history,
)
agent = get_react_agent(
vector_store=get_pinecone_vector_store(),
history=history,
user_id=user_id,
model=model,
)
# Valid types based on looking at source code
response = agent.stream_chat(message) # pyright: ignore
... generator websocket push code ...
print(response.response)
#<function_calls>
#<invoke>
#<tool_name>query_engine_tool</tool_name>
#<parameters>
# "input": "hello"
#</parameters>
#</invoke>
#</function_calls>
#Thought: I need to use the query_engine_tool to help me understand and respond to the user's input.
#Action: query_engine_tool
#Action Input: {"input": "hello"}