Skip to content

docs: add vecr-compress integration provider page#3677

Open
Mythacker (h2cker) wants to merge 7 commits intolangchain-ai:mainfrom
h2cker:patch-1
Open

docs: add vecr-compress integration provider page#3677
Mythacker (h2cker) wants to merge 7 commits intolangchain-ai:mainfrom
h2cker:patch-1

Conversation

@h2cker
Copy link
Copy Markdown

Summary

vecr-compress is an open-source LLM context compressor that provides a deterministic retention contract: order IDs, dates, URLs, emails, and code references are pinned by an auditable regex whitelist before any token-budget packing runs. This PR adds a provider page for the langchain-vecr-compress partner package under src/oss/integrations/providers/, so users can discover it via the official integrations index.

What this PR adds

  • New MDX page at src/oss/integrations/providers/vecr-compress.mdx listing the langchain-vecr-compress partner package, install instructions, and a minimal usage example.

Partner package

Why this belongs in LangChain docs

  • Deterministic retention contract — unlike existing compressors (e.g. LLMLingua), vecr-compress guarantees via regex whitelist that structured tokens (IDs, amounts, dates, URLs) are never dropped regardless of token budget. Auditable and unit-testable.
  • Tested end-to-end with langchain_coreVecrContextCompressor round-trips HumanMessage / SystemMessage / AIMessage including AIMessage.tool_calls via Anthropic-style tool_use content blocks.
  • Complementary, not duplicative — vecr-compress targets correctness/compliance; LLMLingua targets maximum compression ratio. Different problems; they layer well together.

How to test

pip install langchain-vecr-compress langchain-core
python - <<'EOF'
from langchain_core.messages import HumanMessage, SystemMessage
from langchain_vecr_compress import VecrContextCompressor

compressor = VecrContextCompressor(budget_tokens=120)
msgs = [
    SystemMessage(content="You are a refund analyst."),
    HumanMessage(content="Order ORD-99172 placed 2026-03-15. Amount $1,499.00."),
    HumanMessage(content="Hi there, just wanted to say hello!"),
]
out = compressor.compress_messages(msgs)
texts = [m.content for m in out]
assert any("ORD-99172" in t for t in texts), "retention contract broken"
print("OK:", [type(m).__name__ for m in out])
EOF

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for opening a docs PR, Mythacker (@h2cker)! When it's ready for review, please add the relevant reviewers:

  • @npentrel or @lnhsingh (open source)

@github-actions github-actions Bot added oss external User is not a member of langchain-ai labels Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

❌ Import check failed

This PR contains imports from langchain_core that should be imported from langchain instead.

Detailed issues
Analyzing diff for import issues...
 Found 1 import issues:

File: src/oss/integrations/providers/vecr-compress.mdx
Line: 27
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
Suggested: from langchain.messages import AIMessage, HumanMessage, SystemMessage
--------------------------------------------------------------------------------

 Found 1 import issues that need to be fixed.

Why this is a problem

The langchain package re-exports many modules and classes from langchain_core. When possible, imports should use langchain instead of langchain_core for:

  • Better user experience (single import source)
  • Consistency across documentation
  • Reduced cognitive load for users

How to fix

Replace the imports as suggested above. For example:

  • from langchain_core.messages import HumanMessage
  • from langchain.messages import HumanMessage

🤖 Automated check

This check is based on the latest analysis of langchain re-exports from langchain_core.

@mdrxy Mason Daugherty (mdrxy) added the integration For docs updates for LangChain integrations label Apr 22, 2026
Updated the description and installation instructions for vecr-compress. Added details on question-aware scoring and custom retention rules.
@h2cker
Copy link
Copy Markdown
Author

Naomi Pentrel (@npentrel) Lauren Hirata Singh (@lnhsingh) — ready for review when you have a moment. Quick context:

What this adds
A single new page: src/oss/integrations/providers/vecr-compress.mdx — docs entry for the vecr-compress LangChain adapter (VecrContextCompressor).

Why it's low-risk to review

  • Pure docs change. One file added, nothing else touched.
  • The adapter code lives in the vecr-compress package itself (pip install 'vecr-compress[langchain]'), not in this repo — so LangChain doesn't take on any runtime dependency or maintenance burden.
  • Apache 2.0, Python 3.10+, no network calls, no new framework surface.

What it does in one line
Deterministic regex-whitelist pinning of structured tokens (IDs, dates, URLs, emails) before heuristic token-budget packing — so order IDs / citations / amounts survive compression by contract rather than by scorer luck.

CI
All green on ec929ff:

  • Vale lint ✅
  • langchain_core import check ✅ (uses from langchain.messages import ...)
  • links / test / lint / cross-refs / docs.json ✅

Happy to iterate on wording, rename the page, or trim the advanced-usage sections if you'd prefer a shorter page. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external User is not a member of langchain-ai integration For docs updates for LangChain integrations oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants