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

Method parse

src/openai/resources/responses/responses.py:1218–1327  ·  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

1216 )
1217
1218 def parse(
1219 self,
1220 *,
1221 text_format: type[TextFormatT] | Omit = omit,
1222 background: Optional[bool] | Omit = omit,
1223 context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
1224 conversation: Optional[response_create_params.Conversation] | Omit = omit,
1225 include: Optional[List[ResponseIncludable]] | Omit = omit,
1226 input: Union[str, ResponseInputParam] | Omit = omit,
1227 instructions: Optional[str] | Omit = omit,
1228 max_output_tokens: Optional[int] | Omit = omit,
1229 max_tool_calls: Optional[int] | Omit = omit,
1230 metadata: Optional[Metadata] | Omit = omit,
1231 model: ResponsesModel | Omit = omit,
1232 moderation: Optional[response_create_params.Moderation] | Omit = omit,
1233 parallel_tool_calls: Optional[bool] | Omit = omit,
1234 previous_response_id: Optional[str] | Omit = omit,
1235 prompt: Optional[ResponsePromptParam] | Omit = omit,
1236 prompt_cache_key: str | Omit = omit,
1237 prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
1238 reasoning: Optional[Reasoning] | Omit = omit,
1239 safety_identifier: str | Omit = omit,
1240 service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
1241 store: Optional[bool] | Omit = omit,
1242 stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
1243 stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
1244 temperature: Optional[float] | Omit = omit,
1245 text: ResponseTextConfigParam | Omit = omit,
1246 tool_choice: response_create_params.ToolChoice | Omit = omit,
1247 tools: Iterable[ParseableToolParam] | Omit = omit,
1248 top_logprobs: Optional[int] | Omit = omit,
1249 top_p: Optional[float] | Omit = omit,
1250 truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
1251 user: str | Omit = omit,
1252 verbosity: Optional[Literal["low", "medium", "high"]] | Omit = omit,
1253 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1254 # The extra values given here take precedence over values defined on the client or passed to this method.
1255 extra_headers: Headers | None = None,
1256 extra_query: Query | None = None,
1257 extra_body: Body | None = None,
1258 timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1259 ) -> ParsedResponse[TextFormatT]:
1260 if is_given(text_format):
1261 if not text:
1262 text = {}
1263
1264 if "format" in text:
1265 raise TypeError("Cannot mix and match text.format with text_format")
1266 text = copy(text)
1267 text["format"] = _type_to_text_format_param(text_format)
1268
1269 tools = _make_tools(tools)
1270
1271 def parser(raw_response: Response) -> ParsedResponse[TextFormatT]:
1272 return parse_response(
1273 input_tools=tools,
1274 text_format=text_format,
1275 response=raw_response,

Callers 8

pollMethod · 0.45
pollMethod · 0.45
pollMethod · 0.45
pollMethod · 0.45
pollMethod · 0.45
pollMethod · 0.45
pollMethod · 0.45
pollMethod · 0.45

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