docs: add Paritok proxy callback integration - #784
Open
illiand wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is Paritok
Paritok is an open-source context-compression layer for LLM agents. Coding agents in particular re-send a large, growing prefix every turn — tool schemas, file reads, tool outputs, prior history — and you pay the upstream provider for all of it on every request. Paritok shrinks that prefix before it leaves LiteLLM:
[REF:id]stub.read_originaltool to get the exact, verbatim bytes of anything that was shortened, so nothing is permanently lost.Edit/str_replacecalls the model authored against a compressed view are rewritten to match the real file, so exact-match edits still apply.The net effect: fewer tokens billed upstream and a context window that lasts more turns, with no change to the user's app or agent code.
Why this PR
litellm-paritokis a standard LiteLLM ProxyCustomLogger— it plugs in purely through the documentedcallbacks: ["module.instance"]mechanism and requires no changes to LiteLLM itself. This PR only adds documentation pointing users at the pip package, so LiteLLM Proxy users can enable compression with a single config line.How it works (in LiteLLM terms)
async_pre_call_hook→ filter tools + compress content, return the modified request.async_post_call_success_hook→ resolveread_originalrecall calls and apply edit recovery on the response.Both are the proxy-only call hooks documented in Custom Callback Class, so the integration is Proxy-scoped (called out on the page).
Changes
docs/observability/paritok_integration.mdsidebars.js: one line under Callbacks and customizationdocs/observability/callbacks.md: one bullet under Supported Callback IntegrationsLinks
npm run buildpasses locally (no broken links introduced by this PR).