Skip to content

Conversation

@markpollack
Copy link
Member

@markpollack markpollack commented Dec 10, 2025

Summary

  • Add SemanticCacheAdvisor for intelligent response caching based on semantic similarity
  • Add DefaultSemanticCache implementation using RedisVectorStore
  • Add SemanticCache interface for cache abstraction
  • Add Spring Boot auto-configuration for semantic cache
  • Include integration tests

Details

This PR adds semantic caching capabilities for Spring AI chat responses using Redis Stack's vector search. The implementation provides:

  • Semantic similarity matching: Cache hits based on embedding similarity rather than exact string matching
  • Configurable threshold: Adjust similarity threshold for cache hit sensitivity
  • TTL support: Automatic expiration of cached responses
  • Namespace isolation: Support for multiple isolated caches using different index names
  • ChatClient Advisor integration: Seamlessly integrates with Spring AI's advisor pattern

Modules Added

  • vector-stores/spring-ai-redis-semantic-cache/ - Core implementation
  • auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-redis-semantic-cache/ - Auto-configuration

Test Plan

  • Integration tests with Redis Stack (Testcontainers)
  • Tests for basic caching operations
  • Tests for similarity threshold behavior
  • Tests for TTL support
  • Tests for cache isolation with namespaces
  • Tests for advisor pattern integration

Notes

  • Checkstyle is temporarily skipped for this module - style cleanup needed for test files
  • Depends on Redis vector store capabilities

Related

markpollack and others added 2 commits November 24, 2025 15:46
…, and HNSW tuning

Add new capabilities to Redis Vector Store:
- Text search with searchByText() method and configurable scoring algorithms
- Range-based vector search with searchByRange() method
- Support for multiple distance metrics (COSINE, L2, IP)
- Configurable HNSW parameters (M, efConstruction, efRuntime)
- Document count queries with count() method
- Module-level checkstyle configuration

Update Redis documentation with comprehensive coverage of new features
including configuration properties, usage examples, and parameter guidelines.

Co-authored-by: Brian Sam-Bodden <brian@redis.com>
Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
- Add SemanticCacheAdvisor for intelligent response caching
- Add DefaultSemanticCache implementation using RedisVectorStore
- Add SemanticCache interface for cache abstraction
- Add Spring Boot auto-configuration for semantic cache
- Include integration tests

Note: Checkstyle temporarily skipped - style cleanup needed

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants