Skip to content

How to enable the mysql DB with GPTcache? #375

Answered by SimFG
terryweijian asked this question in Q&A
Discussion options

You must be logged in to vote

you can try the following code snippet:

from gptcache.embedding import Onnx
from gptcache.manager import manager_factory

onnx = Onnx()
data_manager = manager_factory(
    "mysql,faiss",
    scalar_params={
        "sql_url": "mysql+pymysql://root:123456@127.0.0.1:3306/mysql",
        "table_name": "gptcache",
    },
    vector_params={"dimension": onnx.dimension},
)

more examples: https://github.com/zilliztech/GPTCache/blob/main/examples/data_manager/scalar_store.py

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@SimFG
Comment options

@Coditas-Vikas-Tiwari
Comment options

@SimFG
Comment options

@prakashpatidarcoindcx
Comment options

@SimFG
Comment options

Answer selected by SimFG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants