MCPcopy
hub / github.com/openai/openai-python / make_request_options

Function make_request_options

src/openai/_base_client.py:2025–2067  ·  src/openai/_base_client.py::make_request_options

Create a dict of type RequestOptions without keys of NotGiven values.

(
    *,
    query: Query | None = None,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    idempotency_key: str | None = None,
    timeout: float | httpx.Timeout | None | NotGiven = not_given,
    post_parser: PostParser | NotGiven = not_given,
    security: SecurityOptions | None = None,
    synthesize_event_and_data: bool | None = None,
)

Source from the content-addressed store, hash-verified

2023
2024
2025def make_request_options(
2026 *,
2027 query: Query | None = None,
2028 extra_headers: Headers | None = None,
2029 extra_query: Query | None = None,
2030 extra_body: Body | None = None,
2031 idempotency_key: str | None = None,
2032 timeout: float | httpx.Timeout | None | NotGiven = not_given,
2033 post_parser: PostParser | NotGiven = not_given,
2034 security: SecurityOptions | None = None,
2035 synthesize_event_and_data: bool | None = None,
2036) -> RequestOptions:
2037 class="st">""class="st">"Create a dict of type RequestOptions without keys of NotGiven values."class="st">""
2038 options: RequestOptions = {}
2039 if extra_headers is not None:
2040 options[class="st">"headers"] = extra_headers
2041
2042 if extra_body is not None:
2043 options[class="st">"extra_json"] = cast(AnyMapping, extra_body)
2044
2045 if query is not None:
2046 options[class="st">"params"] = query
2047
2048 if extra_query is not None:
2049 options[class="st">"params"] = {**options.get(class="st">"params", {}), **extra_query}
2050
2051 if not isinstance(timeout, NotGiven):
2052 options[class="st">"timeout"] = timeout
2053
2054 if idempotency_key is not None:
2055 options[class="st">"idempotency_key"] = idempotency_key
2056
2057 if is_given(post_parser):
2058 class="cm"># internal
2059 options[class="st">"post_parser"] = post_parser class="cm"># type: ignore
2060
2061 if security is not None:
2062 options[class="st">"security"] = security
2063
2064 if synthesize_event_and_data is not None:
2065 options[class="st">"synthesize_event_and_data"] = synthesize_event_and_data
2066
2067 return options
2068
2069
2070class ForceMultipartDict(Dict[str, None]):

Callers 15

createMethod · 0.90
createMethod · 0.90
createMethod · 0.85
retrieveMethod · 0.85
listMethod · 0.85
deleteMethod · 0.85
create_characterMethod · 0.85
download_contentMethod · 0.85

Calls 2

is_givenFunction · 0.85
getMethod · 0.45

Tested by 4