Documentation
¶
Index ¶
- Constants
- func FindHuggingFaceToken() string
- func FormatLlamaBytes(bytes float64) string
- func LlamaInferenceURL(serverURL string) (string, error)
- func NormalizeLlamaServerURL(value string) (string, error)
- type HuggingFaceClient
- type HuggingFaceClientOptions
- type HuggingFaceGating
- type HuggingFaceHTTPError
- type HuggingFaceModel
- type HuggingFaceModelDetails
- type HuggingFaceQuantization
- type LlamaClient
- func (c *LlamaClient) Download(ctx context.Context, model string) error
- func (c *LlamaClient) DownloadAndWait(ctx context.Context, model string, onProgress func(LlamaProgress)) ([]LlamaModelInfo, error)
- func (c *LlamaClient) List(ctx context.Context, options LlamaListOptions) ([]LlamaModelInfo, error)
- func (c *LlamaClient) Load(ctx context.Context, model string) error
- func (c *LlamaClient) LoadAndWait(ctx context.Context, model string, onProgress func(LlamaProgress)) (LlamaModelInfo, error)
- func (c *LlamaClient) ServerURL() string
- func (c *LlamaClient) Unload(ctx context.Context, model string) error
- func (c *LlamaClient) UnloadAndWait(ctx context.Context, model string) error
- func (c *LlamaClient) Watch(ctx context.Context, onEvent func(LlamaModelEvent)) error
- type LlamaClientOptions
- type LlamaHTTPError
- type LlamaListOptions
- type LlamaModelArchitecture
- type LlamaModelEvent
- type LlamaModelInfo
- type LlamaModelLifecycle
- type LlamaModelMeta
- type LlamaModelStatus
- type LlamaProgress
- type LlamaProviderController
- type LlamaProviderOptions
- type LlamaTransferProgress
Constants ¶
const ( LlamaProviderID = "llama.cpp" DefaultLlamaServerURL = "http://127.0.0.1:8080" )
Variables ¶
This section is empty.
Functions ¶
func FindHuggingFaceToken ¶
func FindHuggingFaceToken() string
FindHuggingFaceToken follows Hugging Face's environment and cache path precedence. Unreadable files are skipped so an optional token never blocks local llama.cpp use.
func FormatLlamaBytes ¶
func LlamaInferenceURL ¶
func NormalizeLlamaServerURL ¶
Types ¶
type HuggingFaceClient ¶
type HuggingFaceClient struct {
// contains filtered or unexported fields
}
HuggingFaceClient owns the catalog transport configuration used by the llama.cpp extension. Search and detail results are detached typed values.
func NewHuggingFaceClient ¶
func NewHuggingFaceClient( token string, options ...HuggingFaceClientOptions, ) (*HuggingFaceClient, error)
func (*HuggingFaceClient) Details ¶
func (c *HuggingFaceClient) Details( ctx context.Context, id string, ) (HuggingFaceModelDetails, error)
func (*HuggingFaceClient) Search ¶
func (c *HuggingFaceClient) Search( ctx context.Context, query string, ) ([]HuggingFaceModel, error)
type HuggingFaceGating ¶
type HuggingFaceGating string
const ( HuggingFaceGatingNone HuggingFaceGating = "" HuggingFaceGatingAuto HuggingFaceGating = "auto" HuggingFaceGatingManual HuggingFaceGating = "manual" )
type HuggingFaceHTTPError ¶
func (*HuggingFaceHTTPError) Error ¶
func (e *HuggingFaceHTTPError) Error() string
type HuggingFaceModel ¶
type HuggingFaceModelDetails ¶
type HuggingFaceModelDetails struct {
ID string
Gating HuggingFaceGating
Quantizations []HuggingFaceQuantization
}
type HuggingFaceQuantization ¶
type LlamaClient ¶
type LlamaClient struct {
// contains filtered or unexported fields
}
LlamaClient is a context-aware client for the llama.cpp router management API. It owns no model state; callers publish returned catalogs explicitly.
func NewLlamaClient ¶
func NewLlamaClient( serverURL string, apiKey string, options ...LlamaClientOptions, ) (*LlamaClient, error)
func (*LlamaClient) Download ¶
func (c *LlamaClient) Download( ctx context.Context, model string, ) error
func (*LlamaClient) DownloadAndWait ¶
func (c *LlamaClient) DownloadAndWait( ctx context.Context, model string, onProgress func(LlamaProgress), ) ([]LlamaModelInfo, error)
func (*LlamaClient) List ¶
func (c *LlamaClient) List( ctx context.Context, options LlamaListOptions, ) ([]LlamaModelInfo, error)
func (*LlamaClient) LoadAndWait ¶
func (c *LlamaClient) LoadAndWait( ctx context.Context, model string, onProgress func(LlamaProgress), ) (LlamaModelInfo, error)
func (*LlamaClient) ServerURL ¶
func (c *LlamaClient) ServerURL() string
func (*LlamaClient) UnloadAndWait ¶
func (c *LlamaClient) UnloadAndWait( ctx context.Context, model string, ) error
func (*LlamaClient) Watch ¶
func (c *LlamaClient) Watch( ctx context.Context, onEvent func(LlamaModelEvent), ) error
type LlamaClientOptions ¶
type LlamaHTTPError ¶
LlamaHTTPError preserves the management endpoint status and server message.
func (*LlamaHTTPError) Error ¶
func (e *LlamaHTTPError) Error() string
type LlamaListOptions ¶
type LlamaListOptions struct {
Reload bool
}
type LlamaModelArchitecture ¶
type LlamaModelEvent ¶
type LlamaModelEvent struct {
Model string `json:"model"`
Event string `json:"event"`
Data json.RawMessage `json:"data,omitempty"`
}
LlamaModelEvent is one router SSE event. Data stays raw at the transport boundary and is decoded into operation-specific state by wait methods.
type LlamaModelInfo ¶
type LlamaModelInfo struct {
ID string `json:"id"`
Aliases []string `json:"aliases,omitempty"`
Status LlamaModelStatus `json:"status"`
Architecture LlamaModelArchitecture `json:"architecture,omitempty"`
Source string `json:"source,omitempty"`
Meta LlamaModelMeta `json:"meta,omitempty"`
}
LlamaModelInfo is the canonical management-plane model record.
type LlamaModelLifecycle ¶
type LlamaModelLifecycle string
LlamaModelLifecycle is the router-owned lifecycle state for one model.
const ( LlamaModelUnloaded LlamaModelLifecycle = "unloaded" LlamaModelLoading LlamaModelLifecycle = "loading" LlamaModelLoaded LlamaModelLifecycle = "loaded" LlamaModelDownloading LlamaModelLifecycle = "downloading" LlamaModelSleeping LlamaModelLifecycle = "sleeping" )
type LlamaModelMeta ¶
type LlamaModelStatus ¶
type LlamaModelStatus struct {
Value LlamaModelLifecycle `json:"value"`
Args []string `json:"args,omitempty"`
Failed bool `json:"failed,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
Progress map[string]LlamaTransferProgress `json:"progress,omitempty"`
}
LlamaModelStatus is the typed lifecycle projection returned by llama.cpp.
type LlamaProgress ¶
LlamaProgress is a detached user-facing progress update.
type LlamaProviderController ¶
type LlamaProviderController struct {
// contains filtered or unexported fields
}
LlamaProviderController owns the atomic catalog projection shared by the provider refresh path and the interactive management flow.
func CreateLlamaProvider ¶
func CreateLlamaProvider( options ...LlamaProviderOptions, ) (*LlamaProviderController, error)
func (*LlamaProviderController) Provider ¶
func (c *LlamaProviderController) Provider() *llm.Provider
func (*LlamaProviderController) SetCatalog ¶
func (c *LlamaProviderController) SetCatalog( catalog []LlamaModelInfo, serverURL string, ) error
type LlamaProviderOptions ¶
type LlamaTransferProgress ¶
LlamaTransferProgress reports byte progress for one downloaded artifact.