@@ -195,32 +195,30 @@ def overload_client(
195195 """Overloads client methods to add tracing, local file handling, and evaluation context."""
196196 # Store original log method as _log for all clients. Used in flow decorator
197197 if hasattr (client , "log" ) and not hasattr (client , "_log" ):
198- # Store original method - using getattr/setattr to avoid type errors
199- original_log = getattr (client , "log" )
200- setattr (client , "_log" , original_log )
198+ # Store original method with type ignore
199+ client ._log = client .log # type: ignore
201200
202201 # Create a closure to capture sync_client and use_local_files
203202 def log_wrapper (self : Any , ** kwargs ) -> LogResponseType :
204203 return _overload_log (self , sync_client , use_local_files , ** kwargs )
205204
206- # Replace the log method
207- setattr ( client , " log" , types .MethodType (log_wrapper , client ))
205+ # Replace the log method with type ignore
206+ client . log = types .MethodType (log_wrapper , client ) # type: ignore
208207
209208 # Overload call method for Prompt and Agent clients
210209 if _get_file_type_from_client (client ) in ["prompt" , "agent" ]:
211210 if sync_client is None and use_local_files :
212211 logger .error ("sync_client is None but client has call method and use_local_files=%s" , use_local_files )
213212 raise HumanloopRuntimeError ("sync_client is required for clients that support call operations" )
214213 if hasattr (client , "call" ) and not hasattr (client , "_call" ):
215- # Store original method - using getattr/setattr to avoid type errors
216- original_call = getattr (client , "call" )
217- setattr (client , "_call" , original_call )
214+ # Store original method with type ignore
215+ client ._call = client .call # type: ignore
218216
219217 # Create a closure to capture sync_client and use_local_files
220218 def call_wrapper (self : Any , ** kwargs ) -> CallResponseType :
221219 return _overload_call (self , sync_client , use_local_files , ** kwargs )
222220
223- # Replace the call method
224- setattr ( client , " call" , types .MethodType (call_wrapper , client ))
221+ # Replace the call method with type ignore
222+ client . call = types .MethodType (call_wrapper , client ) # type: ignore
225223
226224 return client
0 commit comments