Skip to content

Serialize Redis embedding cache values#2087

Open
fallintoplace wants to merge 1 commit into
NVIDIA-NeMo:developfrom
fallintoplace:fix/redis-embedding-cache-serialization
Open

Serialize Redis embedding cache values#2087
fallintoplace wants to merge 1 commit into
NVIDIA-NeMo:developfrom
fallintoplace:fix/redis-embedding-cache-serialization

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

This fixes the Redis-backed embeddings cache so embedding vectors are serialized before being written and deserialized when read back.

Root cause

RedisCacheStore.set() passed Python values directly to redis-py, but embedding cache values are list[float] and redis-py rejects lists with DataError. Even if values were serialized elsewhere, RedisCacheStore.get() returned raw Redis bytes instead of decoded embedding vectors.

What changed

  • serialize Redis cache values with JSON on write
  • deserialize JSON values on read so embedding cache callers receive normal Python values
  • keep a small fallback for legacy non-JSON string values already present in Redis
  • add focused tests for Redis cache serialization and embedding round-trips

Validation

  • ./.venv/bin/python -m pytest tests/test_cache_embeddings.py

@github-actions github-actions Bot added size: S status: needs triage New issues that have not yet been reviewed or categorized. labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S status: needs triage New issues that have not yet been reviewed or categorized.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant