instructor
instructor copied to clipboard
Async completions type checking error
Instructor 1.3.7 Python 3.12.3
Here's my example code:
client = instructor.from_litellm(litellm.acompletion, mode=instructor.mode.Mode.PARALLEL_TOOLS)
class Person(BaseModel):
name: str
age: int
class Company(BaseModel):
name: str
location: str
r = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{
"role": "user",
"content": """
John Smith, 29, works for Acme Corporation in San Francisco.
"""
}
],
response_model=typing.Iterable[Person | Company],
)
for obj in r:
print(obj)
Pylance gives me these errors:
However this seems to happen even without the parallel tools option
Is there something different I'm supposed to do to get async type hints working correctly?