import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import * as SarvamAI from "../../../index.js"; import type { ChatCompletionChunk } from "../../../types/ChatCompletionChunk.js"; export declare namespace ChatClient { interface Options extends BaseClientOptions { } interface RequestOptions extends BaseRequestOptions { } } export declare class ChatClient { protected readonly _options: NormalizedClientOptionsWithAuth; constructor(options?: ChatClient.Options); /** * Create a chat completion. Supports both streaming and non-streaming modes. * * @param {SarvamAI.ChatCompletionsRequest} request * @param {ChatClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.ForbiddenError} * @throws {@link SarvamAI.UnprocessableEntityError} * @throws {@link SarvamAI.TooManyRequestsError} * @throws {@link SarvamAI.InternalServerError} * * @example * // Non-streaming * const response = await client.chat.completions({ * messages: [{ role: "user", content: "Hello" }], * model: "sarvam-m" * }); * * @example * // Streaming * const stream = await client.chat.completions({ * messages: [{ role: "user", content: "Hello" }], * model: "sarvam-m", * stream: true * }); * for await (const chunk of stream) { * process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); * } * * @example * // Tool calling * const response = await client.chat.completions({ * messages: [{ role: "user", content: "What is the weather?" }], * model: "sarvam-m", * tools: [{ * type: "function", * function: { * name: "get_weather", * description: "Get the weather", * parameters: { type: "object", properties: { location: { type: "string" } } } * } * }] * }); */ completions(request: SarvamAI.ChatCompletionsRequest & { stream: true; }, requestOptions?: ChatClient.RequestOptions): Promise>; completions(request: SarvamAI.ChatCompletionsRequest & { stream?: false | undefined; }, requestOptions?: ChatClient.RequestOptions): core.HttpResponsePromise; completions(request: SarvamAI.ChatCompletionsRequest, requestOptions?: ChatClient.RequestOptions): core.HttpResponsePromise | Promise>; private __completions; private __completionsStream; private _parseSSEStream; private _throwStatusCodeError; }