2026-05-13">
Skip to content

API Reference

Semvec is a single wheel that exposes its capabilities across a handful of Python namespaces. Every public symbol is listed on one of the following pages:

Page Covers
Core (semvec) SemvecState, SemvecConfig, MultiResolutionMemory, PhaseDetector, LiteralCache, safe_cosine_similarity, exceptions
Token reduction (semvec.token_reduction) SemvecStateSerializer, SemvecChatProxy, OpenAIClient, OllamaClient, LLMConfig, create_llm_client, TokenCounter, estimate_tokens, get_phase_prompt
Cortex (semvec.cortex) SemvecAgentNetwork, SemvecAgent, SemvecCortexObserver, WeightedAverageAggregation, AttentionAggregation, ConsensusEngine, ConsensusProposal, ConsensusLevel, StateVectorPacket, TransferType, SemvecCortexService
Coding (semvec.coding) CodingEngine, CodePointer, CodePointerIndex, NegativeAttractor, NegativeAttractorSet, PromptBuilder, TranscriptParser, CompactionState, mcp_server, hooks.*
REST API (semvec.api) FastAPI app factory + every endpoint + status-code table for the semvec[api] extra
CLI (semvec serve) Command-line reference + env-var table for running the REST server

Conventions

  • Kwargs over positional. Every constructor with more than two parameters takes keyword arguments.
  • No hash fallback. Anything embedding-backed refuses to silently substitute a deterministic pseudo-embedder — missing embedder raises RuntimeError with a ready-to-paste SentenceTransformer snippet.
  • Explicit errors. Every fail path raises a typed exception; every typed exception inherits from a short hierarchy rooted at SemvecError.
  • Result dicts. SemvecState.update() returns a dict with the keys similarity, beta, pattern_strength, fsm, phase, norm, topic_switch, novelty_score. Treat individual scalar values as opaque indicators useful for dashboards and dispatch; do not derive internal algorithms from them.
  • Internal tuning is internal. SemvecConfig contains adaptive tuning fields not part of the public surface; their defaults are calibrated for production workloads and may change between releases. Strip them from shared snapshots via to_bytes(include_adaptive_params=False).

Configuration & environment variables

  • SemvecConfig fields — every Python-level tuning knob with its default and purpose: Core API → SemvecConfig fields.
  • REST / server environment variables — every SEMVEC_* env var read by semvec serve and the supporting daemons, grouped by concern (server & auth, session lifecycle, embedder, retrieval, BM25-hybrid, cross-encoder rerank, anchors & extraction, compliance, licensing, API process): CLI → Environment variables.
  • Embedder daemon flagspython -m semvec.embedder flags are documented on the same page: CLI reference.

What this reference omits

Internal engine mechanics — update mathematics, phase-detection rules, retention scoring, topic-switch internals, multi-agent consensus and attention internals, and binary layout — are out of scope for this reference. For an NDA-bounded integration or security review, contact support@versino.de.