Back to the room

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

Code Observatory / class

Embedder

codeintel.embeddings.Embedder

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 symbols

Loading

Contains (4)
SymbolFileResolved by
describeembeddings.pysame file
embed_documentsembeddings.pysame file
embed_queryembeddings.pysame file
encode_rawembeddings.pysame file
Inside (1)
SymbolFileResolved by
embeddingsembeddings.pysame file
codeintel.embeddings.Embedderbackend/app/codeintel/embeddings.py, lines 75–101Open source
class Embedder(ABC):    model_id: str    dim: int = EMBEDDING_DIM    #: True for models that capture meaning beyond shared tokens.    semantic: bool = True    @abstractmethod    def embed_documents(self, texts: list[str]) -> list[list[float]]: ...    def embed_query(self, text: str) -> list[float]:        return self.embed_documents([text])[0]    def encode_raw(self, texts: list[str]) -> list[list[float]]:        """Embed texts exactly as given (no task prefixes).        Used by the edge embed server: :class:`HttpEmbedder` clients add the        prefixes themselves, so the server must not add them again.        """        return self.embed_documents(texts)    def describe(self) -> dict:        return {            "backend": type(self).__name__,            "model_id": self.model_id,            "dim": self.dim,            "semantic": self.semantic,        }

What the index recorded

Signature
class Embedder(ABC):
File
backend/app/codeintel/embeddings.py
Lines
75–101
Parser
python-ast
Git blob
df7f8202f23ca6ad2c57aca5f09b435eb6486d79

Read it on GitHub at this commit