Home / Function/ _info_to_options() — anthropic-sdk-python Function Reference

_info_to_options() — anthropic-sdk-python Function Reference

Architecture documentation for the _info_to_options() function in _base_client.py from the anthropic-sdk-python codebase.

Function python AnthropicClient SyncAPI calls 3 called by 2

Entity Profile

Dependency Diagram

graph TD
  8431fb55_0370_3fd9_40c1_7e9f3735691f["_info_to_options()"]
  3543329f_b8e7_6257_bf27_c9c0879f8b2b["BasePage"]
  8431fb55_0370_3fd9_40c1_7e9f3735691f -->|defined in| 3543329f_b8e7_6257_bf27_c9c0879f8b2b
  f2d28c81_dfd4_1ffe_b1b5_5248a43a1ab5["get_next_page()"]
  f2d28c81_dfd4_1ffe_b1b5_5248a43a1ab5 -->|calls| 8431fb55_0370_3fd9_40c1_7e9f3735691f
  3373294a_f5ae_b05d_174c_724dcb380905["get_next_page()"]
  3373294a_f5ae_b05d_174c_724dcb380905 -->|calls| 8431fb55_0370_3fd9_40c1_7e9f3735691f
  b381ee1f_de5b_9018_ba09_d5c61a85a361["_params_from_url()"]
  8431fb55_0370_3fd9_40c1_7e9f3735691f -->|calls| b381ee1f_de5b_9018_ba09_d5c61a85a361
  971c9d31_78a5_d642_c4e9_5a1cc48b2f9e["model_copy()"]
  8431fb55_0370_3fd9_40c1_7e9f3735691f -->|calls| 971c9d31_78a5_d642_c4e9_5a1cc48b2f9e
  d58471b8_799b_6583_1307_086d2b49c27a["_strip_raw_response_header()"]
  8431fb55_0370_3fd9_40c1_7e9f3735691f -->|calls| d58471b8_799b_6583_1307_086d2b49c27a
  style 8431fb55_0370_3fd9_40c1_7e9f3735691f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_base_client.py lines 204–232

    def _info_to_options(self, info: PageInfo) -> FinalRequestOptions:
        options = model_copy(self._options)
        options._strip_raw_response_header()

        if not isinstance(info.params, NotGiven):
            options.params = {**options.params, **info.params}
            return options

        if not isinstance(info.url, NotGiven):
            params = self._params_from_url(info.url)
            url = info.url.copy_with(params=params)
            options.params = dict(url.params)
            options.url = str(url)
            return options

        if not isinstance(info.json, NotGiven):
            if not is_mapping(info.json):
                raise TypeError("Pagination is only supported with mappings")

            if not options.json_data:
                options.json_data = {**info.json}
            else:
                if not is_mapping(options.json_data):
                    raise TypeError("Pagination is only supported with mappings")

                options.json_data = {**options.json_data, **info.json}
            return options

        raise ValueError("Unexpected PageInfo state")

Subdomains

Frequently Asked Questions

What does _info_to_options() do?
_info_to_options() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_base_client.py.
Where is _info_to_options() defined?
_info_to_options() is defined in src/anthropic/_base_client.py at line 204.
What does _info_to_options() call?
_info_to_options() calls 3 function(s): _params_from_url, _strip_raw_response_header, model_copy.
What calls _info_to_options()?
_info_to_options() is called by 2 function(s): get_next_page, get_next_page.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free