fix(llm): resolve score runtime config from saved profiles

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-26 20:34:01 +08:00
parent 754a30ad59
commit 1df4010acc
5 changed files with 117 additions and 6 deletions

View File

@@ -54,13 +54,22 @@ class InlineScorer:
self._model_cache: dict[tuple[str, str], tuple[Any, Any]] = {}
self._lock = threading.Lock()
def invalidate_cache(self) -> None:
"""Clear the model cache so the next call rebuilds clients from current profiles."""
with self._lock:
self._model_cache.clear()
def _get_models(
self,
judge_model: str,
embedding_model: str,
settings: EvaluationSettings,
) -> tuple[Any, Any]:
"""Return cached LLM/embedding clients, building them on first use."""
"""Return cached LLM/embedding clients, building them on first use.
Cache is keyed by (judge_model, embedding_model). Call invalidate_cache()
after updating an LLM Profile to force a fresh client on the next request.
"""
cache_key = (judge_model, embedding_model)
with self._lock:
if cache_key not in self._model_cache: