-
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
feat(AI-proxy-plugin): support the new /v1/messages API provided by Anthropic #12699
Conversation
I think you have got this bang on, looks good. I think you're right that we don't need to support both old and new Claude. |
@@ -0,0 +1,5 @@ | |||
"message": "**AI-Proxy**: To support the new messages API of `Anthropic`, the upstream path of the `Anthropic` for `llm/v1/chat` route type is changed from `/v1/complete` to `/v1/messages`" |
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.
would this be a breaking change to mention in changelog?
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.
@fffonion Let me mention it in changelog, thanks!
@ttyS0e Could you give this a review please? Thanks! |
ae09b09
to
450fcb7
Compare
Yes this is fantastic, if possible please merge so I can then add the "Streaming" transformation over the top for my PR. |
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.
Yes this is great, I need to add streaming support too so if any bug is found I will just roll up the fixes into the next commit.
kong/llm/drivers/anthropic.lua
Outdated
if response_table.completion then | ||
local function extract_text_from_content(content) | ||
local buf = buffer:new() | ||
buf:reset() |
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.
Do we need to reset the buffer? it was created in the previous line
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.
Just a couple things, otherwise LGTM
7e9821b
to
ef0ec90
Compare
ef0ec90
to
90f8410
Compare
Anthropic. In this PR, the upstream path of Anthropic for `llm/v1/chat` route type is changed, pointing to the new API path: `/v1/messages`. According to the docs of Anthropic, the `text completion` API has been deprecated. FTI-5770
…angelog/unleased/kong/
Co-authored-by: Brent Yarger <brent.yarger@konghq.com>
90f8410
to
429bfa8
Compare
#12792 depends on this too. I can finish off the comments here today. |
d81f3e4
to
2d3ec5e
Compare
Successfully created cherry-pick PR for |
Summary
Support the newly provided API
/v1/messages
of Anthropic in AI-proxy plugin.In this PR, the upstream path of Anthropic for
llm/v1/chat
route type is changed from pointing to/v1/complete
to now pointing to the new API path/v1/messages
.A doc page PR is needed correspondingly for this update.
Checklist
CHANGELOG/unreleased/kong
or addingskip-changelog
label on PR if unnecessary. README.mdIssue reference
FTI-5770