From 525226fb0b5565386105ce08438a57f7cb807de0 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 12 Apr 2024 12:59:32 -0700 Subject: [PATCH] docs: fix extraction/quickstart.ipynb example code (#20397) - **Description**: The pydantic schema fields are supposed to be optional but the use of `...` makes them required. This causes a `ValidationError` when running the example code. I replaced `...` with `default=None` to make the fields optional as intended. I also standardized the format for all fields. - **Issue**: n/a - **Dependencies**: none - **Twitter handle**: https://twitter.com/m_atoms --------- Co-authored-by: Chester Curme --- docs/docs/use_cases/extraction/quickstart.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/use_cases/extraction/quickstart.ipynb b/docs/docs/use_cases/extraction/quickstart.ipynb index fa8587ab39d..55eee4436e5 100644 --- a/docs/docs/use_cases/extraction/quickstart.ipynb +++ b/docs/docs/use_cases/extraction/quickstart.ipynb @@ -89,12 +89,12 @@ " # 1. Each field is an `optional` -- this allows the model to decline to extract it!\n", " # 2. Each field has a `description` -- this description is used by the LLM.\n", " # Having a good description can help improve extraction results.\n", - " name: Optional[str] = Field(..., description=\"The name of the person\")\n", + " name: Optional[str] = Field(default=None, description=\"The name of the person\")\n", " hair_color: Optional[str] = Field(\n", - " ..., description=\"The color of the peron's hair if known\"\n", + " default=None, description=\"The color of the peron's hair if known\"\n", " )\n", " height_in_meters: Optional[str] = Field(\n", - " ..., description=\"Height measured in meters\"\n", + " default=None, description=\"Height measured in meters\"\n", " )" ] }, @@ -254,12 +254,12 @@ " # 1. Each field is an `optional` -- this allows the model to decline to extract it!\n", " # 2. Each field has a `description` -- this description is used by the LLM.\n", " # Having a good description can help improve extraction results.\n", - " name: Optional[str] = Field(..., description=\"The name of the person\")\n", + " name: Optional[str] = Field(default=None, description=\"The name of the person\")\n", " hair_color: Optional[str] = Field(\n", - " ..., description=\"The color of the peron's hair if known\"\n", + " default=None, description=\"The color of the peron's hair if known\"\n", " )\n", " height_in_meters: Optional[str] = Field(\n", - " ..., description=\"Height measured in meters\"\n", + " default=None, description=\"Height measured in meters\"\n", " )\n", "\n", "\n",