Package com.redis.vl.extensions.cache
Class SemanticCache.Builder
java.lang.Object
com.redis.vl.extensions.cache.SemanticCache.Builder
- Enclosing class:
SemanticCache
Builder for SemanticCache.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the SemanticCachedistanceThreshold
(float threshold) Set the distance threshold for semantic similaritySet the cache nameredisClient
(UnifiedJedis redisClient) Set the Redis clientSet the TTL for cache entriesvectorizer
(BaseVectorizer vectorizer) Set the vectorizer
-
Constructor Details
-
Builder
public Builder()Create a new Builder instance
-
-
Method Details
-
name
Set the cache name- Parameters:
name
- Cache name- Returns:
- This builder
-
redisClient
Set the Redis client- Parameters:
redisClient
- UnifiedJedis client- Returns:
- This builder
-
vectorizer
Set the vectorizer- Parameters:
vectorizer
- Vectorizer to use for embedding prompts- Returns:
- This builder
-
distanceThreshold
Set the distance threshold for semantic similarity- Parameters:
threshold
- Distance threshold (default: 0.2)- Returns:
- This builder
-
ttl
Set the TTL for cache entries- Parameters:
ttl
- Time-to-live in seconds- Returns:
- This builder
-
build
Build the SemanticCache- Returns:
- SemanticCache instance
-