Changed source code documentation for get_system_prompt function
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user