Skip to content

Commit

Permalink
Add the disable report config
Browse files Browse the repository at this point in the history
Signed-off-by: SimFG <[email protected]>
  • Loading branch information
SimFG committed Nov 1, 2023
1 parent 57b1827 commit fd026b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions examples/data_manager/scalar_store.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import os

import numpy as np

from gptcache.adapter import openai
from gptcache import cache
from gptcache.adapter import openai
from gptcache.manager import get_data_manager, CacheBase, VectorBase
from gptcache.similarity_evaluation.distance import SearchDistanceEvaluation


d = 8


# Change the embdding function to your own
def mock_embeddings(data, **kwargs):
return np.random.random((d, )).astype('float32')

Expand Down
2 changes: 1 addition & 1 deletion gptcache/adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def post_process():
chat_cache.data_manager.add_session(
cache_whole_data[2], session.name, pre_embedding_data
)
if cache_whole_data:
if cache_whole_data and not chat_cache.config.disable_report:
# user_question / cache_question / cache_question_id / cache_answer / similarity / consume time/ time
report_cache_data = cache_whole_data[3]
report_search_data = cache_whole_data[2]
Expand Down
2 changes: 2 additions & 0 deletions gptcache/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(
context_len: Optional[int] = None,
skip_list: List[str] = None,
data_check: bool = False,
disable_report: bool = False,
):
if similarity_threshold < 0 or similarity_threshold > 1:
raise CacheError(
Expand All @@ -63,3 +64,4 @@ def __init__(
skip_list = ["system", "assistant"]
self.skip_list = skip_list
self.data_check = data_check
self.disable_report = disable_report

0 comments on commit fd026b8

Please sign in to comment.