@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**.
48 lines • 1.02 kB
JavaScript
/**
* Azure OpenAI chat completion stream response.
*/
export class AzureOpenAiChatCompletionStreamResponse {
_usage;
/**
* Finish reasons for all choices.
*/
_finishReasons = new Map();
_stream;
getTokenUsage() {
return this._usage;
}
/**
* @internal
*/
_setTokenUsage(usage) {
this._usage = usage;
}
getFinishReason(choiceIndex = 0) {
return this._finishReasons.get(choiceIndex);
}
/**
* @internal
*/
_getFinishReasons() {
return this._finishReasons;
}
/**
* @internal
*/
_setFinishReasons(finishReasons) {
this._finishReasons = finishReasons;
}
get stream() {
if (!this._stream) {
throw new Error('Response stream is undefined.');
}
return this._stream;
}
/**
* @internal
*/
set stream(stream) {
this._stream = stream;
}
}
//# sourceMappingURL=azure-openai-chat-completion-stream-response.js.map