Skip to content

feat(perplexity): send X-Pplx-Integration header from the recipe - #364

Open
qirh wants to merge 1 commit into
future-agi:devfrom
qirh:feat/perplexity-integration-header
Open

qirh wants to merge 1 commit into
future-agi:devfrom
qirh:feat/perplexity-integration-header

Conversation

@qirh

@qirh qirh commented Oct 31, 2026 •

Copy link
Copy Markdown

What does this PR do?

The Perplexity recipe now sets X-Pplx-Integration: traceai on its OpenAI client, only when the validated base URL host is exactly api.perplexity.ai. Loopback and any other host get no extra header. Authentication, request bodies and tracing are unchanged.

Why?

The header lets Perplexity attribute API traffic that comes from this recipe, which helps them understand and support integrations like this one.

How was it tested?

  • Added assertions to test_perplexity_recipe.py: every vendor request carries exactly one x-pplx-integration: traceai header, and a loopback base URL sends none.
  • Ran python/examples/perplexity/tests the way openai-compatible-recipe-tests.yml does, on Python 3.11: openai 3.24.0 source mode, openai 1.69.0 source mode, and openai 3.24.0 published mode (traceAI-openai 0.1.10, fi-instrumentation-otel 1.1.0). 187 passed in each. With the app.py change reverted, 11 tests fail on the new assertions.
  • ruff check on the two touched files reports the same 5 findings as dev and none added.

Notes for reviewers

Two files changed: src/app.py (8 lines) and the recipe test (2 lines). README not updated since no env vars or public behavior changed.

Set X-Pplx-Integration: traceai on the recipe's OpenAI client only when
the base URL host is api.perplexity.ai, so Perplexity can attribute
traffic from this recipe. Loopback and other hosts get no header.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant