MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / construct

Method construct

src/anthropic/_models.py:1125–1138  ·  view source on GitHub ↗
(  # type: ignore
        cls,
        _fields_set: set[str] | None = None,
        **values: Unpack[FinalRequestOptionsInput],
    )

Source from the content-addressed store, hash-verified

1123 # type ignore required because we're adding explicit types to `**values`
1124 @classmethod
1125 def construct( # type: ignore
1126 cls,
1127 _fields_set: set[str] | None = None,
1128 **values: Unpack[FinalRequestOptionsInput],
1129 ) -> FinalRequestOptions:
1130 kwargs: dict[str, Any] = {
1131 # we unconditionally call `strip_not_given` on any value
1132 # as it will just ignore any non-mapping types
1133 key: strip_not_given(value)
1134 for key, value in values.items()
1135 }
1136 if PYDANTIC_V1:
1137 return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated]
1138 return super().model_construct(_fields_set, **kwargs)
1139
1140 if not TYPE_CHECKING:
1141 # type checkers incorrectly complain about this assignment

Callers

nothing calls this directly

Calls 2

strip_not_givenFunction · 0.85
constructMethod · 0.45

Tested by

no test coverage detected