1515from humanloop .prompts .client import PromptsClient
1616from humanloop .agents .client import AgentsClient
1717from humanloop .tools .client import ToolsClient
18+ from humanloop .types import FileType
1819from humanloop .types .create_evaluator_log_response import CreateEvaluatorLogResponse
1920from humanloop .types .create_flow_log_response import CreateFlowLogResponse
2021from humanloop .types .create_prompt_log_response import CreatePromptLogResponse
@@ -128,7 +129,6 @@ def _overload_call(self, **kwargs) -> PromptCallResponse:
128129def overload_call_with_local_files (
129130 client : Union [PromptsClient , AgentsClient ],
130131 use_local_files : bool ,
131- file_type : Literal ["prompt" , "agent" ]
132132) -> Union [PromptsClient , AgentsClient ]:
133133 """Overload call to handle local files when use_local_files is True.
134134
@@ -138,6 +138,14 @@ def overload_call_with_local_files(
138138 file_type: Type of file ("prompt" or "agent")
139139 """
140140 original_call = client ._call if hasattr (client , '_call' ) else client .call
141+ # get file type from client type
142+ file_type : FileType
143+ if isinstance (client , PromptsClient ):
144+ file_type = "prompt"
145+ elif isinstance (client , AgentsClient ):
146+ file_type = "agent"
147+ else :
148+ raise ValueError (f"Unsupported client type: { type (client )} " )
141149
142150 def _overload_call (self , ** kwargs ) -> PromptCallResponse :
143151 if use_local_files and "path" in kwargs :
@@ -152,7 +160,7 @@ def _overload_call(self, **kwargs) -> PromptCallResponse:
152160 with open (local_path ) as f :
153161 file_content = f .read ()
154162
155- kwargs [file_type ] = file_content # "prompt" or "agent"
163+ kwargs [file_type ] = file_content # "prompt" or "agent" # TODO: raise warning if kernel passed in
156164
157165 logger .debug (f"Using local file content from { local_path } " )
158166 else :
0 commit comments