cmd

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately.

Types

type APIServer

type APIServer struct {
	// contains filtered or unexported fields
}

APIServer holds the API server state.

type BatchResultsResponse added in v0.7.0

type BatchResultsResponse struct {
	JobID  string               `json:"job_id"`
	Status string               `json:"status"`
	Chunks []DedupeChunk        `json:"chunks"`
	Stats  PipelineStatsPayload `json:"stats"`
}

BatchResultsResponse is the JSON response for GET /v1/batch/{id}/results.

type BatchStatusResponse added in v0.7.0

type BatchStatusResponse struct {
	JobID       string  `json:"job_id"`
	Status      string  `json:"status"`
	Progress    float64 `json:"progress"`
	Error       string  `json:"error,omitempty"`
	CreatedAt   string  `json:"created_at"`
	StartedAt   string  `json:"started_at,omitempty"`
	CompletedAt string  `json:"completed_at,omitempty"`
}

BatchStatusResponse is the JSON response for GET /v1/batch/{id}.

type BatchSubmitRequest added in v0.7.0

type BatchSubmitRequest struct {
	Chunks  []DedupeChunk   `json:"chunks"`
	Options PipelineOptions `json:"options,omitempty"`
}

BatchSubmitRequest is the JSON body for POST /v1/batch.

type BatchSubmitResponse added in v0.7.0

type BatchSubmitResponse struct {
	JobID  string `json:"job_id"`
	Status string `json:"status"`
}

BatchSubmitResponse is the JSON response for POST /v1/batch.

type ChunkInput

type ChunkInput struct {
	ID        string                 `json:"id"`
	Text      string                 `json:"text"`
	Embedding []float64              `json:"embedding"`
	Score     float64                `json:"score"`
	Metadata  map[string]interface{} `json:"metadata"`
}

ChunkInput represents a chunk in the MCP request

type ChunkResponse

