Implements

  • LanguageModel

Constructors

  • Parameters

    • id: string

      the unique id for this language model. It will be used to identify the model in the UI.

    • model: string

      the model id as it is used by the OpenAI API

    • enableStreaming: boolean

      whether the streaming API shall be used

    • apiKey: (() => undefined | string)

      a function that returns the API key to use for this model, called on each request

        • (): undefined | string
        • Returns undefined | string

    • url: undefined | string

      the OpenAI API compatible endpoint where the model is hosted. If not provided the default OpenAI endpoint will be used.

    • Optional defaultRequestSettings: {
          [key: string]: unknown;
      }

      optional default settings for requests made using this model.

      • [key: string]: unknown

    Returns OpenAiModel

Properties

apiKey: (() => undefined | string)

a function that returns the API key to use for this model, called on each request

Type declaration

    • (): undefined | string
    • Returns undefined | string

defaultRequestSettings?: {
    [key: string]: unknown;
}

optional default settings for requests made using this model.

Type declaration

  • [key: string]: unknown
enableStreaming: boolean

whether the streaming API shall be used

id: string

the unique id for this language model. It will be used to identify the model in the UI.

model: string

the model id as it is used by the OpenAI API

url: undefined | string

the OpenAI API compatible endpoint where the model is hosted. If not provided the default OpenAI endpoint will be used.

Methods

  • Parameters

    • request: LanguageModelRequest
    • Optional cancellationToken: CancellationToken

    Returns Promise<LanguageModelResponse>