Skip to content

Commit

Permalink
fix(ai): fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl committed Jan 3, 2025
1 parent b6723e6 commit 4034d6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/03-plugins/38-ai-proxy/09-streaming_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ for _, strategy in helpers.all_strategies() do

assert.equal(#events, 8)
assert.equal(buf:tostring(), "The answer to 1 + 1 is 2.")
-- to verifiy not enable `kong.service.request.enable_buffering()`
assert.logfile().has.no.line("/kong_buffered_http", true, 10)
end)

it("good stream request openai with partial split chunks", function()
Expand Down Expand Up @@ -728,6 +730,8 @@ for _, strategy in helpers.all_strategies() do
assert.same(tonumber(string.format("%.3f", actual_time_per_token)), tonumber(string.format("%.3f", time_per_token)))
assert.match_re(actual_request_log, [[.*content.*What is 1 \+ 1.*]])
assert.match_re(actual_response_log, [[.*content.*The answer.*]])
-- to verifiy not enable `kong.service.request.enable_buffering()`
assert.logfile().has.no.line("/kong_buffered_http", true, 10)
end)

it("good stream request cohere", function()
Expand Down Expand Up @@ -790,6 +794,8 @@ for _, strategy in helpers.all_strategies() do

assert.equal(#events, 17)
assert.equal(buf:tostring(), "1 + 1 = 2. This is the most basic example of addition.")
-- to verifiy not enable `kong.service.request.enable_buffering()`
assert.logfile().has.no.line("/kong_buffered_http", true, 10)
end)

it("good stream request anthropic", function()
Expand Down Expand Up @@ -852,6 +858,8 @@ for _, strategy in helpers.all_strategies() do

assert.equal(#events, 8)
assert.equal(buf:tostring(), "1 + 1 = 2")
-- to verifiy not enable `kong.service.request.enable_buffering()`
assert.logfile().has.no.line("/kong_buffered_http", true, 10)
end)

it("bad request is returned to the client not-streamed", function()
Expand Down Expand Up @@ -902,6 +910,8 @@ for _, strategy in helpers.all_strategies() do

assert.equal(#events, 1)
assert.equal(res.status, 400)
-- to verifiy not enable `kong.service.request.enable_buffering()`
assert.logfile().has.no.line("/kong_buffered_http", true, 10)
end)

end)
Expand Down

0 comments on commit 4034d6f

Please sign in to comment.