Skip to content

Commit 2769ad6

Browse files
authored
Merge pull request #221 from xmican10/LEADS-246-single-cache-property
[LEADS-246] Global cache configuration option
2 parents 377a66b + 8c0ca9d commit 2769ad6

13 files changed

Lines changed: 930 additions & 643 deletions

File tree

config/system.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ core:
55
max_threads: 50 # Maximum number of threads, set to null for Python default. 50 is OK for bigger datasets
66
fail_on_invalid_data: true # If False don't fail on invalid conversations (like missing context for some metrics)
77
skip_on_failure: false # If True, skip remaining turns when a turn evaluation fails (can be overridden per conversation)
8+
cache_enabled: true # Global cache toggle, if True LLM as a judge, embeddings and API queries are cached
9+
cache_base_dir: .caches # Global base cache dir (queries cached separately under /llm (LLM as a judge + embeddings) and /api)
810

911
# LLM as a judge configuration (Legacy)
1012
# Deprecated: top-level llm: (single judge) will be removed — use llm_pool + judge_panel only.
@@ -17,15 +19,11 @@ core:
1719
# max_tokens: 512 # Maximum tokens in response
1820
# timeout: 300 # Request timeout in seconds
1921
# num_retries: 3 # Retry attempts
20-
# cache_dir: ".caches/llm_cache" # Directory with LLM cache
21-
# cache_enabled: true # Is LLM cache enabled?
2222

2323
# Pool of named models (judges reference these IDs)
2424
# Default values merge into each model; parameters supports extra provider keys; null removes an inherited parameter.
2525
llm_pool:
2626
defaults:
27-
cache_enabled: true
28-
cache_dir: ".caches/llm_cache"
2927
timeout: 300
3028
num_retries: 3
3129
parameters:
@@ -64,9 +62,6 @@ embedding:
6462
provider: "openai"
6563
model: "text-embedding-3-small"
6664
provider_kwargs: {}
67-
cache_dir: ".caches/embedding_cache"
68-
cache_enabled: true
69-
7065

7166
# Lightspeed-stack API Configuration
7267
# To get real time data. Currently it supports lightspeed-stack API.
@@ -90,9 +85,6 @@ api:
9085
# Example: extra_request_params:
9186
# mode: troubleshooting
9287
extra_request_params: null
93-
94-
cache_dir: ".caches/api_cache" # Directory with lightspeed-stack cache
95-
cache_enabled: true # Is lightspeed-stack cache enabled?
9688

9789
# MCP Server Authentication Configuration
9890
mcp_headers:

src/lightspeed_evaluation/core/constants.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,17 @@
5050
SIMILARITY_JARO_WINKLER: DistanceMeasure.JARO_WINKLER,
5151
}
5252

53+
# Cache configuration
54+
DEFAULT_CACHE_BASE_DIR = ".caches"
55+
DEFAULT_API_CACHE_SUBDIR = "api"
56+
DEFAULT_LLM_CACHE_SUBDIR = "llm"
5357

5458
# API Constants
5559
DEFAULT_API_BASE = "http://localhost:8080"
5660
DEFAULT_API_VERSION = "v1"
5761
DEFAULT_API_TIMEOUT = 300
5862
DEFAULT_ENDPOINT_TYPE = "streaming"
5963
SUPPORTED_ENDPOINT_TYPES = ["streaming", "query", "infer"]
60-
DEFAULT_API_CACHE_DIR = ".caches/api_cache"
6164

6265
DEFAULT_API_NUM_RETRIES = 3
6366

@@ -75,11 +78,9 @@
7578
DEFAULT_LLM_TEMPERATURE = 0.0
7679
DEFAULT_LLM_MAX_TOKENS = 512
7780
DEFAULT_LLM_RETRIES = 3
78-
DEFAULT_LLM_CACHE_DIR = ".caches/llm_cache"
7981

8082
DEFAULT_EMBEDDING_PROVIDER = "openai"
8183
DEFAULT_EMBEDDING_MODEL = "text-embedding-3-small"
82-
DEFAULT_EMBEDDING_CACHE_DIR = ".caches/embedding_cache"
8384

8485
DEFAULT_OUTPUT_DIR = "./eval_output"
8586
DEFAULT_BASE_FILENAME = "evaluation"

src/lightspeed_evaluation/core/models/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525
from lightspeed_evaluation.core.models.system import (
2626
APIConfig,
2727
CoreConfig,
28+
LoggingConfig,
29+
SystemConfig,
30+
VisualizationConfig,
31+
)
32+
from lightspeed_evaluation.core.models.llm import (
2833
EmbeddingConfig,
2934
GEvalConfig,
3035
GEvalRubricConfig,
3136
JudgePanelConfig,
3237
LLMConfig,
3338
LLMPoolConfig,
34-
LoggingConfig,
35-
SystemConfig,
36-
VisualizationConfig,
3739
)
3840
from lightspeed_evaluation.core.models.statistics import (
3941
NumericStats,

src/lightspeed_evaluation/core/models/agents.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from lightspeed_evaluation.core.constants import (
99
DEFAULT_API_BASE,
10-
DEFAULT_API_CACHE_DIR,
1110
DEFAULT_API_NUM_RETRIES,
1211
DEFAULT_API_TIMEOUT,
1312
DEFAULT_API_VERSION,
@@ -101,9 +100,8 @@ class HttpApiBaseFields(BaseModel):
101100
default=None, description="System prompt for API calls"
102101
)
103102
extra_request_params: Optional[dict[str, Any]] = Field(default=None)
104-
cache_dir: str = Field(
105-
default=DEFAULT_API_CACHE_DIR,
106-
min_length=1,
103+
cache_dir: Optional[str] = Field(
104+
default=None,
107105
description="Location of cached API queries",
108106
)
109107
cache_enabled: bool = Field(

0 commit comments

Comments
 (0)