live · mainnetoc · docs
specs · api · guides
docs / documentation

@orangecheck/agent-openai


@orangecheck/agent-openai / parseFunctionCall

Function: parseFunctionCall()

function parseFunctionCall(raw: unknown): OpenAiFunctionCall;

Defined in: index.ts:54

Normalize either a Chat Completions tool_call or a Responses function_call item into our canonical {id, name, arguments} shape.

Accepts:

  • { id, function: { name, arguments } } (Chat Completions)
  • { call_id, name, arguments } (Responses, function_call)
  • { id, name, arguments } (already normalized)

arguments may be either a JSON string (OpenAI's wire shape) or an already-parsed object (your post-processing). Both work.

Parameters

ParameterType
rawunknown

Returns

OpenAiFunctionCall