11import os
22import typing
33from typing import Any , List , Optional , Sequence , Tuple
4+ import logging
45
56import httpx
67from opentelemetry .sdk .resources import Resource
3132from humanloop .prompts .client import PromptsClient
3233from humanloop .sync .sync_client import SyncClient , DEFAULT_CACHE_SIZE
3334
35+ logger = logging .getLogger ("humanloop.sdk" )
36+
3437
3538class 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