You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
p="Mike Tyson is a legend."call_ai_with_class(prompt=p, response_model=Output)
# {'Name_and_surname': ('Mike', 'Tyson')}
Note: In my real case the tuple was
classOutput(BaseModel):
var: Tuple[bool,str]
which ended up being
classOutput(BaseModel):
var: List[Union[bool,str]]
# or if you want to avoid getting a Pydantic warning when the list gets converted to tupleclassOutput(BaseModel):
var: Union[Tuple,List[str]]
If anyone knows a better way, feel free to chip in. I'd like to know it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As per the Instructor documentation one can use
Let's say I want a Tuple
Which works in Pydantic
But not with Instructor
One can still get the Tuple and keep Instructor happy with
Note: In my real case the tuple was
which ended up being
If anyone knows a better way, feel free to chip in. I'd like to know it.
Beta Was this translation helpful? Give feedback.
All reactions