/** * Together AI LLM Provider * * Implements LLMProvider interface for Together AI models. * Extends OpenAICompatibleProvider for shared functionality. * * @example * ```typescript * const provider = createTogetherProvider({ * model: 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo', * apiKey: process.env.TOGETHER_API_KEY * }); * ``` * * @remarks * - Requires valid Together AI API key * - Default model is meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo * - Supports Llama, Mistral, Qwen, and other open models */ import type { ChatOptions } from './types.js'; import { ProviderError } from '../errors.js'; import { OpenAICompatibleProvider } from './openai-compatible.js'; /** * Configuration for TogetherProvider */ export interface TogetherProviderConfig { /** Together AI API key (falls back to TOGETHER_API_KEY env var) */ apiKey?: string; /** Base URL for Together API (default: https://api.together.xyz) */ baseUrl?: string; /** Default model to use (default: meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo) */ 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; } /** * Together AI LLM Provider * * Provides streaming chat completion using Together AI models. * Supports Llama, Mistral, Qwen, and other open-source models. */ export declare class TogetherProvider extends OpenAICompatibleProvider { readonly name = "together"; private readonly apiKey; constructor(config?: TogetherProviderConfig); /** * Together AI authentication with Bearer token */ protected getAuthHeaders(): Record; /** * Together AI chat completions endpoint (OpenAI-compatible) */ protected getEndpointPath(): string; /** * Together AI uses standard OpenAI body format */ protected buildProviderSpecificBody(_options?: ChatOptions): Record; /** * Map HTTP errors with Together AI-specific messages */ protected mapHttpError(status: number, body: string, _model: string): ProviderError; /** * Map connection errors with Together AI-specific messages */ protected mapConnectionError(_error: Error): ProviderError; } /** * Create a Together AI provider instance * * @example * ```typescript * // Using environment variable (TOGETHER_API_KEY) * const provider = createTogetherProvider(); * * // With explicit API key * const provider = createTogetherProvider({ apiKey: 'xxx-...' }); * * // With custom model * const provider = createTogetherProvider({ * model: 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo' * }); * ``` */ export declare function createTogetherProvider(config?: TogetherProviderConfig): TogetherProvider;