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

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

      a function that returns the OpenAPI version to use for this model, called on each request

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

    • supportsStructuredOutput: boolean
    • url: undefined | string

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

    • openAiModelUtils: OpenAiModelUtils
    • developerMessageSettings: DeveloperMessageSettings = 'developer'

      how to handle system messages

    • Optional tokenUsageService: TokenUsageService

    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

apiVersion: (() => undefined | string)

a function that returns the OpenAPI version to use for this model, called on each request

Type declaration

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

developerMessageSettings: DeveloperMessageSettings = 'developer'

how to handle system messages

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

openAiModelUtils: OpenAiModelUtils
supportsStructuredOutput: boolean
tokenUsageService?: TokenUsageService
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: UserRequest
    • Optional cancellationToken: CancellationToken

    Returns Promise<LanguageModelResponse>