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

34 lines 1.06 kB
/** * Azure OpenAI chat completion stream chunk response. */ export class AzureOpenAiChatCompletionStreamChunkResponse { data; constructor(data) { this.data = data; this.data = data; } /** * Usage of tokens in the chunk response. * @returns Token usage. */ getTokenUsage() { return this.data.usage; } /** * Reason for stopping the completion stream chunk. * @param choiceIndex - The index of the choice to parse. * @returns The finish reason. */ getFinishReason(choiceIndex = 0) { return this.data.choices.find(c => c.index === choiceIndex)?.finish_reason; } /** * Parses the chunk response and returns the delta content. * @param choiceIndex - The index of the choice to parse. * @returns The message delta content. */ getDeltaContent(choiceIndex = 0) { return this.data.choices.find(c => c.index === choiceIndex)?.delta.content; } } //# sourceMappingURL=azure-openai-chat-completion-stream-chunk-response.js.map