|
211 | 211 | "name": "stdout", |
212 | 212 | "output_type": "stream", |
213 | 213 | "text": [ |
214 | | - "\u001b[32m14:56:24\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n", |
215 | | - "\u001b[32m14:56:24\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. user_index\n" |
| 214 | + "\u001b[32m15:14:34\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n", |
| 215 | + "\u001b[32m15:14:34\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. user_index\n" |
216 | 216 | ] |
217 | 217 | } |
218 | 218 | ], |
|
221 | 221 | "!rvl index listall" |
222 | 222 | ] |
223 | 223 | }, |
| 224 | + { |
| 225 | + "cell_type": "code", |
| 226 | + "execution_count": 6, |
| 227 | + "metadata": {}, |
| 228 | + "outputs": [ |
| 229 | + { |
| 230 | + "name": "stdout", |
| 231 | + "output_type": "stream", |
| 232 | + "text": [ |
| 233 | + "\n", |
| 234 | + "\n", |
| 235 | + "Index Information:\n", |
| 236 | + "╭──────────────┬────────────────┬────────────┬─────────────────┬────────────╮\n", |
| 237 | + "│ Index Name │ Storage Type │ Prefixes │ Index Options │ Indexing │\n", |
| 238 | + "├──────────────┼────────────────┼────────────┼─────────────────┼────────────┤\n", |
| 239 | + "│ user_index │ HASH │ ['v1'] │ [] │ 0 │\n", |
| 240 | + "╰──────────────┴────────────────┴────────────┴─────────────────┴────────────╯\n", |
| 241 | + "Index Fields:\n", |
| 242 | + "╭────────────────┬────────────────┬─────────┬────────────────┬────────────────╮\n", |
| 243 | + "│ Name │ Attribute │ Type │ Field Option │ Option Value │\n", |
| 244 | + "├────────────────┼────────────────┼─────────┼────────────────┼────────────────┤\n", |
| 245 | + "│ credit_score │ credit_score │ TAG │ SEPARATOR │ , │\n", |
| 246 | + "│ job │ job │ TEXT │ WEIGHT │ 1 │\n", |
| 247 | + "│ age │ age │ NUMERIC │ │ │\n", |
| 248 | + "│ user_embedding │ user_embedding │ VECTOR │ │ │\n", |
| 249 | + "╰────────────────┴────────────────┴─────────┴────────────────┴────────────────╯\n" |
| 250 | + ] |
| 251 | + } |
| 252 | + ], |
| 253 | + "source": [ |
| 254 | + "# use the CLI to print fields in the index\n", |
| 255 | + "!rvl index info -i user_index" |
| 256 | + ] |
| 257 | + }, |
224 | 258 | { |
225 | 259 | "cell_type": "markdown", |
226 | 260 | "metadata": {}, |
|
232 | 266 | }, |
233 | 267 | { |
234 | 268 | "cell_type": "code", |
235 | | - "execution_count": 6, |
| 269 | + "execution_count": 7, |
236 | 270 | "metadata": {}, |
237 | 271 | "outputs": [], |
238 | 272 | "source": [ |
|
252 | 286 | }, |
253 | 287 | { |
254 | 288 | "cell_type": "code", |
255 | | - "execution_count": 7, |
| 289 | + "execution_count": 8, |
256 | 290 | "metadata": {}, |
257 | 291 | "outputs": [ |
258 | 292 | { |
259 | 293 | "data": { |
260 | 294 | "text/html": [ |
261 | | - "<table><tr><th>id</th><th>vector_distance</th><th>user</th><th>age</th><th>job</th><th>credit_score</th></tr><tr><td>v1:7f2670effaa140adacc13a4a74eac358</td><td>0</td><td>john</td><td>1</td><td>engineer</td><td>high</td></tr><tr><td>v1:7f01fd2181f44eb181caf6262b1a2a6e</td><td>0</td><td>mary</td><td>2</td><td>doctor</td><td>low</td></tr><tr><td>v1:6a6fee8801cd48ecadad722cca4962bf</td><td>0.653301358223</td><td>joe</td><td>3</td><td>dentist</td><td>medium</td></tr></table>" |
| 295 | + "<table><tr><th>id</th><th>vector_distance</th><th>user</th><th>age</th><th>job</th><th>credit_score</th></tr><tr><td>v1:1d91681e86f64175ac2a85d5c0d82c04</td><td>0</td><td>john</td><td>1</td><td>engineer</td><td>high</td></tr><tr><td>v1:336fba2e3e8846d0be5689a8f21da149</td><td>0</td><td>mary</td><td>2</td><td>doctor</td><td>low</td></tr><tr><td>v1:3a059b1b202c416f9a661ed1b60e7d61</td><td>0.653301358223</td><td>joe</td><td>3</td><td>dentist</td><td>medium</td></tr></table>" |
262 | 296 | ], |
263 | 297 | "text/plain": [ |
264 | 298 | "<IPython.core.display.HTML object>" |
|
297 | 331 | }, |
298 | 332 | { |
299 | 333 | "cell_type": "code", |
300 | | - "execution_count": 8, |
| 334 | + "execution_count": 9, |
301 | 335 | "metadata": {}, |
302 | 336 | "outputs": [ |
303 | 337 | { |
304 | 338 | "data": { |
305 | 339 | "text/html": [ |
306 | | - "<table><tr><th>id</th><th>vector_distance</th><th>user</th><th>age</th><th>job</th><th>credit_score</th></tr><tr><td>v1:7f2670effaa140adacc13a4a74eac358</td><td>0</td><td>john</td><td>1</td><td>engineer</td><td>high</td></tr><tr><td>v1:7f01fd2181f44eb181caf6262b1a2a6e</td><td>0</td><td>mary</td><td>2</td><td>doctor</td><td>low</td></tr><tr><td>v1:6a6fee8801cd48ecadad722cca4962bf</td><td>0.653301358223</td><td>joe</td><td>3</td><td>dentist</td><td>medium</td></tr></table>" |
| 340 | + "<table><tr><th>id</th><th>vector_distance</th><th>user</th><th>age</th><th>job</th><th>credit_score</th></tr><tr><td>v1:1d91681e86f64175ac2a85d5c0d82c04</td><td>0</td><td>john</td><td>1</td><td>engineer</td><td>high</td></tr><tr><td>v1:336fba2e3e8846d0be5689a8f21da149</td><td>0</td><td>mary</td><td>2</td><td>doctor</td><td>low</td></tr><tr><td>v1:3a059b1b202c416f9a661ed1b60e7d61</td><td>0.653301358223</td><td>joe</td><td>3</td><td>dentist</td><td>medium</td></tr></table>" |
307 | 341 | ], |
308 | 342 | "text/plain": [ |
309 | 343 | "<IPython.core.display.HTML object>" |
|
333 | 367 | }, |
334 | 368 | { |
335 | 369 | "cell_type": "code", |
336 | | - "execution_count": 9, |
| 370 | + "execution_count": 10, |
337 | 371 | "metadata": {}, |
338 | 372 | "outputs": [ |
339 | 373 | { |
340 | 374 | "data": { |
341 | 375 | "text/html": [ |
342 | | - "<table><tr><th>id</th><th>vector_distance</th><th>user</th><th>age</th><th>job</th><th>credit_score</th></tr><tr><td>v1:ecac61a5802448f695d775d50e925826</td><td>0</td><td>john</td><td>1</td><td>engineer</td><td>high</td></tr><tr><td>v1:20198d650bb84295a9c718680a7506b1</td><td>0</td><td>mary</td><td>2</td><td>doctor</td><td>low</td></tr><tr><td>v1:a7e9aa9466834e00ab91f69aae7bc71e</td><td>0.653301358223</td><td>joe</td><td>3</td><td>dentist</td><td>medium</td></tr></table>" |
| 376 | + "<table><tr><th>id</th><th>vector_distance</th><th>user</th><th>age</th><th>job</th><th>credit_score</th></tr><tr><td>v1:a88e113051364b94bbefa29d6234725d</td><td>0</td><td>john</td><td>1</td><td>engineer</td><td>high</td></tr><tr><td>v1:f850fc9073b8420984acfc79e960fdb4</td><td>0</td><td>mary</td><td>2</td><td>doctor</td><td>low</td></tr><tr><td>v1:c0aecbe4ffe14c15b574563228ea000e</td><td>0.653301358223</td><td>joe</td><td>3</td><td>dentist</td><td>medium</td></tr></table>" |
343 | 377 | ], |
344 | 378 | "text/plain": [ |
345 | 379 | "<IPython.core.display.HTML object>" |
|
369 | 403 | "results = await index.query(query)\n", |
370 | 404 | "result_print(results)" |
371 | 405 | ] |
| 406 | + }, |
| 407 | + { |
| 408 | + "cell_type": "code", |
| 409 | + "execution_count": 11, |
| 410 | + "metadata": {}, |
| 411 | + "outputs": [ |
| 412 | + { |
| 413 | + "name": "stdout", |
| 414 | + "output_type": "stream", |
| 415 | + "text": [ |
| 416 | + "\n", |
| 417 | + "Statistics:\n", |
| 418 | + "╭─────────────────────────────┬─────────────╮\n", |
| 419 | + "│ Stat Key │ Value │\n", |
| 420 | + "├─────────────────────────────┼─────────────┤\n", |
| 421 | + "│ num_docs │ 3 │\n", |
| 422 | + "│ num_terms │ 4 │\n", |
| 423 | + "│ max_doc_id │ 3 │\n", |
| 424 | + "│ num_records │ 13 │\n", |
| 425 | + "│ percent_indexed │ 1 │\n", |
| 426 | + "│ hash_indexing_failures │ 0 │\n", |
| 427 | + "│ number_of_uses │ 3 │\n", |
| 428 | + "│ bytes_per_record_avg │ 2.46154 │\n", |
| 429 | + "│ doc_table_size_mb │ 0.000294685 │\n", |
| 430 | + "│ inverted_sz_mb │ 3.05176e-05 │\n", |
| 431 | + "│ key_table_size_mb │ 0.000110626 │\n", |
| 432 | + "│ offset_bits_per_record_avg │ 8 │\n", |
| 433 | + "│ offset_vectors_sz_mb │ 3.8147e-06 │\n", |
| 434 | + "│ offsets_per_term_avg │ 0.307692 │\n", |
| 435 | + "│ records_per_doc_avg │ 4.33333 │\n", |
| 436 | + "│ sortable_values_size_mb │ 0 │\n", |
| 437 | + "│ total_indexing_time │ 0.1 │\n", |
| 438 | + "│ total_inverted_index_blocks │ 8 │\n", |
| 439 | + "│ vector_index_sz_mb │ 0.164604 │\n", |
| 440 | + "╰─────────────────────────────┴─────────────╯\n" |
| 441 | + ] |
| 442 | + } |
| 443 | + ], |
| 444 | + "source": [ |
| 445 | + "# We can also use the CLI to check the stats for the index we just used\n", |
| 446 | + "!rvl stats -i user_index" |
| 447 | + ] |
| 448 | + }, |
| 449 | + { |
| 450 | + "cell_type": "code", |
| 451 | + "execution_count": 12, |
| 452 | + "metadata": {}, |
| 453 | + "outputs": [], |
| 454 | + "source": [ |
| 455 | + "# clean up the index\n", |
| 456 | + "await index.delete()" |
| 457 | + ] |
372 | 458 | } |
373 | 459 | ], |
374 | 460 | "metadata": { |
|
0 commit comments