From 0a5769f8a056f9d8b1ff4be34a505c86c5e04ebe Mon Sep 17 00:00:00 2001 From: Heiko Joerg Schick Date: Mon, 19 Aug 2024 19:20:35 +0200 Subject: [PATCH] Changed source code documentation for get_system_prompt function --- yolo.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/yolo.py b/yolo.py index c2ca901..575f48e 100755 --- a/yolo.py +++ b/yolo.py @@ -140,30 +140,28 @@ def get_os_friendly_name(): return os_name -# TODO: Change comment def get_system_prompt(user_prompt, shell): """ - Constructs a full prompt string by appending the user's prompt to a predefined prompt template - located in the PROMPT_FILE file. + Retrieves and constructs a system prompt by replacing placeholders + in a predefined template with specific values. - The function finds the absolute path of the currently executing file, and based on this path, - identifies the directory of PROMPT_FILE. It reads this file, replaces placeholders {shell} - and {os} in the text file with a passed shell parameter and the friendly name of the operating - system respectively. The user prompt is then appended to this pre-prompt. If the resulting - prompt does not end with a question mark or a period, a question mark is added at last. + The function finds the absolute path of the currently executing file + and, based on this path, identifies the directory of PROMPT_FILE. + It reads the file and replaces the placeholders {shell} and {os} + with the provided shell parameter and the friendly name of the operating system, respectively. Parameters ---------- user_prompt : str - The prompt supplied by the user to be appended to the pre-prompt. + The user's prompt (not used in this function, included for context in future use). shell : str - The shell information to be inserted in the place of {shell} placeholder in PROMPT_FILE. + The shell information to be inserted in place of the {shell} placeholder in PROMPT_FILE. Returns ------- str - The full prompt, constructed from the template prompt in PROMPT_FILE, - user-provided shell info, the OS name, and the user-supplied prompt string. + The system prompt, constructed from the template prompt in PROMPT_FILE + with the shell and OS placeholders replaced with actual values. """ yolo_path = os.path.abspath(__file__) prompt_path = os.path.dirname(yolo_path)