Repository navigation
feat(openai_api_compatible): support custom rerank endpoint URL - #3821
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Complete endpoint URLs are logged verbatim, potentially exposing sensitive query parameters or userinfo.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds configurable full endpoint URLs for OpenAI-compatible rerank models while preserving legacy routing.
Changes:
- Routes text, multimodal, and validation requests through the custom endpoint.
- Adds configuration UI and regression tests.
- Bumps the plugin version.
File summaries
| File | Description |
|---|---|
models/openai_api_compatible/models/rerank/rerank.py |
Resolves and uses custom rerank URLs. |
models/openai_api_compatible/provider/openai_api_compatible.yaml |
Adds the endpoint configuration field. |
models/openai_api_compatible/tests/test_rerank_authorization.py |
Tests custom and fallback routing. |
models/openai_api_compatible/manifest.yaml |
Bumps version to 0.0.65. |
Review details
Suppressed comments (1)
models/openai_api_compatible/models/rerank/rerank.py:259
- This also logs the complete custom endpoint in multimodal mode, including any query string or embedded userinfo. Avoid recording the raw configured URL so sensitive endpoint parameters cannot leak into logs.
f"Rerank API Request (multimodal mode) to {rerank_endpoint_url}"
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Request exceptions can expose sensitive query parameters from custom endpoint URLs.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
models/openai_api_compatible/models/rerank/rerank.py:264
- The multimodal path has the same error-channel exposure:
requestsexceptions include this full URL, including its query string, and lines 317-320 propagatestr(ex). A failed request to a signed custom endpoint can therefore disclose URL credentials even though the normal request log omits the URL. Sanitize userinfo/query data before wrapping the exception, or return an error that contains no request URL.
rerank_endpoint_url,
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
Mairuis
left a comment
There was a problem hiding this comment.
Reviewed the custom endpoint routing, blank-value fallback, authorization preservation and sanitized request errors. Updated the branch from main and advanced the plugin version to 0.0.66 because 0.0.65 is already on main. Full local suite on the updated branch: 84 passed. Approving to run plugin CI; merge remains pending CI.
There was a problem hiding this comment.
🟢 Approval recommended
The endpoint routing and sanitization changes are coherent, backward-compatible, and adequately covered by targeted tests.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Summary
Adds an optional complete
rerank_endpoint_urlfor OpenAI-compatible rerank models.When configured, text and multimodal invocations and credential validation send requests directly to that URL.
When omitted or blank, the existing API Base URL +
/rerankbehavior remains unchanged.The configuration placeholder documents the fallback behavior and warns against including credentials or tokens in the URL.
Request failures retain safe HTTP status or error-type diagnostics without exposing the configured URL.
Malformed successful responses are reported without exposing response values through validation errors.
Rerank logs no longer include endpoint URLs, query or document content, payloads, rejected image URLs, or error response bodies.
This supports services such as Alibaba Cloud Model Studio, whose compatible rerank endpoint ends in
/v1/reranks.Release Notes
/rerank.Change Type
Screenshots / Videos
Not available in this environment.
The schema-driven configuration field was validated through provider-schema parsing and plugin packaging.
LLM Plugin Checklist
Areas affected by this change
Version
versioninmanifest.yamlfrom0.0.65to0.0.66.dify_plugin>=0.3.0,<0.6.0is declared inpyproject.tomland locked inuv.lock.The SDK dependency is unchanged because this plugin already declares and locks
dify_plugin0.9.0.Testing
88 passed).16 passed).dify_plugin0.9.0.