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

    Class OrchestrationResponse

    Representation of an orchestration response.

    Index
    • Parameters

      • rawResponse: HttpResponse

      Returns OrchestrationResponse

    _data: CompletionPostResponse
    rawResponse: HttpResponse

    The completion post response.

    • Parses the response and returns the choice by index.

      Parameters

      • index: number

        The index of the choice to find.

      Returns LlmChoice | undefined

      An LLMChoice object associated with the index.

    • Messages that can be used for subsequent prompts as message history. When reasoning content is present, it is automatically included in the returned messages. Pass the result directly as messagesHistory in the next request to maintain reasoning context.

      Parameters

      • OptionalchoiceIndex: number

        The index of the choice to parse.

      Returns ChatMessages

      A list of all messages including any reasoning content.

    • Gets the assistant message from the response.

      Parameters

      • OptionalchoiceIndex: number

        The index of the choice to use (default is 0).

      Returns AssistantChatMessage | undefined

      The assistant message.

    • Gets the citations from the orchestration response. Citations are returned by models like Perplexity Sonar that provide source references.

      Returns Citation[] | undefined

      The citations, or undefined if there are none.

    • Parses the orchestration response and returns the content. If the response was filtered, an error is thrown.

      Parameters

      • OptionalchoiceIndex: number

        The index of the choice to parse.

      Returns string | undefined

      The message content.

    • Reason for stopping the completion.

      Parameters

      • OptionalchoiceIndex: number

        The index of the choice to parse.

      Returns string | undefined

      The finish reason.

    • Gets the intermediate failures from the orchestration response. When using module fallback, this contains errors from module configurations that failed before a successful one was found.

      Each failure includes:

      • message: Description of what went wrong
      • code: Error code identifying the type of failure
      • location: Position in the fallback chain (e.g., "config[0]", "config[1]").

      Returns OrchestrationError[] | undefined

      The intermediate failures, or undefined if there were none.

      const response = await client.chatCompletion();
      const failures = response.getIntermediateFailures();
      if (failures) {
      failures.forEach(f => console.log(`${f.location}: ${f.message}`));
      }
    • Gets the intermediate results from the orchestration response.

      Returns ModuleResults

      The intermediate results.

    • Parses the orchestration response and returns the reasoning content generated by the model. Only available for models that support reasoning (enabled via the harmonized reasoning_effort model parameter). Returns only the user-visible reasoning text; encrypted or redacted reasoning blocks are excluded. To preserve reasoning context in multi-turn conversations, pass the result of getAllMessages as messagesHistory in the next request instead of using this method directly.

      Parameters

      • OptionalchoiceIndex: number

        The index of the choice to parse.

      Returns string[] | undefined

      The content of each reasoning block as an array, or undefined if no reasoning content is present.

    • Parses the orchestration response and returns the refusal message generated by the model.

      Parameters

      • OptionalchoiceIndex: number

        The index of the choice to parse.

      Returns string | undefined

      The refusal string.

    • Gets the request ID from the orchestration response.

      Returns string

      The request ID.

    • Usage of tokens in the response.

      Returns TokenUsage

      Token usage.

    • Parses the orchestration response and returns the tool calls generated by the model.

      Parameters

      • OptionalchoiceIndex: number

        The index of the choice to parse.

      Returns MessageToolCalls | undefined

      The message tool calls.