Refine prompt to reduce unnecessary browsing and open_file use

This commit is contained in:
Reinier van der Leer
2023-08-24 15:13:40 +02:00
parent 714f0fc676
commit bcd00b39b7
4 changed files with 7 additions and 4 deletions

View File

@@ -29,7 +29,8 @@ def agent_implements_context(agent: BaseAgent) -> bool:
@command(
"open_file",
"Open a file for editing, creating it if it does not exist yet",
"Open a file for editing, creating it if it does not exist yet."
" Note: if you only need to read or write a file once, use `write_to_file` instead.",
{
"file_path": {
"type": "string",

View File

@@ -58,4 +58,4 @@ class Command:
f"{param.name}: {param.type if param.required else f'Optional[{param.type}]'}"
for param in self.parameters
]
return f"{self.name}: {self.description}. Params: ({', '.join(params)})"
return f"{self.name}: {self.description.rstrip('.')}. Params: ({', '.join(params)})"

View File

@@ -53,7 +53,7 @@ class PromptGenerator:
params_string = ", ".join(
f'"{key}": "{value}"' for key, value in self.params.items()
)
return f'{self.label}: "{self.name}". Params: ({params_string})'
return f'{self.label}: "{self.name.rstrip(".")}". Params: ({params_string})'
def add_constraint(self, constraint: str) -> None:
"""

View File

@@ -6,10 +6,12 @@ constraints: [
resources: [
'Internet access for searches and information gathering.',
'The ability to read and write files.',
'You are a Large Language Model, trained on millions of pages of text, including a lot of factual knowledge. Make use of this factual knowledge to avoid unnecessary gathering of information.'
]
best_practices: [
'Continuously review and analyze your actions to ensure you are performing to the best of your abilities.',
'Constructively self-criticize your big-picture behavior constantly.',
'Reflect on past decisions and strategies to refine your approach.',
'Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.'
'Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.',
'Only make use of your information gathering abilities to find information that you don''t yet have knowledge of.'
]