Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
841b02d
feat(llm): support bedrock converse and retrieveAndGenerate API nativ…
oowl May 27, 2025
5a76275
fix(ai-prompt-decorator): increase max length for content field (#12515)
hackerchai May 28, 2025
e4afa5a
fix(ai-prompt-decorator): add ngx set body optional param to set_requ…
hackerchai May 28, 2025
88aa378
fix(pdk): properly encode boolean value in multipart request
fffonion May 12, 2025
700ae31
chore(llm): move keybastion to shared module
fffonion May 26, 2025
671f552
perf(llm): make parsing sse chunk 50% faster (#12574)
spacewander Jun 4, 2025
e23c303
fix(analytics): fixed an issue where some of the ai metrics not inclu…
liverpool8056 Jun 4, 2025
9172edb
chore(*): fix a typo in ai-proxy plugin
fffonion Jun 4, 2025
fb2c78f
fix(llm): every chunk should end with \n\n (#12468)
fffonion Jun 4, 2025
48989ac
fix(ai-bedrock): do not set api dimensionality for bedrock titan embe…
oowl Jun 6, 2025
c69a22d
fix(ai): set bedrock single-string tool response in correct field
oowl Jun 6, 2025
9906b70
fix(ai): ollama correct handling of tools and timestamp formats
oowl Jun 6, 2025
ff19e02
fix(ai-proxy): fix AI-response-transformer plugin subrequest llm API …
dylankyc Jun 11, 2025
81777ad
fix(ai-proxy): resp for observability may be larger than the real one
spacewander Jun 9, 2025
41688fe
fix(ai-proxy): fix AI Plugins with multiple capture groups
dylankyc Jun 18, 2025
ff69219
fix(ai-proxy): Implement latency metric for streaming responses (#12837)
spacewander Jun 18, 2025
5f44094
fix(ai-proxy): large request payload was not logged (#12915)
spacewander Jun 19, 2025
cd55370
fix(ai): support anthropic models in gemini (#12789)
tysoekong Jun 20, 2025
026f61c
fix(gemini): fix non-chat request handling for gemini driver
fffonion Jun 26, 2025
dbf9c7e
chore(ai-proxy): drop duplicate get_source check
spacewander Jun 17, 2025
ab7ef37
chore(*): address conflicts of normalize-sse-chunk
fffonion Oct 28, 2025
70ce939
fix(llm): fix error of failover for bedrock driver
fffonion Jun 24, 2025
f93d5e7
refactor(llm): move save-request-body to a standalone filter
fffonion Jul 7, 2025
aaa9ddc
fix(llm): fix ai plugin retry phase kong.plugin.ctx missing correct n…
oowl Jul 10, 2025
868c194
fix(llm): AI Proxy might produce duplicate content in the response wh…
spacewander Jul 12, 2025
75a3168
fix(embeddings): fix gemini vertex embeddings
fffonion Jul 11, 2025
8e0cf20
fix(llm): AI Proxy might drop content in the response when the SSE ev…
spacewander Jul 24, 2025
5b8ba71
fix(ai-proxy): aws stream parser didn't parse correctly when the fram…
spacewander Jul 28, 2025
073288f
fix(llm): fix ai driver set wrong target port when upstream using dif…
oowl Aug 1, 2025
17e2544
fix(ai-proxy): JSON array is not correctly parsed for Gemini and Cohe…
spacewander Aug 15, 2025
17bee13
fix(ai): gemini and anthropic correct stop_reason mappings
tysoekong Jul 8, 2025
292df8e
fix(tests): ai tests move to compare whole object
tysoekong Jul 8, 2025
0c7a96c
fix(ai): AG-405: add mappings for gemini structured output
tysoekong Jul 30, 2025
bb419c0
fix(ai): AG-405 add anthropic structured output support
tysoekong Jul 31, 2025
8110101
fix(ai): AG-405 add bedrock structured output support
ttyS0e Aug 14, 2025
616a41c
fix(ai): mistral unknown field seed error
tysoekong Aug 14, 2025
a22f671
tests(e2e): add tests for structured output
tysoekong Aug 13, 2025
8099159
chore(llm): add error handling and tests for iso_8601_to_epoch
fffonion Aug 15, 2025
ad4a9ad
fix(ai-proxy): map OpenAI chat completion's tool_choice when using An…
spacewander Aug 19, 2025
d9119d9
feat(gemini): add vertex ai model garden model support (#13734)
oowl Aug 20, 2025
4371897
fix(llm): fix content_type judgment typo
oowl Aug 20, 2025
a3edddc
fix(ai-proxy): `model` field was missing in OpenAI format response fr…
spacewander Aug 26, 2025
cb83bc1
fix(ai-proxy): `model` field was incorrect in Gemini responses with v…
spacewander Sep 1, 2025
49a7ee4
fix(ai-proxy): empty array in structured output was encoded as empty…
spacewander Sep 3, 2025
1cb319c
fix(ai): bedrock structured_output streaming responses
tysoekong Aug 21, 2025
18c688f
fix(ai): bedrock not supporting multiple toolUse in one turn
tysoekong Aug 21, 2025
c5e32ab
fix(ai): refactor gemini transformer to properly handle function call…
tysoekong Aug 21, 2025
787f5ef
fix(ai): anthropic streaming tool_use responses
tysoekong Aug 21, 2025
abebe4d
fix(ai): anthropic streaming tool_use responses
tysoekong Aug 21, 2025
cdbe47d
fix(ai): truncation of anthropic streaming responses when in mid-struct
tysoekong Sep 6, 2025
bc94412
feat(huggingface): add support for new serverless inference provider …
dylankyc Sep 15, 2025
6e61d75
fix(ai-proxy): fix huggingface embedding inproperly parsed and add e2…
dylankyc Sep 23, 2025
67ab86f
fix(ai): AG-488 Correctly return GCP Model Armor 'floor' failures [ai…
tysoekong Sep 23, 2025
312b61e
fix(ai-proxy): fix huggingface inference provider does not support us…
dylankyc Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**llm**: Added support for Bedrock agent SDK, including rerand, converse, converse-stream, retrieveAndGenerate, and retrieveAndGenerate-stream."
type: "feature"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**ai-proxy**: Added support for HuggingFace's new serverless API in the AI Proxy plugin, enabling seamless integration and improved compatibility.
type: "feature"
scope: "Plugin"
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/fix-ai-analytics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: Fixed an issue where some of ai metrics was missed in analytics
scope: Plugin
type: bugfix
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix-ai-bedrock-tool-use.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**AI Plugins**: Fixed an issue where Bedrock (Converse API) didn't properly parse multiple `toolUse` tool calls in one turn, on some models.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-driver**: Fixed an issue where AI Proxy and AI Proxy Advanced generated incorrect default ports for upstream schemes, leading to 400 errors.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**AI Plugins**: Fixed an issue where the Gemini provider would not correctly return Model Armor 'Floor' blocking responses to the caller.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where large request payload was not logged.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**ai-proxy**: Fixed an issue where patterns using multiple capture groups (e.g., `$(group1)/$(group2)`) failed to extract expected matches.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where the Anthropic provider mapped the wrong stop_reason to Chat and Completions responses.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where the Anthropic provider failed to stream function call responses.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where the Anthropic provider may truncate tokens in streaming responses.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**AI Plugins**: Fixed an issue Structured Output did not work correctly with Anthropic Claude models."
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**AI Plugins**: Fixed an issue where structured output did not work for the Bedrock provider when SSE streaming responses."
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**AI Plugins**: Fixed an issue Structured Output did not work correctly with Bedrock (Converse API) models."
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**AI Plugins**: Fixed an issue where the Gemini provider could not use Anthropic 'rawPredict' endpoint models hosted in Vertex."
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**AI Plugins**: Fixed an issue where `id`, `created`, and/or `finish_reason` fields were missing from or incorrect in Gemini responses."
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**ai-proxy**: Fixed an issue where `model` field was missing in OpenAI format response from Gemini provider in some situations."
type: "bugfix"
scope: "Plugin"
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix-ai-proxy-gemini-tool-calls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where the Gemini provider did not properly handle multiple tool calls across different turns.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where latency metric was not implemented for streaming responses.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**ai-proxy**: Fixed an issue when empty array in structured output was encoded as empty object."
type: "bugfix"
scope: "Plugin"
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/fix-ai-proxy-structured-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**AI Plugins**: Fixed an issue where Structured-Output requests were ignored."
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**ai-proxy-advanced**: Fixed an issue where ai-retry phase was not correctly setting the namespace in the kong.plugin.ctx, causing ai-proxy-advanced balancer retry first target more than once.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where aws stream parser didn't parse correctly when the frame was incomplete.
type: bugfix
scope: Plugin
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix-gemini-vertex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**Semantic Plugins*: Fixed an issue where Gemini Vertex AI embeddings failed due to incorrect URL construction and response parsing.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**ai-proxy**: Fixed an issue where HuggingFace embedding driver were incorrectly parsed responses from embedding API
type: bugfix
scope: Plugin
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix-json-array-iterator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where JSON array data is not correctly parsed.
type: bugfix
scope: Plugin
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix-llm-failover-bedrock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
Fixed an issue where AI Proxy and AI Proxy Advanced can't properly failover to a Bedrock target.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
Fixed an issue where AI Proxy and AI Proxy Advanced might produce duplicate content in the response when the SSE event was truncated.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
Fixed an issue where AI Proxy and AI Proxy Advanced might drop content in the response when the SSE event was truncated.
type: bugfix
scope: Plugin
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix-sse-terminator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where SSE terminator may not have correct ending characters.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where the response body for observability may be larger than the real one because of the stale data.
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**AI Proxy**: Fixed an issue where extra inputs were not permitted for huggingface inference provider
type: "bugfix"
scope: "Plugin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**AI Plugins**: Fixed unable to use Titan Text Embeddings models.
type: bugfix
scope: Plugin
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix_ai_gemini_model_garden.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
"AI Proxy Advanced: Fixed an issue where gemini provider not support model garden"
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
Fixed an issue where the `ai-prompt-decorator` plugin prompt field was too short.
type: feature
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**ai-prompt-decorator**: Fixed an issue where the plugin would miss the model, temperature, and other user-defined fields.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ai-proxy**: Fixed an issue where AI Proxy returns 403 using gemini provider.
type: bugfix
scope: Plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
**ollama**: Fixed an issue where 'tools' and 'RAG' decoration did not work for Ollama (llama2) provider.
type: bugfix
scope: Plugin
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix_mistral_remove_seed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**AI Proxy Advanced**: Fixed an issue where Mistral models would return `Unsupported field: seed` when using some inference libraries.
type: "bugfix"
scope: "Plugin"
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/perf-parse-sse-chunk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**ai-proxy**: Implemented a faster SSE parser."
type: "performance"
scope: "Plugin"
1 change: 1 addition & 0 deletions kong-latest.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ build = {
["kong.llm.plugin.shared-filters.parse-json-response"] = "kong/llm/plugin/shared-filters/parse-json-response.lua",
["kong.llm.plugin.shared-filters.parse-request"] = "kong/llm/plugin/shared-filters/parse-request.lua",
["kong.llm.plugin.shared-filters.parse-sse-chunk"] = "kong/llm/plugin/shared-filters/parse-sse-chunk.lua",
["kong.llm.plugin.shared-filters.save-request-body"] = "kong/llm/plugin/shared-filters/save-request-body.lua",
["kong.llm.plugin.shared-filters.serialize-analytics"] = "kong/llm/plugin/shared-filters/serialize-analytics.lua",

["kong.llm.adapters.bedrock"] = "kong/llm/adapters/bedrock.lua",
Expand Down
42 changes: 42 additions & 0 deletions kong/llm/adapters/bedrock.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local cjson = require("cjson.safe")
local fmt = string.format


local _BedrockAdapter = {}

_BedrockAdapter.role_map = {
Expand Down Expand Up @@ -305,10 +306,51 @@ function _BedrockAdapter:to_kong_req(bedrock_table, kong)
openai_table.tools = self:extract_tools(bedrock_table.toolConfig.tools)
end

local url = kong.request.get_path()
if url:find("/rerank", 1, true) then
self.forward_path = "/rerank"
openai_table.messages = bedrock_table.queries
return openai_table
elseif url:find("/retrieveAndGenerateStream", 1, true) then
self.forward_path = "/retrieveAndGenerateStream"
openai_table.prompt = bedrock_table.input and bedrock_table.input.text
openai_table.stream = true
return openai_table
elseif url:find("/retrieveAndGenerate", 1, true) then
self.forward_path = "/retrieveAndGenerate"
openai_table.prompt = bedrock_table.input and bedrock_table.input.text
return openai_table
elseif url:find('converse-stream',1, true) then
self.forward_path = "/model/%s/converse-stream"
openai_table.stream = true
return openai_table
elseif url:find("converse",1, true) then
self.forward_path = "/model/%s/converse"
return openai_table
end
return openai_table
end


function _BedrockAdapter:get_forwarded_path(model)
if not self.forward_path then
return
end

-- if the forward path is a string, it means we have to format it with the model name
if type(self.forward_path) == "string" then
local forward_path = fmt(self.forward_path, model)
if self.forward_path == "/rerank" or
self.forward_path == "/retrieveAndGenerate" or
self.forward_path == "/retrieveAndGenerateStream" then
return forward_path, "bedrock_agent"
end
return forward_path, "bedrock"
end

return
end

-- for unit tests
if _G.TEST then
_BedrockAdapter._set_kong = function(this_kong)
Expand Down
Loading
Loading