Find answers from the community

Updated last month

Generating a Poem from Content Using Structured LLM

trying to run this code for structured output
from llama_index.core.llms import ChatMessage sllm = llm.as_structured_llm(output_cls=Content) input_msg = ChatMessage.from_str(f"Generate a poem from the content: {content}") response = sllm.chat(input_msg)

and getting this error
Input should be a valid dictionary or instance of ChatMessage
i checked the input_msg and it is a ChatMessage object
L
3 comments
llm.chat([input_msg])
needs to be a list
pydantic errors are always the worst lol
Add a reply
Sign up and join the conversation on Discord