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 <chester.curme@gmail.com>
This commit is contained in:
michael 2024-04-12 12:59:32 -07:00 committed by GitHub
parent e7b1a44c5b
commit 525226fb0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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",