parse_tool_call#

langchain_core.output_parsers.openai_tools.parse_tool_call(raw_tool_call: Dict[str, Any], *, partial: bool = False, strict: bool = False, return_id: bool = True) Dict[str, Any] | None[source]#

Parse a single tool call.

Parameters:
  • raw_tool_call (Dict[str, Any]) – The raw tool call to parse.

  • partial (bool) – Whether to parse partial JSON. Default is False.

  • strict (bool) – Whether to allow non-JSON-compliant strings. Default is False.

  • return_id (bool) – Whether to return the tool call id. Default is True.

Returns:

The parsed tool call.

Raises:

OutputParserException – If the tool call is not valid JSON.

Return type:

Dict[str, Any] | None