@metreeca/llms
    Preparing search index...
    • Extracts the output text of a chat completion as a JSON payload.

      The payload is parsed from the output text produced under the requested response format, and typed as T without further validation: callers needing guarantees on its shape must validate it themselves.

      A strict response format states an absent member as null instead of leaving it out. Object members stated as null are therefore dropped, so that a payload generated under a strict schema conforms to the shape the schema was converted from. null array items are kept.

      Type Parameters

      • T extends Value = Value

        The expected shape of the JSON payload

      Parameters

      • completion: ChatCompletion

        The completion of a chat.completions.create request carrying a JSON response format

      Returns T

      The JSON payload parsed from the output text of completion

      Error If completion carries no output text (see text) or its text is not well-formed JSON