SAP AI SDK for JavaScript - v2.8.0
    Preparing search index...

    Azure OpenAI client for chat completion.

    Index

    Constructors

    Methods

    Constructors

    • Creates an instance of the Azure OpenAI chat client.

      Parameters

      • modelDeployment: ModelDeployment<AzureOpenAiChatModel>

        This configuration is used to retrieve a deployment. Depending on the configuration use either the given deployment ID or the model name to retrieve matching deployments. If model and deployment ID are given, the model is verified against the deployment.

      • Optionaldestination:
            | never
            | Without<HttpDestination> & DestinationFetchOptions & {
                serviceBindingTransformFn?: ServiceBindingTransformFunction;
            } & { destinationName: string; service?: undefined }
            | Without<
                DestinationFetchOptions & {
                    serviceBindingTransformFn?: ServiceBindingTransformFunction;
                } & { destinationName: string; service?: undefined },
            > & Destination & { url: string }

        The destination to use for the request.

        • never
        • Without<HttpDestination> & DestinationFetchOptions & {
              serviceBindingTransformFn?: ServiceBindingTransformFunction;
          } & { destinationName: string; service?: undefined }
          • OptionalserviceBindingTransformFn?: ServiceBindingTransformFunction

            Custom transformation function to control how a Destination is built from the given Service.

          • destinationName: string

            The name of the destination to retrieve from service bindings.

          • Optionalservice?: undefined
        • Without<
              DestinationFetchOptions & {
                  serviceBindingTransformFn?: ServiceBindingTransformFunction;
              } & { destinationName: string; service?: undefined },
          > & Destination & { url: string }

      Returns AzureOpenAiChatClient

    Methods

    • Creates a completion for the chat messages.

      Parameters

      • request: AzureOpenAiCreateChatCompletionRequest

        Request containing chat completion input parameters.

      • OptionalrequestConfig: CustomRequestConfig

        The request configuration.

      Returns Promise<AzureOpenAiChatCompletionResponse>

      The completion result.