-
Notifications
You must be signed in to change notification settings - Fork 2.8k
docs: improve ai-prompt-template plugin docs
#12897
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| curl "http://127.0.0.1:9180/apisix/admin/routes/1" -X PATCH \ | ||
| -H "X-API-KEY: ${admin_key}" \ | ||
| -d '{ | ||
| "uri": "/v1/chat/completions", | ||
| "upstream": { | ||
| "type": "roundrobin", | ||
| "nodes": { | ||
| "api.openai.com:443": 1 | ||
| }, | ||
| "scheme": "https", | ||
| "pass_host": "node" | ||
| }, | ||
| "plugins": { | ||
| "ai-prompt-template": { | ||
| "templates": [ | ||
| { | ||
| "name": "QnA with complexity", | ||
| "template": { | ||
| "model": "gpt-4", | ||
| "messages": [ | ||
| { | ||
| "role": "system", | ||
| "content": "Answer in {{complexity}}." | ||
| }, | ||
| { | ||
| "role": "user", | ||
| "content": "Explain {{prompt}}." | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "name": "echo", | ||
| "template": { | ||
| "model": "gpt-4", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "Echo {{prompt}}." | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }' | ||
| ``` |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proxy-rewrite plugin configuration is missing from this PATCH request, but it's required to set the Authorization header with the OpenAI API key. Since this is a PATCH request that only updates the ai-prompt-template plugin, the Authorization header from the previous configuration may not be preserved. Users following this example after the first example would lose authentication and get API errors. Consider either using PUT to include the full configuration or adding a note that the proxy-rewrite configuration from the previous example is still active.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Traky Deng <trakydeng@gmail.com>
Description
Improve the
ai-prompt-templateplugin doc and update the Chinese version accordingly.Checklist