mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
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:
parent
e7b1a44c5b
commit
525226fb0b
@ -89,12 +89,12 @@
|
|||||||
" # 1. Each field is an `optional` -- this allows the model to decline to extract it!\n",
|
" # 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",
|
" # 2. Each field has a `description` -- this description is used by the LLM.\n",
|
||||||
" # Having a good description can help improve extraction results.\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",
|
" 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",
|
" )\n",
|
||||||
" height_in_meters: Optional[str] = Field(\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",
|
" # 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",
|
" # 2. Each field has a `description` -- this description is used by the LLM.\n",
|
||||||
" # Having a good description can help improve extraction results.\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",
|
" 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",
|
" )\n",
|
||||||
" height_in_meters: Optional[str] = Field(\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",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user