UNPKG

@sap-ai-sdk/foundation-models

Version:

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

73 lines 3.06 kB
import { type ToolCallAccumulator } from './util/index.js'; import type { AzureOpenAiChatCompletionMessageToolCalls, AzureOpenAiCompletionUsage, AzureOpenAiCreateChatCompletionStreamResponse } from './client/inference/schema/index.js'; import type { AzureOpenAiChatCompletionStream } from './azure-openai-chat-completion-stream.js'; import type { HttpResponse } from '@sap-cloud-sdk/http-client'; /** * Azure OpenAI chat completion stream response. */ export declare class AzureOpenAiChatCompletionStreamResponse<T> { private _usage; /** * Finish reasons for all choices. */ private _finishReasons; private _toolCallsAccumulators; private _toolCalls; private _stream; private _rawResponse; /** * @deprecated Since v2.9.0. Provide an HttpResponse parameter when constructing AzureOpenAiChatCompletionStreamResponse. This constructor overload will be removed in v3.0.0. * Creates an Azure OpenAI chat completion stream response. */ constructor(); /** * Creates an Azure OpenAI chat completion stream response. * @param rawResponse - The raw HTTP response. SSE data is not part of the immediate response. */ constructor(rawResponse: HttpResponse); /** * Gets the raw HTTP response. SSE data is not part of the immediate response. * @returns The raw HTTP response. * @throws {Error} When constructed without a raw response parameter (deprecated). */ get rawResponse(): HttpResponse; /** * Gets the request ID from the response headers. * @returns The request ID, or undefined if the header is not present. */ getRequestId(): string | undefined; getTokenUsage(): AzureOpenAiCompletionUsage | undefined; /** * @internal */ _setTokenUsage(usage: AzureOpenAiCompletionUsage): void; getFinishReason(choiceIndex?: number): AzureOpenAiCreateChatCompletionStreamResponse['choices'][0]['finish_reason'] | undefined; /** * @internal */ _getFinishReasons(): Map<number, AzureOpenAiCreateChatCompletionStreamResponse['choices'][0]['finish_reason']>; /** * @internal */ _setFinishReasons(finishReasons: Map<number, AzureOpenAiCreateChatCompletionStreamResponse['choices'][0]['finish_reason']>): void; /** * Gets the tool calls for a specific choice index. * @param choiceIndex - The index of the choice to get the tool calls for. * @returns The tool calls for the specified choice index. */ getToolCalls(choiceIndex?: number): AzureOpenAiChatCompletionMessageToolCalls | undefined; /** * @internal */ _setToolCalls(choiceIndex: number, toolCalls: AzureOpenAiChatCompletionMessageToolCalls): void; /** * @internal */ _getToolCallsAccumulators(): Map<number, Map<number, ToolCallAccumulator>>; get stream(): AzureOpenAiChatCompletionStream<T>; /** * @internal */ set stream(stream: AzureOpenAiChatCompletionStream<T>); } //# sourceMappingURL=azure-openai-chat-completion-stream-response.d.ts.map