redis / redis-vl-python

Redis Vector Library (RedisVL) interfaces with Redis' vector database for realtime semantic search, RAG, and recommendation systems.
https://www.redisvl.com/
MIT License
210 stars 32 forks source link

ValueError: Required Redis database module searchlight with version >= 20600 not installed. Refer to Redis Stack documentation: #166

Closed pradeepdev-1995 closed 2 months ago

pradeepdev-1995 commented 3 months ago

Tried the given code

from redisvl.extensions.llmcache import SemanticCache
llmcache = SemanticCache(
    name="llmcache",                     # underlying search index name
    prefix="llmcache",                   # redis key prefix for hash entries
    redis_url="redis://localhost:6379",  # redis connection url string
    distance_threshold=0.1               # semantic cache distance threshold
)

and getting given error

using python 3.9 and redisvl==0.2.1
ValueError: Required Redis database module searchlight with version >= 20600 not installed. Refer to Redis Stack documentation:
tylerhutcherson commented 3 months ago

Can you share the output of the MODULE LIST command on your Redis instance (using Redis cli)?

and verify which version of Redis you are using?

pradeepdev-1995 commented 3 months ago

@tylerhutcherson i am using redis-cli 7.2.5 also i can empty array in MODULE LIST command

127.0.0.1:6379> MODULE LIST
(empty array)
bsbodden commented 3 months ago

You have the wrong version of Redis, follow the instructions here for your OS https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/

pradeepdev-1995 commented 3 months ago

@bsbodden Since I am using ubuntu OS,I am using these steps from the official documentation(From the link you mentioned)

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
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
sudo apt-get update
sudo apt-get install redis-stack-server

And it installing redis-cli 7.2.5 version. Here what I should change?

bsbodden commented 3 months ago

The instructions you followed should have installed the proper version of Redis with the modules required. It is possible that you had a prior version on your Linux machine and that's what's running. Try a ps aux | grep redis and if the right Redis is running you should see something like:

root         8  0.0  0.4 3102496 150696 ?      Sl   Jun18   0:03 /opt/redis-stack/nodejs/bin/node -r /opt/redis-stack/share/redisinsight/api/node_modules/dotenv/config share/redisinsight/api/dist/src/main.js dotenv_config_path=/opt/redis-stack/share/redisinsight/.env
root         9  0.1  0.1 546756 34176 ?        Sl   Jun18   2:12 /opt/redis-stack/bin/redis-server *:6379
root        63  0.0  0.0   2884  1280 pts/0    S+   17:38   0:00 grep redis

The from the redis-cli you can type module list to confirm that the modules have been correctly loaded:

127.0.0.1:6379> module list
1) 1) "name"
   2) "bf"
   3) "ver"
   4) (integer) 999999
   5) "path"
   6) "/opt/redis-stack/lib/redisbloom.so"
   7) "args"
   8) (empty array)
2) 1) "name"
   2) "ReJSON"
   3) "ver"
   4) (integer) 999999
   5) "path"
   6) "/opt/redis-stack/lib/rejson.so"
   7) "args"
   8) (empty array)
3) 1) "name"
   2) "graph"
   3) "ver"
   4) (integer) 999999
   5) "path"
   6) "/opt/redis-stack/lib/redisgraph.so"
   7) "args"
   8) 1) "MAX_QUEUED_QUERIES"
      2) "25"
      3) "TIMEOUT"
      4) "1000"
      5) "RESULTSET_SIZE"
      6) "10000"
4) 1) "name"
   2) "search"
   3) "ver"
   4) (integer) 999999
   5) "path"
   6) "/opt/redis-stack/lib/redisearch.so"
   7) "args"
   8) 1) "MAXSEARCHRESULTS"
      2) "10000"
      3) "MAXAGGREGATERESULTS"
      4) "10000"
5) 1) "name"
   2) "timeseries"
   3) "ver"
   4) (integer) 999999
   5) "path"
   6) "/opt/redis-stack/lib/redistimeseries.so"
   7) "args"
   8) (empty array)
6) 1) "name"
   2) "redisgears_2"
   3) "ver"
   4) (integer) 999999
   5) "path"
   6) "/opt/redis-stack/lib/redisgears.so"
   7) "args"
   8) 1) "v8-plugin-path"
      2) "/opt/redis-stack/lib/libredisgears_v8_plugin.so"

FYI redis-cli is just the command line interface and it's version it's not necessarily the version of the Redis server you're running. +

pradeepdev-1995 commented 3 months ago

@bsbodden I installed the redis as per the official documentation

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
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
sudo apt-get update
sudo apt-get install redis

But still getting the error in SemanticCache() ValueError: Required Redis database module searchlight with version >= 20600 not installed. Refer to Redis Stack documentation and empty module list in terminal also. Here is the screenshot Screenshot from 2024-07-03 14-40-58

bsbodden commented 2 months ago

The sudo app-get install redis will not install the right version, you need to do a sudo apt-get install redis-stack-server. See https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/linux/

pradeepdev-1995 commented 2 months ago

@bsbodden Worked it thanks

pradeepdev-1995 commented 2 months ago

@bsbodden How to configure the maximum cache size in redis-stack-server from documentation I could find this configuration- https://redis.io/docs/latest/operate/oss_and_stack/management/config-file/ but which is the exact key in configuration which decides the total storage size of the semantic cache