• Function that creates an extraction chain from a Zod schema. It converts the Zod schema to a JSON schema using zod-to-json-schema before creating the extraction chain.

    Parameters

    • schema: ZodObject<any, any, any, any, {}>

      The Zod schema which extracted data should match

    • llm: BaseChatModel<BaseFunctionCallOptions>

      Must be a ChatOpenAI or AnthropicFunctions model that supports function calling.

    Returns LLMChain<string, BaseChatModel<BaseFunctionCallOptions>>

    A LLMChain instance configured to return data matching the schema.

Generated using TypeDoc