mirror of
https://github.com/kennethreitz/instructor.git
synced 2026-06-05 22:50:18 +00:00
RFC how much detail is too much? (#198)
This commit is contained in:
@@ -246,7 +246,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Lastly you can also define functions that run on the data."
|
||||
"Lastly you can also define functions that run on the data. In this case we use the [@field_validator](https://docs.pydantic.dev/latest/concepts/validators/#field-validators) decorator."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -284,6 +284,18 @@
|
||||
"Person(name=\"Sam\", age=10)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"'...' is used as a placeholder for a required value in Pydantic's [Field](https://docs.pydantic.dev/latest/concepts/fields/) function.\n",
|
||||
"\n",
|
||||
"```age: int = Field(..., gt=0)```\n",
|
||||
"defines a field age of type int in the Person model. The ... indicates that this field is required and must be provided when creating an instance of the Person model. The gt=0 is a validation that ensures the age must be greater than 0.\n",
|
||||
"\n",
|
||||
"If you try to create a Person without providing an age, Pydantic will raise a validation error because of the ... placeholder."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
@@ -397,7 +409,7 @@
|
||||
"source": [
|
||||
"## Introduction to Function Calling \n",
|
||||
"\n",
|
||||
"The json could be anything! We could add more and more into a prompt and hope it works, or we can use something called function calling to directly specify the schema we want. \n",
|
||||
"The json could be anything! We could add more and more into a prompt and hope it works, or we can use something called [function calling](https://platform.openai.com/docs/guides/function-calling) to directly specify the schema we want. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"**Function Calling**\n",
|
||||
|
||||
Reference in New Issue
Block a user