Describe the bug
When using the instructor library, there seems to be an issue with the raw response not being available when the response model is an Iterable.
To Reproduce
from typing import Iterable
import instructor
from openai import OpenAI
from pydantic import BaseModel
client = instructor.patch(OpenAI())
class UserDetail(BaseModel):
name: str
age: int
users = client.chat.completions.create(
model="gpt-3.5-turbo",
response_model=Iterable[UserDetail],
messages=[
{"role": "user", "content": "Give me 3 users"},
],
)
print(users) # [UserDetail(name='Alice', age=25), UserDetail(name='Bob', age=30), UserDetail(name='Charlie', age=35)]
assert users._raw_response is not None # AttributeError: 'list' object has no attribute '_raw_response'
Expected behavior
The expected behavior is that the raw response should be available and accessible.
Describe the bug
When using the instructor library, there seems to be an issue with the raw response not being available when the response model is an Iterable.
To Reproduce
Expected behavior
The expected behavior is that the raw response should be available and accessible.