Skip to content

Conversation

@TejasGhatte
Copy link
Collaborator

@TejasGhatte TejasGhatte commented Dec 19, 2025

Summary

Fix duplicate models in Azure provider response by adding deduplication logic based on model IDs.

Changes

  • Added a seenIDs map to track which model IDs have already been processed
  • Added logic to skip adding duplicate models to the response when the same model ID is encountered multiple times
  • This prevents duplicate entries that can occur when alias matching is performed

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (Next.js)
  • Docs

How to test

Test the Azure provider's model listing functionality to ensure no duplicate models appear:

# Core/Transports
go version
go test ./core/providers/azure/...

You can also test manually by configuring the Azure provider with models that have multiple aliases and verifying that each model only appears once in the response.

Breaking changes

  • Yes
  • No

Related issues

Fixes an issue where Azure models could appear multiple times in model listings due to alias matching.

Security considerations

No security implications.

Checklist

  • I added/updated tests where appropriate
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Duplicate model entries in Azure model listings are removed; model lists may be reordered slightly as a result.
  • Chores

    • Minor formatting-only change with no impact on visible behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Removes an early-return shortcut in aggregate list-model responses so deduplication always runs; also adds a formatting-only newline in the Azure models response file. No exported APIs changed.

Changes

Cohort / File(s) Change Summary
Aggregation & Deduplication
core/providers/utils/utils.go
Removed single-response early return in aggregateListModelsResponses; always runs deduplication using a seenIDs map, collects raw responses, filters duplicates, and sorts aggregated models by ID.
Formatting-only
core/providers/azure/models.go
Minor formatting change (blank line added) in AzureListModelsResponse.ToBifrostListModelsResponse, no behavioral change.
Manifest
go.mod
Present in diff (no behavioral change noted).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review focus:
    • core/providers/utils/utils.go — verify deduplication correctness (seenIDs key choice, handling of empty/nil IDs), ordering implications from sorting by ID, and that RawResponse/pagination behavior remains correct.
    • core/providers/azure/models.go — confirm formatting-only change introduces no unintended edits.
    • Ensure tests or callers relying on previous ordering or duplicate preservation are updated or acceptable.

Possibly related issues

Poem

🐰 I hopped through lists both near and far,
A tiny map chased each duplicate star,
One ID each, no echoes left behind,
Neat rows of models — tidy, trimmed, and kind. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: deduplicate model ids in single response of azure' directly and clearly summarizes the main change: deduplication of model IDs in Azure provider responses.
Description check ✅ Passed The PR description follows the template structure with all major sections completed: Summary, Changes, Type of change, Affected areas, How to test, Breaking changes, Related issues, Security considerations, and Checklist items checked.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 12-19-fix_deduplicate_model_ids_in_single_response_of_azure

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99408a3 and 484a234.

📒 Files selected for processing (2)
  • core/providers/azure/models.go (1 hunks)
  • core/providers/utils/utils.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/providers/azure/models.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

always check the stack if there is one for the current PR. do not give localized reviews for the PR, always see all changes in the light of the whole stack of PRs (if there is a stack, if there is no stack you can continue to make localized suggestions/reviews)

Files:

  • core/providers/utils/utils.go
🧠 Learnings (1)
📚 Learning: 2025-12-09T17:07:42.007Z
Learnt from: qwerty-dvorak
Repo: maximhq/bifrost PR: 1006
File: core/schemas/account.go:9-18
Timestamp: 2025-12-09T17:07:42.007Z
Learning: In core/schemas/account.go, the HuggingFaceKeyConfig field within the Key struct is currently unused and reserved for future Hugging Face inference endpoint deployments. Do not flag this field as missing from OpenAPI documentation or require its presence in the API spec until the feature is actively implemented and used. When the feature is added, update the OpenAPI docs accordingly; otherwise, treat this field as non-breaking and not part of the current API surface.

Applied to files:

  • core/providers/utils/utils.go
🔇 Additional comments (2)
core/providers/utils/utils.go (2)

1120-1142: LGTM: Deduplication now handles single responses correctly.

The change to always apply deduplication fixes the Azure duplicate model issue caused by alias matching. The seenIDs map efficiently prevents duplicate model IDs from appearing in the response, which is the intended behavior.


1150-1153: Verify that callers can handle the new sorted model ordering.

Removing the early-return shortcut means single responses now go through sorting by model ID, which changes the output from provider ordering to alphabetical ordering. While this provides consistent, predictable ordering, it's a behavior change that could affect callers.

The aggregation function now consistently applies alphabetical sorting across all responses (single or multiple). Verify that the 10+ providers using HandleMultipleListModelsRequests—vertex, mistral, openai, openrouter, bedrock, cohere, gemini, elevenlabs, anthropic, and azure—don't depend on the original provider ordering being preserved.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

🧪 Test Suite Available

This PR can be tested by a repository admin.

Run tests for PR #1134

@TejasGhatte TejasGhatte marked this pull request as ready for review December 19, 2025 07:05
@TejasGhatte TejasGhatte force-pushed the 12-19-fix_deduplicate_model_ids_in_single_response_of_azure branch from 99408a3 to 484a234 Compare December 19, 2025 08:32
Copy link
Collaborator

Pratham-Mishra04 commented Dec 19, 2025

Merge activity

  • Dec 19, 11:42 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 19, 11:43 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04 Pratham-Mishra04 merged commit 21dd198 into main Dec 19, 2025
9 checks passed
@Pratham-Mishra04 Pratham-Mishra04 deleted the 12-19-fix_deduplicate_model_ids_in_single_response_of_azure branch December 19, 2025 11:43
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.

3 participants