Gptcache

Latest version: v0.1.44

Safety actively analyzes 701563 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 7

0.1.33

πŸŽ‰ Introduction to new functions of GPTCache

1. Make some improvements to the code by fixing a few bugs. For further information, please refer to the new pull request list.
2. Add [How to better configure your cache](https://gptcache.readthedocs.io/en/latest/configure_it.html) document

What's Changed
* Updated link to langchain instructions by technicalpickles in https://github.com/zilliztech/GPTCache/pull/434
* Fix the eviction error by SimFG in https://github.com/zilliztech/GPTCache/pull/440
* [Feature] search only operation support by wybryan in https://github.com/zilliztech/GPTCache/pull/445
* T10H-85 - VectorBase change for namespace allocation by jacktempo7 in https://github.com/zilliztech/GPTCache/pull/449
* Add `How to better configure your cache` document by SimFG in https://github.com/zilliztech/GPTCache/pull/450

New Contributors
* technicalpickles made their first contribution in https://github.com/zilliztech/GPTCache/pull/434
* wybryan made their first contribution in https://github.com/zilliztech/GPTCache/pull/445
* jacktempo7 made their first contribution in https://github.com/zilliztech/GPTCache/pull/449

**Full Changelog**: https://github.com/zilliztech/GPTCache/compare/0.1.32...0.1.33

0.1.32

πŸŽ‰ Introduction to new functions of GPTCache

1. Support the redis as vector store

python
from gptcache.manager import VectorBase

vector_base = VectorBase("redis", dimension=10)


2. Fix the context len config bug

What's Changed
* Fix context_len in config by zc277584121 in https://github.com/zilliztech/GPTCache/pull/430
* Fix sequence match example by zc277584121 in https://github.com/zilliztech/GPTCache/pull/431
* Add the Redis vector store by SimFG in https://github.com/zilliztech/GPTCache/pull/432

New Contributors
* zc277584121 made their first contribution in https://github.com/zilliztech/GPTCache/pull/430

**Full Changelog**: https://github.com/zilliztech/GPTCache/compare/0.1.31...0.1.32

0.1.31

πŸŽ‰ Introduction to new functions of GPTCache

1. To improve the precision of cache hits, four similarity evaluation methods were added

- SBERT CrossEncoder Evaluation
- Cohere rerank api (**Free accounts can make up to 100 calls per minute.**)
- Multi-round dialog similarity weight matching
- Time Evaluation. For the cached answer, first check the time dimension, such as only using the generated cache for the past day

2. Fix some bugs

- OpenAI exceptions type 416
- LangChainChat does work with _agenerate function 400

more details: https://github.com/zilliztech/GPTCache/blob/main/docs/release_note.md

What's Changed
* Raise the same type's error for the openai by SimFG in https://github.com/zilliztech/GPTCache/pull/421
* Add sequence match evaluation. by wxywb in https://github.com/zilliztech/GPTCache/pull/420
* Add the Time Evaluation by SimFG in https://github.com/zilliztech/GPTCache/pull/423
* Improve SequenceMatchEvaluation for several cases. by wxywb in https://github.com/zilliztech/GPTCache/pull/424
* Change the evaluation score of sequence evaluation to be larger as th… by wxywb in https://github.com/zilliztech/GPTCache/pull/425
* LangchainChat support `_agenerate` function by SimFG in https://github.com/zilliztech/GPTCache/pull/426
* Add SBERT CrossEncoder evaluation. by wxywb in https://github.com/zilliztech/GPTCache/pull/428
* Update the version to `0.1.31` by SimFG in https://github.com/zilliztech/GPTCache/pull/429


**Full Changelog**: https://github.com/zilliztech/GPTCache/compare/0.1.30...0.1.31

0.1.30

πŸŽ‰ Introduction to new functions of GPTCache

1. Support to use the cohere rerank api to evaluate the similarity

python
from gptcache.similarity_evaluation import CohereRerankEvaluation

evaluation = CohereRerankEvaluation()
score = evaluation.evaluation(
{
'question': 'What is the color of sky?'
},
{
'answer': 'the color of sky is blue'
}
)


2. Improve the gptcache server api, refer to the "/docs" path after starting the server
3. Fix the bug about the langchain track token usage

What's Changed
* Add input summarization. by wxywb in https://github.com/zilliztech/GPTCache/pull/404
* Langchain track token usage by SimFG in https://github.com/zilliztech/GPTCache/pull/409
* Support to download the cache files by SimFG in https://github.com/zilliztech/GPTCache/pull/410
* Support to use the cohere rerank api to evaluate the similarity by SimFG in https://github.com/zilliztech/GPTCache/pull/412


**Full Changelog**: https://github.com/zilliztech/GPTCache/compare/0.1.29...0.1.30

0.1.29

πŸŽ‰ Introduction to new functions of GPTCache

1. Improve the GPTCache server by using FASTAPI

**NOTE**: The api struct has been optimized, details: [Use GPTCache server](https://github.com/zilliztech/GPTCache/blob/dev/docs/usage.md#use-gptcache-server)

2. Add the usearch vector store

python
from gptcache.manager import manager_factory

data_manager = manager_factory("sqlite,usearch", vector_params={"dimension": 10})


What's Changed
* Improve the unit test flow by SimFG in https://github.com/zilliztech/GPTCache/pull/397
* Add: USearch vector search engine by VoVoR in https://github.com/zilliztech/GPTCache/pull/399
* Add the saved token report, auto flush data by SimFG in https://github.com/zilliztech/GPTCache/pull/401
* Use the fastapi to improve the GPTCache server by SimFG in https://github.com/zilliztech/GPTCache/pull/405
* Update the version to `0.1.29` by SimFG in https://github.com/zilliztech/GPTCache/pull/406

New Contributors
* VoVoR made their first contribution in https://github.com/zilliztech/GPTCache/pull/399

**Full Changelog**: https://github.com/zilliztech/GPTCache/compare/0.1.28...0.1.29

0.1.28

πŸŽ‰ Introduction to new functions of GPTCache

To handle a large prompt, there are currently two options available:

1. Increase the column size of CacheStorage.

python
from gptcache.manager import manager_factory

data_manager = manager_factory(
"sqlite,faiss", scalar_params={"table_len_config": {"question_question": 5000}}
)


More Details:
- 'question_question': the question column size in the question table, default to 3000.
- 'answer_answer': the answer column size in the answer table, default to 3000.
- 'session_id': the session id column size in the session table, default to 1000.
- 'dep_name': the name column size in the dep table, default to 1000.
- 'dep_data': the data column size in the dep table, default to 3000.

2. When using a template, use the dynamic value in the template as the cache key instead of using the entire template as the key.

- **str template**
python
from gptcache import Config
from gptcache.processor.pre import last_content_without_template

template_obj = "tell me a joke about {subject}"
prompt = template_obj.format(subject="animal")
value = last_content_without_template(
data={"messages": [{"content": prompt}]}, cache_config=Config(template=template_obj)
)
print(value)
['animal']


- **langchain prompt template**

python
from langchain import PromptTemplate

from gptcache import Config
from gptcache.processor.pre import last_content_without_template

template_obj = PromptTemplate.from_template("tell me a joke about {subject}")
prompt = template_obj.format(subject="animal")

value = last_content_without_template(
data={"messages": [{"content": prompt}]},
cache_config=Config(template=template_obj.template),
)
print(value)
['animal']


3. Wrap the openai object, reference: [BaseCacheLLM](https://gptcache.readthedocs.io/en/dev/references/adapter.html#module-gptcache.adapter.base)

python
import random

from gptcache import Cache
from gptcache.adapter import openai
from gptcache.adapter.api import init_similar_cache
from gptcache.processor.pre import last_content

cache_obj = Cache()
init_similar_cache(
data_dir=str(random.random()), pre_func=last_content, cache_obj=cache_obj
)


def proxy_openai_chat_complete(*args, **kwargs):
nonlocal is_proxy
is_proxy = True
import openai as real_openai

return real_openai.ChatCompletion.create(*args, **kwargs)


openai.ChatCompletion.llm = proxy_openai_chat_complete
openai.ChatCompletion.cache_args = {"cache_obj": cache_obj}

openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What's GitHub"},
],
)


What's Changed
* Add the BaseCacheLLM abstract class to wrap the llm by SimFG in https://github.com/zilliztech/GPTCache/pull/394
* Add the pre-function of handling long prompt and Update context doc by SimFG in https://github.com/zilliztech/GPTCache/pull/395
* Support to config the context pre-process by the yaml file by SimFG in https://github.com/zilliztech/GPTCache/pull/396


**Full Changelog**: https://github.com/zilliztech/GPTCache/compare/0.1.27...0.1.28

Page 3 of 7

Β© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.