Fix llm_model_func retrieval error.

This commit is contained in:
yangdx
2025-02-02 03:54:41 +08:00
parent 873b52d2e4
commit 8484564f50

View File

@@ -368,7 +368,7 @@ async def get_best_cached_response(
original_prompt=None, original_prompt=None,
cache_type=None, cache_type=None,
) -> Union[str, None]: ) -> Union[str, None]:
logger.debug(f"get_best_cached_response: mode={mode} cache_type={cache_type}") logger.debug(f"get_best_cached_response: mode={mode} cache_type={cache_type} use_llm_check={use_llm_check}")
mode_cache = await hashing_kv.get_by_id(mode) mode_cache = await hashing_kv.get_by_id(mode)
if not mode_cache: if not mode_cache:
return None return None
@@ -511,11 +511,7 @@ async def handle_cache(
if is_embedding_cache_enabled: if is_embedding_cache_enabled:
# Use embedding cache # Use embedding cache
current_embedding = await hashing_kv.embedding_func([prompt]) current_embedding = await hashing_kv.embedding_func([prompt])
llm_model_func = ( llm_model_func = hashing_kv.global_config.get('llm_model_func')
hashing_kv.llm_model_func
if hasattr(hashing_kv, "llm_model_func")
else None
)
quantized, min_val, max_val = quantize_embedding(current_embedding[0]) quantized, min_val, max_val = quantize_embedding(current_embedding[0])
best_cached_response = await get_best_cached_response( best_cached_response = await get_best_cached_response(
hashing_kv, hashing_kv,