🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix: capture shots in `FewShotGenerator` in metadata (#2159)
hallerite17316d4421d3
diff --git a/camel/datasets/few_shot_generator.py b/camel/datasets/few_shot_generator.pyindex 45d4daf6d..f215361a0 100644--- a/camel/datasets/few_shot_generator.py+++ b/camel/datasets/few_shot_generator.py@@ -235,6 +235,7 @@ class FewShotGenerator(BaseGenerator):"synthetic": str(True),"created": datetime.now().isoformat(),"generator": "few_shot",+ "shots": [e.to_dict() for e in examples],},)except ValidationError as e:diff --git a/camel/environments/single_step.py b/camel/environments/single_step.pyindex 3e7d65cb4..fd8547d4b 100644--- a/camel/environments/single_step.py+++ b/camel/environments/single_step.py@@ -200,7 +200,13 @@ class SingleStepEnv:self._states_done = [False] * self.current_batch_sizeobservations = [- Observation(question=sample.question, context={}, metadata={})+ Observation(+ question=sample.question,+ context={},+ metadata=sample.metadata+ if sample.metadata is not None+ else {},+ )for sample in self._states]@@ -214,7 +220,13 @@ class SingleStepEnv:self._states_done = [False] * batch_sizeobservations = [- Observation(question=sample.question, context={}, metadata={})+ Observation(+ question=sample.question,+ context={},+ metadata=sample.metadata+ if sample.metadata is not None+ else {},+ )for sample in self._states]diff --git a/examples/dataset/few_shot_generator.py b/examples/dataset/few_shot_generator.pyindex dff711036..8fa006f5e 100644--- a/examples/dataset/few_shot_generator.py+++ b/examples/dataset/few_shot_generator.py@@ -27,7 +27,7 @@ from camel.verifiers import PythonVerifierlogger = get_logger(__name__)verifier = PythonVerifier(required_packages=["sympy"])-asyncio.run(verifier.setup())+asyncio.run(verifier.setup(uv=True))raw_data2 = [{@@ -85,9 +85,6 @@ generator = FewShotGenerator(new_data = asyncio.run(generator.generate_new(n=2, max_retries=5))-for dp in new_data:- print(dp)-generator.save_to_jsonl(Path("generated_data.jsonl"))asyncio.run(verifier.cleanup())