Documentation
¶
Overview ¶
Package veloxquant is the VeloxQuant Go SDK: memory intelligence and optimization for local AI on Apple Silicon and beyond. It hides MLX and Python runtime implementation details behind an idiomatic Go API for hardware detection, memory/KV-cache estimation, optimization profile selection, and communication with a local VeloxQuant runtime.
Index ¶
- Constants
- Variables
- func FormatBytes(b uint64) string
- type AutoPilotConfig
- type AutoPilotPlan
- type BenchmarkInput
- type BenchmarkResult
- type ChatChunk
- type ChatRequest
- type ChatResponse
- type ChatStream
- type Client
- func (c *Client) AutoPilot(ctx context.Context, cfg AutoPilotConfig) (*Session, error)
- func (c *Client) Chat(ctx context.Context, req ChatRequest) (ChatResponse, error)
- func (c *Client) ChatStream(ctx context.Context, req ChatRequest) (*ChatStream, error)
- func (c *Client) Embed(ctx context.Context, req EmbedRequest) (EmbedResponse, error)
- func (c *Client) Monitor(opts ...MonitorOption) *monitor.Monitor
- func (c *Client) NewConversation(model string, system string) *Conversation
- type Conversation
- type ConversationStream
- type DeleteResult
- type EmbedRequest
- type EmbedResponse
- type Embedding
- type InferenceMetrics
- type JSONSchemaFormat
- type LocalModelInfo
- type MemoryEstimate
- type MemoryRequest
- type MemoryService
- type Message
- type ModelArchitecture
- type ModelRecommendationRequest
- type ModelsService
- func (m *ModelsService) Delete(ctx context.Context, python string, modelID string) (DeleteResult, error)
- func (m *ModelsService) List() []models.Info
- func (m *ModelsService) Local(ctx context.Context) ([]LocalModelInfo, error)
- func (m *ModelsService) Pull(ctx context.Context, python string, modelID string) (PullResult, error)
- func (m *ModelsService) Recommend(ctx context.Context, req ModelRecommendationRequest) ([]models.Info, error)
- func (m *ModelsService) RecommendScored(ctx context.Context, req ModelRecommendationRequest) ([]models.Scored, error)
- type MonitorConfig
- type MonitorOption
- type OptimizationRecommendation
- type OptimizationRequest
- type OptimizeService
- type Option
- type Precision
- type PullResult
- type ResponseFormat
- type RuntimeService
- type RuntimeStatus
- type Session
- type SystemInfo
- type SystemService
- type ToolCall
- type ToolCallFunction
- type ToolDefinition
- type ToolFunction
- type Usage
Constants ¶
Variables ¶
var ( ErrUnsupportedPlatform = errors.New("unsupported platform") ErrInsufficientMemory = errors.New("insufficient memory") ErrModelNotFound = errors.New("model not found") ErrInvalidConfig = errors.New("invalid configuration") // at the top level: it's the error models.Pull/models.Delete report when // the configured Python interpreter can't import huggingface_hub. Defined // in the models package (which is what actually detects it) and aliased // here, alongside this SDK's other sentinel errors, so callers can // errors.Is against either veloxquant.ErrHuggingFaceHubUnavailable or // models.ErrHuggingFaceHubUnavailable interchangeably. ErrHuggingFaceHubUnavailable = models.ErrHuggingFaceHubUnavailable )
Sentinel errors returned by the SDK. Use errors.Is to check for these after wrapping with fmt.Errorf("...: %w", err).
Functions ¶
func FormatBytes ¶
FormatBytes renders a byte count as a human-readable string, e.g. "24.0 GB".
Types ¶
type AutoPilotConfig ¶
type AutoPilotConfig struct {
// Task is used to select a suitable model, e.g. "coding", "chat",
// "reasoning", "vision", "agent", "translation".
Task string
// Model may be a specific model name, or "auto" (or empty) to let
// AutoPilot choose one based on Task and available hardware.
Model string
// ContextLength, if set, overrides AutoPilot's automatic context
// length selection.
ContextLength int
}
AutoPilotConfig describes the intent behind an AutoPilot session: what task the caller wants to accomplish, and optionally which model to use.
type AutoPilotPlan ¶
type AutoPilotPlan struct {
Hardware SystemInfo
SelectedModel string
ContextLength int
CompressionBits int
EstimatedMemoryBytes uint64
SafetyMarginBytes uint64
Profile optimize.Profile
Reason string
}
AutoPilotPlan documents every decision AutoPilot made when constructing a Session, so the process is transparent and debuggable.
type BenchmarkInput ¶ added in v0.5.0
type BenchmarkInput struct {
// Model is the Hugging Face model id (or local path) to benchmark.
Model string
// OptimizedMethod names the KV-cache compression method to compare
// against the default (unoptimized) method, e.g. "kivi". Empty lets
// the runtime pick automatically (optimize: "auto").
OptimizedMethod string
// MaxTokens caps each benchmarked generation. Defaults to 128.
MaxTokens int
}
BenchmarkInput configures a Benchmark run.
type BenchmarkResult ¶ added in v0.5.0
type BenchmarkResult struct {
Model string
Chip string
UnifiedMemoryBytes uint64
TokensPerSecond float64
TimeToFirstTokenMs float64
// DefaultMethodResidentBytes and OptimizedResidentBytes are measured
// resident memory (RSS) of the runtime subprocess for each method,
// sampled once right after each model finishes loading. nil means the
// measurement couldn't be taken (e.g. the process had already exited,
// or `ps` failed) — matching TS's `| null` for the same case, not a
// zero value that could be mistaken for "measured zero bytes".
//
// This is real, measured memory, but it reflects idle model-load RSS,
// not KV-cache growth under load — and compression is not guaranteed
// to lower it: it can measure smaller in accounting terms (see
// MemoryEstimate) while resident memory stays flat or even increases.
DefaultMethodResidentBytes *uint64
OptimizedResidentBytes *uint64
Method string
OptimizedMethodUsed string
}
BenchmarkResult reports the outcome of a Benchmark run. Call ToMarkdown to render it as a human-readable report.
func Benchmark ¶ added in v0.5.0
func Benchmark(ctx context.Context, client *Client, input BenchmarkInput) (BenchmarkResult, error)
Benchmark measures tokens/sec, time-to-first-token, and resident memory for input.Model on this machine, comparing the default (unoptimized) serve method against an optimized one (input.OptimizedMethod, or the runtime's own automatic choice when empty). It launches two separate runtime processes sequentially — never concurrently, so resource contention doesn't skew either measurement — and fully stops each one before starting the next.
Requires real Apple Silicon hardware and a downloaded model; this is not unit-testable in CI. See runtime/benchmark_manual_test.go (build tag "manual") for a by-hand verification harness.
func (BenchmarkResult) ToMarkdown ¶ added in v0.5.0
func (r BenchmarkResult) ToMarkdown() string
ToMarkdown renders r as a human-readable Markdown report, matching the TS SDK's benchmark().toMarkdown() format. When both resident-memory measurements are available and the optimized method measured *higher* resident memory than the default, the report includes an explicit accounting-only caveat rather than silently reporting an increase as if it were a simple regression — compression byte counts (see MemoryEstimate) are not the same thing as measured RSS, and the two can diverge in either direction.
type ChatRequest ¶
type ChatRequest struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
Temperature float64 `json:"temperature,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Stream bool `json:"stream,omitempty"`
// ResponseFormat requests a specific output shape from the model, in
// OpenAI's response_format wire format. Build it with JSONMode or
// JSONSchema.
//
// The VeloxQuant runtime serves chat completions via mlx_lm.server,
// which as of this writing does not read or enforce response_format:
// it is forwarded on the wire for forward-compatibility and for
// OpenAI-compatible backends that do honor it, but the local runtime
// will not constrain decoding to match it. Prompt the model
// explicitly to return the desired shape, and validate its output;
// do not rely on ResponseFormat alone for structured extraction
// against the VeloxQuant runtime today.
ResponseFormat *ResponseFormat `json:"response_format,omitempty"`
// Tools declares the functions the model may call. When the model
// responds by calling one or more of them, ChatResponse.ToolCalls is
// populated instead of (or alongside) Text, and FinishReason is
// "tool_calls".
Tools []ToolDefinition `json:"tools,omitempty"`
}
ChatRequest describes a chat completion request.
type ChatResponse ¶
type ChatResponse struct {
ID string `json:"id"`
Model string `json:"model"`
Text string `json:"text"`
// FinishReason is the reason generation stopped, e.g. "stop", "length",
// or "tool_calls" when the model called one or more tools (see
// ToolCalls).
FinishReason string `json:"finish_reason,omitempty"`
// ToolCalls holds the tool calls the model requested, when
// FinishReason is "tool_calls". Empty otherwise.
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
Usage Usage `json:"usage"`
Metrics InferenceMetrics `json:"metrics"`
}
ChatResponse is the result of a chat completion request.
type ChatStream ¶
type ChatStream struct {
// contains filtered or unexported fields
}
ChatStream is a handle to a streaming chat completion. Call Next to advance, Chunk to read the current piece of text, and Err to check for errors after iteration ends. Always call Close when done. Once the stream is finished (Next returns false with a nil Err), Metrics reports the completed request's tokens/sec and time-to-first-token.
func (*ChatStream) Chunk ¶
func (s *ChatStream) Chunk() ChatChunk
Chunk returns the most recently read chunk.
func (*ChatStream) Close ¶
func (s *ChatStream) Close() error
Close releases the underlying connection.
func (*ChatStream) Err ¶
func (s *ChatStream) Err() error
Err returns the first error encountered while streaming, if any.
func (*ChatStream) Metrics ¶ added in v0.3.0
func (s *ChatStream) Metrics() InferenceMetrics
Metrics reports performance characteristics of the stream so far. TokensPerSecond and TimeToFirstToken are approximate: they're derived from the number of non-empty content chunks and wall-clock time, since OpenAI-compatible streaming responses don't report per-chunk token counts.
func (*ChatStream) Next ¶
func (s *ChatStream) Next() bool
Next advances the stream. It returns false when the stream ends (check Err for failures).
type Client ¶
type Client struct {
System *SystemService
Memory *MemoryService
Optimize *OptimizeService
Runtime *RuntimeService
Models *ModelsService
// contains filtered or unexported fields
}
Client is the main entry point to the VeloxQuant Go SDK. Construct one with NewClient. Client is safe for concurrent use.
func NewClient ¶
NewClient constructs a VeloxQuant Client. By default it connects to a runtime at http://localhost:8765 with a 60s HTTP timeout; use the With* options to customize behavior.
func (*Client) AutoPilot ¶
AutoPilot inspects the host system, selects a compatible model and context length for the given task, chooses a VeloxQuant compression strategy, and returns a ready-to-use Session.
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, req ChatRequest) (ChatResponse, error)
Chat sends a chat completion request to the configured runtime and returns the full response.
func (*Client) ChatStream ¶
func (c *Client) ChatStream(ctx context.Context, req ChatRequest) (*ChatStream, error)
ChatStream starts a streaming chat completion request.
func (*Client) Embed ¶ added in v0.4.0
func (c *Client) Embed(ctx context.Context, req EmbedRequest) (EmbedResponse, error)
Embed sends an embeddings request to the configured runtime and returns the resulting vectors. req.Input may be a single string or a []string to embed a batch in one call.
func (*Client) Monitor ¶
func (c *Client) Monitor(opts ...MonitorOption) *monitor.Monitor
Monitor returns a Monitor sampling memory from this client's system detector at a periodic interval (5s by default; override with WithMonitorInterval). Between samples, any Chat or ChatStream call made through this Client also pushes a live update carrying that request's TokensPerSecond and TimeToFirstToken, merged onto the most recent memory sample — so subscribers see inference performance as it happens rather than waiting for the next tick.
func (*Client) NewConversation ¶ added in v0.4.0
func (c *Client) NewConversation(model string, system string) *Conversation
NewConversation returns a Conversation bound to model. Use system to seed an initial system prompt, or leave it empty to start with no history.
type Conversation ¶ added in v0.4.0
type Conversation struct {
// contains filtered or unexported fields
}
Conversation accumulates chat history across turns so callers don't have to build []Message by hand on every call. It is not safe for concurrent use by multiple goroutines.
func (*Conversation) History ¶ added in v0.4.0
func (conv *Conversation) History() []Message
History returns the accumulated messages so far, oldest first. The returned slice is a copy; mutating it does not affect the Conversation.
func (*Conversation) Send ¶ added in v0.4.0
func (conv *Conversation) Send(ctx context.Context, prompt string) (ChatResponse, error)
Send appends prompt as a user message, sends the full history so far to the model, and appends the assistant's reply to the history before returning it. If the request fails, the history is left exactly as it was before Send was called (the failed turn is not recorded), so a retried Send starts from the same state.
func (*Conversation) SendStream ¶ added in v0.4.0
func (conv *Conversation) SendStream(ctx context.Context, prompt string) (*ConversationStream, error)
SendStream appends prompt as a user message and starts a streaming reply. Call Drain (or otherwise fully consume the stream and check its Err) before the returned history reflects the assistant's reply — the assistant message is appended to history only once the stream finishes without error. If the stream errors, the history is left as it was before SendStream was called.
type ConversationStream ¶ added in v0.4.0
type ConversationStream struct {
// contains filtered or unexported fields
}
ConversationStream is a streaming reply within a Conversation. It wraps ChatStream and, once the stream finishes successfully, commits the assistant's full reply to the owning Conversation's history.
func (*ConversationStream) Chunk ¶ added in v0.4.0
func (cs *ConversationStream) Chunk() ChatChunk
Chunk returns the most recently read chunk.
func (*ConversationStream) Close ¶ added in v0.4.0
func (cs *ConversationStream) Close() error
Close releases the underlying connection.
func (*ConversationStream) Err ¶ added in v0.4.0
func (cs *ConversationStream) Err() error
Err returns the first error encountered while streaming, if any.
func (*ConversationStream) Next ¶ added in v0.4.0
func (cs *ConversationStream) Next() bool
Next advances the stream. It returns false when the stream ends (check Err for failures).
type DeleteResult ¶ added in v0.5.0
type DeleteResult = models.DeleteResult
DeleteResult is the result of a successful ModelsService.Delete.
type EmbedRequest ¶ added in v0.4.0
EmbedRequest describes an embeddings request. Input is either a single string or a []string to embed a batch in one call.
type EmbedResponse ¶ added in v0.4.0
type EmbedResponse struct {
Model string `json:"model"`
Data []Embedding `json:"data"`
Usage Usage `json:"usage"`
}
EmbedResponse is the result of an embeddings request.
type Embedding ¶ added in v0.4.0
Embedding is a single embedding vector within an EmbedResponse, at the same index as its corresponding entry in EmbedRequest.Input.
type InferenceMetrics ¶
type InferenceMetrics struct {
TokensPerSecond float64 `json:"tokens_per_second"`
TimeToFirstToken time.Duration `json:"time_to_first_token"`
TotalDuration time.Duration `json:"total_duration"`
}
InferenceMetrics reports performance characteristics of a completed inference request.
type JSONSchemaFormat ¶ added in v0.4.0
type JSONSchemaFormat = openai.JSONSchema
JSONSchemaFormat re-exports openai.JSONSchema at the top level.
type LocalModelInfo ¶ added in v0.4.0
type LocalModelInfo struct {
Name string `json:"name"`
Path string `json:"path"`
SizeBytes uint64 `json:"size_bytes"`
LastModified *time.Time `json:"last_modified,omitempty"`
}
LocalModelInfo describes a model found in the local model cache, as returned by ModelsService.Local.
type MemoryEstimate ¶
type MemoryEstimate struct {
ModelMemoryBytes uint64
KVCacheMemoryBytes uint64
RuntimeOverheadBytes uint64
TotalMemoryBytes uint64
OptimizedKVBytes uint64
OptimizedTotalBytes uint64
SavedBytes uint64
SavedPercent float64
RecommendedStrategy string
}
MemoryEstimate is the result of a memory estimation.
type MemoryRequest ¶
type MemoryRequest struct {
Model ModelArchitecture
ContextLength int
Precision Precision
}
MemoryRequest describes a memory estimation query.
type MemoryService ¶
type MemoryService struct {
// contains filtered or unexported fields
}
MemoryService exposes model and KV-cache memory estimation.
func (*MemoryService) Estimate ¶
func (m *MemoryService) Estimate(ctx context.Context, req MemoryRequest) (MemoryEstimate, error)
Estimate computes memory requirements for a model at a given context length and precision.
type Message ¶
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
}
Message is a single chat message. ToolCalls is populated on an assistant message that called one or more tools; ToolCallID is set on a "tool" role message reporting a tool's result back to the model, identifying which call it answers. See the agent package for a tool-calling loop built on these fields.
type ModelArchitecture ¶
type ModelArchitecture = memory.Architecture
ModelArchitecture re-exports memory.Architecture at the top level.
type ModelRecommendationRequest ¶
type ModelRecommendationRequest struct {
Task string
AvailableMemoryBytes uint64
ContextLength int
}
ModelRecommendationRequest describes a model recommendation query.
type ModelsService ¶
type ModelsService struct {
// contains filtered or unexported fields
}
ModelsService exposes the VeloxQuant model registry.
func (*ModelsService) Delete ¶ added in v0.5.0
func (m *ModelsService) Delete(ctx context.Context, python string, modelID string) (DeleteResult, error)
Delete removes modelID's weights from the local model cache (see ModelsService.Local) via huggingface_hub's cache-eviction API. python selects the interpreter to use; pass "" to use models.ResolvePythonInterpreter's default resolution.
func (*ModelsService) List ¶
func (m *ModelsService) List() []models.Info
List returns all known models.
func (*ModelsService) Local ¶ added in v0.4.0
func (m *ModelsService) Local(ctx context.Context) ([]LocalModelInfo, error)
Local scans the local model cache directory (e.g. the MLX/Hugging Face hub cache) and reports the models found on disk, their size, and when they were last modified. It returns an empty slice, not an error, if the cache directory doesn't exist or can't be read.
func (*ModelsService) Pull ¶ added in v0.5.0
func (m *ModelsService) Pull(ctx context.Context, python string, modelID string) (PullResult, error)
Pull downloads modelID's weights into the local model cache (see ModelsService.Local) via huggingface_hub's snapshot_download(), shelling out to a Python interpreter — see models.Pull's doc comment for why this (unlike Local/ScanLocal) can't be a dependency-free operation. python selects the interpreter to use; pass "" to use models.ResolvePythonInterpreter's default resolution (VELOXQUANT_PYTHON, then "python3").
func (*ModelsService) Recommend ¶
func (m *ModelsService) Recommend(ctx context.Context, req ModelRecommendationRequest) ([]models.Info, error)
Recommend returns models suited to the requested task that fit within AvailableMemoryBytes, ranked best first.
func (*ModelsService) RecommendScored ¶ added in v0.3.0
func (m *ModelsService) RecommendScored(ctx context.Context, req ModelRecommendationRequest) ([]models.Scored, error)
RecommendScored behaves like Recommend but also returns the score and human-readable reasoning behind each candidate's ranking.
type MonitorConfig ¶ added in v0.3.0
type MonitorConfig struct {
// contains filtered or unexported fields
}
MonitorConfig configures a Monitor returned by Client.Monitor.
type MonitorOption ¶ added in v0.3.0
type MonitorOption func(*MonitorConfig)
MonitorOption configures a Monitor. Use the WithMonitor* functions to build options.
func WithMonitorInterval ¶ added in v0.3.0
func WithMonitorInterval(interval time.Duration) MonitorOption
WithMonitorInterval sets how often the Monitor samples system memory. Defaults to 5 seconds.
type OptimizationRecommendation ¶
type OptimizationRecommendation struct {
Profile optimize.Profile
CompressionMethod string
CompressionBits int
EstimatedMemoryBefore uint64
EstimatedMemoryAfter uint64
ContextLength int
Reason string
}
OptimizationRecommendation is VeloxQuant's suggested optimization strategy for a model/context combination.
type OptimizationRequest ¶
type OptimizationRequest struct {
Model string
Architecture ModelArchitecture
ContextLength int
}
OptimizationRequest describes an optimization recommendation query.
type OptimizeService ¶
type OptimizeService struct {
// contains filtered or unexported fields
}
OptimizeService exposes VeloxQuant optimization profile recommendations.
func (*OptimizeService) Recommend ¶
func (o *OptimizeService) Recommend(ctx context.Context, req OptimizationRequest) (OptimizationRecommendation, error)
Recommend returns VeloxQuant's recommended optimization strategy for the given model and context length.
type Option ¶
type Option func(*config)
Option configures a Client. Use the With* functions to build options.
func WithAutoDetect ¶
func WithAutoDetect() Option
WithAutoDetect enables automatic hardware detection and profile selection when the Client is constructed.
func WithHTTPTimeout ¶
WithHTTPTimeout sets the timeout used for HTTP requests to the runtime.
func WithOpenAICompatibleRuntime ¶
WithOpenAICompatibleRuntime configures the client to send chat requests to an OpenAI-compatible endpoint (e.g. "http://localhost:8765/v1") instead of the native VeloxQuant runtime API.
func WithProfile ¶
WithProfile forces a specific VeloxQuant optimization profile rather than letting the SDK choose one automatically.
func WithRuntimeURL ¶
WithRuntimeURL sets the base URL of the VeloxQuant runtime. Defaults to http://localhost:8765.
type Precision ¶
Precision re-exports memory.Precision at the top level so callers don't need to import the memory subpackage for common usage.
type PullResult ¶ added in v0.5.0
type PullResult = models.PullResult
PullResult is the result of a successful ModelsService.Pull.
type ResponseFormat ¶ added in v0.4.0
type ResponseFormat = openai.ResponseFormat
ResponseFormat requests a specific chat completion output format.
func JSONMode ¶ added in v0.4.0
func JSONMode() *ResponseFormat
JSONMode returns a ResponseFormat requesting a JSON object response (OpenAI's response_format: {"type": "json_object"}), without constraining it to a specific schema.
func JSONSchema ¶ added in v0.4.0
func JSONSchema(name string, schema any, strict bool) *ResponseFormat
JSONSchema returns a ResponseFormat requesting a response constrained to the given schema (OpenAI's response_format: {"type": "json_schema", ...}). name identifies the schema; schema is typically a map[string]any describing a JSON Schema object, or a value that marshals to one. Set strict to true to request exact schema adherence, for backends that support it.
type RuntimeService ¶
type RuntimeService struct {
// contains filtered or unexported fields
}
RuntimeService exposes communication with a local VeloxQuant runtime.
func (*RuntimeService) Health ¶
func (r *RuntimeService) Health(ctx context.Context) (RuntimeStatus, error)
Health checks whether the VeloxQuant runtime is reachable and healthy.
type RuntimeStatus ¶
RuntimeStatus describes the health of a VeloxQuant runtime instance.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is a ready-to-use AI session produced by AutoPilot, bound to a specific model and optimization plan.
func (*Session) Conversation ¶ added in v0.4.0
func (s *Session) Conversation(system string) *Conversation
Conversation returns a history-tracking Conversation bound to the model AutoPilot selected for this Session.
func (*Session) Plan ¶
func (s *Session) Plan() AutoPilotPlan
Plan returns the decisions AutoPilot made to construct this Session.
type SystemInfo ¶
type SystemInfo struct {
Platform string
Architecture string
CPUModel string
AppleSilicon bool
TotalMemory uint64
AvailableMemory uint64
RecommendedProfile string
}
SystemInfo describes the host system relevant to running local LLM inference.
type SystemService ¶
type SystemService struct {
// contains filtered or unexported fields
}
SystemService exposes hardware and platform detection.
func (*SystemService) Info ¶
func (s *SystemService) Info(ctx context.Context) (SystemInfo, error)
Info returns details about the host system.
type ToolCall ¶ added in v0.5.0
ToolCall re-exports openai.ToolCall at the top level: a single tool invocation the model requested.
type ToolCallFunction ¶ added in v0.5.0
type ToolCallFunction = openai.ToolCallFunction
ToolCallFunction re-exports openai.ToolCallFunction at the top level.
type ToolDefinition ¶ added in v0.5.0
type ToolDefinition = openai.ToolDefinition
ToolDefinition re-exports openai.ToolDefinition at the top level: a callable tool description in OpenAI's function-calling wire format.
type ToolFunction ¶ added in v0.5.0
type ToolFunction = openai.ToolFunction
ToolFunction re-exports openai.ToolFunction at the top level.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent implements a single-turn tool-calling loop over a veloxquant.Client: send a prompt, execute any tools the model calls, feed the results back, and repeat until the model stops calling tools or a maximum number of round trips is used up.
|
Package agent implements a single-turn tool-calling loop over a veloxquant.Client: send a prompt, execute any tools the model calls, feed the results back, and repeat until the model stops calling tools or a maximum number of round trips is used up. |
|
cmd
|
|
|
vq
command
Command vq is the VeloxQuant CLI: hardware diagnostics, model memory analysis, optimization recommendations, benchmarking, and a local runtime bridge.
|
Command vq is the VeloxQuant CLI: hardware diagnostics, model memory analysis, optimization recommendations, benchmarking, and a local runtime bridge. |
|
examples
|
|
|
agent
command
Example: a single-turn tool-calling agent, using the model's native tool-calling support (confirmed working against mlx-community/Qwen3-4B-4bit — not every model's tokenizer supports this).
|
Example: a single-turn tool-calling agent, using the model's native tool-calling support (confirmed working against mlx-community/Qwen3-4B-4bit — not every model's tokenizer supports this). |
|
autopilot
command
Example: letting AutoPilot select a model, context length, and compression strategy based on detected hardware.
|
Example: letting AutoPilot select a model, context length, and compression strategy based on detected hardware. |
|
chat
command
Example: a single chat completion request against a local VeloxQuant runtime.
|
Example: a single chat completion request against a local VeloxQuant runtime. |
|
conversation
command
Example: a multi-turn conversation that automatically tracks message history across calls.
|
Example: a multi-turn conversation that automatically tracks message history across calls. |
|
embeddings
command
Example: requesting embeddings for a batch of strings from a local VeloxQuant runtime.
|
Example: requesting embeddings for a batch of strings from a local VeloxQuant runtime. |
|
server
command
Example: building a small HTTP service on top of the VeloxQuant Go SDK, exposing memory estimation and chat as JSON endpoints.
|
Example: building a small HTTP service on top of the VeloxQuant Go SDK, exposing memory estimation and chat as JSON endpoints. |
|
streaming
command
Example: streaming a chat completion token-by-token.
|
Example: streaming a chat completion token-by-token. |
|
structured
command
Example: requesting structured (JSON) output from a chat completion.
|
Example: requesting structured (JSON) output from a chat completion. |
|
internal
|
|
|
httpclient
Package httpclient provides a small, shared HTTP client wrapper used by the runtime and openai packages: context-aware requests, JSON encoding helpers, and typed error responses.
|
Package httpclient provides a small, shared HTTP client wrapper used by the runtime and openai packages: context-aware requests, JSON encoding helpers, and typed error responses. |
|
langchain
module
|
|
|
mcp
module
|
|
|
Package memory implements VeloxQuant's memory intelligence: estimating how much RAM a model and its KV cache will need, and how much VeloxQuant compression can save.
|
Package memory implements VeloxQuant's memory intelligence: estimating how much RAM a model and its KV cache will need, and how much VeloxQuant compression can save. |
|
Package models provides a curated registry of known local LLMs and task-based recommendations.
|
Package models provides a curated registry of known local LLMs and task-based recommendations. |
|
Package monitor provides thread-safe, subscribable monitoring of memory and inference metrics.
|
Package monitor provides thread-safe, subscribable monitoring of memory and inference metrics. |
|
Package openai implements a minimal client for OpenAI-compatible chat completion APIs, used to talk to the VeloxQuant runtime (or any other OpenAI-compatible local server).
|
Package openai implements a minimal client for OpenAI-compatible chat completion APIs, used to talk to the VeloxQuant runtime (or any other OpenAI-compatible local server). |
|
Package optimize provides VeloxQuant optimization profile selection and compression recommendations for a given model and context length.
|
Package optimize provides VeloxQuant optimization profile selection and compression recommendations for a given model and context length. |
|
Package runtime implements the HTTP client used to communicate with a local VeloxQuant runtime process (typically at http://localhost:8765).
|
Package runtime implements the HTTP client used to communicate with a local VeloxQuant runtime process (typically at http://localhost:8765). |
|
Package system provides hardware and platform detection for VeloxQuant, including Apple Silicon detection and system memory inspection.
|
Package system provides hardware and platform detection for VeloxQuant, including Apple Silicon detection and system memory inspection. |