Documentation
¶
Overview ¶
Package api implements eyrie's internal HTTP API server (Server) and its configuration, including the reranker interface used to score results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Store storage.Store
Analytics storage.AnalyticsStore // optional: enables /api/usage, /api/costs
Provider client.Provider
HealthChecker *eyrie.HealthChecker // optional: enables /api/health/providers
Reranker Reranker // optional: provider-backed /rerank; nil => lexical fallback
APIKey string
Port int
// VirtualKeyResolver optionally maps an inbound bearer/API-key token to a
// logical virtual key id. When set, the resolved id is injected into the
// request context so a BudgetProvider in the provider chain can enforce
// per-key budgets. When nil, requests are unmetered (existing behavior).
VirtualKeyResolver func(token string) string
}
type Reranker ¶
type Reranker interface {
// Rerank returns relevance scores in [0,1] for each document, in the same
// order as the input documents.
Rerank(ctx context.Context, model, query string, documents []string) ([]float64, error)
}
Reranker is the provider-backed reranking interface. A concrete implementation (e.g. backed by Cohere's /rerank API or a cross-encoder model) can be injected so /rerank uses model-quality scores instead of the local lexical fallback.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ListenAndServe ¶
func (*Server) RecordCost ¶
func (s *Server) RecordCost(rec *storage.CostRecord)
RecordCost persists a cost entry. Callers (e.g. the conversation engine or middleware) should invoke this after each completed LLM request.
Click to show internal directories.
Click to hide internal directories.