Skip to content

Commit cbb186a

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(internal): add type construction helper (#1584)
1 parent 04b3e6c commit cbb186a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/openai/_models.py

+9
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,15 @@ def build(
406406
return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs))
407407

408408

409+
def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
410+
"""Loose coercion to the expected type with construction of nested values.
411+
412+
Note: the returned value from this function is not guaranteed to match the
413+
given type.
414+
"""
415+
return cast(_T, construct_type(value=value, type_=type_))
416+
417+
409418
def construct_type(*, value: object, type_: object) -> object:
410419
"""Loose coercion to the expected type with construction of nested values.
411420

0 commit comments

Comments
 (0)