Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / module
embeddings
codeintel.embeddings
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| _normalize | embeddings.py | same file |
| _pad | embeddings.py | same file |
| _PrefixMixin | embeddings.py | same file |
| _read_profile | embeddings.py | same file |
| _use_prefixes | embeddings.py | same file |
| EdgeFirstEmbedder | embeddings.py | same file |
| Embedder | embeddings.py | same file |
| EmbeddingUnavailable | embeddings.py | same file |
| get_embedder | embeddings.py | same file |
| HashEmbedder | embeddings.py | same file |
| HttpEmbedder | embeddings.py | same file |
| OnnxEmbedder | embeddings.py | same file |
| reset_embedder_cache | embeddings.py | same file |
| resolve_backend | embeddings.py | same file |
| SentenceTransformerEmbedder | embeddings.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| text | text.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| context | context.py | through an import |
| describe | describe.py | through an import |
| edge_server | edge_server.py | through an import |
| indexer | indexer.py | through an import |
| jobs | jobs.py | through an import |
| retrieval | retrieval.py | through an import |
| router | router.py | through an import |
| native_server | native_server.py | through an import |
codeintel.embeddingsbackend/app/codeintel/embeddings.py, lines 1–40Open source
"""Embedding backends.Every chunk embedding is stored together with the ``model_id`` of theembedder that produced it. Dense retrieval only compares a query vector withchunk vectors of the same ``model_id`` — vectors from different models livein unrelated spaces and comparing them returns confident nonsense.Backends (``EMBEDDING_BACKEND``):``hash`` Deterministic feature-hashing of identifier-split tokens into 768 dims. No dependencies, no network, CPU-only. **It is a lexical model, not a semantic one** — it exists so the whole pipeline (indexing, pgvector, fusion) can be exercised offline and in CI. Its retrieval quality is reported separately in the benchmarks and must not be presented as neural dense retrieval.``sentence-transformers`` Local model, default ``nomic-ai/nomic-embed-text-v1`` (the production model). Needs ``requirements-edge.txt`` (torch). Uses CUDA when present.``http`` POSTs to an embedding server (the edge worker's ``/embed`` endpoint, reached over Tailscale in production). Optional bearer token.``onnx`` A sentence-transformers model exported to ONNX (``model.onnx`` + ``tokenizer.json`` in ``EMBEDDING_ONNX_DIR``), run with onnxruntime on CPU. Mean pooling + L2 normalisation.``none`` No embeddings: keyword retrieval only; dense/hybrid report unavailable.Models with fewer than 768 dimensions are zero-padded to the column width.Zero padding leaves dot products and norms unchanged, so cosine similarityis exactly preserved."""from __future__ import annotationsimport hashlibimport jsonimport loggingimport mathShows the first 40 of 521 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
module backend.app.codeintel.embeddings- File
backend/app/codeintel/embeddings.py- Lines
- 1–521
- Parser
- python-ast
- Git blob
df7f8202f23ca6ad2c57aca5f09b435eb6486d79- Call sites
- 2 named, 0 resolved, 2 left unlinked
- Outside this subset
- 17 more edges reach code outside the graph shown here
