Back to All questionsHow do I resolve InstructorException: Stream response_model must be a Iterable or Generator?
Ask questionpython
user = client.chat.completions.create_partial(
model="gpt-4o",
response_model=UserDetail,
messages=[{"role": "user", "content": "Extract user"}]
)
Error:
text
ValueError: Stream response_model must be an Iterable or
Generator type for streaming
1 answerHelpful solutions from the community
Fix:
python
from typing import Iterable
users = client.chat.completions.create_iterable(
model="gpt-4o",
response_model=UserDetail,
messages=[{"role": "user", "content": "Extract users"}]
)
Need a custom solution?
Tell us about your project and get help tailored to your problem.
Contact usHave an answer? Join the conversation.
Everyone can read. Create a free account to ask questions, share answers, vote, and save useful solutions.