feat(perplexity): add X-Pplx-Integration attribution header - #2903
feat(perplexity): add X-Pplx-Integration attribution header#2903jliounis wants to merge 1 commit into
Conversation
|
james-pplx seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Hi @jliounis, thanks for the contribution! Before we can review or merge this PR, you need to sign our Contributor License Agreement — the Once the CLA is signed, the check turns green, the ⏳ If the CLA isn't signed within 3 days, this PR will be marked stale and closed 7 days after that. Signing later and reopening is always an option. |
* feat(perplexity): add X-Pplx-Integration attribution header Perplexity attributes AG2 traffic in api-gateway logs via this header. Merged into user-supplied default_headers, no-op for users. Refs ag2ai#2903 * refactor(perplexity): move header merge into toolkit method Header name extracted to module constant. Merge runs once at tool creation instead of per SDK call. * refactor(perplexity): merge attribution header in init Attribution header is an integral part of this client, not a per-request concern, so it is merged into default_headers once in __init__.
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 41 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Summary
X-Pplx-Integration: ag2/<version>default header to Perplexity SDK client construction for both AG2 Perplexity tools.default_headersso existing client customization remains intact.Motivation
The original Perplexity integration in #2752 added the tools but did not include this attribution header. The header lets Perplexity attribute Search API traffic back to AG2 through api-gateway logs and metrics. This is a no-op for users; it only adds an HTTP request header on Perplexity SDK calls.
Testing
uv run pytest test/beta/tools/search/test_perplexity.pyuv run ruff check autogen/beta/tools/search/perplexity.py test/beta/tools/search/test_perplexity.pyuv run ruff format --check autogen/beta/tools/search/perplexity.py test/beta/tools/search/test_perplexity.pyNote: current
maindoes not containtest/beta/tools/search/test_perplexity_search_api.py; the Perplexity Search API and chat-completions coverage is consolidated intest/beta/tools/search/test_perplexity.py.🤖 Generated by PSI
🧠 Agent used:
codex