@@ -65,7 +65,7 @@ def _get_file_content_impl(self, path: str, file_type: FileType) -> str:
6565 file_type: The type of file (Prompt or Agent)
6666
6767 Returns:
68- The file content
68+ The raw file content
6969
7070 Raises:
7171 HumanloopRuntimeError: If the file doesn't exist or can't be read
@@ -79,7 +79,7 @@ def _get_file_content_impl(self, path: str, file_type: FileType) -> str:
7979 raise HumanloopRuntimeError (f"Local file not found: { local_path } " )
8080
8181 try :
82- # Read the file content
82+ # Read the raw file content
8383 with open (local_path ) as f :
8484 file_content = f .read ()
8585 logger .debug (f"Using local file content from { local_path } " )
@@ -88,7 +88,7 @@ def _get_file_content_impl(self, path: str, file_type: FileType) -> str:
8888 raise HumanloopRuntimeError (f"Error reading local file { local_path } : { str (e )} " )
8989
9090 def get_file_content (self , path : str , file_type : FileType ) -> str :
91- """Get the content of a file from cache or filesystem.
91+ """Get the raw file content of a file from cache or filesystem.
9292
9393 This method uses an LRU cache to store file contents. When the cache is full,
9494 the least recently accessed files are automatically removed to make space.
@@ -98,7 +98,7 @@ def get_file_content(self, path: str, file_type: FileType) -> str:
9898 file_type: The type of file (Prompt or Agent)
9999
100100 Returns:
101- The file content
101+ The raw file content
102102
103103 Raises:
104104 HumanloopRuntimeError: If the file doesn't exist or can't be read
@@ -153,7 +153,7 @@ def _save_serialized_file(self, serialized_content: str, file_path: str, file_ty
153153 """Save serialized file to local filesystem.
154154
155155 Args:
156- serialized_content: The content to save
156+ serialized_content: The raw file content to save
157157 file_path: The path to save the file to
158158 file_type: The type of file (Prompt or Agent)
159159
@@ -169,7 +169,7 @@ def _save_serialized_file(self, serialized_content: str, file_path: str, file_ty
169169 # Add file type extension
170170 new_path = full_path .parent / f"{ full_path .stem } .{ file_type } "
171171
172- # Write content to file
172+ # Write raw file content to file
173173 with open (new_path , "w" ) as f :
174174 f .write (serialized_content )
175175
@@ -195,16 +195,16 @@ def _pull_file(self, path: str, environment: str | None = None) -> None:
195195 file = self .client .files .retrieve_by_path (
196196 path = path ,
197197 environment = environment ,
198- include_content = True
198+ include_raw_file_content = True
199199 )
200200
201201 if file .type not in ["prompt" , "agent" ]:
202202 raise ValueError (f"Unsupported file type: { file .type } " )
203203
204- self ._save_serialized_file (file .content , file .path , file .type )
204+ self ._save_serialized_file (file .raw_file_content , file .path , file .type )
205205
206206 def _pull_directory (self ,
207- directory : str | None = None ,
207+ path : str | None = None ,
208208 environment : str | None = None ,
209209 ) -> List [str ]:
210210 """Sync Prompt and Agent files from Humanloop to local filesystem.
@@ -231,9 +231,9 @@ def _pull_directory(self,
231231 response = self .client .files .list_files (
232232 type = ["prompt" , "agent" ],
233233 page = page ,
234- include_content = True ,
234+ include_raw_file_content = True ,
235235 environment = environment ,
236- directory = directory
236+ path = path
237237 )
238238
239239 if len (response .records ) == 0 :
@@ -246,13 +246,13 @@ def _pull_directory(self,
246246 logger .warning (f"Skipping unsupported file type: { file .type } " )
247247 continue
248248
249- # Skip if no content
250- if not getattr (file , "content " , None ):
249+ # Skip if no raw file content
250+ if not getattr (file , "raw_file_content " , None ):
251251 logger .warning (f"No content found for { file .type } { getattr (file , 'id' , '<unknown>' )} " )
252252 continue
253253
254254 try :
255- self ._save_serialized_file (file .content , file .path , file .type )
255+ self ._save_serialized_file (file .raw_file_content , file .path , file .type )
256256 successful_files .append (file .path )
257257 except Exception as e :
258258 failed_files .append (file .path )
@@ -275,7 +275,7 @@ def pull(self, path: str | None = None, environment: str | None = None) -> List[
275275 """Pull files from Humanloop to local filesystem.
276276
277277 If the path ends with .prompt or .agent, pulls that specific file.
278- Otherwise, pulls all files under the specified directory path.
278+ Otherwise, pulls all files under the specified path.
279279 If no path is provided, pulls all files from the root.
280280
281281 Args:
0 commit comments