Skip to content

Conversation

@nkanu17
Copy link
Collaborator

@nkanu17 nkanu17 commented Dec 15, 2025

Fix distance threshold documentation inconsistencies (Part of issue #407)
Summary
Corrects documentation to accurately reflect that Redis COSINE distance thresholds use the range [0-2], not [0-1]. The code validation was already correct, but docstrings and examples were misleading.

Changes

  • SemanticCache: Fixed __init__ and set_threshold docstrings to specify [0-2] range
  • Message History: Corrected notebook stating max threshold is 2.0, not 1.0
  • Examples: Added inline comments clarifying Redis COSINE distance scale in README and notebooks

- Update SemanticCache.__init__ docstring to specify [0-2] range instead of [0-1]
- Update SemanticCache.set_threshold docstring to specify [0-2] range
- Enhance distance_threshold parameter docs to clarify Redis COSINE units
- Fixes inconsistency between docstrings and actual validation logic

Relates to #407
- Fix notebook documentation stating 1.0 as max threshold
- Update to correctly state 2.0 as maximum for Redis COSINE distance
- Add clarification that Redis COSINE distance range is [0-2]

Relates to #407
- Add inline comments to README.md explaining Redis COSINE distance scale
- Enhance llmcache notebook with distance scale explanation
- Add semantic router notebook clarification about distance units
- Improves user understanding of threshold values in examples

Relates to #407
Copy link
Collaborator

@justin-cechmanek justin-cechmanek left a comment

Choose a reason for hiding this comment

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

Thanks for making these changes

Copy link
Collaborator

@abrookins abrookins left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@nkanu17 nkanu17 merged commit 8747a3a into main Dec 16, 2025
71 of 72 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.

5 participants