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]

fix(cache): remove redundant source comments

Yujong Lee22995d1575ec
diff --git a/litellm-rust/crates/cache-memory/src/cache.rs b/litellm-rust/crates/cache-memory/src/cache.rs
index 77635893640..45c638f5178 100644
--- a/litellm-rust/crates/cache-memory/src/cache.rs
+++ b/litellm-rust/crates/cache-memory/src/cache.rs
@@ -228,7 +228,6 @@ where
.get(key)
.filter(|existing| eligible.is_empty() || eligible.contains(existing))
.cloned();
- // Matches the Redis claim: an unconditional claim only extends its own winner.
if let Some(existing) = &existing
&& eligible.is_empty()
&& *existing != candidate
diff --git a/litellm-rust/crates/cache-redis/src/cache.rs b/litellm-rust/crates/cache-redis/src/cache.rs
index 23b1fabbab4..2249966dd79 100644
--- a/litellm-rust/crates/cache-redis/src/cache.rs
+++ b/litellm-rust/crates/cache-redis/src/cache.rs
@@ -57,8 +57,6 @@ const INCREMENT_SCRIPT: &str = concat!(
"redis.call('EXPIRE', KEYS[1], ARGV[2]); end; return value"
);
-// Compare-and-set against the exact bytes the claim decision was made on.
-// ARGV: [1] expected payload or "" when absent, [2] ttl, [3] new payload, [4] refresh ttl.
const CLAIM_SCRIPT: &str = concat!(
"local current = redis.call('GET', KEYS[1]); ",
"if ARGV[1] == '' then if current ~= false and current ~= '' then return 0; end; ",
diff --git a/litellm-rust/crates/cache-response/src/buffer.rs b/litellm-rust/crates/cache-response/src/buffer.rs
index 68af5278c8c..1fd2bb809de 100644
--- a/litellm-rust/crates/cache-response/src/buffer.rs
+++ b/litellm-rust/crates/cache-response/src/buffer.rs
@@ -5,7 +5,6 @@ use serde_json::Value;
use crate::{CacheEntry, ResponseCache, ResponseCacheRequest};
-/// Defers async writes until `flush_size` entries are pending, then stores them as one batch.
pub struct WriteBuffer {
flush_size: usize,
entries: Mutex<Vec<(ResponseCacheRequest, Value, Duration)>>,
diff --git a/litellm-rust/crates/python-bridge/src/cache/binding.rs b/litellm-rust/crates/python-bridge/src/cache/binding.rs
index 44c133d4611..ad64b24d3c1 100644
--- a/litellm-rust/crates/python-bridge/src/cache/binding.rs
+++ b/litellm-rust/crates/python-bridge/src/cache/binding.rs
@@ -125,8 +125,6 @@ impl ResolvedCache {
}
}
- /// Native bindings return `{values, missing_indices}`, while a Python callback returns the
- /// list of its per-request results.
#[pyo3(signature = (requests, *, callback_kwargs=None))]
fn lookup_batch(
&self,
@@ -222,7 +220,6 @@ impl ResolvedCache {
}
}
- /// A Python callback receives the caller's original result through `callback_result`.
#[pyo3(signature = (requests, responses, *, callback_result=None, callback_kwargs=None))]
fn async_store_batch<'py>(
&self,
diff --git a/litellm-rust/crates/python-bridge/src/cache/callback.rs b/litellm-rust/crates/python-bridge/src/cache/callback.rs
index 318f9d02080..492e0329672 100644
--- a/litellm-rust/crates/python-bridge/src/cache/callback.rs
+++ b/litellm-rust/crates/python-bridge/src/cache/callback.rs
@@ -7,8 +7,6 @@ use pyo3::{
use super::future::ready_none;
-/// A custom Python cache object, driven through the built-in `Cache` API so a `Cache` subclass
-/// works unchanged.
pub(super) struct PythonCallback(Py<PyAny>);
impl PythonCallback {
@@ -61,8 +59,6 @@ impl PythonCallback {
)
}
- /// The built-in `Cache` API has no batch read, so the callback receives one
- /// `get_cache(**kwargs)` call per request, in order, and the results come back as a list.
pub(super) fn lookup_batch<'py>(
&self,
py: Python<'py>,
@@ -98,8 +94,6 @@ impl PythonCallback {
.call_method1("gather", PyTuple::new(py, awaitables)?)
}
- /// Receives the caller's original result, because the built-in
- /// `Cache.async_add_cache_pipeline` splits the batch itself.
pub(super) fn async_store_batch<'py>(
&self,
py: Python<'py>,
@@ -116,7 +110,6 @@ impl PythonCallback {
)
}
- /// The built-in `Cache` facade has no flush of its own; its backend does.
pub(super) fn async_flush<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
let object = self.0.bind(py);
let backend = match object.getattr_opt("cache")? {