Fix deprecation warning from importlib.resources.read_text (#543)
This commit is contained in:
		
							parent
							
								
									ecabb9ea4f
								
							
						
					
					
						commit
						ff73f5326e
					
				|  | @ -648,7 +648,7 @@ class ToolCallingAgent(MultiStepAgent): | ||||||
|         **kwargs, |         **kwargs, | ||||||
|     ): |     ): | ||||||
|         prompt_templates = prompt_templates or yaml.safe_load( |         prompt_templates = prompt_templates or yaml.safe_load( | ||||||
|             importlib.resources.read_text("smolagents.prompts", "toolcalling_agent.yaml") |             importlib.resources.files("smolagents.prompts").joinpath("toolcalling_agent.yaml").read_text() | ||||||
|         ) |         ) | ||||||
|         super().__init__( |         super().__init__( | ||||||
|             tools=tools, |             tools=tools, | ||||||
|  | @ -781,7 +781,7 @@ class CodeAgent(MultiStepAgent): | ||||||
|         self.additional_authorized_imports = additional_authorized_imports if additional_authorized_imports else [] |         self.additional_authorized_imports = additional_authorized_imports if additional_authorized_imports else [] | ||||||
|         self.authorized_imports = list(set(BASE_BUILTIN_MODULES) | set(self.additional_authorized_imports)) |         self.authorized_imports = list(set(BASE_BUILTIN_MODULES) | set(self.additional_authorized_imports)) | ||||||
|         prompt_templates = prompt_templates or yaml.safe_load( |         prompt_templates = prompt_templates or yaml.safe_load( | ||||||
|             importlib.resources.read_text("smolagents.prompts", "code_agent.yaml") |             importlib.resources.files("smolagents.prompts").joinpath("code_agent.yaml").read_text() | ||||||
|         ) |         ) | ||||||
|         super().__init__( |         super().__init__( | ||||||
|             tools=tools, |             tools=tools, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue