zilliztech / GPTCache

Semantic cache for LLMs. Fully integrated with LangChain and llama_index.
https://gptcache.readthedocs.io
MIT License
7.06k stars 500 forks source link

[DOCS]: Any reference or guide on using MongoDB as for the cache #476

Closed OnlinePage closed 1 year ago

OnlinePage commented 1 year ago

Documentation Link

No response

Describe the problem

No response

Describe the improvement

Hi one of the recent most version indicates that it supports MongoDB for caching, However i could not find any refrence to it in the documentation. I am planning to use langchain with GPTCache with MongoDB. Can we get some reference or a guide on this?

Anything else?

No response

SimFG commented 1 year ago

Hi, @OnlinePage reference docs:

  1. how to better configure your cache
  2. recommended by newcomers
  3. mongo api reference

In general, you can use mongo as a cache store in this way, and the scalar_params parameter is the relevant parameter of the cache store, showing the default value of mongo

from gptcache.manager import manager_factory

data_manager = manager_factory("mongo,faiss", data_dir="./workspace", scalar_params={"mongo_host": "localhost", "mongo_port": 27017, dbname="gptcache", username="", password=""}, vector_params={"dimension": 128})
akshaysaini11 commented 1 year ago

Hi, @OnlinePage reference docs:

  1. how to better configure your cache
  2. recommended by newcomers
  3. mongo api reference

In general, you can use mongo as a cache store in this way, and the scalar_params parameter is the relevant parameter of the cache store, showing the default value of mongo

from gptcache.manager import manager_factory

data_manager = manager_factory("mongo,faiss", data_dir="./workspace", scalar_params={"mongo_host": "localhost", "mongo_port": 27017, dbname="gptcache", username="", password=""}, vector_params={"dimension": 128})

this code use but show error: NotFoundError: Unsupported $cache store: mongo

my use code : from gptcache.manager import manager_factory

data_manager = manager_factory("mongo,faiss", data_dir="./workspace", scalar_params={"mongo_host": "localhost", "mongo_port": 27017, "dbname":"gptcache", "username":"", "password":""}, vector_params={"dimension": 128})

SimFG commented 1 year ago

@akshaysaini11 What version of GPTCache are you using?

akshaysaini11 commented 1 year ago

gptcache == 0.1.37

this version use

akshaysaini11 commented 1 year ago

@akshaysaini11 What version of GPTCache are you using?

gptcache == 0.1.37

this version use

SimFG commented 1 year ago

@akshaysaini11 there is testing output in my conputer. image I guess your computer has some python environment. you can try to check the GPTCache version by using python -m pip show gptcache image

akshaysaini11 commented 1 year ago

@akshaysaini11 there is testing output in my conputer. image I guess your computer has some python environment. you can try to check the GPTCache version by using python -m pip show gptcache image

Hi Brother, sorry, i have check for vs code.it is working for your code in vs code. Thanks,