Documentation
¶
Overview ¶
Package graph is the SDK's internal catalog-discovery graph: a denormalized, cross-linked view of the embedded catalog (models, the hosts that serve them, and the providers that author them) built once from sdk/catalog.
It is internal on purpose. Consumers reach it only through the public sdk/model, sdk/host, and sdk/provider packages, which re-export these types by alias and expose a Resolve entry point each. Keeping the graph here lets the three public packages cross-link (Model→Host, Host→Model, Model→Provider) without importing each other — which would be a cycle.
JSON note: a Model nests its Author and Hosts one level deep, but every back-reference (Provider.Models, Host.Models) is a slug string, never a pointer — so any node marshals to JSON without a cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
Chat bool `json:"chat,omitempty"`
Embeddings bool `json:"embeddings,omitempty"`
Streaming bool `json:"streaming,omitempty"`
Tools bool `json:"tools,omitempty"`
ParallelTools bool `json:"parallelTools,omitempty"`
Vision bool `json:"vision,omitempty"`
Audio bool `json:"audio,omitempty"`
PromptCache bool `json:"promptCache,omitempty"`
Reasoning bool `json:"reasoning,omitempty"`
JSONMode bool `json:"jsonMode,omitempty"`
StructuredOutputs bool `json:"structuredOutputs,omitempty"`
Batch bool `json:"batch,omitempty"`
ComputerUse bool `json:"computerUse,omitempty"`
WebSearch bool `json:"webSearch,omitempty"`
FileInput bool `json:"fileInput,omitempty"`
AudioInput bool `json:"audioInput,omitempty"`
AudioOutput bool `json:"audioOutput,omitempty"`
SystemMessages bool `json:"systemMessages,omitempty"`
AssistantPrefill bool `json:"assistantPrefill,omitempty"`
}
Capabilities mirrors catalog.Capabilities field-for-field (convertible).
type ContextWindow ¶
type ContextWindow struct {
Input int `json:"input,omitempty"`
Output int `json:"output,omitempty"`
Total int `json:"total,omitempty"`
}
ContextWindow is the model's token-window split.
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is the built, cross-linked catalog. Resolution reuses the catalog engine (ic) for ref matching, then maps the matched slug to its node.
func Build ¶
func Build(ic *catalog.IndexedCatalog) *Graph
Build constructs the graph from a loaded catalog.
func (*Graph) ResolveHost ¶
ResolveHost returns the host node by name.
func (*Graph) ResolveModel ¶
ResolveModel returns the model node for a ref, aggregating every host that serves it. Ref forms match the catalog engine (bare slug, provider/model, wire name, alias). Cross-host matches are not ambiguous — they are one model.
type Host ¶
type Host struct {
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
BaseURL string `json:"baseURL"`
HomepageURL string `json:"homepageURL,omitempty"`
DocsURL string `json:"docsURL,omitempty"`
ConsoleURL string `json:"consoleURL,omitempty"`
StatusPageURL string `json:"statusPageURL,omitempty"`
Icon string `json:"icon,omitempty"`
Models []string `json:"models,omitempty"`
}
Host is a serving endpoint. Models lists the slugs it serves.
func ResolveHost ¶
type Modalities ¶
type Modalities struct {
Input []string `json:"input,omitempty"`
Output []string `json:"output,omitempty"`
}
Modalities mirrors catalog.Modalities (convertible).
type Model ¶
type Model struct {
Name string `json:"name"`
Slug string `json:"slug"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
Family string `json:"family,omitempty"`
Version string `json:"version,omitempty"`
Capabilities Capabilities `json:"capabilities,omitempty"`
Modalities Modalities `json:"modalities,omitempty"`
ContextWindow ContextWindow `json:"contextWindow,omitempty"`
MaxOutputTokens int `json:"maxOutputTokens,omitempty"`
KnowledgeCutoff string `json:"knowledgeCutoff,omitempty"`
ReleaseDate string `json:"releaseDate,omitempty"`
License string `json:"license,omitempty"`
Tags []string `json:"tags,omitempty"`
Featured bool `json:"featured,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Author *Provider `json:"author,omitempty"`
Hosts []ModelHost `json:"hosts,omitempty"`
}
Model is the discovery node: the model plus its author and the hosts serving it. Name is the real provider wire name; Slug is our catalog metadata name.
func ResolveModel ¶
type ModelHost ¶
type ModelHost struct {
Host *Host `json:"host"`
Adapter string `json:"adapter,omitempty"`
Pricing []Rate `json:"pricing,omitempty"`
}
ModelHost is one place a model is served: the host node plus the per-host serving terms (wire adapter + pricing) that live on the (model, host) edge.
type Provider ¶
type Provider struct {
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
HomepageURL string `json:"homepageURL,omitempty"`
DocsURL string `json:"docsURL,omitempty"`
StatusPageURL string `json:"statusPageURL,omitempty"`
Icon string `json:"icon,omitempty"`
Models []string `json:"models,omitempty"`
}
Provider is a model author (the vendor). Models lists the slugs it authors.