How can we further specify something for an AI model? #313
Answered
by
zzstoatzz
santiagobasulto
asked this question in
Q&A
-
Following the docs example: @ai_model
class Resume(pydantic.BaseModel):
first_name: str
last_name: str
phone_number: Optional[str]
email: str Is there any way to provide more details to the fields? For example, say US-similar phone numbers, or "korean last names" and "spanish first names", or "emails that finish with a public domain like 'gmailcom', 'yahoo.com', or 'live.com'". |
Beta Was this translation helpful? Give feedback.
Answered by
zzstoatzz
May 31, 2023
Replies: 1 comment 1 reply
-
hi @santiagobasulto - apologies for the late response 😅 . I haven't checked this section in a bit you can add more color to the schema by using from pydantic import BaseModel, Field
@ai_model
class Resume(BaseModel):
"""<A general description of how the fields should be parsed>"""
first_name: str = Field(description="The first name of the resume owner")
last_name: str = Field(description="The last name of the resume owner")
phone_number: Optional[str] = Field(description="The phone number of the resume owner")
email: str = Field(description="The email address of the resume owner") and you can check what the schema looks like after defining your model with Resume.schema()
{'title': 'Resume',
'description': '<A general description of how the fields should be parsed>',
'type': 'object',
'properties': {'first_name': {'title': 'First Name',
'description': 'The first name of the resume owner',
'type': 'string'},
'last_name': {'title': 'Last Name',
'description': 'The last name of the resume owner',
'type': 'string'},
'phone_number': {'title': 'Phone Number',
'description': 'The phone number of the resume owner',
'type': 'string'},
'email': {'title': 'Email',
'description': 'The email address of the resume owner',
'type': 'string'}},
'required': ['first_name', 'last_name', 'email']} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
santiagobasulto
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi @santiagobasulto - apologies for the late response 😅 . I haven't checked this section in a bit
you can add more color to the schema by using
Field
and itsdescription
, as well as a class docstringand you can check what the schem…