zilliztech / GPTCache

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

[BUG] search_result distances may come as strings #462

Closed andre-meneses-fivestars closed 1 year ago

andre-meneses-fivestars commented 1 year ago

While testing GPTCache with PostrgreSQL as cache_base and RedisVectorStore as vector_base, along with SearchDistanceEvaluation as similarity_evaluation an error occurs, because the distance value in cache_dict is a str and then it can't be compared with 0 right from the start.

I added a cast to float in order to fix the Bug.

sre-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: andre-meneses-fivestars To complete the pull request process, please assign simfg after the PR has been reviewed. You can assign the PR to them by writing /assign @simfg in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/zilliztech/GPTCache/blob/main/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
sre-ci-robot commented 1 year ago

Welcome @andre-meneses-fivestars! It looks like this is your first PR to zilliztech/GPTCache 🎉

andre-meneses-fivestars commented 1 year ago

There is a better way to fix this from the RedisVectorStore side

SimFG commented 1 year ago

@andre-meneses-fivestars the bug has fix in the dev branch. And i will publish a new version

andre-meneses-fivestars commented 1 year ago

@andre-meneses-fivestars the bug has fix in the dev branch. And i will publish a new version

@SimFG I see you also fixed removing the doc_prefix, which I was going to address next ;) Thank you

SimFG commented 1 year ago

Thank your attention and support

andre-meneses-fivestars commented 1 year ago

@SimFG no problem. Will you update the release on PyPI ?

SimFG commented 1 year ago

@andre-meneses-fivestars has released, you can try to install the latest version 0.1.34

andre-meneses-fivestars commented 1 year ago

@SimFG already installed. You're great!