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

Method parse

src/openai/resources/responses/responses.py:2969–3078  ·  view source on GitHub ↗
(
        self,
        *,
        text_format: type[TextFormatT] | Omit = omit,
        background: Optional[bool] | Omit = omit,
        context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
        conversation: Optional[response_create_params.Conversation] | Omit = omit,
        include: Optional[List[ResponseIncludable]] | Omit = omit,
        input: Union[str, ResponseInputParam] | Omit = omit,
        instructions: Optional[str] | Omit = omit,
        max_output_tokens: Optional[int] | Omit = omit,
        max_tool_calls: Optional[int] | Omit = omit,
        metadata: Optional[Metadata] | Omit = omit,
        model: ResponsesModel | Omit = omit,
        moderation: Optional[response_create_params.Moderation] | Omit = omit,
        parallel_tool_calls: Optional[bool] | Omit = omit,
        previous_response_id: Optional[str] | Omit = omit,
        prompt: Optional[ResponsePromptParam] | Omit = omit,
        prompt_cache_key: str | Omit = omit,
        prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
        reasoning: Optional[Reasoning] | Omit = omit,
        safety_identifier: str | Omit = omit,
        service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
        store: Optional[bool] | Omit = omit,
        stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
        stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
        temperature: Optional[float] | Omit = omit,
        text: ResponseTextConfigParam | Omit = omit,
        tool_choice: response_create_params.ToolChoice | Omit = omit,
        tools: Iterable[ParseableToolParam] | Omit = omit,
        top_logprobs: Optional[int] | Omit = omit,
        top_p: Optional[float] | Omit = omit,
        truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
        user: str | Omit = omit,
        verbosity: Optional[Literal["low", "medium", "high"]] | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    )

Source from the content-addressed store, hash-verified

2967 )
2968
2969 async def parse(
2970 self,
2971 *,
2972 text_format: type[TextFormatT] | Omit = omit,
2973 background: Optional[bool] | Omit = omit,
2974 context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
2975 conversation: Optional[response_create_params.Conversation] | Omit = omit,
2976 include: Optional[List[ResponseIncludable]] | Omit = omit,
2977 input: Union[str, ResponseInputParam] | Omit = omit,
2978 instructions: Optional[str] | Omit = omit,
2979 max_output_tokens: Optional[int] | Omit = omit,
2980 max_tool_calls: Optional[int] | Omit = omit,
2981 metadata: Optional[Metadata] | Omit = omit,
2982 model: ResponsesModel | Omit = omit,
2983 moderation: Optional[response_create_params.Moderation] | Omit = omit,
2984 parallel_tool_calls: Optional[bool] | Omit = omit,
2985 previous_response_id: Optional[str] | Omit = omit,
2986 prompt: Optional[ResponsePromptParam] | Omit = omit,
2987 prompt_cache_key: str | Omit = omit,
2988 prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
2989 reasoning: Optional[Reasoning] | Omit = omit,
2990 safety_identifier: str | Omit = omit,
2991 service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
2992 store: Optional[bool] | Omit = omit,
2993 stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
2994 stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
2995 temperature: Optional[float] | Omit = omit,
2996 text: ResponseTextConfigParam | Omit = omit,
2997 tool_choice: response_create_params.ToolChoice | Omit = omit,
2998 tools: Iterable[ParseableToolParam] | Omit = omit,
2999 top_logprobs: Optional[int] | Omit = omit,
3000 top_p: Optional[float] | Omit = omit,
3001 truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
3002 user: str | Omit = omit,
3003 verbosity: Optional[Literal["low", "medium", "high"]] | Omit = omit,
3004 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
3005 # The extra values given here take precedence over values defined on the client or passed to this method.
3006 extra_headers: Headers | None = None,
3007 extra_query: Query | None = None,
3008 extra_body: Body | None = None,
3009 timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3010 ) -> ParsedResponse[TextFormatT]:
3011 if is_given(text_format):
3012 if not text:
3013 text = {}
3014
3015 if "format" in text:
3016 raise TypeError("Cannot mix and match text.format with text_format")
3017 text = copy(text)
3018 text["format"] = _type_to_text_format_param(text_format)
3019
3020 tools = _make_tools(tools)
3021
3022 def parser(raw_response: Response) -> ParsedResponse[TextFormatT]:
3023 return parse_response(
3024 input_tools=tools,
3025 text_format=text_format,
3026 response=raw_response,

Callers

nothing calls this directly

Calls 4

is_givenFunction · 0.85
_make_toolsFunction · 0.85
maybe_transformFunction · 0.85
make_request_optionsFunction · 0.85

Tested by

no test coverage detected