UNPKG

infomaniak-ai-provider

Version:

> the project is under active development, for now only text and embedding models are supported.

88 lines (84 loc) 4.2 kB
import { OpenAICompatibleProviderSettings } from '@ai-sdk/openai-compatible'; import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2 } from '@ai-sdk/provider'; type ModelType = 'stt' | 'llm' | 'image' | 'embedding'; type InfoStatus = 'ready' | 'coming_soon' | (string & {}); type InfomaniakSTTModelId = 'whisper' | 'whisperV2' | (string & {}); type InfomaniakChatModelId = 'llama3' | 'granite' | 'reasoning' | 'mistral24b' | 'mistral3' | 'qwen3' | 'gemma3n' | (string & {}); type InfomaniakImageModelId = 'photomaker' | 'flux' | (string & {}); type InfomaniakEmbeddingModelId = 'bge_multilingual_gemma2' | 'mini_lm_l12_v2' | (string & {}); type InfomaniakModelId = InfomaniakSTTModelId | InfomaniakChatModelId | InfomaniakImageModelId | InfomaniakEmbeddingModelId; interface InfomaniakModel { description: string; documentation_link: string; id: number; info_status: InfoStatus; last_updated_at: string; logo_url: string; max_token_input: number | null; name: string; type: ModelType; version: string; } type InfomaniakModels = InfomaniakModel[]; declare const MODEL_NAMES: { readonly WHISPER: "whisper"; readonly LLAMA3: "llama3"; readonly PHOTOMAKER: "photomaker"; readonly WHISPERV2: "whisperV2"; readonly FLUX: "flux"; readonly GRANITE: "granite"; readonly BGE_MULTILINGUAL_GEMMA2: "bge_multilingual_gemma2"; readonly MINI_LM_L12_V2: "mini_lm_l12_v2"; readonly REASONING: "reasoning"; readonly MISTRAL24B: "mistral24b"; readonly MISTRAL3: "mistral3"; readonly QWEN3: "qwen3"; readonly GEMMA3N: "gemma3n"; }; declare function getModelsByType<T extends ModelType>(models: InfomaniakModels, type: T): InfomaniakModel[]; declare function getReadyModels(models: InfomaniakModels): InfomaniakModels; declare function getTranscriptionModels(models: InfomaniakModels): InfomaniakModels; declare function getChatModels(models: InfomaniakModels): InfomaniakModels; declare function getImageModels(models: InfomaniakModels): InfomaniakModels; declare function getEmbeddingModels(models: InfomaniakModels): InfomaniakModels; interface InfomaniakProviderSettings { /** API key for authenticating requests. If specified, adds an `Authorization` header to request headers with the value `Bearer <apiKey>`. This will be added before any headers potentially specified in the `headers` option. Defaults to `INFOMANIAK_API_KEY` env variable */ apiKey?: OpenAICompatibleProviderSettings['apiKey']; /** Custom headers to include in the requests. */ headers?: OpenAICompatibleProviderSettings['headers']; /** Infomaniak product ID. */ productId?: string; /** Custom fetch implementation. You can use it as a middleware to intercept requests, or to provide a custom fetch implementation for e.g. testing. */ fetch?: OpenAICompatibleProviderSettings['fetch']; /** Include usage information in streaming responses. */ includeUsage?: OpenAICompatibleProviderSettings['includeUsage']; } interface InfomaniakProvider { (modelId: InfomaniakChatModelId): LanguageModelV2; languageModel: (modelId: InfomaniakChatModelId) => LanguageModelV2; chatModel: (modelId: InfomaniakChatModelId) => LanguageModelV2; textEmbeddingModel: (modelId: InfomaniakEmbeddingModelId) => EmbeddingModelV2<string>; imageModel: (modelId: InfomaniakImageModelId) => ImageModelV2; /** * Creates a model for transcription. * @experimental */ transcription: (modelId: InfomaniakSTTModelId) => TranscriptionModelV2; } declare function createInfomaniak(options?: InfomaniakProviderSettings): InfomaniakProvider; declare const infomaniak: InfomaniakProvider; export { type InfoStatus, type InfomaniakChatModelId, type InfomaniakEmbeddingModelId, type InfomaniakImageModelId, type InfomaniakModel, type InfomaniakModelId, type InfomaniakModels, type InfomaniakProvider, type InfomaniakProviderSettings, type InfomaniakSTTModelId, MODEL_NAMES, type ModelType, createInfomaniak, getChatModels, getEmbeddingModels, getImageModels, getModelsByType, getReadyModels, getTranscriptionModels, infomaniak };