Skip to content

Commit f4dad65

Browse files
committed
readme updates
1 parent 4921a2b commit f4dad65

File tree

6 files changed

+67
-331
lines changed

6 files changed

+67
-331
lines changed

.github/ignore-notebooks.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
00_semantic_caching_gemini
44
01_collaborative_filtering
55
05_nvidia_ai_rag_redis
6+
01_routing_optimization
7+
02_semantic_cache_optimization

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,17 @@ An estimated 31% of LLM queries are potentially redundant ([source](https://arxi
7777

7878
| Recipe | Description |
7979
| --- | --- |
80-
| [/semantic-cache/01_doc2cache_llama3_1.ipynb](python-recipes/semantic-cache/01_doc2cache_llama3_1.ipynb) | Build a semantic cache using the Doc2Cache framework and Llama3.1 |
8180
| [/semantic-cache/00_semantic_caching_gemini.ipynb](python-recipes/semantic-cache/00_semantic_caching_gemini.ipynb) | Build a semantic cache with Redis and Google Gemini |
81+
| [/semantic-cache/01_doc2cache_llama3_1.ipynb](python-recipes/semantic-cache/01_doc2cache_llama3_1.ipynb) | Build a semantic cache using the Doc2Cache framework and Llama3.1 |
82+
| [/semantic-cache/02_semantic_cache_optimization.ipynb](python-recipes/semantic-cache/02_semantic_cache_optimization.ipynb) | Use CacheThresholdOptimizer from redisvl to setup best cache config |
8283

8384
### Semantic Routing
8485
Routing is a simple and effective way of preventing misuses with your AI application or for creating branching logic between data sources etc.
8586

8687
| Recipe | Description |
8788
| --- | --- |
8889
| [/semantic-router/00_semantic_routing.ipynb](python-recipes/semantic-router/00_semantic_routing.ipynb) | Simple examples of how to build an allow/block list router in addition to a multi-topic router |
90+
| [/semantic-router/01_routing_optimization.ipynb](python-recipes/semantic-router/01_routing_optimization.ipynb) | Use RouterThresholdOptimizer from redisvl to setup best router config |
8991

9092
### Agents
9193

python-recipes/semantic-cache/02_semantic_cache_optimization.ipynb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,69 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7+
"![Redis](https://redis.io/wp-content/uploads/2024/04/Logotype.svg?auto=webp&quality=85,75&width=120)\n",
8+
"\n",
79
"# Optimize semantic cache threshold with RedisVL\n",
810
"\n",
911
"> **Note:** Threshold optimization in redisvl relies on `python > 3.9.`\n",
1012
"\n",
1113
"<a href=\"https://colab.research.google.com/github/redis-developer/redis-ai-resources/blob/main/python-recipes/semantic-cache/02_semantic_cache_optimization.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
1214
]
1315
},
16+
{
17+
"cell_type": "markdown",
18+
"metadata": {},
19+
"source": [
20+
"# Install dependencies"
21+
]
22+
},
23+
{
24+
"cell_type": "code",
25+
"execution_count": null,
26+
"metadata": {},
27+
"outputs": [],
28+
"source": [
29+
"# install redisvl from branch since scheduled for 0.5.0\n",
30+
"%pip install git+https://github.com/redis/redis-vl-python.git@feat/RAAE-602/threshold-optimizer"
31+
]
32+
},
33+
{
34+
"cell_type": "markdown",
35+
"metadata": {},
36+
"source": [
37+
"# Run a Redis instance\n",
38+
"\n",
39+
"#### For Colab\n",
40+
"Use the shell script below to download, extract, and install [Redis Stack](https://redis.io/docs/getting-started/install-stack/) directly from the Redis package archive."
41+
]
42+
},
43+
{
44+
"cell_type": "code",
45+
"execution_count": null,
46+
"metadata": {},
47+
"outputs": [],
48+
"source": [
49+
"# NBVAL_SKIP\n",
50+
"%%sh\n",
51+
"curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg\n",
52+
"echo \"deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main\" | sudo tee /etc/apt/sources.list.d/redis.list\n",
53+
"sudo apt-get update > /dev/null 2>&1\n",
54+
"sudo apt-get install redis-stack-server > /dev/null 2>&1\n",
55+
"redis-stack-server --daemonize yes"
56+
]
57+
},
58+
{
59+
"cell_type": "markdown",
60+
"metadata": {},
61+
"source": [
62+
"#### For Alternative Environments\n",
63+
"There are many ways to get the necessary redis-stack instance running\n",
64+
"1. On cloud, deploy a [FREE instance of Redis in the cloud](https://redis.com/try-free/). Or, if you have your\n",
65+
"own version of Redis Enterprise running, that works too!\n",
66+
"2. Per OS, [see the docs](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/)\n",
67+
"3. With docker: `docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest`"
68+
]
69+
},
1470
{
1571
"cell_type": "markdown",
1672
"metadata": {},

python-recipes/semantic-router/01_routing_optimization.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
},
195195
{
196196
"cell_type": "code",
197-
"execution_count": 7,
197+
"execution_count": 38,
198198
"id": "60ad280c",
199199
"metadata": {},
200200
"outputs": [],
@@ -268,7 +268,7 @@
268268
},
269269
{
270270
"cell_type": "code",
271-
"execution_count": 8,
271+
"execution_count": 39,
272272
"id": "e80aaf84",
273273
"metadata": {},
274274
"outputs": [
@@ -284,7 +284,7 @@
284284
"name": "stdout",
285285
"output_type": "stream",
286286
"text": [
287-
"10:07:29 redisvl.index.index INFO Index already exists, overwriting.\n"
287+
"15:46:13 redisvl.index.index INFO Index already exists, overwriting.\n"
288288
]
289289
}
290290
],
@@ -313,7 +313,7 @@
313313
},
314314
{
315315
"cell_type": "code",
316-
"execution_count": 9,
316+
"execution_count": 40,
317317
"id": "3caedb77",
318318
"metadata": {},
319319
"outputs": [
@@ -355,7 +355,7 @@
355355
},
356356
{
357357
"cell_type": "code",
358-
"execution_count": 10,
358+
"execution_count": 41,
359359
"id": "5b0e3208",
360360
"metadata": {},
361361
"outputs": [
@@ -365,7 +365,7 @@
365365
"RouteMatch(name='faq', distance=0.108501493931)"
366366
]
367367
},
368-
"execution_count": 10,
368+
"execution_count": 41,
369369
"metadata": {},
370370
"output_type": "execute_result"
371371
}

python-recipes/semantic-router/resources/test_data.json

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)