Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / Source

Is dense possible here?

Vectors from different models are never compared. A model mismatch makes dense unavailable.

PINNED SOURCE Copied from the repository at this commit. Source, not an execution.

PHAROS at 975a38dMIT license

Retriever._dense_unavailable_reasonbackend/app/codeintel/retrieval.py, lines 281–301Open source
    def _dense_unavailable_reason(self, filters: Filters) -> str | None:        if self.embedder is None:            return "no embedding backend configured (EMBEDDING_BACKEND=none)"        stmt = select(DocumentChunk.id).where(            DocumentChunk.embedding_model == self.embedder.model_id,            *self._filter_clauses(filters),        ).limit(1)        if self.db.execute(stmt).first() is not None:            return None        models = self.db.execute(            select(DocumentChunk.embedding_model)            .where(DocumentChunk.embedding_model.isnot(None), *self._filter_clauses(filters))            .distinct()            .limit(5)        ).scalars().all()        if models:            return (                f"index was embedded with {sorted(models)}, query embedder is "                f"{self.embedder.model_id!r}; re-index with the same EMBEDDING_BACKEND"            )        return "no chunk embeddings in the index"

Where this comes from

Commit
975a38d5d17839c26ee219295a5be6ac66b6d910
File
backend/app/codeintel/retrieval.py
Lines
281–301
Git blob
884729a39ae0b3d340ad83f75946677dcddf3791
License
MIT, © 2024–2026 Pharos Contributors. Notice

Read it on GitHub at this commit

Check it yourself

From a clone of the repository, the first command prints the blob above and the second prints these lines.

git rev-parse 975a38d:backend/app/codeintel/retrieval.py
git show 975a38d:backend/app/codeintel/retrieval.py | sed -n '281,301p'