Documentation
    Preparing search index...
    • Coerce LLM arguments to match expected schema types.

      LLMs often return values with incorrect types (e.g., numbers as strings). This function recursively coerces values based on the schema:

      • "42"42 (when schema expects number)
      • "true"true (when schema expects boolean)
      • "null"null (when schema expects null)
      • "{...}"{...} (when schema expects object)
      • "[...]"[...] (when schema expects array)

      Use this when SDK provides already-parsed objects but values may have wrong types. For raw JSON strings, use parse instead.

      Type Parameters

      • T = unknown

      Parameters

      • input: unknown

        Parsed arguments object from LLM

      • parameters: ILlmSchema.IParameters

        LLM function parameters schema for type coercion

      Returns T

      Coerced arguments with corrected types