Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / Source
The character budget
Records when the budget truncated the response.
PINNED SOURCE Copied from the repository at this commit. Source, not an execution.
PHAROS at 975a38dMIT license
_Budgetbackend/app/codeintel/context.py, lines 64–79Open source
@dataclassclass _Budget: limit: int used: int = 0 truncated: bool = False def take(self, text: str) -> str | None: remaining = self.limit - self.used if remaining <= 0: self.truncated = True return None if len(text) > remaining: self.truncated = True text = text[:remaining] self.used += len(text) return textWhere this comes from
- Commit
975a38d5d17839c26ee219295a5be6ac66b6d910- File
backend/app/codeintel/context.py- Lines
- 64–79
- Git blob
0c4a7dd4639651a5c13142d168630e344439f22a- 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/context.py
git show 975a38d:backend/app/codeintel/context.py | sed -n '64,79p'