Hello,
I am currently testing a document that requires me to obtain specific output from the query engine. I am following the example provided in
https://docs.llamaindex.ai/en/stable/module_guides/querying/structured_outputs/query_engine/, but unfortunately, I keep getting a blank object. Below is my Pydantic model. I am using it to generate a set of questions from the details that I have obtained from the vector store.
I'm using OpenAI model and embeddings for this example.
class Questions(BaseModel):
""" Data model for a questions, which has four options, one correct option and explanation for the correct option."""
question: str = Field(..., description="natural lanaguage question")
options: List[str] = Field(..., description="four options for the question")
corrent_option: str = Field(..., description="correct option for the question")
explanation : str = Field(..., description="explanation for the correct option")
query_engine = index.as_query_engine(
response_mode="tree_summarize", output_cls = Questions, llm = Settings.llm
)