gardnerhan opened a new issue, #13447:
URL: https://github.com/apache/apisix/issues/13447

   ### Current Behavior
   
   The ai-request-rewrite plugin returns the LLM output directly as the HTTP 
response instead of forwarding the modified request body to the configured 
upstream server.
   
   Reference: https://apisix.apache.org/docs/apisix/plugins/ai-request-rewrite/
   
   ### Expected Behavior
   
   The plugin should forward the LLM-modified request body to the upstream 
server and return the upstream's response, not return the LLM output directly.
   
   ### Error Logs
   
   No error logs. The plugin executes successfully but returns the wrong 
response.
   
   ### Steps to Reproduce
   
   1. Create a route with ai-request-rewrite plugin and upstream:
   
   curl -X PUT "http://localhost:9180/apisix/admin/routes/test"; \
     -H "X-API-KEY: ${admin_key}" \
     -d '{
       "id": "test",
       "uri": "/test",
       "upstream": {"type": "roundrobin", "nodes": [{"host": "httpbin.org", 
"port": 80, "weight": 1}]},
       "plugins": {
         "ai-request-rewrite": {
           "prompt": "Add a field processed:true to the JSON. Return the 
modified JSON only.",
           "provider": "openai-compatible",
           "auth": {"header": {"Authorization": "Bearer <token>"}},
           "options": {"model": "MiniMax-M2.7-highspeed"},
           "override": {"endpoint": 
"https://aix.panther.sohurdc.com/v1/chat/completions"}
         }
       }
     }'
   
   2. Send a request:
   
   curl -X POST "http://localhost:9080/test"; -H "Content-Type: 
application/json" -d '{"name":"John"}'
   Actual Response: {"data":"{\"name\":\"John\",\"processed\":true}"}
   
   Expected Response: The upstream's response, not the LLM output directly.
   
   ### Environment
   
   - APISIX version: 3.16
   - Plugin: ai-request-rewrite
   - LLM Provider: openai-compatible (MiniMax-M2.7-highspeed)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to