Skip to content

fix: ai-request-rewrite plugin wrong test #12083

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LiteSun
Copy link
Member

@LiteSun LiteSun commented Mar 25, 2025

Description

In the ai-request-rewrite2.ts file, the TEST 3 case was incorrectly configured with the wrong plugin. It has now been corrected.

deepend on #12101

Fixes # (issue)

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Mar 25, 2025
@@ -124,13 +124,12 @@ local function request_to_llm(conf, request_table, ctx)
model_options = conf.options
}

local res, err, httpc = ai_driver:request(conf, request_table, extra_opts)
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to manully close according to the docs
https://github.com/openresty/lua-nginx-module#tcpsockclose
image

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/apache/apisix/blob/master/apisix/plugins/ai-drivers/openai-base.lua#L131

It seems that only two parameters were returned, why didn't painc occur before?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think at least one pass case is needed, and there should be no error level logs.

Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/apache/apisix/blob/master/apisix/plugins/ai-drivers/openai-base.lua#L131

It seems that only two parameters were returned, why didn't painc occur before?

This issue occurred because when I started development and created my branch, the function was returning three parameters. After this PR was merged: https://github.com/apache/apisix/pull/12030/files#diff-b9bb0990d3ea842c42b094837737acfb597e2c8bf3a976dda8be56c84ef5b3c0L109, the returned parameters were adjusted. The code in my branch hasn't been synchronized with upstream, which caused this inconsistency.

I think at least one pass case is needed, and there should be no error level logs.

The test cases are already covered, and the tests cannot pass without making this change.

@LiteSun LiteSun requested review from nic-6443 and Revolyssup March 27, 2025 00:58
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 27, 2025
@LiteSun LiteSun requested review from nic-6443 and AlinsRan March 27, 2025 09:34
@Baoyuantop Baoyuantop moved this to 👀 In review in ⚡️ Apache APISIX Roadmap Mar 28, 2025
@LiteSun LiteSun marked this pull request as draft March 31, 2025 01:59
@Baoyuantop Baoyuantop moved this from 👀 In review to 🏗 In progress in ⚡️ Apache APISIX Roadmap Apr 1, 2025
Copy link
Contributor

@Baoyuantop Baoyuantop left a comment

Choose a reason for hiding this comment

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

Please revise to a meaningful PR title

@LiteSun LiteSun changed the title fix: ai-request-rewrite test fix: ai-request-rewrite plugin wrong test Apr 3, 2025
@LiteSun LiteSun changed the title fix: ai-request-rewrite plugin wrong test fix: ai-request-rewrite plugin wrong test Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants