import type { ChatCompletionMessageParam, ChatCompletionChunk } from "openai/resources/chat";
export type CodeBuddyMessage = ChatCompletionMessageParam;
/** JSON Schema property definition */
export interface JsonSchemaProperty {
    type: string;
    description?: string;
    enum?: string[];
    items?: JsonSchemaProperty;
    properties?: Record<string, JsonSchemaProperty>;
    required?: string[];
    default?: unknown;
}
export interface CodeBuddyTool {
    type: "function";
    function: {
        name: string;
        description: string;
        parameters: {
            type: "object";
            properties: Record<string, JsonSchemaProperty>;
            required: string[];
        };
    };
}
export interface CodeBuddyToolCall {
    id: string;
    type: "function";
    function: {
        name: string;
        arguments: string;
    };
}
/** Message with tool calls (assistant message that requested tool use) */
export interface CodeBuddyMessageWithToolCalls {
    role: 'assistant';
    content: string | null;
    tool_calls: CodeBuddyToolCall[];
}
/** Type guard for messages with tool calls */
export declare function hasToolCalls(msg: CodeBuddyMessage): msg is CodeBuddyMessageWithToolCalls;
export interface SearchParameters {
    mode?: "auto" | "on" | "off";
}
export interface SearchOptions {
    search_parameters?: SearchParameters;
}
export interface ChatOptions {
    model?: string;
    temperature?: number;
    searchOptions?: SearchOptions;
}
export interface CodeBuddyResponse {
    choices: Array<{
        message: {
            role: string;
            content: string | null;
            tool_calls?: CodeBuddyToolCall[];
        };
        finish_reason: string;
    }>;
    usage?: {
        prompt_tokens: number;
        completion_tokens: number;
        total_tokens: number;
    };
}
export declare class CodeBuddyClient {
    private client;
    private currentModel;
    private defaultMaxTokens;
    private baseURL;
    private apiKey;
    private toolSupportProbed;
    private toolSupportDetected;
    private probePromise;
    private isGeminiProvider;
    constructor(apiKey: string, model?: string, baseURL?: string);
    /**
     * Probe the model to check if it supports function calling
     * Makes a quick test request with a simple tool
     * Uses promise-based locking to prevent concurrent probes
     */
    probeToolSupport(): Promise<boolean>;
    /**
     * Perform the actual tool support probe
     */
    private performToolProbe;
    /**
     * Models known to support function calling / tool use
     */
    private static readonly FUNCTION_CALLING_MODELS;
    /**
     * Check if the current model supports function calling based on its name
     */
    private modelSupportsFunctionCalling;
    /**
     * Check if using LM Studio or other local inference server
     * Can be overridden with GROK_FORCE_TOOLS=true for models that support function calling
     * Auto-enables tools for models known to support function calling
     */
    private isLocalInference;
    setModel(model: string): void;
    getCurrentModel(): string;
    getBaseURL(): string;
    /**
     * Check if using Gemini provider
     */
    isGemini(): boolean;
    /**
     * Gemini-specific chat implementation
     */
    private geminiChat;
    private convertContentToGeminiParts;
    private parseDataUrl;
    chat(messages: CodeBuddyMessage[], tools?: CodeBuddyTool[], options?: string | ChatOptions, searchOptions?: SearchOptions): Promise<CodeBuddyResponse>;
    /**
     * Gemini type mapping: lowercase OpenAI types to uppercase Gemini types
     */
    private static readonly GEMINI_TYPE_MAP;
    /**
     * Sanitize JSON Schema for Gemini API compatibility
     * - Converts lowercase types to uppercase (string -> STRING, object -> OBJECT)
     * - Ensures all array types have 'items' defined
     */
    private sanitizeSchemaForGemini;
    /**
     * Convert tool messages to user messages for models that don't support the tool role
     * LM Studio and some local models require this transformation
     */
    private convertToolMessagesForLocalModels;
    /**
     * Gemini-specific streaming (falls back to non-streaming for simplicity)
     */
    private geminiChatStream;
    chatStream(messages: CodeBuddyMessage[], tools?: CodeBuddyTool[], options?: string | ChatOptions, searchOptions?: SearchOptions): AsyncGenerator<ChatCompletionChunk, void, unknown>;
    search(query: string, searchParameters?: SearchParameters): Promise<CodeBuddyResponse>;
}
