|
1 | 1 | {
|
2 | 2 | "cells": [
|
3 |
| - { |
4 |
| - "cell_type": "markdown", |
5 |
| - "metadata": {}, |
6 |
| - "source": [ |
7 |
| - "# Semantic Caching for LLMs\n", |
8 |
| - "\n", |
9 |
| - "RedisVL provides a ``SemanticCache`` interface to utilize Redis' built-in caching capabilities AND vector search in order to store responses from previously-answered questions. This reduces the number of requests and tokens sent to the Large Language Models (LLM) service, decreasing costs and enhancing application throughput (by reducing the time taken to generate responses).\n", |
10 |
| - "\n", |
11 |
| - "This notebook will go over how to use Redis as a Semantic Cache for your applications" |
12 |
| - ] |
13 |
| - }, |
14 | 3 | {
|
15 | 4 | "cell_type": "markdown",
|
16 | 5 | "metadata": {},
|
|
110 | 99 | " name=\"llmcache\", # underlying search index name\n",
|
111 | 100 | " redis_url=\"redis://localhost:6379\", # redis connection url string\n",
|
112 | 101 | " distance_threshold=0.1, # semantic cache distance threshold\n",
|
113 |
| - " vectorizer=HFTextVectorizer(\"redis/langcache-embed-v1\"), # embdding model\n", |
| 102 | + " vectorizer=HFTextVectorizer(\"redis/langcache-embed-v1\"), # embedding model\n", |
114 | 103 | ")"
|
115 | 104 | ]
|
116 | 105 | },
|
|
315 | 304 | "cell_type": "markdown",
|
316 | 305 | "metadata": {},
|
317 | 306 | "source": [
|
318 |
| - "## Customize the Distance Threshhold\n", |
| 307 | + "## Customize the Distance Threshold\n", |
319 | 308 | "\n",
|
320 |
| - "For most use cases, the right semantic similarity threshhold is not a fixed quantity. Depending on the choice of embedding model,\n", |
321 |
| - "the properties of the input query, and even business use case -- the threshhold might need to change. \n", |
| 309 | + "For most use cases, the right semantic similarity threshold is not a fixed quantity. Depending on the choice of embedding model,\n", |
| 310 | + "the properties of the input query, and even business use case -- the threshold might need to change. \n", |
322 | 311 | "\n",
|
323 |
| - "Fortunately, you can seamlessly adjust the threshhold at any point like below:" |
| 312 | + "Fortunately, you can seamlessly adjust the threshold at any point like below:" |
324 | 313 | ]
|
325 | 314 | },
|
326 | 315 | {
|
|
930 | 919 | "name": "python",
|
931 | 920 | "nbconvert_exporter": "python",
|
932 | 921 | "pygments_lexer": "ipython3",
|
933 |
| - "version": "3.13.2" |
| 922 | + "version": "3.12.8" |
934 | 923 | },
|
935 | 924 | "orig_nbformat": 4
|
936 | 925 | },
|
|
0 commit comments