Adjust SYSTEM_PROMPT_PATH usage to support new file selection
This commit is contained in:
@@ -14,8 +14,12 @@ class BaseTelegramInferenceBot(ABC):
|
||||
|
||||
@staticmethod
|
||||
def load_system_prompt():
|
||||
with open(os.environ.get("SYSTEM_PROMPT_PATH"), "r", encoding="utf-8") as file:
|
||||
return file.read().strip()
|
||||
system_prompt_path = os.getenv("SYSTEM_PROMPT_PATH")
|
||||
if system_prompt_path and os.path.isfile(system_prompt_path):
|
||||
with open(system_prompt_path, "r", encoding="utf-8") as file:
|
||||
return file.read().strip()
|
||||
else:
|
||||
raise FileNotFoundError("SYSTEM_PROMPT_PATH is not set or file does not exist.")
|
||||
|
||||
@staticmethod
|
||||
def load_functions():
|
||||
@@ -52,7 +56,7 @@ class BaseTelegramInferenceBot(ABC):
|
||||
|
||||
def call_tool(self, function_call_name, function_call_arguments):
|
||||
function_name = function_call_name
|
||||
function_args = json.loads(function_call_arguments if function_call_arguments is not None else "{}")
|
||||
function_args = json.loads(function_call_arguments if function_call_arguments is not None else "{}").
|
||||
for tool in self.tools:
|
||||
if function_name in [f["name"] for f in tool.get_functions()]:
|
||||
return tool.execute(function_name, **function_args)
|
||||
|
||||
Reference in New Issue
Block a user