Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

fix: sample new instruction pool before updating the existing function (#1446)

AveryYayc7bd39c898cb
diff --git a/camel/datagen/self_instruct/self_instruct.py b/camel/datagen/self_instruct/self_instruct.py
index 25a31a5b8..ff0487824 100644
--- a/camel/datagen/self_instruct/self_instruct.py
+++ b/camel/datagen/self_instruct/self_instruct.py
@@ -365,13 +365,13 @@ class SelfInstructPipeline:
and instances.
"""
while len(self.machine_tasks) < self.num_machine_instructions:
+ prompt, instruction = self.generate_machine_instruction()
existing_instructions = [
t["instruction"] for t in self.human_tasks
] + [t["instruction"] for t in self.machine_tasks]
for f in self.instruction_filter.filters:
if isinstance(f, RougeSimilarityFilter):
f.existing_instructions = existing_instructions
- prompt, instruction = self.generate_machine_instruction()
if self.instruction_filter.filter(prompt, instruction):
instruction_dict = {
"id": f"machine_task_{len(self.machine_tasks) + 1}",
diff --git a/camel/datagen/self_instruct/templates.py b/camel/datagen/self_instruct/templates.py
index 3fa2ec2e9..8a34c0565 100644
--- a/camel/datagen/self_instruct/templates.py
+++ b/camel/datagen/self_instruct/templates.py
@@ -269,22 +269,20 @@ class SelfInstructTemplates:
'''
input_first_template_for_gen = '''You will be given a task,
- Please generate at most two example instances illustrating how to
+ Your job is to generate at most two example instances demonstrating how to
perform this task. For each instance:
- - If the task requires input (as an actual instance of the task),
- provide it. if the task itself can be answered without an instance,
- skip the input.
- - Then provide the correct output.
+ - If the task requires input (as an actual example of the task), provide it.
+ - If the task can be answered directly without requiring input, omit the input section.
- Do not provide any additional commentary, explanations, or more than two instances. Just show the instances in the following format:
-
- Example 1
- [Input if necessary]
- Output: [oldest person]
-
- Example 2
- [Input if necessary]
- Output: [oldest person]
+ Example 1
+ Input: [Provide input here if needed, otherwise omit this section]
+ Output: [Provide the correct output]
+
+ Example 2
+ Input: [Provide input here if needed, otherwise omit this section]
+ Output: [Provide the correct output]
+
+ Do not include any additional commentary, explanations, or more than two instances.
Below are some examples: