Member Junction
    Preparing search index...

    Function extractOpenAICompatibleToolCalls

    • Normalizes raw response tool calls into ChatToolCalls with PARSED arguments.

      A model can emit malformed JSON for its arguments. That is a tool-specific failure the caller must be able to see, so the call is surfaced with empty arguments and a warning rather than dropped — dropping it would look to an agent loop like the model said nothing at all.

      Parameters

      • toolCalls: RawOpenAICompatibleToolCall[]

        Raw calls from the response, if any

      • providerName: string

        Used only in the warning, so a log line names the provider

      Returns ChatToolCall[]

      Normalized calls, or undefined when the model called nothing