Back to the room

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

Code Observatory / Source

What gets embedded

A chunk is embedded from its signature, docstring, calls and first body lines, not from raw source.

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

PHAROS at 975a38dMIT license

semantic_summarybackend/app/codeintel/text.py, lines 117–149Open source
def semantic_summary(sym: Symbol, *, language: str, path: str, module_name: str, body: str = "",                     description: str = "") -> str:    '''The text that gets embedded for a chunk (not the raw source).    Format::        [python] pkg/auth.py :: TokenStore.issue        def issue(self, user):            """Issue a signed token."""            payload = {"sub": user.id}            return self._sign(encode(payload))            calls: [_sign, encode]    ``body`` (see :func:`body_excerpt`) goes before the call list: embedders    truncate long inputs (MiniLM at 256 tokens), and the body says more.    '''    local_name = sym.qualified_name    if module_name and local_name.startswith(module_name + "."):        local_name = local_name[len(module_name) + 1 :]    if sym.kind in ("module", "block"):        header = f"[{language}] {path}"    else:        header = f"[{language}] {path} :: {local_name}"    lines = [header, sym.signature] if sym.signature else [header]    if sym.docstring:        lines.append(f'    """{sym.docstring}"""')    if description:        lines.append(f"    purpose: {description}")    if body:        lines.append(body)    if sym.calls:        lines.append(f"    calls: [{', '.join(sym.calls[:20])}]")    return "\n".join(lines)

Where this comes from

Commit
975a38d5d17839c26ee219295a5be6ac66b6d910
File
backend/app/codeintel/text.py
Lines
117–149
Git blob
74781c9c047d5953611fd7634b2cf29e7661b895
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/text.py
git show 975a38d:backend/app/codeintel/text.py | sed -n '117,149p'