"Query a retriever to get information about state of the union address")Create response schema‚ÄãHere is where we will define the response schema. In this case, we want the final answer to have two fields: one for the answer, and then another that is a list of sourcesfrom pydantic import BaseModel, Fieldfrom typing import Listfrom langchain.utils.openai_functions import convert_pydantic_to_openai_functionclass Response(BaseModel):    """Final response to the question being asked"""    answer: str = Field(description = "The final answer to respond to the user")    sources: List[int] = Field(description="List of page chunks that contain answer to the question. Only include a page chunk if it contains relevant information")Create the custom parsing logic‚ÄãWe now create some custom parsing logic.
This notebook covers how to have an agent return a structured output.
This notebook covers how to have an agent return a structured output. ->: "Query a retriever to get information about state of the union address")Create response schema‚ÄãHere is where we will define the response schema. In this case, we want the final answer to have two fields: one for the answer, and then another that is a list of sourcesfrom pydantic import BaseModel, Fieldfrom typing import Listfrom langchain.utils.openai_functions import convert_pydantic_to_openai_functionclass Response(BaseModel):    """Final response to the question being asked"""    answer: str = Field(description = "The final answer to respond to the user")    sources: List[int] = Field(description="List of page chunks that contain answer to the question. Only include a page chunk if it contains relevant information")Create the custom parsing logic‚ÄãWe now create some custom parsing logic.