zilliztech / GPTCache

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

Fix when partition key is not supplied #605

Closed ziyi-curiousthing closed 10 months ago

ziyi-curiousthing commented 10 months ago

Fix when partition key is not supplied, default to empty string.

sre-ci-robot commented 10 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ziyi-curiousthing To complete the pull request process, please assign cxie after the PR has been reviewed. You can assign the PR to them by writing /assign @cxie 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/dev/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
SimFG commented 10 months ago

@ziyi-curiousthing it doesn't seem to change obviously. When partition_key is what value, an exception will occur

ziyi-curiousthing commented 10 months ago

@SimFG This is to fix the case where user doesn't supply partition_key, so it is passed in as None and Milvus doesn't like it because the field type is string. I am not quite sure how to set the field to be optional so that it can take None (or save without this property). Any suggestions?

SimFG commented 10 months ago

@ziyi-curiousthing maybe when the partition key is None, you can set it's value to default, like:

partition_key = kwargs.get("partition_key", "default")
SimFG commented 10 months ago

And for the better way, you should have a param when initing the milvus, which is whether enable the partition key function.

ziyi-curiousthing commented 10 months ago

And for the better way, you should have a param when initing the milvus, which is whether enable the partition key function.

Thank you @SimFG for your feedback. Should be addressed now.