Fix more problematic attribute values for LangCache#438
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the LangCache attribute encoding mechanism to handle backslash (\) and question mark (?) characters in attribute values by mapping them to fullwidth Unicode equivalents. This follows the same pattern established in PR #437 for comma and slash characters.
- Adds two new character mappings to the encoding/decoding translation tables
- Updates unit test to verify encoding/decoding of backslash and question mark
- Adds comprehensive integration tests for newly supported special characters and all tokenizer separators
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| redisvl/extensions/cache/llm/langcache.py | Adds backslash and question mark mappings to the attribute encoding/decoding translation tables |
| tests/unit/test_langcache_semantic_cache.py | Updates mock data and assertions to include backslash and question mark in encoded attribute values |
| tests/integration/test_langcache_semantic_cache_integration.py | Adds new integration tests for backslash/question mark handling and comprehensive tokenizer separator testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following on #437, we find and encode/decode more problematic characters used within attribute values in LangCache. This PR also adds a comprehensive punctuation test for other characters.