Skip to content

Commit 1f8e622

Browse files
committed
update pip install
1 parent 7d9d236 commit 1f8e622

File tree

3 files changed

+40
-74
lines changed

3 files changed

+40
-74
lines changed

libs/redis/docs/cache.ipynb

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,23 @@
2121
{
2222
"metadata": {
2323
"ExecuteTime": {
24-
"end_time": "2025-11-22T07:10:04.327797Z",
25-
"start_time": "2025-11-22T07:10:01.111867Z"
24+
"end_time": "2025-11-22T17:06:36.495021Z",
25+
"start_time": "2025-11-22T17:06:35.814138Z"
2626
}
2727
},
2828
"cell_type": "code",
29-
"source": [
30-
"%pip install -qU langchain-core langchain-redis \"langchain-openai>=1.0.3\" \"redis<7.0\"\n",
31-
"%pip install -qU -e \"../[langcache]\""
32-
],
29+
"source": "%pip install -qU langchain-core \"langchain-redis[langcache]\" \"langchain-openai>=1.0.3\" \"redis<7.0\"",
3330
"outputs": [
3431
{
3532
"name": "stdout",
3633
"output_type": "stream",
3734
"text": [
35+
"\r\n",
3836
"Note: you may need to restart the kernel to use updated packages.\n"
3937
]
4038
}
4139
],
42-
"execution_count": 5
40+
"execution_count": 3
4341
},
4442
{
4543
"metadata": {},
@@ -57,8 +55,8 @@
5755
{
5856
"metadata": {
5957
"ExecuteTime": {
60-
"end_time": "2025-11-22T07:10:04.339135Z",
61-
"start_time": "2025-11-22T07:10:04.337286Z"
58+
"end_time": "2025-11-22T17:06:36.502005Z",
59+
"start_time": "2025-11-22T17:06:36.499949Z"
6260
}
6361
},
6462
"cell_type": "code",
@@ -79,7 +77,7 @@
7977
]
8078
}
8179
],
82-
"execution_count": 6
80+
"execution_count": 4
8381
},
8482
{
8583
"metadata": {},
@@ -89,8 +87,8 @@
8987
{
9088
"metadata": {
9189
"ExecuteTime": {
92-
"end_time": "2025-11-22T07:10:04.351558Z",
93-
"start_time": "2025-11-22T07:10:04.349814Z"
90+
"end_time": "2025-11-22T17:06:38.048298Z",
91+
"start_time": "2025-11-22T17:06:36.519903Z"
9492
}
9593
},
9694
"cell_type": "code",
@@ -105,7 +103,7 @@
105103
"from langchain_redis import RedisCache, RedisSemanticCache, LangCacheSemanticCache"
106104
],
107105
"outputs": [],
108-
"execution_count": 7
106+
"execution_count": 5
109107
},
110108
{
111109
"metadata": {},
@@ -115,8 +113,8 @@
115113
{
116114
"metadata": {
117115
"ExecuteTime": {
118-
"end_time": "2025-11-22T07:10:04.360419Z",
119-
"start_time": "2025-11-22T07:10:04.358547Z"
116+
"end_time": "2025-11-22T17:06:38.059329Z",
117+
"start_time": "2025-11-22T17:06:38.057687Z"
120118
}
121119
},
122120
"cell_type": "code",
@@ -143,7 +141,7 @@
143141
]
144142
}
145143
],
146-
"execution_count": 8
144+
"execution_count": 6
147145
},
148146
{
149147
"metadata": {},
@@ -153,8 +151,8 @@
153151
{
154152
"metadata": {
155153
"ExecuteTime": {
156-
"end_time": "2025-11-22T07:10:05.188067Z",
157-
"start_time": "2025-11-22T07:10:04.365151Z"
154+
"end_time": "2025-11-22T17:06:39.414088Z",
155+
"start_time": "2025-11-22T17:06:38.071005Z"
158156
}
159157
},
160158
"cell_type": "code",
@@ -201,20 +199,20 @@
201199
"Result: \n",
202200
"\n",
203201
"Caching is the process of storing frequently accessed data in a temporary storage location for faster retrieval. This helps to reduce the time and resources needed to access the data from its original source. Caching is commonly used in computer systems, web browsers, and databases to improve performance and efficiency.\n",
204-
"Time: 0.68 seconds\n",
202+
"Time: 1.15 seconds\n",
205203
"\n",
206204
"Second call (cached):\n",
207205
"Result: \n",
208206
"\n",
209207
"Caching is the process of storing frequently accessed data in a temporary storage location for faster retrieval. This helps to reduce the time and resources needed to access the data from its original source. Caching is commonly used in computer systems, web browsers, and databases to improve performance and efficiency.\n",
210208
"Time: 0.00 seconds\n",
211209
"\n",
212-
"Speed improvement: 525.11x faster\n",
210+
"Speed improvement: 552.26x faster\n",
213211
"Cache cleared\n"
214212
]
215213
}
216214
],
217-
"execution_count": 9
215+
"execution_count": 7
218216
},
219217
{
220218
"metadata": {},
@@ -224,8 +222,8 @@
224222
{
225223
"metadata": {
226224
"ExecuteTime": {
227-
"end_time": "2025-11-22T07:10:07.296869Z",
228-
"start_time": "2025-11-22T07:10:05.206110Z"
225+
"end_time": "2025-11-22T17:06:43.518554Z",
226+
"start_time": "2025-11-22T17:06:39.428393Z"
229227
}
230228
},
231229
"cell_type": "code",
@@ -277,22 +275,22 @@
277275
"Result: \n",
278276
"\n",
279277
"The capital of France is Paris.\n",
280-
"Time: 1.37 seconds\n",
278+
"Time: 3.05 seconds\n",
281279
"\n",
282280
"Similar query:\n",
283281
"Prompt: Can you tell me the capital city of France?\n",
284282
"\n",
285283
"Result: \n",
286284
"\n",
287285
"The capital of France is Paris.\n",
288-
"Time: 0.39 seconds\n",
286+
"Time: 0.14 seconds\n",
289287
"\n",
290-
"Speed improvement: 3.48x faster\n",
288+
"Speed improvement: 21.12x faster\n",
291289
"Semantic cache cleared\n"
292290
]
293291
}
294292
],
295-
"execution_count": 10
293+
"execution_count": 8
296294
},
297295
{
298296
"metadata": {},
@@ -311,8 +309,8 @@
311309
{
312310
"metadata": {
313311
"ExecuteTime": {
314-
"end_time": "2025-11-22T07:10:09.664948Z",
315-
"start_time": "2025-11-22T07:10:07.313993Z"
312+
"end_time": "2025-11-22T17:06:44.679848Z",
313+
"start_time": "2025-11-22T17:06:43.540988Z"
316314
}
317315
},
318316
"cell_type": "code",
@@ -390,28 +388,28 @@
390388
"Result: \n",
391389
"\n",
392390
"The capital of France is Paris.\n",
393-
"Time: 2.02 seconds\n",
391+
"Time: 0.85 seconds\n",
394392
"\n",
395393
"Similar query:\n",
396394
"Prompt: Can you tell me the capital city of France?\n",
397395
"\n",
398396
"Result: \n",
399397
"\n",
400398
"The capital of France is Paris.\n",
401-
"Time: 0.15 seconds\n",
399+
"Time: 0.13 seconds\n",
402400
"\n",
403-
"(Similar query) Speed improvement: 13.78x faster\n",
401+
"(Similar query) Speed improvement: 6.75x faster\n",
404402
"Semantic cache cleared\n"
405403
]
406404
}
407405
],
408-
"execution_count": 11
406+
"execution_count": 9
409407
},
410408
{
411409
"metadata": {
412410
"ExecuteTime": {
413-
"end_time": "2025-11-22T07:10:09.686945Z",
414-
"start_time": "2025-11-22T07:10:09.685687Z"
411+
"end_time": "2025-11-22T17:06:44.697353Z",
412+
"start_time": "2025-11-22T17:06:44.696216Z"
415413
}
416414
},
417415
"cell_type": "code",
@@ -432,8 +430,8 @@
432430
{
433431
"metadata": {
434432
"ExecuteTime": {
435-
"end_time": "2025-11-22T07:10:15.708721Z",
436-
"start_time": "2025-11-22T07:10:09.689547Z"
433+
"end_time": "2025-11-22T17:06:50.714859Z",
434+
"start_time": "2025-11-22T17:06:44.700932Z"
437435
}
438436
},
439437
"cell_type": "code",
@@ -470,7 +468,7 @@
470468
]
471469
}
472470
],
473-
"execution_count": 12
471+
"execution_count": 10
474472
},
475473
{
476474
"metadata": {},
@@ -480,8 +478,8 @@
480478
{
481479
"metadata": {
482480
"ExecuteTime": {
483-
"end_time": "2025-11-22T07:10:17.430674Z",
484-
"start_time": "2025-11-22T07:10:15.729854Z"
481+
"end_time": "2025-11-22T17:06:52.510744Z",
482+
"start_time": "2025-11-22T17:06:50.738791Z"
485483
}
486484
},
487485
"cell_type": "code",
@@ -524,7 +522,7 @@
524522
]
525523
}
526524
],
527-
"execution_count": 13
525+
"execution_count": 11
528526
},
529527
{
530528
"metadata": {},

libs/redis/langchain_redis/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ class LangCacheSemanticCache(BaseCache):
732732
over the managed LangCache API). The optional dependency ``langcache`` must
733733
be installed at runtime when this class is used. Install with either
734734
``pip install 'langchain-redis[langcache]'`` or
735-
``pip install 'langcache>=0.10.0'``.
735+
``pip install langcache``.
736736
737737
Args:
738738
distance_threshold (float): Maximum distance for semantic matches.

