ContextRetrieverOpenAIAgent.from_tools_and_retriever
context agent. I noticed that it's not managing the number of tokens effectively, and as a result, it often exceeds the limit. Shouldn't this context agent inherently control the number of tokens?agent._chat_history
. It's just a list of ChatMessage
objects right nowchat_history
property of from_tools_and_retriever
which includes a question for my chat. However, when the user responds to this question with just "yes", it calls the function with an empty input, thereby causing an error:Calling function: my-index with args: { "input": "" } Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/tenacity/__init__.py", line 382, in __call__ result = fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/llama_index/embeddings/openai.py", line 106, in get_embedding return openai.Embedding.create(input=[text], model=engine, **kwargs)["data"][0][ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/openai/api_resources/embedding.py", line 33, in create response = super().create(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "./context-pinecone.py", line 165, in <module> response = context_agent.chat(text_input, chat_history=messages) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/llama_index/agent/context_retriever_agent.py", line 165, in chat return super().chat(formatted_message, chat_history=chat_history) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
query_engine_tools = [ QueryEngineTool( query_engine=engine_home, metadata=ToolMetadata( name="llamaindex-home", description=f"Useful for asking questions about LLamaIndex", ), ), QueryEngineTool( query_engine=engine_openai_agent, metadata=ToolMetadata( name="llmaindex-openai_agent", description=f"Useful for asking questions about Context-Augmented OpenAI Agent", ), ) ]