as_structured_llm
with llama_index.llms.openai.OpenAI
and pass that as the llm
to llama_index.agent.openai.OpenAIAgent.from_tools()
, but I'm getting an error ValueError: llm must be a OpenAI instance
. It seems as_structured_llm
changes the LLM enough that it's not considered an OpenAI instance anymore.from llama_index.core.agent import FunctionCallingAgentWorker agent = FunctionCallingAgentWorker.from_tools(...),as_agent()
as_structured_llm
will prevent the LLM from invoking tools?AttributeError: 'StructuredLLM' object has no attribute 'achat_with_tools'
await agent.achat(question.prompt) messages = [ agent.memory.get_all()[-1], ChatMessage.from_str("Please convert your previous message into the required format."), ] response = await structured_llm.achat(messages=messages)
agent
has the tool(s) and structured_llm
has the structure. The parsed object is in response.raw
.