Skip to content

feat(cohere): add CohereAzureRanker for rerank models served via Azure AI - #3750

Closed
Aryan-Pardeshi wants to merge 5 commits into
deepset-ai:mainfrom
Aryan-Pardeshi:feat/cohere-azure-ranker
Closed

feat(cohere): add CohereAzureRanker for rerank models served via Azure AI#3750
Aryan-Pardeshi wants to merge 5 commits into
deepset-ai:mainfrom
Aryan-Pardeshi:feat/cohere-azure-ranker

Conversation

@Aryan-Pardeshi

Copy link
Copy Markdown

Closes #2795.

Adds a ranker for Cohere rerank models served through Azure AI, in the existing cohere integration rather than a new one — per the conclusion in the issue thread that these models are reached without any Azure SDK dependency.

Built on the reference code @sjrl posted on 2026-04-22, using httpx rather than the Cohere SDK because of cohere-ai/cohere-python#661, which @bglearning flagged on the issue as blocking the SDK route.

Adapted rather than copied — the reference had an import-time os.getenv default, passed a raw Secret through to_dict, defined custom exception classes, and carried a __del__ with a bare except. This follows CohereRanker instead: Secret handling and to_dict/from_dict round-trip, ValueError for validation, and dataclasses.replace so documents are not mutated in place.

Unit tests mock the transport; no credentials or network needed.

@Aryan-Pardeshi
Aryan-Pardeshi requested a review from a team as a code owner August 7, 2026 22:19
@Aryan-Pardeshi
Aryan-Pardeshi requested review from bogdankostic and removed request for a team August 7, 2026 22:20
@CLAassistant

CLAassistant commented Aug 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Heads-up for maintainers

This PR is from a fork and touches integrations whose integration tests require API keys.
Those tests are skipped in CI because fork PRs don't have access to repo secrets for security reasons.

Affected integrations:

  • cohere

Please run the integration tests locally (hatch run test:integration inside each folder) before approving.

@github-actions github-actions Bot added the type:documentation Improvements or additions to documentation label Aug 7, 2026
@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @Aryan-Pardeshi, thanks a lot for your contribution! 🙏

We noticed that the Contributor License Agreement (CLA) check (license/cla) hasn't passed yet, so we've temporarily moved this PR to draft and paused the review assignment.

To get your PR reviewed, please sign the CLA via the link in the license/cla check below (or in the CLA bot comment). As soon as the check turns green, this PR will automatically be marked ready for review again and a reviewer will be re-assigned.

@HaystackBot
HaystackBot removed the request for review from bogdankostic August 7, 2026 23:29
@HaystackBot HaystackBot added the cla-pending PR is in draft until the contributor signs the CLA label Aug 7, 2026
@HaystackBot
HaystackBot marked this pull request as draft August 7, 2026 23:29
@HaystackBot
HaystackBot marked this pull request as ready for review August 8, 2026 05:08
@HaystackBot HaystackBot removed the cla-pending PR is in draft until the contributor signs the CLA label Aug 8, 2026
@HaystackBot

Copy link
Copy Markdown
Contributor

Thanks for signing the CLA, @Aryan-Pardeshi! 🎉 This PR is now ready for review again and the reviewer has been re-assigned.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (cohere)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/cohere/src/haystack_integrations/components/rankers/cohere
  azure_ranker.py 116-121, 128
Project Total  

This report was generated by python-coverage-comment-action

@bogdankostic

Copy link
Copy Markdown
Contributor

Thanks a lot for this @Aryan-Pardesh!

I tried the existing CohereRanker against a live Cohere rerank deployment on Azure AI Foundry and it works as-is. I added a working example in #2795. Therefore, I'm closing this PR given that a separate CohereAzureRanker is not needed anyore.

Either way, thanks for the effort you put in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:cohere type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Azure Ranker Component

4 participants