type ChunkResponse struct {
	ID        string                 `json:"id"`
	Text      string                 `json:"text,omitempty"`
	Score     float32                `json:"score"`
	ClusterID int                    `json:"cluster_id"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

ChunkResponse represents a chunk in the response.

type DedupeChunk

type DedupeChunk struct {
	ID        string    `json:"id"`
	Text      string    `json:"text"`
	Embedding []float32 `json:"embedding,omitempty"`
	Score     float32   `json:"score,omitempty"`
	// CacheControl mirrors the Anthropic cache_control field. When non-empty,
	// this chunk is treated as a cache boundary marker. Used with
	// options.preserve_cache_prefix to freeze the prefix during dedup.
	CacheControl string `json:"cache_control,omitempty"`
}

DedupeChunk represents a chunk in the request.

type DedupeChunkResponse

type DedupeChunkResponse struct {
	ID        string  `json:"id"`
	Text      string  `json:"text"`
	Score     float32 `json:"score"`
	ClusterID int     `json:"cluster_id"`
}

DedupeChunkResponse represents a chunk in the response.

type DedupeOptions added in v0.5.0

type DedupeOptions struct {
	// PreserveCachePrefix freezes chunks before the last cache_control marker
	// so the dedup pipeline cannot reorder or remove them. This prevents
	// Distill from silently invalidating Anthropic prompt cache prefixes.
	PreserveCachePrefix bool `json:"preserve_cache_prefix,omitempty"`
}

DedupeOptions controls optional dedup behaviour.

type DedupeRequest

type DedupeRequest struct {
	Chunks    []DedupeChunk `json:"chunks"`
	Threshold float64       `json:"threshold,omitempty"`
	Lambda    float64       `json:"lambda,omitempty"`
	TargetK   int           `json:"target_k,omitempty"`
	Options   DedupeOptions `json:"options,omitempty"`
}

DedupeRequest is the JSON request body for /v1/dedupe.

type DedupeResponse

type DedupeResponse struct {
	Chunks []DedupeChunkResponse `json:"chunks"`
	Stats  DedupeStats           `json:"stats"`
}

DedupeResponse is the JSON response for /v1/dedupe.

type DedupeStats

type DedupeStats struct {
	InputCount   int   `json:"input_count"`
	OutputCount  int   `json:"output_count"`
	ClusterCount int   `json:"cluster_count"`
	ReductionPct int   `json:"reduction_pct"`
	LatencyMs    int64 `json:"latency_ms"`

	// Cache prefix fields — populated when options.preserve_cache_prefix=true.
	CachePrefixFrozen bool   `json:"cache_prefix_frozen,omitempty"`
	CachePrefixTokens int    `json:"cache_prefix_tokens,omitempty"`
	CachePrefixHash   string `json:"cache_prefix_hash,omitempty"`
	SuffixInputCount  int    `json:"suffix_input_count,omitempty"`
	SuffixOutputCount int    `json:"suffix_output_count,omitempty"`
}

DedupeStats contains processing statistics.

type MCPServer

type MCPServer struct {
	// contains filtered or unexported fields
}

MCPServer wraps the MCP server with Distill capabilities

type MemoryAPI added in v0.3.0

type MemoryAPI struct {
	// contains filtered or unexported fields
}

MemoryAPI handles memory-related HTTP endpoints.

func (*MemoryAPI) RegisterMemoryRoutes added in v0.3.0

func (m *MemoryAPI) RegisterMemoryRoutes(mux *http.ServeMux, mw func(string, http.HandlerFunc) http.HandlerFunc)

RegisterMemoryRoutes adds memory endpoints to the given mux.

type PipelineAPI added in v0.7.0

type PipelineAPI struct {
	// contains filtered or unexported fields
}

PipelineAPI holds the pipeline runner and batch processor.

func NewPipelineAPI added in v0.7.0

func NewPipelineAPI() *PipelineAPI

NewPipelineAPI creates a PipelineAPI with a default batch processor.

func (*PipelineAPI) RegisterPipelineRoutes added in v0.7.0

func (a *PipelineAPI) RegisterPipelineRoutes(mux *http.ServeMux, middleware func(string, http.HandlerFunc) http.HandlerFunc)

RegisterPipelineRoutes wires up /v1/pipeline and /v1/batch/* routes.

type PipelineCompressOptions added in v0.7.0

type PipelineCompressOptions struct {
	Enabled         bool    `json:"enabled"`
	TargetReduction float64 `json:"target_reduction,omitempty"`
}

type PipelineDedupOptions added in v0.7.0

type PipelineDedupOptions struct {
	Enabled   bool    `json:"enabled"`
	Threshold float64 `json:"threshold,omitempty"`
	Lambda    float64 `json:"lambda,omitempty"`
	TargetK   int     `json:"target_k,omitempty"`
}

type PipelineOptions added in v0.7.0

type PipelineOptions struct {
	Dedup     PipelineDedupOptions     `json:"dedup,omitempty"`
	Compress  PipelineCompressOptions  `json:"compress,omitempty"`
	Summarize PipelineSummarizeOptions `json:"summarize,omitempty"`
}

PipelineOptions mirrors pipeline.Options for JSON serialisation.

type PipelineRequest added in v0.7.0

type PipelineRequest struct {
	Chunks  []DedupeChunk   `json:"chunks"`
	Options PipelineOptions `json:"options,omitempty"`
}

PipelineRequest is the JSON body for POST /v1/pipeline.

type PipelineResponse added in v0.7.0

type PipelineResponse struct {
	Chunks []DedupeChunk        `json:"chunks"`
	Stats  PipelineStatsPayload `json:"stats"`
}

PipelineResponse is the JSON response for POST /v1/pipeline.

type PipelineStatsPayload added in v0.7.0

type PipelineStatsPayload struct {
	OriginalTokens int                     `json:"original_tokens"`
	FinalTokens    int                     `json:"final_tokens"`
	TotalReduction float64                 `json:"total_reduction"`
	LatencyMs      float64                 `json:"latency_ms"`
	Stages         map[string]StageStatsPL `json:"stages"`
}

PipelineStatsPayload is the serialisable form of pipeline.Stats.

type PipelineSummarizeOptions added in v0.7.0

type PipelineSummarizeOptions struct {
	Enabled    bool `json:"enabled"`
	MaxTokens  int  `json:"max_tokens,omitempty"`
	KeepRecent int  `json:"keep_recent,omitempty"`
}

type RetrieveRequest

type RetrieveRequest struct {
	Query          string                 `json:"query,omitempty"`
	QueryEmbedding []float32              `json:"query_embedding,omitempty"`
	Index          string                 `json:"index,omitempty"`
	Namespace      string                 `json:"namespace,omitempty"`
	OverFetchK     int                    `json:"over_fetch_k,omitempty"`
	TargetK        int                    `json:"target_k,omitempty"`
	Threshold      float64                `json:"threshold,omitempty"`
	Lambda         float64                `json:"lambda,omitempty"`
	Filter         map[string]interface{} `json:"filter,omitempty"`
}

RetrieveRequest is the JSON request body for /v1/retrieve.

type RetrieveResponse

type RetrieveResponse struct {
	Chunks []ChunkResponse `json:"chunks"`
	Stats  StatsResponse   `json:"stats"`
}

RetrieveResponse is the JSON response for /v1/retrieve.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds the HTTP server state.

type ServerConfig

type ServerConfig struct {
	Host string
	Port int
}

ServerConfig holds server configuration.

type SessionAPI added in v0.4.0

type SessionAPI struct {
	// contains filtered or unexported fields
}

SessionAPI handles session-related HTTP endpoints.

func (*SessionAPI) RegisterSessionRoutes added in v0.4.0

func (s *SessionAPI) RegisterSessionRoutes(mux *http.ServeMux, mw func(string, http.HandlerFunc) http.HandlerFunc)

RegisterSessionRoutes adds session endpoints to the given mux.

type StageStatsPL added in v0.7.0

type StageStatsPL struct {
	Enabled      bool    `json:"enabled"`
	InputTokens  int     `json:"input_tokens"`
	OutputTokens int     `json:"output_tokens"`
	Reduction    float64 `json:"reduction"`
	LatencyMs    float64 `json:"latency_ms"`
}

StageStatsPL is the serialisable form of pipeline.StageStats.

type StatsResponse

type StatsResponse struct {
	Retrieved           int   `json:"retrieved"`
	Clustered           int   `json:"clustered"`
	Returned            int   `json:"returned"`
	RetrievalLatencyMs  int64 `json:"retrieval_latency_ms"`
	ClusteringLatencyMs int64 `json:"clustering_latency_ms"`
	TotalLatencyMs      int64 `json:"total_latency_ms"`
}

StatsResponse contains processing statistics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL