From 483352254dcd30d68f3c1e7bab3d2ea9c6348db3 Mon Sep 17 00:00:00 2001 From: Arsenii Shatokhin Date: Tue, 30 Jan 2024 07:52:30 +0400 Subject: [PATCH] Use pathlib to get class folder path #52 --- agency_swarm/agents/agent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agency_swarm/agents/agent.py b/agency_swarm/agents/agent.py index 290b0688..62761cf5 100644 --- a/agency_swarm/agents/agent.py +++ b/agency_swarm/agents/agent.py @@ -1,6 +1,7 @@ import inspect import json import os +from pathlib import Path from typing import Dict, Union, Any, Type from typing import List @@ -459,7 +460,8 @@ def _read_instructions(self): self.instructions = f.read() def get_class_folder_path(self): - return os.path.abspath(os.path.dirname(inspect.getfile(self.__class__))) + return str(Path(__file__).parent.resolve()) + # return os.path.abspath(os.path.dirname(inspect.getfile(self.__class__))) def add_shared_instructions(self, instructions: str): if self._shared_instructions is None: