mirror of
https://github.com/mark3labs/kit.git
synced 2026-06-14 03:30:26 +00:00
f0e4e2f757
Rename public SDK symbols to use generic LLM terminology instead of exposing the internal dependency name (charm.land/fantasy): Public API renames (with deprecated wrappers for backward compat): - ConvertToFantasyMessages() → ConvertToLLMMessages() - ConvertFromFantasyMessage() → ConvertFromLLMMessage() - GetFantasyProviders() → GetLLMProviders() New type alias: - LLMFilePart = fantasy.FilePart (eliminates need for direct fantasy import) - PromptResultWithFiles() signature now uses LLMFilePart Internal renames (with deprecated wrappers): - ModelsRegistry.GetFantasyProviders() → GetLLMProviders() - TreeManager.GetFantasyMessages() → GetLLMMessages() - TreeManager.AppendFantasyMessage() → AppendLLMMessage() - TreeManager.AddFantasyMessages() → AddLLMMessages() - Message.ToFantasyMessages() → ToLLMMessages() - FromFantasyMessage() → FromLLMMessage() - npmToFantasyProvider → npmToLLMProvider - isProviderFantasySupported() → isProviderLLMSupported() All internal callers migrated to new names. ~30 comments updated to remove Fantasy references across pkg/kit/, internal/agent/, internal/models/, internal/message/, internal/session/. Documentation updates: - AGENTS.md: added Public SDK rules section (no dependency leakage, naming conventions, deprecation pattern) - README.md: removed Fantasy references - pkg/kit/README.md: full rewrite with current API surface - skills/kit-sdk/SKILL.md: updated examples and type references - www/pages/providers.md, www/pages/cli/commands.md: updated
66 lines
2.5 KiB
Go
66 lines
2.5 KiB
Go
package models
|
|
|
|
// ModelsDBProviders is the top-level type for models.dev/api.json data:
|
|
// a map of provider ID → provider object.
|
|
type ModelsDBProviders = map[string]modelsDBProvider
|
|
|
|
// modelsDBProvider represents a provider entry from models.dev/api.json.
|
|
type modelsDBProvider struct {
|
|
ID string `json:"id"`
|
|
Env []string `json:"env"`
|
|
NPM string `json:"npm"`
|
|
API string `json:"api,omitempty"`
|
|
Name string `json:"name"`
|
|
Doc string `json:"doc,omitempty"`
|
|
Models map[string]modelsDBModel `json:"models"`
|
|
}
|
|
|
|
// modelsDBModel represents a model entry from models.dev/api.json.
|
|
type modelsDBModel struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Family string `json:"family,omitempty"`
|
|
Attachment bool `json:"attachment"`
|
|
Reasoning bool `json:"reasoning"`
|
|
ToolCall bool `json:"tool_call"`
|
|
Temperature bool `json:"temperature"`
|
|
Cost modelsDBCost `json:"cost"`
|
|
Limit modelsDBLimit `json:"limit"`
|
|
Provider *modelsDBModelProvider `json:"provider,omitempty"` // Model-specific provider override
|
|
}
|
|
|
|
// modelsDBModelProvider represents a provider reference within a model.
|
|
type modelsDBModelProvider struct {
|
|
NPM string `json:"npm"`
|
|
}
|
|
|
|
// modelsDBCost represents model pricing from models.dev.
|
|
type modelsDBCost struct {
|
|
Input float64 `json:"input"`
|
|
Output float64 `json:"output"`
|
|
CacheRead *float64 `json:"cache_read,omitempty"`
|
|
CacheWrite *float64 `json:"cache_write,omitempty"`
|
|
}
|
|
|
|
// modelsDBLimit represents model context/output limits from models.dev.
|
|
type modelsDBLimit struct {
|
|
Context int `json:"context"`
|
|
Output int `json:"output"`
|
|
}
|
|
|
|
// npmToLLMProvider maps npm package names from models.dev to LLM
|
|
// provider identifiers. Providers not in this map but with an api URL
|
|
// can be auto-routed through openaicompat.
|
|
var npmToLLMProvider = map[string]string{
|
|
"@ai-sdk/anthropic": "anthropic",
|
|
"@ai-sdk/openai": "openai",
|
|
"@ai-sdk/google": "google",
|
|
"@ai-sdk/google-vertex": "google-vertex",
|
|
"@ai-sdk/google-vertex/anthropic": "google-vertex-anthropic",
|
|
"@ai-sdk/amazon-bedrock": "bedrock",
|
|
"@ai-sdk/azure": "azure",
|
|
"@openrouter/ai-sdk-provider": "openrouter",
|
|
"@ai-sdk/vercel": "vercel",
|
|
"@ai-sdk/openai-compatible": "openaicompat",
|
|
}
|