libs/redis/tests/integration_tests/test_langcache_semantic_cache_integration.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@
2727

2828
from langchain_redis import LangCacheSemanticCache
2929

30-
try: # Optional direct redisvl client for debugging comparisons
31-
from redisvl.extensions.cache.llm import ( # type: ignore
32-
LangCacheSemanticCache as RedisVLLangCacheSemanticCache,
33-
)
34-
except Exception: # pragma: no cover - optional dependency path
35-
RedisVLLangCacheSemanticCache = None
36-
3730

3831
REQUIRED_WITH_ATTRS_VARS = (
3932
"LANGCACHE_WITH_ATTRIBUTES_API_KEY",
@@ -96,31 +89,6 @@ def langcache_no_attrs() -> LangCacheSemanticCache:
9689
)
9790

9891

99-
@pytest.fixture
100-
def rv_langcache_with_attrs() -> "RedisVLLangCacheSemanticCache":
101-
"""Direct redisvl LangCacheSemanticCache bound to attrs-enabled cache.
102-
103-
This bypasses the langchain_redis adapter and talks to LangCache via the
104-
redisvl integration directly, without using any llm_string attribute
105-
filtering. These tests help isolate whether the underlying cache instance
106-
can successfully store and retrieve entries when attributes are not used
107-
as filters.
108-
"""
109-
110-
if RedisVLLangCacheSemanticCache is None:
111-
pytest.skip("redisvl LangCacheSemanticCache is not available")
112-
113-
env = _require_env_vars(REQUIRED_WITH_ATTRS_VARS)
114-
115-
return RedisVLLangCacheSemanticCache(
116-
name="redisvl_with_attributes_direct",
117-
server_url=env["LANGCACHE_WITH_ATTRIBUTES_URL"],
118-
cache_id=env["LANGCACHE_WITH_ATTRIBUTES_CACHE_ID"],
119-
api_key=env["LANGCACHE_WITH_ATTRIBUTES_API_KEY"],
120-
ttl=60,
121-
)
122-
123-
12492
@pytest.mark.requires_api_keys
12593
class TestLangCacheSemanticCacheIntegrationWithAttributes:
12694
def test_update_and_lookup_roundtrip(

0 commit comments

Comments
 (0)