langchain.js
    Preparing search index...

    Function createExtractionChainFromZod

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

      Parameters

      • schema: InteropZodObject

        The Zod schema which extracted data should match

      • llm: BaseChatModel<BaseFunctionCallOptions>

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

      Returns LLMChain<object, BaseChatModel<BaseFunctionCallOptions, AIMessageChunk>>

      A LLMChain instance configured to return data matching the schema.