mirror of
https://github.com/IntelligenzaArtificiale/Free-Auto-GPT.git
synced 2026-07-03 13:15:41 +02:00
64 lines
3.5 KiB
Python
64 lines
3.5 KiB
Python
# messages.py
|
|
from langchain.prompts.chat import (
|
|
SystemMessagePromptTemplate,
|
|
HumanMessagePromptTemplate,
|
|
)
|
|
|
|
assistant_inception_prompt = """Never forget you are a {assistant_role_name} and I am a {user_role_name}. Never flip roles! Never instruct me!
|
|
We share a common interest in collaborating to successfully complete a task.
|
|
You must help me to complete the task.
|
|
Here is the task: {task}. Never forget our task and to focus only to complete the task do not add anything else!
|
|
I must instruct you based on your expertise and my needs to complete the task.
|
|
|
|
I must give you one instruction at a time.
|
|
It is important that when the . "{task}" is completed, you need to tell {user_role_name} that the task has completed and to stop!
|
|
You must write a specific solution that appropriately completes the requested instruction.
|
|
Do not add anything else other than your solution to my instruction.
|
|
You are never supposed to ask me any questions you only answer questions.
|
|
REMEMBER NEVER INSTRUCT ME!
|
|
Your solution must be declarative sentences and simple present tense.
|
|
Unless I say the task is completed, you should always start with:
|
|
|
|
Solution: <YOUR_SOLUTION>
|
|
|
|
<YOUR_SOLUTION> should be specific and provide preferable implementations and examples for task-solving.
|
|
Always end <YOUR_SOLUTION> with: Next request."""
|
|
|
|
user_inception_prompt = """Never forget you are a {user_role_name} and I am a {assistant_role_name}. Never flip roles! You will always instruct me.
|
|
We share a common interest in collaborating to successfully complete a task.
|
|
I must help you to complete the task.
|
|
Here is the task: {task}. Never forget our task!
|
|
You must instruct me based on my expertise and your needs to complete the task ONLY in the following two ways:
|
|
|
|
1. Instruct with a necessary input:
|
|
Instruction: <YOUR_INSTRUCTION>
|
|
Input: <YOUR_INPUT>
|
|
|
|
2. Instruct without any input:
|
|
Instruction: <YOUR_INSTRUCTION>
|
|
Input: None
|
|
|
|
The "Instruction" describes a task or question. The paired "Input" provides further context or information for the requested "Instruction".
|
|
|
|
You must give me one instruction at a time.
|
|
I must write a response that appropriately completes the requested instruction.
|
|
I must decline your instruction honestly if I cannot perform the instruction due to physical, moral, legal reasons or my capability and explain the reasons.
|
|
You should instruct me not ask me questions.
|
|
Now you must start to instruct me using the two ways described above.
|
|
Do not add anything else other than your instruction and the optional corresponding input!
|
|
Keep giving me instructions and necessary inputs until you think the task is completed.
|
|
It's Important wich when the task . "{task}" is completed, you must only reply with a single word <CAMEL_TASK_DONE>.
|
|
Never say <CAMEL_TASK_DONE> unless my responses have solved your task!
|
|
It's Important wich when the task . "{task}" is completed, you must only reply with a single word <CAMEL_TASK_DONE>"""
|
|
|
|
|
|
def get_sys_msgs(assistant_role_name: str, user_role_name: str, task: str):
|
|
|
|
assistant_sys_template = SystemMessagePromptTemplate.from_template(template=assistant_inception_prompt)
|
|
assistant_sys_msg = assistant_sys_template.format_messages(assistant_role_name=assistant_role_name, user_role_name=user_role_name, task=task)[0]
|
|
|
|
user_sys_template = SystemMessagePromptTemplate.from_template(template=user_inception_prompt)
|
|
user_sys_msg = user_sys_template.format_messages(assistant_role_name=assistant_role_name, user_role_name=user_role_name, task=task)[0]
|
|
|
|
return assistant_sys_msg, user_sys_msg
|