@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**.
61 lines • 2.71 kB
TypeScript
import type { HttpResponse } from '@sap-cloud-sdk/http-client';
import type { AzureOpenAiChatCompletionMessageToolCalls, AzureOpenAiChatCompletionResponseMessage, AzureOpenAiCompletionUsage, AzureOpenAiCreateChatCompletionResponse } from './client/inference/schema/index.js';
/**
* Azure OpenAI chat completion response.
*/
export declare class AzureOpenAiChatCompletionResponse {
readonly rawResponse: HttpResponse;
/**
* The chat completion response.
*/
readonly _data: AzureOpenAiCreateChatCompletionResponse;
constructor(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;
/**
* Usage of tokens in the response.
* @returns Token usage.
*/
getTokenUsage(): AzureOpenAiCompletionUsage | undefined;
/**
* Reason for stopping the completion.
* @param choiceIndex - The index of the choice to parse.
* @returns The finish reason.
*/
getFinishReason(choiceIndex?: number): AzureOpenAiCreateChatCompletionResponse['choices'][0]['finish_reason'] | undefined;
/**
* Parses the Azure OpenAI response and returns the content.
* @param choiceIndex - The index of the choice to parse.
* @returns The message content.
*/
getContent(choiceIndex?: number): string | undefined | null;
/**
* Parses the Azure OpenAI 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): AzureOpenAiChatCompletionMessageToolCalls | undefined;
/**
* Parses the Azure OpenAI 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 | null | 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): AzureOpenAiChatCompletionResponseMessage | 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): AzureOpenAiCreateChatCompletionResponse['choices'][number] | undefined;
private getChoices;
}
//# sourceMappingURL=azure-openai-chat-completion-response.d.ts.map