Runner implementation for LangChain chat models.

Implements the unified Runner protocol via run. Returned by LangChainRunnerFactory.createModel.

Hierarchy

  • LangChainModelRunner

Implements

  • Runner

Constructors

Properties

_chatHistory: InMemoryChatMessageHistory
_llm: BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure<MessageToolSet>>>
_logger?: LDLogger
_multiTurn: boolean

Methods

  • Get the underlying LangChain model instance.

    Returns BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure<MessageToolSet>>>

  • Run the LangChain model with the given user prompt.

    The runner maintains a LangChain InMemoryChatMessageHistory that is initialized from any messages on the AI config (system prompt, etc.). On every invocation the user prompt is appended to the existing history before being sent to the model. When multiTurn is true (the default) and the call succeeds with non-empty content, the user prompt and the assistant's reply are persisted to the history so subsequent calls continue the conversation. When multiTurn is false, history is treated as read-only — useful for stateless runners (e.g. judges) where every call should see only the initial config messages plus the current input. Failed calls leave the history unchanged so the next call can retry cleanly.

    Parameters

    • input: string

      The user prompt string.

    • Optional outputType: Record<string, unknown>

      Optional JSON schema for structured output. When provided, the parsed result is exposed via RunnerResult.parsed.

      Optional

    Returns Promise<RunnerResult>

Generated using TypeDoc