-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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-plugins): streamline AI Proxy streaming system & add compatibilty for existing "client SDKs" #12903
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to spend some more time with this, but here are a couple of superficial suggestions.
kong/tools/http.lua
Outdated
-- | ||
-- @param path string the path to ensure is valid | ||
-- @return string the newly-formatted valid path, or the original path if nothing changed | ||
function _M.ensure_valid_path(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the context of kong.tools.utils
, ensure_valid_path
is not an appropriate name, as "path validity" is not a well defined concept. I would suggest start_with_slash
or something that is more narrow and precise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was like this because I was thinking to add a bunch more checks later, and the stencil function would make sense for others to use.
I have removed it for now - I can in next round of features if it's still needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still here, still not working for more than two slashes. use gsub
@hanshuebner It won't let me reply for some reason. This was a mistake and is no longer used, so I've removed it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/n
first pass; submitting to provide early feedback
@hanshuebner @jschmid1 I've fixed everything in comments here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2/n
I've had some things queued up
@jschmid1 I've done all comments, the only thing I don't know is the 'compatibility check' on the plugin conf schema, RE new field "upstream_path" |
ef31041
to
565ab59
Compare
565ab59
to
789bebf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good now, but I feel a bit uneasy without testing against actual endpoints. I agree that using mocked endpoints is beneficial for per-commit testing, but we should also implement a daily or weekly test against real endpoints.
Testing with these providers helps uncover issues related to timing, unexpected responses, changes in their API, and more.
Actually, lets get the version compat code in this PR as it would break tests otherwise. |
39d6c0a
to
b65a540
Compare
@jschmid1 Please hold the merge for one second, Antoine has fixes here that we should bring in here so that we don't have another EE cherry pick. |
@jschmid1 , ok I think we are good to go. Thanks |
Are further changes planned in this PR? @jschmid1 is your approval still OK? |
@hanshuebner , this PR is ready. |
Let me give it one last pass |
I'll do it yep, I will handle all the EE work |
…eaming system & add comp… (#8955) * refactor(ai-plugins): streamline AI Proxy streaming system & add compatibilty for existing "client SDKs" (#12903) * feat(ai-proxy): complete refactor of streaming subsystem --------- Signed-off-by: Joshua Schmid <jaiks@posteo.de> Co-authored-by: Antoine Jacquemin <ajacquem@gmail.com> Co-authored-by: Joshua Schmid <jaiks@posteo.de>
Summary
This PR supersedes:
by completely re-writing the AI Proxy streaming from "exit early" to something far more robust, using the existing body_filter transformer system.
This came out of testing with Customer G, where things like '\r\n' string literal being in any of the streaming response frame would break the plugin. Through not exiting early, it's also consistent with other AI service calls, and will produce much better compatibility with future AI roadmap functions later on.
It also fixes all the PR comments relating to the "Enable SDK compatibility", which PR is now closed and superseded by this one.
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
KAG-4126