provider
Module: vibex/provider
AI Provider Management Handles initialization and configuration of different AI providers
Philosophy: Keep it simple - agents specify their provider and model explicitly.
To add a new provider (e.g., Google, Mistral, Cohere):
- Install:
pnpm add @ai-sdk/google - Import:
import { createGoogleGenerativeAI } from "@ai-sdk/google"; - Add case:
case "google": return createGoogleGenerativeAI({…}) - Add environment variable handling
Interfaces
ModelConfig
View sourceProperties:
| Name | Type | Description |
|---|---|---|
provider | ModelProvider | |
modelName | string | |
apiKey | string | (optional) |
baseURL | string | (optional) |
spaceId | string | (optional) |
userId | string | (optional) |
storageRoot | string | (optional) |
teamConfig | string | (optional) |
defaultGoal | string | (optional) |
Types
ModelProvider
View sourcetype ModelProvider = stringFunctions
getModelProvider
View sourceGet the appropriate AI provider instance
function getModelProvider(config: ModelConfig): voidParameters:
| Name | Type | Description |
|---|---|---|
config | ModelConfig |
isProviderConfigured
View sourceCheck if a provider is properly configured
function isProviderConfigured(provider: string): booleanParameters:
| Name | Type | Description |
|---|---|---|
provider | string |
getConfiguredProviders
View sourceGet list of configured providers
function getConfiguredProviders(): string[]parseModelString
View sourceParse model string to extract provider and model name Examples: “gpt-4o” → { provider: “openai”, modelName: “gpt-4o” }
function parseModelString(model: string): ModelConfigParameters:
| Name | Type | Description |
|---|---|---|
model | string |
getModelContextLimit
View sourceGet context limit for a model
function getModelContextLimit(modelName: string): numberParameters:
| Name | Type | Description |
|---|---|---|
modelName | string |
getCompletionTokens
View sourceGet completion token reservation for a model
function getCompletionTokens(modelName: string): numberParameters:
| Name | Type | Description |
|---|---|---|
modelName | string |