Replies: 4 comments 1 reply
-
switching pydantic version to 2.7.* fixed it, the problem happens on pydantic version 2.8.* |
Beta Was this translation helpful? Give feedback.
0 replies
-
hey @vikyw89 , I tried running the code snippet above and didn't get any issues. Any other ways to reproduce the error? import instructor
from pydantic import BaseModel
import openai
client = instructor.from_openai(openai.OpenAI())
class User(BaseModel):
name: str
age: int
user_stream = client.chat.completions.create_partial(
model="gpt-4-turbo-preview",
messages=[
{"role": "user", "content": "Create a user"},
],
response_model=User,
)
for user in user_stream:
print(user) This was my shell output > uv pip list | grep pydantic
pydantic 2.7.3
pydantic-core 2.18.4
pydantic-extra-types 2.8.0
> python3 test.py
name=None age=None
name=None age=None
name=None age=None
name=None age=None
name=None age=25
name=None age=25
name=None age=25
name='' age=25
name='John' age=25
name='John Doe' age=25
name='John Doe' age=25 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Use pydantic 2.8.* |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, i see that this has been closed as an issue. Will there be a fix for this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What Model are you using?
Describe the bug
A clear and concise description of what the bug is.
astream partial stopped working
To Reproduce
Steps to reproduce the behavior, including code snippets of the model and the input data and openai response.
tests/text/test_instructor.py:15:
../../.cache/pypoetry/virtualenvs/llmtext-HjOqM6W8-py3.11/lib/python3.11/site-packages/instructor/client.py:135: in create_partial
response_model = instructor.Partial[response_model] # type: ignore
cls = <class 'instructor.dsl.partial.Partial'>, wrapped_class = <class 'test_instructor.test_instructor..User'>
E TypeError: create_model() missing 1 required positional argument: 'model_name'
../../.cache/pypoetry/virtualenvs/llmtext-HjOqM6W8-py3.11/lib/python3.11/site-packages/instructor/dsl/partial.py:292: TypeError
Beta Was this translation helpful? Give feedback.
All reactions