Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ai): fix Azure streaming with raw JSON transmission mode #14148

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

tysoekong
Copy link
Contributor

@tysoekong tysoekong commented Jan 14, 2025

Summary

Fixes Azure streaming when "JSON mode" is used (i.e. when inline content safety is enabled).

It broke because the SSE chunk would start with [ or ' and be caught by the wrong switch statement in the parser.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

FTI-6419

Copy link
Contributor

@fffonion fffonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be trivial to add tests to cover this case?

@tysoekong
Copy link
Contributor Author

tysoekong commented Jan 14, 2025

@fffonion The tests already cover the case, but for some reason started failing. I think something changed in chunked requests in some backport.

It's working fine now.

I mean: it's tested by the integration suite for AI Gateway.

@AntoineJac
Copy link
Contributor

I start looking the code. LGTM but for info I never manage to replicate the issue on Azure...

@fffonion
Copy link
Contributor

due to timeline, will add unit test after merged.

@fffonion fffonion merged commit 17836b4 into master Jan 15, 2025
38 checks passed
@fffonion fffonion deleted the fix/ai_azure_streaming branch January 15, 2025 09:14
github-actions bot pushed a commit that referenced this pull request Jan 15, 2025
@team-gateway-bot
Copy link
Collaborator

Successfully created backport PR for release/3.9.x:

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

Successfully merging this pull request may close these issues.

5 participants