Skip to content

feat: configurable Cohere reranker URL (Azure AI support)#12969

Open
npeham wants to merge 1 commit into
danny-avila:mainfrom
pcode-at:feat/MIA-201-cohere-url-env-variable-config
Open

feat: configurable Cohere reranker URL (Azure AI support)#12969
npeham wants to merge 1 commit into
danny-avila:mainfrom
pcode-at:feat/MIA-201-cohere-url-env-variable-config

Conversation

@npeham
Copy link
Copy Markdown

@npeham npeham commented May 6, 2026

Summary

Implements #12328

This PR adds support for an optional custom Cohere API URL configuration, allowing users to specify alternative Cohere endpoints (e.g., Azure AI serverless deployments or self-hosted instances). This mirrors the existing optional URL configuration already available for Jina.

The changes include:

  • Added cohereApiUrl as an optional configuration field in the web search schema
  • Updated the API key dialog to include a Cohere URL input field
  • Extended type definitions and configuration loading logic to handle the new field
  • Added corresponding localization strings for the UI
  • Updated environment example documentation

Change Type

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update
  • Translation update

Testing

Existing unit tests have been updated to verify:

  • cohereApiUrl is properly marked as optional (value 0) in the web search auth schema
  • The configuration loader correctly defaults to ${COHERE_API_URL} when not provided
  • Custom Cohere URLs are preserved when explicitly configured

All updated tests in packages/api/src/web/web.spec.ts and packages/data-schemas/src/app/web.spec.ts pass with these changes.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have made pertinent documentation changes (.env.example)
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective
  • Local unit tests pass with my changes
  • A pull request for updating the documentation has been submitted (to be done separately in librechat.ai repo) --> docs: document configurable Cohere reranker API URL LibreChat-AI/librechat.ai#571

Mirror the Jina reranker pattern by adding an optional cohereApiUrl
field across the web search auth pipeline so Cohere-compatible
endpoints (e.g. Azure AI serverless) can be targeted instead of the
hardcoded Cohere API URL.

- packages/data-schemas: register cohereApiUrl as optional reranker
  key and add ${COHERE_API_URL} placeholder default in
  loadWebSearchConfig.
- packages/data-provider: extend webSearchSchema with cohereApiUrl.
- packages/api: include cohereApiUrl in the user-provided URL set so
  the value is gated by SSRF preflight before being passed to the
  reranker.
- client: surface the URL input in ApiKeyDialog and propagate it
  through useAuthSearchTool form state.
- locales: add com_ui_web_search_cohere_url and
  com_ui_web_search_reranker_cohere_url_help English keys.
- .env.example: document COHERE_API_URL alongside JINA_API_URL.
- tests: extend data-schemas and packages/api specs to cover the
  new optional URL key.

Refs danny-avila#12328

https://claude.ai/code/session_016h4wbHY2VKPiFnd1krqies
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.

2 participants