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

Method construct

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

Source from the content-addressed store, hash-verified

807 # type ignore required because we're adding explicit types to `**values`
808 @classmethod
809 def construct( # type: ignore
810 cls,
811 _fields_set: set[str] | None = None,
812 **values: Unpack[FinalRequestOptionsInput],
813 ) -> FinalRequestOptions:
814 kwargs: dict[str, Any] = {
815 # we unconditionally call `strip_not_given` on any value
816 # as it will just ignore any non-mapping types
817 key: strip_not_given(value)
818 for key, value in values.items()
819 }
820 if PYDANTIC_V2:
821 return super().model_construct(_fields_set, **kwargs)
822 return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated]
823
824 if not TYPE_CHECKING:
825 # 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