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

    Class OrchestrationClient

    Client for the SAP AI Core Orchestration Service.

    The configuration (model, parameters, tools, etc.) is fixed at construction time. To use different model parameters or tools for a specific request, create a new OrchestrationClient instance with the desired configuration.

    Index
    • Creates an instance of the orchestration client.

      Parameters

      • config:
            | string
            | Xor<
                OrchestrationConfigRef,
                OrchestrationModuleConfig
                | OrchestrationModuleConfigList,
            >

        Orchestration configuration. Can be:

        • An OrchestrationModuleConfig object for inline configuration
        • An OrchestrationModuleConfigList array for module fallback (tries each config in order until one succeeds)
        • A JSON string obtained from AI Launchpad
        • An object of typeOrchestrationConfigRef to reference a stored configuration by ID or name.
      • OptionaldeploymentConfig: DeploymentIdConfig | ResourceGroupConfig

        Deployment configuration.

      • 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 OrchestrationClient

    • Send a chat completion request to the orchestration service.

      Parameters

      • Optionalrequest: ChatCompletionRequest

        Request containing messages, placeholder values, and message history.

      • OptionalrequestConfig: Pick<
            HttpRequestConfig,
            | "middleware"
            | "maxContentLength"
            | "proxy"
            | "httpAgent"
            | "httpsAgent"
            | "parameterEncoder"
            | "signal",
        > & Record<string, any> & { headers?: OrchestrationRequestHeaders }

        Additional request configuration. Use requestConfig.headers to pass service-specific headers:

        • AI-Object-Store-Secret-Name: Name of the object store secret used by the feedback service.

      Returns Promise<OrchestrationResponse>

      The orchestration service response.

    • Create a streaming chat completion request to the orchestration service.

      Parameters

      • Optionalrequest: ChatCompletionRequest

        Request containing messages, placeholder values, and message history.

      • Optionalsignal: AbortSignal

        An abort signal to cancel the request.

      • Optionaloptions: StreamOptions

        Streaming options, e.g., for input/output filtering.

      • OptionalrequestConfig: Pick<
            HttpRequestConfig,
            | "middleware"
            | "maxContentLength"
            | "proxy"
            | "httpAgent"
            | "httpsAgent"
            | "parameterEncoder"
            | "signal",
        > & Record<string, any> & { headers?: OrchestrationRequestHeaders }

        Additional request configuration. Use requestConfig.headers to pass service-specific headers:

        • AI-Object-Store-Secret-Name: Name of the object store secret used by the feedback service.

      Returns Promise<OrchestrationStreamResponse<OrchestrationStreamChunkResponse>>

      The orchestration stream response.