Skip to content

Commit 2072cf3

Browse files
committed
Rename files_directory to local_files_directory in HL Client
1 parent 893b23c commit 2072cf3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/humanloop/client.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import typing
33
from typing import Any, List, Optional, Sequence, Tuple
4+
import logging
45

56
import httpx
67
from opentelemetry.sdk.resources import Resource
@@ -31,6 +32,8 @@
3132
from humanloop.prompts.client import PromptsClient
3233
from humanloop.sync.sync_client import SyncClient, DEFAULT_CACHE_SIZE
3334

35+
logger = logging.getLogger("humanloop.sdk")
36+
3437

3538
class ExtendedEvalsClient(EvaluationsClient):
3639
"""
@@ -105,7 +108,7 @@ def __init__(
105108
opentelemetry_tracer_provider: Optional[TracerProvider] = None,
106109
opentelemetry_tracer: Optional[Tracer] = None,
107110
use_local_files: bool = False,
108-
files_directory: str = "humanloop",
111+
local_files_directory: str = "humanloop",
109112
cache_size: int = DEFAULT_CACHE_SIZE,
110113
):
111114
"""
@@ -128,7 +131,7 @@ def __init__(
128131
opentelemetry_tracer_provider: Optional tracer provider for telemetry
129132
opentelemetry_tracer: Optional tracer for telemetry
130133
use_local_files: Whether to use local files for prompts and agents
131-
files_directory: Directory for local files (default: "humanloop")
134+
local_files_directory: Directory for local files (default: "humanloop")
132135
cache_size: Maximum number of files to cache when use_local_files is True (default: DEFAULT_CACHE_SIZE).
133136
This parameter has no effect if use_local_files is False.
134137
"""
@@ -142,7 +145,16 @@ def __init__(
142145
)
143146

144147
self.use_local_files = use_local_files
145-
self._sync_client = SyncClient(client=self, base_dir=files_directory, cache_size=cache_size)
148+
149+
# Warn user if cache_size is non-default but use_local_files is False — has no effect and will therefore be ignored
150+
if not self.use_local_files and cache_size != DEFAULT_CACHE_SIZE:
151+
logger.warning(
152+
f"The specified cache_size={cache_size} will have no effect because use_local_files=False. "
153+
f"File caching is only active when local files are enabled."
154+
)
155+
156+
# Check if cache_size is non-default but use_local_files is False
157+
self._sync_client = SyncClient(client=self, base_dir=local_files_directory, cache_size=cache_size)
146158
eval_client = ExtendedEvalsClient(client_wrapper=self._client_wrapper)
147159
eval_client.client = self
148160
self.evaluations = eval_client

0 commit comments

Comments
 (0)