@@ -5,6 +5,81 @@ To read the following content, you need to understand the basic use of GPTCache,
55- [ Readme doc] ( https://github.com/zilliztech/GPTCache )
66- [ Usage doc] ( https://github.com/zilliztech/GPTCache/blob/main/docs/usage.md )
77
8+ ## v0.1.31 (2023.6.14)
9+
10+ 1 . To improve the precision of cache hits, two similarity evaluation methods were added
11+
12+ a. SBERT CrossEncoder Evaluation
13+
14+ ``` python
15+ from gptcache.similarity_evaluation import SbertCrossencoderEvaluation
16+ evaluation = SbertCrossencoderEvaluation()
17+ score = evaluation.evaluation(
18+ {
19+ ' question' : ' What is the color of sky?'
20+ },
21+ {
22+ ' question' : ' hello'
23+ }
24+ )
25+ ```
26+
27+ b. Cohere rerank api (** Free accounts can make up to 100 calls per minute.** )
28+
29+ ``` python
30+ from gptcache.similarity_evaluation import CohereRerankEvaluation
31+
32+ evaluation = CohereRerankEvaluation()
33+ score = evaluation.evaluation(
34+ {
35+ ' question' : ' What is the color of sky?'
36+ },
37+ {
38+ ' answer' : ' the color of sky is blue'
39+ }
40+ )
41+ ```
42+
43+ c. Multi-round dialog similarity weight matching
44+
45+ ``` python
46+ from gptcache.similarity_evaluation import SequenceMatchEvaluation
47+
48+ weights = [0.5 , 0.3 , 0.2 ]
49+ evaluation = SequenceMatchEvaluation(weights, ' onnx' )
50+
51+ query = {
52+ ' question' : ' USER: "foo2" USER: "foo4"' ,
53+ }
54+
55+ cache = {
56+ ' question' : ' USER: "foo6" USER: "foo8"' ,
57+ }
58+
59+ score = evaluation.evaluation(query, cache)
60+ ```
61+
62+ d. Time Evaluation. For the cached answer, first check the time dimension, such as only using the generated cache for the past day
63+
64+ ``` python
65+ from gptcache.similarity_evaluation import TimeEvaluation
66+
67+ evaluation = TimeEvaluation(evaluation = " distance" , time_range = 86400 )
68+
69+ similarity = eval .evaluation(
70+ {},
71+ {
72+ " search_result" : (3.5 , None ),
73+ " cache_data" : CacheData(" a" , " b" , create_on = datetime.datetime.now()),
74+ },
75+ )
76+ ```
77+
78+ 2 . Fix some bugs
79+
80+ a. OpenAI exceptions type #416
81+ b. LangChainChat does work with _ agenerate function #400
82+
883## v0.1.30 (2023.6.7)
984
10851 . Support to use the cohere rerank api to evaluate the similarity
0 commit comments