Skip to content

feat(openai_api_compatible): support custom rerank endpoint URL - #3821

Merged
WH-2099 merged 6 commits into
mainfrom
feat/openai-api-compatible-rerank-endpoint-url
Sep 7, 2026
Merged

WH-2099 merged 6 commits into
mainfrom
feat/openai-api-compatible-rerank-endpoint-url

Conversation

@WH-2099

@WH-2099 WH-2099 commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds an optional complete rerank_endpoint_url for 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 + /rerank behavior 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

  • Added an optional Rerank Endpoint URL for OpenAI-compatible rerank models.
  • When unset, the plugin continues to use API Base URL + /rerank.
  • Reduced sensitive rerank data in logs and errors while retaining safe request diagnostics.

Change Type

  • Documentation / non-plugin change
  • Non-LLM plugin (tools, extensions, datasource, etc.)
  • LLM plugin

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
  • Message flow (system messages, user ↔ assistant turn-taking)
  • Tool interaction flow (multi-round usage, Agent App and Agent Node)
  • Multimodal input (images, PDFs, audio, video, etc.)
  • Multimodal output (images, audio, video, etc.)
  • Structured output (JSON, XML, etc.)
  • Token consumption metrics
  • Other LLM functionality (rerank endpoint routing)
  • New models / model parameter fixes

Version

  • Bumped top-level version in manifest.yaml from 0.0.65 to 0.0.66.
  • dify_plugin>=0.3.0,<0.6.0 is declared in pyproject.toml and locked in uv.lock.

The SDK dependency is unchanged because this plugin already declares and locks dify_plugin 0.9.0.

Version coordination: #3832 currently also proposes 0.0.66.
If it merges first, this branch must sync with main and advance to 0.0.67 before merge.

Testing

  • Fresh Python 3.12 environment: full plugin test suite passed (88 passed).
  • Targeted rerank regression suite passed (16 passed).
  • Provider schema parsed with dify_plugin 0.9.0.
  • Packaged successfully with Dify plugin CLI 0.6.10 and passed archive integrity validation.
  • Local deployment — Dify version: not available in this environment.
  • SaaS (cloud.dify.ai): not available in this environment.

@WH-2099 WH-2099 self-assigned this Sep 3, 2026
Copilot AI balanced review requested due to automatic review settings September 3, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Copilot AI review requested due to automatic review settings September 3, 2026 10:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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: requests exceptions include this full URL, including its query string, and lines 317-320 propagate str(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

Copilot AI review requested due to automatic review settings September 3, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The routing behavior is complete, backward-compatible, and covered by focused regression tests.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings September 7, 2026 09:42
Mairuis
Mairuis previously approved these changes Sep 7, 2026

@Mairuis Mairuis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Mairuis
Mairuis deployed to models/openai_api_compatible September 7, 2026 09:43 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Endpoint selection is consistently applied, preserves fallback behavior, and has focused regression coverage.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@WH-2099
WH-2099 marked this pull request as draft September 7, 2026 09:52
@WH-2099
WH-2099 marked this pull request as ready for review September 7, 2026 14:08
@WH-2099
WH-2099 requested review from Mairuis and Copilot and removed request for Copilot September 7, 2026 14:08
Copilot AI review requested due to automatic review settings September 7, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@WH-2099
WH-2099 enabled auto-merge (squash) September 7, 2026 14:47
@WH-2099
WH-2099 disabled auto-merge September 7, 2026 14:47
@Stream29
Stream29 deployed to models/openai_api_compatible September 7, 2026 15:16 — with GitHub Actions Active
@WH-2099
WH-2099 merged commit e1efdbe into main Sep 7, 2026
7 checks passed
@WH-2099
WH-2099 deleted the feat/openai-api-compatible-rerank-endpoint-url branch September 7, 2026 15:17

This branch was successfully deployed

1 active deployment
models/openai_api_compatible — 8ea8dedc Deployed Sep 7, 2026 by Stream29 via test (models/openai_api_compatible) #2691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants