UNPKG

@sap-ai-sdk/orchestration

Version:

SAP Cloud SDK for AI is the official Software Development Kit (SDK) for **SAP AI Core**, **SAP Generative AI Hub**, and **Orchestration Service**.

68 lines 2.72 kB
import type { HttpResponse } from '@sap-cloud-sdk/http-client'; import type { CompletionPostResponse, TokenUsage, ChatMessages, AssistantChatMessage, MessageToolCalls, LlmChoice, ModuleResults } from './client/api/schema/index.js'; /** * Representation of an orchestration response. */ export declare class OrchestrationResponse { readonly rawResponse: HttpResponse; /** * The completion post response. */ readonly _data: CompletionPostResponse; constructor(rawResponse: HttpResponse); /** * Usage of tokens in the response. * @returns Token usage. */ getTokenUsage(): TokenUsage; /** * Reason for stopping the completion. * @param choiceIndex - The index of the choice to parse. * @returns The finish reason. */ getFinishReason(choiceIndex?: number): string | undefined; /** * Parses the orchestration response and returns the content. * If the response was filtered, an error is thrown. * @param choiceIndex - The index of the choice to parse. * @returns The message content. */ getContent(choiceIndex?: number): string | undefined; /** * Parses the orchestration response and returns the tool calls generated by the model. * @param choiceIndex - The index of the choice to parse. * @returns The message tool calls. */ getToolCalls(choiceIndex?: number): MessageToolCalls | undefined; /** * Parses the orchestration response and returns the refusal message generated by the model. * @param choiceIndex - The index of the choice to parse. * @returns The refusal string. */ getRefusal(choiceIndex?: number): string | undefined; /** * Messages that can be used for subsequent prompts as message history. * @param choiceIndex - The index of the choice to parse. * @returns A list of all messages. */ getAllMessages(choiceIndex?: number): ChatMessages; /** * Gets the assistant message from the response. * @param choiceIndex - The index of the choice to use (default is 0). * @returns The assistant message. */ getAssistantMessage(choiceIndex?: number): AssistantChatMessage | undefined; /** * Gets the intermediate results from the orchestration response. * @returns The intermediate results. */ getIntermediateResults(): ModuleResults; /** * Parses the response and returns the choice by index. * @param index - The index of the choice to find. * @returns An {@link LLMChoice} object associated with the index. */ findChoiceByIndex(index: number): LlmChoice | undefined; private getChoices; } //# sourceMappingURL=orchestration-response.d.ts.map