Skip to content

fix case insensitive lookup for custom text models - #645

Merged
joein merged 2 commits into
qdrant:mainfrom
CODING-DARSH:fix-custom-model-case-insensitive
Sep 16, 2026
Merged

joein merged 2 commits into
qdrant:mainfrom
CODING-DARSH:fix-custom-model-case-insensitive

Conversation

@CODING-DARSH

@CODING-DARSH CODING-DARSH commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #650

Checklist

  • Have you followed the guidelines in the Contributing document?
  • Have you checked that there are no existing open PRs for the same issue?
  • Does the change pass tests locally?
  • Have you added a regression test for the fix?

Summary

Custom models can be registered using one casing (e.g. Org/Model) and later instantiated using a different casing (e.g. org/model). TextEmbedding already resolves models case-insensitively, but CustomTextEmbedding later looked up the postprocessing configuration using the original user-provided model name, which could result in a KeyError.

This change uses the canonical resolved model name from self.model_description.model when retrieving the postprocessing configuration.

Changes

  • Fix custom text model postprocessing lookup to use the canonical resolved model name.
  • Add a regression test covering mixed-case registration and instantiation.

Reproduction

Before

  1. Register a custom model as Org/Model.
  2. Instantiate TextEmbedding("org/model").
  3. Construction can fail with KeyError.

After

  1. Register a custom model as Org/Model.
  2. Instantiate TextEmbedding("org/model").
  3. Construction succeeds and uses the correct postprocessing configuration.

Testing

  • Added test_custom_text_model_lookup_is_case_insensitive.
  • Verified with:
poetry run pytest tests/test_custom_models.py -k custom_text_model_lookup_is_case_insensitive -q

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 24a56a04-8400-4e97-94b0-9df22ee1802b

📥 Commits

Reviewing files that changed from the base of the PR and between ff91ff6 and d844fec.

📒 Files selected for processing (2)
  • fastembed/text/custom_text_embedding.py
  • tests/test_custom_models.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

CustomTextEmbedding now stores the postprocessing configuration lookup in a local variable before assigning pooling and normalization. The test fixture resets the postprocessing mapping and supported-model registries. A new test verifies case-insensitive custom model loading and the configured postprocessing values.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to d844f

The change correctly supports mixed-case custom model construction and adds regression coverage without leaving a concrete merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing case-insensitive lookup for custom text models.
Description check ✅ Passed The description directly explains the case-insensitive lookup failure, the canonical model-name fix, the regression test, and the targeted test command.
Linked Issues check ✅ Passed The change meets the coding requirements in [#650]. CustomTextEmbedding.__init__ now retrieves POSTPROCESSING_MAPPING with self.model_description.model, which is the canonical resolved model nam…
Out of Scope Changes check ✅ Passed The changes remain within [#650]. The fixture reset changes isolate custom-model state between tests, and the removed per-test cleanup is redundant after that centralization. The added test directly v…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@joein
joein self-requested a review September 16, 2026 10:18

@joein joein left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for fixing this!

@joein
joein merged commit cc4d101 into qdrant:main Sep 16, 2026
6 checks passed
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.

[Bug]: CustomTextEmbedding lookup is case-sensitive after canonical model resolution

2 participants