Skip to content

fix(ai-proxy): check type of choices/usage/content fields before use it#12548

Merged
Revolyssup merged 4 commits into
apache:masterfrom
Revolyssup:revolyssup/ai-proxy-type-check
Aug 28, 2025
Merged

fix(ai-proxy): check type of choices/usage/content fields before use it#12548
Revolyssup merged 4 commits into
apache:masterfrom
Revolyssup:revolyssup/ai-proxy-type-check

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

In the user's environment, the content field returned by the LLM service may be null. Our code needs to handle this case to avoid panic:

apisix/plugins/ai-drivers/openai-base.lua:160: invalid value (userdata) at index 1 in table for 'concat'

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:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Aug 27, 2025
Comment thread t/plugin/ai-proxy3.t Outdated
@Revolyssup

Copy link
Copy Markdown
Contributor Author

failing test unrelated and flaky

@Revolyssup
Revolyssup merged commit de03766 into apache:master Aug 28, 2025
30 of 31 checks passed
@Revolyssup
Revolyssup deleted the revolyssup/ai-proxy-type-check branch August 28, 2025 07:41
jizhuozhi pushed a commit to jizhuozhi/apisix that referenced this pull request Oct 18, 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

None yet

Development

Successfully merging this pull request may close these issues.

4 participants