/** * Groq LLM Provider * * Implements LLMProvider interface for Groq models. * Extends OpenAICompatibleProvider for shared functionality. * * @example * ```typescript * const provider = createGroqProvider({ * model: 'llama-3.2-90b-vision-preview', * apiKey: process.env.GROQ_API_KEY * }); * ``` * * @remarks * - Requires valid Groq API key * - Default model is llama-3.2-8b-preview * - Known for extremely fast inference speeds */ import type { ChatOptions } from './types.js'; import { ProviderError } from '../errors.js'; import { OpenAICompatibleProvider } from './openai-compatible.js'; /** * Configuration for GroqProvider */ export interface GroqProviderConfig { /** Groq API key (falls back to GROQ_API_KEY env var) */ apiKey?: string; /** Base URL for Groq API (default: https://api.groq.com/openai) */ baseUrl?: string; /** Default model to use (default: llama-3.2-8b-preview) */ model?: string; /** Default max tokens (default: 4096) */ maxTokens?: number; /** Request timeout in milliseconds (default: 120000) */ timeout?: number; /** Optional token estimator (e.g., tiktoken) for debug payload */ estimateTokens?: (text: string) => number; } /** * Groq LLM Provider * * Provides streaming chat completion using Groq's ultra-fast inference. * Supports Llama, Mixtral, and other models optimized for speed. */ export declare class GroqProvider extends OpenAICompatibleProvider { readonly name = "groq"; private readonly apiKey; constructor(config?: GroqProviderConfig); /** * Groq authentication with Bearer token */ protected getAuthHeaders(): Record; /** * Groq chat completions endpoint (OpenAI-compatible) */ protected getEndpointPath(): string; /** * Groq uses standard OpenAI body format */ protected buildProviderSpecificBody(_options?: ChatOptions): Record; /** * Map HTTP errors with Groq-specific messages */ protected mapHttpError(status: number, body: string, _model: string): ProviderError; /** * Map connection errors with Groq-specific messages */ protected mapConnectionError(_error: Error): ProviderError; } /** * Create a Groq provider instance * * @example * ```typescript * // Using environment variable (GROQ_API_KEY) * const provider = createGroqProvider(); * * // With explicit API key * const provider = createGroqProvider({ apiKey: 'gsk_...' }); * * // With custom model * const provider = createGroqProvider({ * model: 'llama-3.2-90b-vision-preview' * }); * ``` */ export declare function createGroqProvider(config?: GroqProviderConfig): GroqProvider;