langchain.js
    Preparing search index...

    Function createExtractionChain

    • Function that creates an extraction chain using the provided JSON schema. It sets up the necessary components, such as the prompt, output parser, and tags.

      Parameters

      • schema: FunctionParameters

        JSON schema of the function parameters.

      • 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.