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**.

71 lines 2.92 kB
import type { AssistantChatMessage, ChatMessages, CompletionPostResponse, LlmChoice, MessageToolCalls, ModuleResults, TokenUsage } from './client/api/schema/index.js'; import type { OrchestrationStream } from './orchestration-stream.js'; /** * Orchestration stream response. */ export declare class OrchestrationStreamResponse<T> { _openStream: boolean; _data: Partial<CompletionPostResponse>; private _stream; /** * Gets the token usage for the response. * @returns The token usage for the response. */ getTokenUsage(): TokenUsage | undefined; /** * Gets the finish reason for a specific choice index. * @param choiceIndex - The index of the choice to get the finish reason for. * @returns The finish reason for the specified choice index. */ 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 | undefined; /** * 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 | undefined; /** * 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; get stream(): OrchestrationStream<T>; private getChoices; private isStreamOpen; /** * @internal */ set stream(stream: OrchestrationStream<T>); } //# sourceMappingURL=orchestration-stream-response.d.ts.map