Class AIProviderAbstract

Abstract base class for AI providers that implement chat model functionality. This class provides the contract that all provider implementations must follow to integrate with LaunchDarkly's tracking and configuration capabilities.

Following the AICHAT spec recommendation to use base classes with non-abstract methods for better extensibility and backwards compatibility.

Hierarchy

  • AIProvider

Constructors

Properties

Methods

Constructors

Properties

logger?: LDLogger

Methods

  • Invoke the chat model with an array of messages. This method should convert messages to provider format, invoke the model, and return a ChatResponse with the result and metrics.

    Parameters

    • messages: LDMessage[]

      Array of LDMessage objects representing the conversation

    Returns Promise<ChatResponse>

    Promise that resolves to a ChatResponse containing the model's response

  • Static method that constructs an instance of the provider. Each provider implementation must provide their own static create method that accepts an AIConfig and returns a configured instance.

    Parameters

    • aiConfig: LDAIConfig

      The LaunchDarkly AI configuration

    • Optional logger: LDLogger

      Optional logger for the provider

      Optional

    Returns Promise<AIProvider>

    Promise that resolves to a configured provider instance

Generated using TypeDoc