import { AIMessageChunk, type BaseMessage } from "@langchain/core/messages";
import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
import { BaseChatModel, BaseChatModelCallOptions, type BaseChatModelParams, BindToolsInput, LangSmithParams } from "@langchain/core/language_models/chat_models";
import { FunctionCall, Function as _Function, Message, Chat, ChatFunctionCall, Usage, ChatCompletion, ChatCompletionChunk, WithXHeaders } from "gigachat/interfaces";
import { GigaChat as GigaChatClient, GigaChatClientConfig } from "gigachat";
import { Runnable } from "@langchain/core/runnables";
import { BaseLanguageModelInput, StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
import { z } from "zod";
type Kwargs = Record<string, any>;
export type ChatGigaChatToolType = _Function | BindToolsInput;
export interface GigaChatModelInput {
    /** Model name */
    model?: string;
    /** What sampling temperature to use. */
    temperature?: number;
    /** Maximum number of tokens to generate. */
    maxTokens?: number;
    /** top_p value to use for nucleus sampling. Must be between 0.0 and 1.0 */
    topP?: number;
    /** The penalty applied to repeated tokens */
    repetitionPenalty?: number;
    /** Minimum interval in seconds that elapses between sending tokens */
    updateInterval?: number;
}
export interface GigaChatInput extends GigaChatModelInput {
    /** Use GigaChat API for tokens count. */
    useApiForTokens?: boolean;
    /** Verbose logging */
    verbose?: boolean;
    /** Whether to stream the results or not */
    streaming?: boolean;
    /** Stop sequence */
    stopSequence?: Array<string>;
    /** Holds any additional parameters that are valid to pass to GigaChat
     *  that are not explicitly specified on this class.
     */
    invocationKwargs?: Kwargs;
}
/**
 * Input to chat model class.
 */
export interface GigaChatCallOptions extends BaseChatModelCallOptions, GigaChatModelInput {
    tools?: _Function[];
    tool_choice?: FunctionCall;
    model: string;
}
interface GigaChatLLMOutput {
    usage: Usage;
}
/**
 * Integration with a chat model.
 */
export declare class GigaChat<CallOptions extends GigaChatCallOptions = GigaChatCallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> implements GigaChatInput {
    static lc_name(): string;
    lc_serializable: boolean;
    model: string;
    useApiForTokens: boolean;
    streaming: boolean;
    verbose: boolean;
    temperature?: number;
    maxTokens?: number;
    topP?: number;
    repetitionPenalty?: number;
    updateInterval?: number;
    stopSequence?: Array<string>;
    invocationKwargs?: Kwargs;
    protected clientConfig: GigaChatClientConfig;
    protected _client?: GigaChatClient;
    get lc_secrets(): {
        [key: string]: string;
    } | undefined;
    get lc_aliases(): {
        [key: string]: string;
    } | undefined;
    _convertMessageToPayload(_messages: BaseMessage[]): Message[];
    getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
    /**
     * Get the parameters used to invoke the model
     */
    invocationParams(options?: this["ParsedCallOptions"]): Omit<Chat, "messages"> & Kwargs;
    constructor(fields?: GigaChatClientConfig & GigaChatInput & BaseChatModelParams);
    _llmType(): string;
    bindTools(tools: ChatGigaChatToolType[], kwargs?: Partial<CallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, CallOptions>;
    /**
     * Formats LangChain StructuredTools to GigaChat Functions.
     *
     * @param {ChatGigaChatToolType[] | undefined} tools The tools to format
     * @returns {_Function[] | undefined} The formatted tools, or undefined if none are passed.
     */
    formatStructuredToolToGigaChat(tools: ChatGigaChatToolType[] | undefined): _Function[] | undefined;
    _combineLLMOutput(...llmOutputs: GigaChatLLMOutput[]): GigaChatLLMOutput;
    identifyingParams(): {
        function_call?: ChatFunctionCall | undefined;
        model?: string | undefined;
        temperature?: number | undefined;
        stream?: boolean | undefined;
        top_p?: number | undefined;
        n?: number | undefined;
        max_tokens?: number | undefined;
        repetition_penalty?: number | undefined;
        update_interval?: number | undefined;
        profanity_check?: boolean | undefined;
        functions?: _Function[] | undefined;
        flags?: string[] | undefined;
        model_name: string;
    };
    _streamResponseChunks(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
    /**
     * Creates a streaming request with retry.
     * @param request The parameters for creating a completion.
     * @returns A streaming request.
     */
    protected createStreamWithRetry(request: Chat & Kwargs, signal?: AbortSignal): Promise<AsyncIterable<ChatCompletionChunk & WithXHeaders> | undefined>;
    protected completionWithRetry(request: Chat & Kwargs, options: this["ParsedCallOptions"]): Promise<ChatCompletion & WithXHeaders>;
    /** @ignore */
    _generateNonStreaming(messages: BaseMessage[], params: Omit<Chat, "messages"> & Kwargs, requestOptions: this["ParsedCallOptions"]): Promise<ChatResult>;
    /** @ignore */
    _generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
    withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: z.ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
    withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: z.ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
        raw: BaseMessage;
        parsed: RunOutput;
    }>;
}
export {};
