parse_tool_calls#

langchain_core.output_parsers.openai_tools.parse_tool_calls(raw_tool_calls: List[dict], *, partial: bool = False, strict: bool = False, return_id: bool = True) List[Dict[str, Any]][source]#

Parse a list of tool calls.

Parameters:
  • raw_tool_calls (List[dict]) – The raw tool calls 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 calls.

Raises:

OutputParserException – If any of the tool calls are not valid JSON.

Return type:

List[Dict[str, Any]]