fix: accept LF-terminated Perplexity streams - #11
Merged
Merged
Conversation
voodoohop
commented
Sep 9, 2026
Member
- Fixes Perplexity streams being buffered as one JSON object when upstream uses LF instead of CRLF. Accepts both separators; keeps raw SSE valid when no transformer is selected.
- Keeps the existing Perplexity adapter, developer-to-system conversion, model routes, OpenRouter fallbacks, prices, usage validation, and retries unchanged. The compatible-adapter alternative rejected developer messages, so it was discarded.
- Reproduced the exact JSON parse failure with a captured live response. Five framing regression tests pass (LF/CRLF, byte-split UTF-8, raw passthrough); the LF tests fail on the old parser.
- Seven live requests through local patched Portkey and Gen’s existing client/validator pass: all three Sonar models, streaming/non-streaming, high-search citations and usage, plus a developer-message request. Non-stream cost metadata stripping remains separate in fix: preserve Perplexity usage cost in non-strict mode #7.
- Validation: 52 focused tests, formatting, diff check, and build pass. Full-suite setup failures remain; type checking reports the same 12 errors on unchanged main. No production deployment or secret changes. Complements feat: add OpenRouter fallbacks for Perplexity Sonar models pollinations#14642.
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.