Skip to content

Commit 28d59aa

Browse files
committed
Revert "fix(responses): fix Redis session key mismatch for conversation context"
This reverts commit 8ba9e5f.
1 parent 8ba9e5f commit 28d59aa

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

litellm/responses/litellm_completion_transformation/transformation.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,13 +1080,15 @@ async def _patch_get_session_from_redis(previous_response_id: str) -> Optional[D
10801080
if litellm.cache is None or not hasattr(litellm.cache, 'cache') or not hasattr(litellm.cache.cache, 'init_async_client'):
10811081
return None
10821082

1083-
# NOTE: Use the raw previous_response_id as-is (no decoding)
1084-
# The response_id stored in Redis is the same format as previous_response_id
1085-
# (both are the LiteLLM-encoded IDs containing provider/model info)
1083+
# Decode response ID to get actual request ID
1084+
from litellm.responses.utils import ResponsesAPIRequestUtils
1085+
actual_request_id = ResponsesAPIRequestUtils.decode_previous_response_id_to_original_previous_response_id(
1086+
previous_response_id
1087+
)
10861088

10871089
# Get session data from Redis using the async Redis client
10881090
async_redis_client = litellm.cache.cache.init_async_client()
1089-
session_json = await async_redis_client.get(name=f"litellm_patch:session:{previous_response_id}")
1091+
session_json = await async_redis_client.get(name=f"litellm_patch:session:{actual_request_id}")
10901092

10911093
if session_json:
10921094
return json.loads(session_json)

0 commit comments

Comments
 (0)