program
where you can augment with context, and where you can reference source_nodes
? Additionally any output_parser
that selects the correct results from ACCUMULATE? The closest I've seen is references to structured refine but not even really sure what kind of extraction program this is using.llm = OpenAI(..., pydantic_program_mode="...")
| PydanticProgramMode | Description | |---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | default | Traditional prompt extraction where the template is formatted and the resulting string is sent to the LLM with the context and instructions. **Note:** This mode has no specific instructions on how the model should provide output, it is up to the template and query to define this. | | openai | Uses the [new OpenAI API](https://openai.com/blog/function-calling-and-other-api-updates) function calling to extract a structured object while leveraging OpenAI native JSON fine-tuning. Only works with Azure/OpenAI LLMs that natively support function calling with the new API. | | function | Uses function calling to extract a structured object by leveraging JSON generation instructions/fine-tuning. Only works with LLMs that natively support function calling. | | llm | For LLMs without function calling, this method leverages JSON generation instructions to attempt to extract structured data. |
lama_index/core/response_synthesizers/refine.py:485
attempts to:structured_response = cast( StructuredRefineResponse, structured_response ) query_satisfied = structured_response.query_satisfied
structured_response
is my Pydantic BaseModel
. What am I missing here? Why does it try to cast the Pydantic model to a different one StructuredRefineResponse
?StructuredRefine
essentially has it's own Pydantic model (StructuredRefineResponse
) it uses with the PydanticProgram and does not accept the user's models?structured_answer_filtering=True
is broken. I can take a deeper look this weekend π