AlinsRan commented on code in PR #13676:
URL: https://github.com/apache/apisix/pull/13676#discussion_r3576301661
##########
apisix/plugins/ai-providers/azure-openai.lua:
##########
@@ -32,6 +32,7 @@ return require("apisix.plugins.ai-providers.base").new(
path = "/completions",
rewrite_request_body = rewrite_chat_request_body,
},
+ ["openai-embeddings"] = { path = "/embeddings" },
Review Comment:
Confirmed — this was broken, thanks for catching it. `build_request`
resolves `parsed_url.path or opts.target_path`, and an Azure endpoint always
carries a path, so the capability `/embeddings` was dead code. Worse, my doc
example stopped at the deployment root, so following it would have POSTed there
and 404'd — and since every routing test used `provider: openai`, nothing
exercised this.
Went with (a), matching the convention the azure chat path and
`ai-cache-semantic` already use (full URL, `api-version` in the query):
- `azure-openai` now declares the capability with **no** default path
(`["openai-embeddings"] = {}`), so a path-less endpoint fails loudly in
`build_request` instead of silently building a wrong URL.
- `check_schema` rejects an azure `embeddings.endpoint` without a deployment
path — otherwise the route would fail open to the catchall on every request,
i.e. silently never work.
- Docs (en + zh) and the schema description now show the full URL:
`https://{resource}.openai.azure.com/openai/deployments/{deployment}/embeddings?api-version=2024-02-01`.
- Added an end-to-end test that drives a real azure-shaped URL and asserts
the request lands on the deployment path *with* `api-version`, plus a negative
schema test.
--
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]