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

refactor(ai-proxy) clean up code and fix gzip response #13155

Merged
merged 5 commits into from
Aug 7, 2024
Merged

Conversation

fffonion
Copy link
Contributor

@fffonion fffonion commented Jun 4, 2024

Summary

  • move shared ctx usage of ai plugins to use a proper API to make typo more obvious to be catched
  • only send gzipped response if client has Accept-Encoding that accepts gzip
  • style cleanup

Checklist

  • A changelog file has been added to CHANGELOG/unreleased/kong or adding skip-changelog label on PR if unnecessary. README.md

Issue reference

AG-39

fffonion added a commit that referenced this pull request Jun 4, 2024
@fffonion fffonion changed the title Ai proxy pr refactor(ai-proxy) enable buffered body filter Jun 4, 2024
fffonion added a commit that referenced this pull request Jun 4, 2024
@fffonion fffonion force-pushed the ai-proxy-pr branch 2 times, most recently from 5db01c5 to 5feeb6c Compare June 4, 2024 13:05
fffonion added a commit that referenced this pull request Jun 4, 2024
fffonion added a commit that referenced this pull request Jun 7, 2024
fffonion added a commit that referenced this pull request Jun 24, 2024
fffonion added a commit that referenced this pull request Jul 8, 2024
fffonion added a commit that referenced this pull request Jul 17, 2024
@oowl oowl self-requested a review July 29, 2024 06:51
fffonion added a commit that referenced this pull request Aug 2, 2024
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Aug 6, 2024
@fffonion fffonion changed the title refactor(ai-proxy) enable buffered body filter refactor(ai-proxy) enable buffered body filter and fix gzip response Aug 6, 2024
kong/llm/state.lua Outdated Show resolved Hide resolved
fffonion added a commit that referenced this pull request Aug 6, 2024
@fffonion fffonion changed the title refactor(ai-proxy) enable buffered body filter and fix gzip response refactor(ai-proxy) clean up code and fix gzip response Aug 6, 2024
fffonion added a commit that referenced this pull request Aug 6, 2024
fffonion added a commit that referenced this pull request Aug 6, 2024
end

function _M.should_disable_ai_proxy_response_transform()
return kong.ctx.shared.llm_disable_ai_proxy_response_transform == true
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a tiny suggestion: we can just return kong.ctx.shared.llm_disable_ai_proxy_response_transform since we ensure it is a bool itself by a dedicated function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, we can fix in the next round of refactor.

@fffonion fffonion merged commit bcc4980 into master Aug 7, 2024
25 checks passed
@fffonion fffonion deleted the ai-proxy-pr branch August 7, 2024 08:49
@team-gateway-bot
Copy link
Collaborator

Cherry-pick failed for master, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git remote add upstream https://github.com/kong/kong-ee
git fetch upstream master
git worktree add -d .worktree/cherry-pick-13155-to-master-to-upstream upstream/master
cd .worktree/cherry-pick-13155-to-master-to-upstream
git checkout -b cherry-pick-13155-to-master-to-upstream
ancref=$(git merge-base c882de932965a21d89100b1f1c1421b627460c4a a69eebff9ee61046c5f5d41d11813f3c9f390757)
git cherry-pick -x $ancref..a69eebff9ee61046c5f5d41d11813f3c9f390757

@github-actions github-actions bot added the incomplete-cherry-pick A cherry-pick was incomplete and needs manual intervention label Aug 7, 2024
fffonion added a commit that referenced this pull request Aug 9, 2024
Missing from #13155

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>
ProBrian pushed a commit that referenced this pull request Aug 13, 2024
Missing from #13155

Co-authored-by: Xumin <100666470+StarlightIbuki@users.noreply.github.com>
@kikito kikito removed the incomplete-cherry-pick A cherry-pick was incomplete and needs manual intervention label Aug 13, 2024
oowl pushed a commit that referenced this pull request Aug 15, 2024
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.

6 participants