Skip to content

Commit

Permalink
add a flag for search only operation (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
wybryan authored Jun 26, 2023
1 parent 10dcfae commit 1106f08
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gptcache/adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def adapt(llm_handler, cache_data_convert, update_cache_callback, *args, **kwarg
:param kwargs: llm kwargs
:return: llm result
"""
search_only_flag = kwargs.pop("search_only", False)
user_temperature = "temperature" in kwargs
user_top_k = "top_k" in kwargs
temperature = kwargs.pop("temperature", 0.0)
Expand Down Expand Up @@ -191,6 +192,9 @@ def post_process():
llm_handler, cache_data_convert, update_cache_callback, *args, **kwargs
)
else:
if search_only_flag:
# cache miss
return None
llm_data = time_cal(
llm_handler, func_name="llm_request", report_func=chat_cache.report.llm
)(*args, **kwargs)
Expand Down

0 comments on commit 1106f08

Please sign in to comment.