What breaks
construct_type() in src/openai/_models.py (line 660) does _, items_type = get_args(type_) after checking origin == dict. When type_ is the bare, unparameterised dict class (no [K, V] type arguments), get_args(dict) returns an empty tuple (). Unpacking it with two targets raises ValueError: not enough values to unpack (expected 2, got 0). This crashes whenever a Pydantic BaseModel field or any response type is annotated as plain dict and the library tries to deserialise a mapping value into it.
from openai._models import construct_type
result = construct_type(value={"key": "value"}, type_=dict)
# ValueError: not enough values to unpack (expected 2, got 0)
Traceback
File "/tmp/repro.py", line 2, in <module>
result = construct_type(value={"key": "value"}, type_=dict)
File ".../src/openai/_models.py", line 660, in construct_type
_, items_type = get_args(type_) # Dict[_, items_type]
^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 0)
What breaks
construct_type()insrc/openai/_models.py(line 660) does_, items_type = get_args(type_)after checkingorigin == dict. Whentype_is the bare, unparameteriseddictclass (no[K, V]type arguments),get_args(dict)returns an empty tuple(). Unpacking it with two targets raisesValueError: not enough values to unpack (expected 2, got 0). This crashes whenever a PydanticBaseModelfield or any response type is annotated as plaindictand the library tries to deserialise a mapping value into it.Traceback