Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

feat(cache-redis-semantic): expose backend accessors for bridge binding

Yujong Leec311073a178d
diff --git a/litellm-rust/crates/cache-redis-semantic/src/cache.rs b/litellm-rust/crates/cache-redis-semantic/src/cache.rs
index 26d19d34670..5aa484356d7 100644
--- a/litellm-rust/crates/cache-redis-semantic/src/cache.rs
+++ b/litellm-rust/crates/cache-redis-semantic/src/cache.rs
@@ -41,15 +41,6 @@ pub struct RedisSemanticConfig {
pub similarity_threshold: f32,
}
-impl Default for RedisSemanticConfig {
- fn default() -> Self {
- Self {
- index_name: DEFAULT_INDEX_NAME.into(),
- similarity_threshold: 0.9,
- }
- }
-}
-
struct Inner {
index_name: String,
distance_threshold: f64,
@@ -247,6 +238,18 @@ impl<E: Embedder, C: redis::ConnectionLike + Send + 'static> RedisSemanticCache<
}
}
+ pub fn embedder(&self) -> &E {
+ &self.embedder
+ }
+
+ pub fn index_name(&self) -> &str {
+ &self.inner.index_name
+ }
+
+ pub fn similarity_threshold(&self) -> f32 {
+ (1.0 - self.inner.distance_threshold) as f32
+ }
+
fn tag<'a>(key: &'a str, context: &'a SemanticCacheContext) -> &'a str {
context.scope.as_deref().unwrap_or(key)
}