Skip to content

Commit db65632

Browse files
committed
wip
1 parent b6eab78 commit db65632

File tree

2 files changed

+220
-0
lines changed

2 files changed

+220
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,6 @@ libs/redis/docs/.Trash*
221221
.python-version
222222
.idea/*
223223
java-recipes/.*
224+
225+
python-recipes/vector-search/beir_datasets/
226+
python-recipes/vector-search/datasets
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"![Redis](https://redis.io/wp-content/uploads/2024/04/Logotype.svg?auto=webp&quality=85,75&width=120)\n",
8+
"# RedisVL 0.5.0 - Release overview\n",
9+
"\n",
10+
"This notebook provides an overview of what's new with the 0.5.0 release of redisvl. It also highlights changes and potential enhancements for existing usage.\n",
11+
"\n",
12+
"<a href=\"https://colab.research.google.com/github/redis-developer/redis-ai-resources/blob/main/python-recipes/redisvl-release/0.5.0_release_overview.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
13+
"\n",
14+
"# What's new?\n",
15+
"\n",
16+
"- Hybrid query and text query classes\n",
17+
"- Threshold optimizer classes\n",
18+
"- Schema validation\n",
19+
"- Timestamp filters\n",
20+
"- Batched queries\n",
21+
"- Vector normalization\n",
22+
"- Hybrid policy on knn with filters\n",
23+
"\n",
24+
"# Env setup\n",
25+
"\n",
26+
"## Install Redis Stack\n",
27+
"\n",
28+
"#### For Colab\n",
29+
"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."
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"# NBVAL_SKIP\n",
39+
"%%sh\n",
40+
"curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg\n",
41+
"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",
42+
"sudo apt-get update > /dev/null 2>&1\n",
43+
"sudo apt-get install redis-stack-server > /dev/null 2>&1\n",
44+
"redis-stack-server --daemonize yes"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"#### For Alternative Environments\n",
52+
"There are many ways to get the necessary redis-stack instance running\n",
53+
"1. On cloud, deploy a [FREE instance of Redis in the cloud](https://redis.com/try-free/). Or, if you have your\n",
54+
"own version of Redis Enterprise running, that works too!\n",
55+
"2. Per OS, [see the docs](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/)\n",
56+
"3. With docker: `docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest`\n",
57+
"\n",
58+
"### Define the Redis Connection URL\n",
59+
"\n",
60+
"By default this notebook connects to the local instance of Redis Stack. **If you have your own Redis Enterprise instance** - replace REDIS_PASSWORD, REDIS_HOST and REDIS_PORT values with your own."
61+
]
62+
},
63+
{
64+
"cell_type": "code",
65+
"execution_count": 1,
66+
"metadata": {},
67+
"outputs": [],
68+
"source": [
69+
"import os\n",
70+
"\n",
71+
"# Replace values below with your own if using Redis Cloud instance\n",
72+
"REDIS_HOST = os.getenv(\"REDIS_HOST\", \"localhost\") # ex: \"redis-18374.c253.us-central1-1.gce.cloud.redislabs.com\"\n",
73+
"REDIS_PORT = os.getenv(\"REDIS_PORT\", \"6379\") # ex: 18374\n",
74+
"REDIS_PASSWORD = os.getenv(\"REDIS_PASSWORD\", \"\") # ex: \"1TNxTEdYRDgIDKM2gDfasupCADXXXX\"\n",
75+
"\n",
76+
"# If SSL is enabled on the endpoint, use rediss:// as the URL prefix\n",
77+
"REDIS_URL = f\"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}\""
78+
]
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"metadata": {},
83+
"source": [
84+
"# Install redisvl 0.5.0"
85+
]
86+
},
87+
{
88+
"cell_type": "code",
89+
"execution_count": null,
90+
"metadata": {},
91+
"outputs": [],
92+
"source": [
93+
"%pip install git+https://github.com/redis/[email protected]"
94+
]
95+
},
96+
{
97+
"cell_type": "markdown",
98+
"metadata": {},
99+
"source": [
100+
"# Hybrid query and text query classes\n",
101+
"\n",
102+
"In 0.5.0 we introduced classes to make it easier to perform lexical search in redis both standalone and combined with vector search.\n",
103+
"\n",
104+
"## TODO: provide quick before/after on hybrid"
105+
]
106+
},
107+
{
108+
"cell_type": "code",
109+
"execution_count": null,
110+
"metadata": {},
111+
"outputs": [],
112+
"source": []
113+
},
114+
{
115+
"cell_type": "markdown",
116+
"metadata": {},
117+
"source": [
118+
"# Threshold optimization\n",
119+
"\n",
120+
"In redis 0.5.0 we added the ability to quickly configure either you're semantic cache or semantic router with test data examples. \n",
121+
"\n",
122+
"See [semantic-cache/02_semantic_cache_optimization.ipynb](../semantic-cache/02_semantic_cache_optimization.ipynb) and [semantic-router/01_routing_optimization.ipynb](../semantic-router/01_routing_optimization.ipynb) for the full implementation details. "
123+
]
124+
},
125+
{
126+
"cell_type": "code",
127+
"execution_count": null,
128+
"metadata": {},
129+
"outputs": [],
130+
"source": []
131+
},
132+
{
133+
"cell_type": "markdown",
134+
"metadata": {},
135+
"source": [
136+
"# Schema validation\n",
137+
"\n",
138+
"This feature makes it easier to make sure your data is in the right format."
139+
]
140+
},
141+
{
142+
"cell_type": "code",
143+
"execution_count": 2,
144+
"metadata": {},
145+
"outputs": [],
146+
"source": [
147+
"# not merged yet but should add"
148+
]
149+
},
150+
{
151+
"cell_type": "markdown",
152+
"metadata": {},
153+
"source": [
154+
"# Timestamp filters\n",
155+
"\n",
156+
"In Redis datetime objects are stored as numeric epoch times. Timestamp filter makes it easier to handle querying by these fields by handling conversion for you."
157+
]
158+
},
159+
{
160+
"cell_type": "markdown",
161+
"metadata": {},
162+
"source": []
163+
},
164+
{
165+
"cell_type": "markdown",
166+
"metadata": {},
167+
"source": [
168+
"# Batched queries\n",
169+
"\n",
170+
"This enhancement allows you to speed up the execution of queries by reducing the impact of network latency."
171+
]
172+
},
173+
{
174+
"cell_type": "code",
175+
"execution_count": null,
176+
"metadata": {},
177+
"outputs": [],
178+
"source": []
179+
},
180+
{
181+
"cell_type": "markdown",
182+
"metadata": {},
183+
"source": [
184+
"# Vector normalization\n",
185+
"\n",
186+
"By default Redis returns vector cosine *distance* when performing a search which returns a value between 0 and 2 where 0 would be a perfect match. Sometimes you may wish instead for a *similarity* score between 0 and 1 where 1 is a perfect match when turned on this flag does the conversion for you. Additionally, if this flag is set to true for L2 distance will normalize the euclidean distance to a value between 0 and 1 as well. \n",
187+
" "
188+
]
189+
},
190+
{
191+
"cell_type": "markdown",
192+
"metadata": {},
193+
"source": []
194+
}
195+
],
196+
"metadata": {
197+
"kernelspec": {
198+
"display_name": "Python 3",
199+
"language": "python",
200+
"name": "python3"
201+
},
202+
"language_info": {
203+
"codemirror_mode": {
204+
"name": "ipython",
205+
"version": 3
206+
},
207+
"file_extension": ".py",
208+
"mimetype": "text/x-python",
209+
"name": "python",
210+
"nbconvert_exporter": "python",
211+
"pygments_lexer": "ipython3",
212+
"version": "3.11.9"
213+
}
214+
},
215+
"nbformat": 4,
216+
"nbformat_minor": 2
217+
}

0 commit comments

Comments
 (0)