camel-ai 0.2.28__tar.gz → 0.2.30__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of camel-ai might be problematic. Click here for more details.

Files changed (355) hide show
  1. {camel_ai-0.2.28 → camel_ai-0.2.30}/PKG-INFO +3 -2
  2. {camel_ai-0.2.28 → camel_ai-0.2.30}/README.md +1 -1
  3. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/__init__.py +1 -1
  4. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/chat_agent.py +151 -4
  5. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datasets/__init__.py +8 -10
  6. camel_ai-0.2.30/camel/datasets/base_generator.py +335 -0
  7. camel_ai-0.2.30/camel/datasets/models.py +61 -0
  8. camel_ai-0.2.30/camel/datasets/static_dataset.py +346 -0
  9. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/openai_compatible_embedding.py +4 -4
  10. camel_ai-0.2.30/camel/environments/__init__.py +25 -0
  11. camel_ai-0.2.30/camel/environments/models.py +111 -0
  12. camel_ai-0.2.30/camel/environments/multi_step.py +271 -0
  13. camel_ai-0.2.30/camel/environments/single_step.py +293 -0
  14. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/logger.py +56 -0
  15. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/openai_compatible_model.py +4 -2
  16. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/browser_toolkit.py +59 -1
  17. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/search_toolkit.py +70 -0
  18. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/utils/commons.py +1 -1
  19. {camel_ai-0.2.28 → camel_ai-0.2.30}/pyproject.toml +2 -1
  20. camel_ai-0.2.28/camel/datasets/base.py +0 -1171
  21. camel_ai-0.2.28/camel/environments/__init__.py +0 -16
  22. camel_ai-0.2.28/camel/environments/base.py +0 -511
  23. {camel_ai-0.2.28 → camel_ai-0.2.30}/.gitignore +0 -0
  24. {camel_ai-0.2.28 → camel_ai-0.2.30}/LICENSE +0 -0
  25. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/__init__.py +0 -0
  26. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/_types.py +0 -0
  27. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/_utils.py +0 -0
  28. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/base.py +0 -0
  29. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/critic_agent.py +0 -0
  30. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/deductive_reasoner_agent.py +0 -0
  31. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/embodied_agent.py +0 -0
  32. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/knowledge_graph_agent.py +0 -0
  33. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/multi_hop_generator_agent.py +0 -0
  34. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/programmed_agent_instruction.py +0 -0
  35. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/role_assignment_agent.py +0 -0
  36. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/search_agent.py +0 -0
  37. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/task_agent.py +0 -0
  38. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/tool_agents/__init__.py +0 -0
  39. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/tool_agents/base.py +0 -0
  40. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/agents/tool_agents/hugging_face_tool_agent.py +0 -0
  41. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/benchmarks/__init__.py +0 -0
  42. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/benchmarks/apibank.py +0 -0
  43. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/benchmarks/apibench.py +0 -0
  44. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/benchmarks/base.py +0 -0
  45. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/benchmarks/gaia.py +0 -0
  46. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/benchmarks/nexus.py +0 -0
  47. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/benchmarks/ragbench.py +0 -0
  48. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/__init__.py +0 -0
  49. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/discord/__init__.py +0 -0
  50. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/discord/discord_app.py +0 -0
  51. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/discord/discord_installation.py +0 -0
  52. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/discord/discord_store.py +0 -0
  53. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/slack/__init__.py +0 -0
  54. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/slack/models.py +0 -0
  55. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/slack/slack_app.py +0 -0
  56. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/bots/telegram_bot.py +0 -0
  57. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/__init__.py +0 -0
  58. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/aiml_config.py +0 -0
  59. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/anthropic_config.py +0 -0
  60. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/base_config.py +0 -0
  61. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/cohere_config.py +0 -0
  62. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/deepseek_config.py +0 -0
  63. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/gemini_config.py +0 -0
  64. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/groq_config.py +0 -0
  65. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/internlm_config.py +0 -0
  66. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/litellm_config.py +0 -0
  67. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/mistral_config.py +0 -0
  68. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/moonshot_config.py +0 -0
  69. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/nvidia_config.py +0 -0
  70. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/ollama_config.py +0 -0
  71. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/openai_config.py +0 -0
  72. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/qwen_config.py +0 -0
  73. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/reka_config.py +0 -0
  74. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/samba_config.py +0 -0
  75. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/sglang_config.py +0 -0
  76. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/siliconflow_config.py +0 -0
  77. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/togetherai_config.py +0 -0
  78. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/vllm_config.py +0 -0
  79. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/yi_config.py +0 -0
  80. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/configs/zhipuai_config.py +0 -0
  81. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/data_collector/__init__.py +0 -0
  82. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/data_collector/alpaca_collector.py +0 -0
  83. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/data_collector/base.py +0 -0
  84. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/data_collector/sharegpt_collector.py +0 -0
  85. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/__init__.py +0 -0
  86. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/cot_datagen.py +0 -0
  87. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_improving_cot.py +0 -0
  88. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_instruct/__init__.py +0 -0
  89. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_instruct/filter/__init__.py +0 -0
  90. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_instruct/filter/filter_function.py +0 -0
  91. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_instruct/filter/filter_registry.py +0 -0
  92. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_instruct/filter/instruction_filter.py +0 -0
  93. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_instruct/self_instruct.py +0 -0
  94. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/self_instruct/templates.py +0 -0
  95. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/source2synth/__init__.py +0 -0
  96. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/source2synth/data_processor.py +0 -0
  97. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/source2synth/models.py +0 -0
  98. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datagen/source2synth/user_data_processor_config.py +0 -0
  99. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datahubs/__init__.py +0 -0
  100. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datahubs/base.py +0 -0
  101. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datahubs/huggingface.py +0 -0
  102. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/datahubs/models.py +0 -0
  103. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/__init__.py +0 -0
  104. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/base.py +0 -0
  105. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/jina_embedding.py +0 -0
  106. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/mistral_embedding.py +0 -0
  107. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/openai_embedding.py +0 -0
  108. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/sentence_transformers_embeddings.py +0 -0
  109. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/embeddings/vlm_embedding.py +0 -0
  110. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/extractors/__init__.py +0 -0
  111. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/extractors/base.py +0 -0
  112. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/extractors/python_strategies.py +0 -0
  113. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/generators.py +0 -0
  114. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/human.py +0 -0
  115. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/__init__.py +0 -0
  116. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/base.py +0 -0
  117. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/docker/Dockerfile +0 -0
  118. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/docker_interpreter.py +0 -0
  119. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/e2b_interpreter.py +0 -0
  120. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/internal_python_interpreter.py +0 -0
  121. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/interpreter_error.py +0 -0
  122. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/ipython_interpreter.py +0 -0
  123. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/interpreters/subprocess_interpreter.py +0 -0
  124. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/__init__.py +0 -0
  125. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/apify_reader.py +0 -0
  126. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/base_io.py +0 -0
  127. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/chunkr_reader.py +0 -0
  128. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/firecrawl_reader.py +0 -0
  129. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/jina_url_reader.py +0 -0
  130. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/mineru_extractor.py +0 -0
  131. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/panda_reader.py +0 -0
  132. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/loaders/unstructured_io.py +0 -0
  133. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/__init__.py +0 -0
  134. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/agent_memories.py +0 -0
  135. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/base.py +0 -0
  136. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/blocks/__init__.py +0 -0
  137. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/blocks/chat_history_block.py +0 -0
  138. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/blocks/vectordb_block.py +0 -0
  139. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/context_creators/__init__.py +0 -0
  140. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/context_creators/score_based.py +0 -0
  141. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/memories/records.py +0 -0
  142. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/__init__.py +0 -0
  143. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/base.py +0 -0
  144. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/conversion/__init__.py +0 -0
  145. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/conversion/alpaca.py +0 -0
  146. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/conversion/conversation_models.py +0 -0
  147. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/conversion/sharegpt/__init__.py +0 -0
  148. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/conversion/sharegpt/function_call_formatter.py +0 -0
  149. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/conversion/sharegpt/hermes/__init__.py +0 -0
  150. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/conversion/sharegpt/hermes/hermes_function_formatter.py +0 -0
  151. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/messages/func_message.py +0 -0
  152. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/__init__.py +0 -0
  153. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/_utils.py +0 -0
  154. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/aiml_model.py +0 -0
  155. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/anthropic_model.py +0 -0
  156. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/azure_openai_model.py +0 -0
  157. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/base_audio_model.py +0 -0
  158. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/base_model.py +0 -0
  159. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/cohere_model.py +0 -0
  160. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/deepseek_model.py +0 -0
  161. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/fish_audio_model.py +0 -0
  162. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/gemini_model.py +0 -0
  163. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/groq_model.py +0 -0
  164. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/internlm_model.py +0 -0
  165. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/litellm_model.py +0 -0
  166. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/mistral_model.py +0 -0
  167. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/model_factory.py +0 -0
  168. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/model_manager.py +0 -0
  169. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/moonshot_model.py +0 -0
  170. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/nemotron_model.py +0 -0
  171. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/nvidia_model.py +0 -0
  172. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/ollama_model.py +0 -0
  173. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/openai_audio_models.py +0 -0
  174. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/openai_model.py +0 -0
  175. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/qwen_model.py +0 -0
  176. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/reka_model.py +0 -0
  177. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/reward/__init__.py +0 -0
  178. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/reward/base_reward_model.py +0 -0
  179. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/reward/evaluator.py +0 -0
  180. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/reward/nemotron_model.py +0 -0
  181. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/reward/skywork_model.py +0 -0
  182. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/samba_model.py +0 -0
  183. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/sglang_model.py +0 -0
  184. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/siliconflow_model.py +0 -0
  185. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/stub_model.py +0 -0
  186. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/togetherai_model.py +0 -0
  187. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/vllm_model.py +0 -0
  188. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/volcano_model.py +0 -0
  189. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/yi_model.py +0 -0
  190. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/models/zhipuai_model.py +0 -0
  191. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/personas/__init__.py +0 -0
  192. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/personas/persona.py +0 -0
  193. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/personas/persona_hub.py +0 -0
  194. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/__init__.py +0 -0
  195. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/ai_society.py +0 -0
  196. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/base.py +0 -0
  197. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/code.py +0 -0
  198. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/evaluation.py +0 -0
  199. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/generate_text_embedding_data.py +0 -0
  200. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/image_craft.py +0 -0
  201. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/misalignment.py +0 -0
  202. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/multi_condition_image_craft.py +0 -0
  203. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/object_recognition.py +0 -0
  204. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/persona_hub.py +0 -0
  205. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/prompt_templates.py +0 -0
  206. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/role_description_prompt_template.py +0 -0
  207. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/solution_extraction.py +0 -0
  208. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/task_prompt_template.py +0 -0
  209. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/translation.py +0 -0
  210. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/prompts/video_description_prompt.py +0 -0
  211. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/py.typed +0 -0
  212. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/responses/__init__.py +0 -0
  213. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/responses/agent_responses.py +0 -0
  214. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/retrievers/__init__.py +0 -0
  215. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/retrievers/auto_retriever.py +0 -0
  216. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/retrievers/base.py +0 -0
  217. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/retrievers/bm25_retriever.py +0 -0
  218. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/retrievers/cohere_rerank_retriever.py +0 -0
  219. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/retrievers/hybrid_retrival.py +0 -0
  220. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/retrievers/vector_retriever.py +0 -0
  221. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/__init__.py +0 -0
  222. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/api.py +0 -0
  223. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/base.py +0 -0
  224. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/configs.py +0 -0
  225. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/docker_runtime.py +0 -0
  226. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/llm_guard_runtime.py +0 -0
  227. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/remote_http_runtime.py +0 -0
  228. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/utils/__init__.py +0 -0
  229. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/utils/function_risk_toolkit.py +0 -0
  230. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/runtime/utils/ignore_risk_toolkit.py +0 -0
  231. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/schemas/__init__.py +0 -0
  232. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/schemas/base.py +0 -0
  233. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/schemas/openai_converter.py +0 -0
  234. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/schemas/outlines_converter.py +0 -0
  235. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/__init__.py +0 -0
  236. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/babyagi_playing.py +0 -0
  237. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/role_playing.py +0 -0
  238. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/__init__.py +0 -0
  239. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/base.py +0 -0
  240. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/prompts.py +0 -0
  241. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/role_playing_worker.py +0 -0
  242. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/single_agent_worker.py +0 -0
  243. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/task_channel.py +0 -0
  244. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/utils.py +0 -0
  245. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/worker.py +0 -0
  246. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/societies/workforce/workforce.py +0 -0
  247. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/__init__.py +0 -0
  248. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/graph_storages/__init__.py +0 -0
  249. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/graph_storages/base.py +0 -0
  250. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/graph_storages/graph_element.py +0 -0
  251. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/graph_storages/nebula_graph.py +0 -0
  252. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/graph_storages/neo4j_graph.py +0 -0
  253. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/key_value_storages/__init__.py +0 -0
  254. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/key_value_storages/base.py +0 -0
  255. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/key_value_storages/in_memory.py +0 -0
  256. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/key_value_storages/json.py +0 -0
  257. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/key_value_storages/redis.py +0 -0
  258. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/object_storages/__init__.py +0 -0
  259. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/object_storages/amazon_s3.py +0 -0
  260. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/object_storages/azure_blob.py +0 -0
  261. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/object_storages/base.py +0 -0
  262. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/object_storages/google_cloud.py +0 -0
  263. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/vectordb_storages/__init__.py +0 -0
  264. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/vectordb_storages/base.py +0 -0
  265. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/vectordb_storages/milvus.py +0 -0
  266. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/storages/vectordb_storages/qdrant.py +0 -0
  267. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/tasks/__init__.py +0 -0
  268. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/tasks/task.py +0 -0
  269. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/tasks/task_prompt.py +0 -0
  270. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/terminators/__init__.py +0 -0
  271. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/terminators/base.py +0 -0
  272. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/terminators/response_terminator.py +0 -0
  273. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/terminators/token_limit_terminator.py +0 -0
  274. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/__init__.py +0 -0
  275. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/arxiv_toolkit.py +0 -0
  276. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/ask_news_toolkit.py +0 -0
  277. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/audio_analysis_toolkit.py +0 -0
  278. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/base.py +0 -0
  279. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/code_execution.py +0 -0
  280. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/dalle_toolkit.py +0 -0
  281. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/dappier_toolkit.py +0 -0
  282. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/data_commons_toolkit.py +0 -0
  283. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/excel_toolkit.py +0 -0
  284. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/file_write_toolkit.py +0 -0
  285. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/function_tool.py +0 -0
  286. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/github_toolkit.py +0 -0
  287. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/google_maps_toolkit.py +0 -0
  288. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/google_scholar_toolkit.py +0 -0
  289. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/human_toolkit.py +0 -0
  290. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/image_analysis_toolkit.py +0 -0
  291. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/linkedin_toolkit.py +0 -0
  292. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/math_toolkit.py +0 -0
  293. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/mcp_toolkit.py +0 -0
  294. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/meshy_toolkit.py +0 -0
  295. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/mineru_toolkit.py +0 -0
  296. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/networkx_toolkit.py +0 -0
  297. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/notion_toolkit.py +0 -0
  298. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/biztoc/__init__.py +0 -0
  299. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/biztoc/ai-plugin.json +0 -0
  300. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/biztoc/openapi.yaml +0 -0
  301. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/coursera/__init__.py +0 -0
  302. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/coursera/openapi.yaml +0 -0
  303. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/create_qr_code/__init__.py +0 -0
  304. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/create_qr_code/openapi.yaml +0 -0
  305. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/klarna/__init__.py +0 -0
  306. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/klarna/openapi.yaml +0 -0
  307. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/nasa_apod/__init__.py +0 -0
  308. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/nasa_apod/openapi.yaml +0 -0
  309. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/outschool/__init__.py +0 -0
  310. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/outschool/ai-plugin.json +0 -0
  311. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/outschool/openapi.yaml +0 -0
  312. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/outschool/paths/__init__.py +0 -0
  313. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/outschool/paths/get_classes.py +0 -0
  314. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/outschool/paths/search_teachers.py +0 -0
  315. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/security_config.py +0 -0
  316. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/speak/__init__.py +0 -0
  317. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/speak/openapi.yaml +0 -0
  318. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/web_scraper/__init__.py +0 -0
  319. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/web_scraper/ai-plugin.json +0 -0
  320. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/web_scraper/openapi.yaml +0 -0
  321. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/web_scraper/paths/__init__.py +0 -0
  322. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_specs/web_scraper/paths/scraper.py +0 -0
  323. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/open_api_toolkit.py +0 -0
  324. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/openbb_toolkit.py +0 -0
  325. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/page_script.js +0 -0
  326. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/pubmed_toolkit.py +0 -0
  327. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/reddit_toolkit.py +0 -0
  328. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/retrieval_toolkit.py +0 -0
  329. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/semantic_scholar_toolkit.py +0 -0
  330. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/slack_toolkit.py +0 -0
  331. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/stripe_toolkit.py +0 -0
  332. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/sympy_toolkit.py +0 -0
  333. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/terminal_toolkit.py +0 -0
  334. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/twitter_toolkit.py +0 -0
  335. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/video_analysis_toolkit.py +0 -0
  336. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/video_download_toolkit.py +0 -0
  337. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/weather_toolkit.py +0 -0
  338. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/whatsapp_toolkit.py +0 -0
  339. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/toolkits/zapier_toolkit.py +0 -0
  340. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/types/__init__.py +0 -0
  341. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/types/agents/__init__.py +0 -0
  342. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/types/agents/tool_calling_record.py +0 -0
  343. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/types/enums.py +0 -0
  344. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/types/openai_types.py +0 -0
  345. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/types/unified_model_type.py +0 -0
  346. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/utils/__init__.py +0 -0
  347. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/utils/async_func.py +0 -0
  348. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/utils/constants.py +0 -0
  349. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/utils/deduplication.py +0 -0
  350. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/utils/response_format.py +0 -0
  351. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/utils/token_counting.py +0 -0
  352. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/verifiers/__init__.py +0 -0
  353. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/verifiers/base.py +0 -0
  354. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/verifiers/models.py +0 -0
  355. {camel_ai-0.2.28 → camel_ai-0.2.30}/camel/verifiers/python_verifier.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: camel-ai
3
- Version: 0.2.28
3
+ Version: 0.2.30
4
4
  Summary: Communicative Agents for AI Society Study
5
5
  Project-URL: Homepage, https://www.camel-ai.org/
6
6
  Project-URL: Repository, https://github.com/camel-ai/camel
@@ -239,6 +239,7 @@ Requires-Dist: pytest-asyncio<0.24,>=0.23.0; extra == 'test'
239
239
  Requires-Dist: pytest<8,>=7; extra == 'test'
240
240
  Provides-Extra: web-tools
241
241
  Requires-Dist: apify-client<2,>=1.8.1; extra == 'web-tools'
242
+ Requires-Dist: beautifulsoup4<5,>=4; extra == 'web-tools'
242
243
  Requires-Dist: dappier<0.4,>=0.3.3; extra == 'web-tools'
243
244
  Requires-Dist: duckduckgo-search<7,>=6.3.5; extra == 'web-tools'
244
245
  Requires-Dist: fastapi>=0.115.11; extra == 'web-tools'
@@ -447,7 +448,7 @@ pip install camel-ai
447
448
 
448
449
  For more detailed instructions and additional configuration options, check out the [installation section](https://github.com/camel-ai/camel/blob/master/docs/get_started/installation.md).
449
450
 
450
- After running, you can explore our CAMEL Tech Stack and Cookbooks at [www.docs.camel-ai.org](https://www.docs.camel-ai.org) to build powerful multi-agent systems.
451
+ After running, you can explore our CAMEL Tech Stack and Cookbooks at [www.docs.camel-ai.org](https://docs.camel-ai.org) to build powerful multi-agent systems.
451
452
 
452
453
  We provide a [![Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1AzP33O8rnMW__7ocWJhVBXjKziJXPtim?usp=sharing) demo showcasing a conversation between two ChatGPT agents playing roles as a python programmer and a stock trader collaborating on developing a trading bot for stock market.
453
454
 
@@ -189,7 +189,7 @@ pip install camel-ai
189
189
 
190
190
  For more detailed instructions and additional configuration options, check out the [installation section](https://github.com/camel-ai/camel/blob/master/docs/get_started/installation.md).
191
191
 
192
- After running, you can explore our CAMEL Tech Stack and Cookbooks at [www.docs.camel-ai.org](https://www.docs.camel-ai.org) to build powerful multi-agent systems.
192
+ After running, you can explore our CAMEL Tech Stack and Cookbooks at [www.docs.camel-ai.org](https://docs.camel-ai.org) to build powerful multi-agent systems.
193
193
 
194
194
  We provide a [![Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1AzP33O8rnMW__7ocWJhVBXjKziJXPtim?usp=sharing) demo showcasing a conversation between two ChatGPT agents playing roles as a python programmer and a stock trader collaborating on developing a trading bot for stock market.
195
195
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  from camel.logger import disable_logging, enable_logging, set_log_level
16
16
 
17
- __version__ = '0.2.28'
17
+ __version__ = '0.2.30'
18
18
 
19
19
  __all__ = [
20
20
  '__version__',
@@ -707,10 +707,13 @@ class ChatAgent(BaseAgent):
707
707
  f"did not run successfully. Error: {error_info}"
708
708
  )
709
709
 
710
+ sanitized_messages = self._sanitize_messages_for_logging(
711
+ openai_messages
712
+ )
710
713
  logger.info(
711
714
  f"Model {self.model_backend.model_type}, "
712
715
  f"index {self.model_backend.current_model_index}, "
713
- f"processed these messages: {openai_messages}"
716
+ f"processed these messages: {sanitized_messages}"
714
717
  )
715
718
 
716
719
  if isinstance(response, ChatCompletion):
@@ -752,10 +755,13 @@ class ChatAgent(BaseAgent):
752
755
  f"did not run successfully. Error: {error_info}"
753
756
  )
754
757
 
758
+ sanitized_messages = self._sanitize_messages_for_logging(
759
+ openai_messages
760
+ )
755
761
  logger.info(
756
762
  f"Model {self.model_backend.model_type}, "
757
763
  f"index {self.model_backend.current_model_index}, "
758
- f"processed these messages: {openai_messages}"
764
+ f"processed these messages: {sanitized_messages}"
759
765
  )
760
766
 
761
767
  if isinstance(response, ChatCompletion):
@@ -763,6 +769,134 @@ class ChatAgent(BaseAgent):
763
769
  else:
764
770
  return await self._ahandle_stream_response(response, num_tokens)
765
771
 
772
+ def _sanitize_messages_for_logging(self, messages):
773
+ r"""Sanitize OpenAI messages for logging by replacing base64 image
774
+ data with a simple message and a link to view the image.
775
+
776
+ Args:
777
+ messages (List[OpenAIMessage]): The OpenAI messages to sanitize.
778
+
779
+ Returns:
780
+ List[OpenAIMessage]: The sanitized OpenAI messages.
781
+ """
782
+ import hashlib
783
+ import os
784
+ import re
785
+ import tempfile
786
+
787
+ # Create a copy of messages for logging to avoid modifying the
788
+ # original messages
789
+ sanitized_messages = []
790
+ for msg in messages:
791
+ if isinstance(msg, dict):
792
+ sanitized_msg = msg.copy()
793
+ # Check if content is a list (multimodal content with images)
794
+ if isinstance(sanitized_msg.get('content'), list):
795
+ content_list = []
796
+ for item in sanitized_msg['content']:
797
+ if (
798
+ isinstance(item, dict)
799
+ and item.get('type') == 'image_url'
800
+ ):
801
+ # Handle image URL
802
+ image_url = item.get('image_url', {}).get(
803
+ 'url', ''
804
+ )
805
+ if image_url and image_url.startswith(
806
+ 'data:image'
807
+ ):
808
+ # Extract image data and format
809
+ match = re.match(
810
+ r'data:image/([^;]+);base64,(.+)',
811
+ image_url,
812
+ )
813
+ if match:
814
+ img_format, base64_data = match.groups()
815
+
816
+ # Create a hash of the image data to use
817
+ # as filename
818
+ img_hash = hashlib.md5(
819
+ base64_data[:100].encode()
820
+ ).hexdigest()[:10]
821
+ img_filename = (
822
+ f"image_{img_hash}.{img_format}"
823
+ )
824
+
825
+ # Save image to temp directory for viewing
826
+ try:
827
+ import base64
828
+
829
+ temp_dir = tempfile.gettempdir()
830
+ img_path = os.path.join(
831
+ temp_dir, img_filename
832
+ )
833
+
834
+ # Only save if file doesn't exist
835
+ if not os.path.exists(img_path):
836
+ with open(img_path, 'wb') as f:
837
+ f.write(
838
+ base64.b64decode(
839
+ base64_data
840
+ )
841
+ )
842
+
843
+ # Create a file:// URL that can be
844
+ # opened
845
+ file_url = f"file://{img_path}"
846
+
847
+ content_list.append(
848
+ {
849
+ 'type': 'image_url',
850
+ 'image_url': {
851
+ 'url': f'{file_url}',
852
+ 'detail': item.get(
853
+ 'image_url', {}
854
+ ).get('detail', 'auto'),
855
+ },
856
+ }
857
+ )
858
+ except Exception as e:
859
+ # If saving fails, fall back to simple
860
+ # message
861
+ content_list.append(
862
+ {
863
+ 'type': 'image_url',
864
+ 'image_url': {
865
+ 'url': '[base64 '
866
+ + 'image - error saving: '
867
+ + str(e)
868
+ + ']',
869
+ 'detail': item.get(
870
+ 'image_url', {}
871
+ ).get('detail', 'auto'),
872
+ },
873
+ }
874
+ )
875
+ else:
876
+ # If regex fails, fall back to simple
877
+ # message
878
+ content_list.append(
879
+ {
880
+ 'type': 'image_url',
881
+ 'image_url': {
882
+ 'url': '[base64 '
883
+ + 'image - invalid format]',
884
+ 'detail': item.get(
885
+ 'image_url', {}
886
+ ).get('detail', 'auto'),
887
+ },
888
+ }
889
+ )
890
+ else:
891
+ content_list.append(item)
892
+ else:
893
+ content_list.append(item)
894
+ sanitized_msg['content'] = content_list
895
+ sanitized_messages.append(sanitized_msg)
896
+ else:
897
+ sanitized_messages.append(msg)
898
+ return sanitized_messages
899
+
766
900
  def _step_get_info(
767
901
  self,
768
902
  output_messages: List[BaseMessage],
@@ -1043,7 +1177,13 @@ class ChatAgent(BaseAgent):
1043
1177
  args = tool_call_request.args
1044
1178
  tool_call_id = tool_call_request.tool_call_id
1045
1179
  tool = self._internal_tools[func_name]
1046
- result = tool(**args)
1180
+ try:
1181
+ result = tool(**args)
1182
+ except Exception as e:
1183
+ # Capture the error message to prevent framework crash
1184
+ error_msg = f"Error executing tool '{func_name}': {e!s}"
1185
+ result = {"error": error_msg}
1186
+ logging.warning(error_msg)
1047
1187
 
1048
1188
  return self._record_tool_calling(func_name, args, result, tool_call_id)
1049
1189
 
@@ -1055,7 +1195,14 @@ class ChatAgent(BaseAgent):
1055
1195
  args = tool_call_request.args
1056
1196
  tool_call_id = tool_call_request.tool_call_id
1057
1197
  tool = self._internal_tools[func_name]
1058
- result = await tool.async_call(**args)
1198
+ try:
1199
+ result = await tool.async_call(**args)
1200
+ except Exception as e:
1201
+ # Capture the error message to prevent framework crash
1202
+ error_msg = f"Error executing async tool '{func_name}': {e!s}"
1203
+ result = {"error": error_msg}
1204
+ logging.warning(error_msg)
1205
+
1059
1206
  return self._record_tool_calling(func_name, args, result, tool_call_id)
1060
1207
 
1061
1208
  def _record_tool_calling(
@@ -11,18 +11,16 @@
11
11
  # See the License for the specific language governing permissions and
12
12
  # limitations under the License.
13
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
- from .base import (
15
- BaseDataset,
16
- DataPoint,
17
- GenerativeDataset,
18
- SeedDataset,
19
- SyntheticDataset,
14
+ from .base_generator import (
15
+ BaseGenerator,
16
+ FewShotGenerator,
20
17
  )
18
+ from .models import DataPoint
19
+ from .static_dataset import StaticDataset
21
20
 
22
21
  __all__ = [
22
+ "BaseGenerator",
23
23
  "DataPoint",
24
- "BaseDataset",
25
- "SeedDataset",
26
- "GenerativeDataset",
27
- "SyntheticDataset",
24
+ "FewShotGenerator",
25
+ "StaticDataset",
28
26
  ]
@@ -0,0 +1,335 @@
1
+ # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
+
15
+ import abc
16
+ import json
17
+ import random
18
+ from datetime import datetime
19
+ from pathlib import Path
20
+ from typing import (
21
+ List,
22
+ Union,
23
+ )
24
+
25
+ from pydantic import ValidationError
26
+
27
+ from camel.agents import ChatAgent
28
+ from camel.logger import get_logger
29
+ from camel.verifiers import BaseVerifier
30
+ from camel.verifiers.models import VerifierInput
31
+
32
+ from .models import DataPoint
33
+ from .static_dataset import StaticDataset
34
+
35
+ logger = get_logger(__name__)
36
+
37
+
38
+ class BaseGenerator(abc.ABC):
39
+ r"""Abstract base class for data generators.
40
+
41
+ This class defines the interface for generating synthetic datapoints.
42
+ Concrete implementations should provide specific generation strategies.
43
+ """
44
+
45
+ def __init__(self, seed: int = 42, **kwargs):
46
+ r"""Initialize the base generator.
47
+
48
+ Args:
49
+ seed (int): Random seed for reproducibility. (default: :obj:`42`)
50
+ **kwargs: Additional generator parameters.
51
+ """
52
+ self._rng = random.Random(seed)
53
+
54
+ self._data: List[DataPoint] = []
55
+
56
+ @abc.abstractmethod
57
+ async def generate_new(self, n: int, **kwargs) -> List[DataPoint]:
58
+ r"""Generate n new datapoints.
59
+
60
+ Args:
61
+ n (int): Number of datapoints to generate.
62
+ **kwargs: Additional generation parameters.
63
+
64
+ Returns:
65
+ List[DataPoint]: A list of newly generated datapoints.
66
+ """
67
+ pass
68
+
69
+ def __len__(self) -> int:
70
+ r"""Return the size of the generated dataset."""
71
+ return len(self._data)
72
+
73
+ def __getitem__(self, idx: int) -> DataPoint:
74
+ r"""Retrieve a datapoint by index.
75
+
76
+ Args:
77
+ idx (int): Index of the datapoint.
78
+
79
+ Returns:
80
+ DataPoint: The datapoint corresponding to the given index.
81
+
82
+ Raises:
83
+ IndexError: If idx is out of bounds.
84
+ """
85
+ if idx < 0 or idx >= len(self._data):
86
+ raise IndexError(
87
+ f"Index {idx} out of bounds for dataset of "
88
+ f"size {len(self._data)}"
89
+ )
90
+ return self._data[idx]
91
+
92
+ def sample(self) -> DataPoint:
93
+ if len(self._data) == 0:
94
+ raise RuntimeError("Dataset is empty, cannot sample.")
95
+ idx = self._rng.randint(0, len(self._data) - 1)
96
+ return self[idx]
97
+
98
+ def save_to_jsonl(self, file_path: Union[str, Path]) -> None:
99
+ r"""Saves the generated datapoints to a JSONL (JSON Lines) file.
100
+
101
+ Each datapoint is stored as a separate JSON object on a new line.
102
+
103
+ Args:
104
+ file_path (Union[str, Path]): Path to save the JSONL file.
105
+
106
+ Raises:
107
+ ValueError: If no datapoints have been generated.
108
+ IOError: If there is an issue writing to the file.
109
+
110
+ Notes:
111
+ - Uses `self._data`, which contains the generated datapoints.
112
+ - Overwrites the file if it already exists.
113
+ - Ensures compatibility with large datasets by using JSONL format.
114
+ """
115
+ if not self._data:
116
+ raise ValueError("Dataset is empty. No data to save.")
117
+
118
+ file_path = Path(file_path)
119
+
120
+ try:
121
+ with file_path.open("w", encoding="utf-8") as f:
122
+ for datapoint in self._data:
123
+ json.dump(datapoint.to_dict(), f)
124
+ f.write("\n") # Ensure each entry is on a new line
125
+ logger.info(f"Dataset saved successfully to {file_path}")
126
+ except IOError as e:
127
+ logger.error(f"Error writing to file {file_path}: {e}")
128
+ raise
129
+
130
+
131
+ class FewShotGenerator(BaseGenerator):
132
+ r"""A generator for creating synthetic datapoints using few-shot learning.
133
+
134
+ This class leverages a seed dataset, an agent, and a verifier to generate
135
+ new synthetic datapoints on demand through few-shot prompting.
136
+ """
137
+
138
+ def __init__(
139
+ self,
140
+ seed_dataset: StaticDataset,
141
+ verifier: BaseVerifier,
142
+ agent: ChatAgent,
143
+ seed: int = 42,
144
+ **kwargs,
145
+ ):
146
+ r"""Initialize the few-shot generator.
147
+
148
+ Args:
149
+ seed_dataset (StaticDataset): Validated static dataset to
150
+ use for examples.
151
+ verifier (BaseVerifier): Verifier to validate generated content.
152
+ agent (ChatAgent): Agent to generate new datapoints.
153
+ seed (int): Random seed for reproducibility. (default: :obj:`42`)
154
+ **kwargs: Additional generator parameters.
155
+ """
156
+ super().__init__(seed=seed, **kwargs)
157
+ self.seed_dataset = seed_dataset
158
+ try:
159
+ self._validate_seed_dataset()
160
+ except Exception:
161
+ raise RuntimeError("Seed Data does not follow Datapoint format")
162
+ self.verifier = verifier
163
+ self.agent = agent
164
+
165
+ # TODO: Validate that seed dataset contains rationale
166
+ def _validate_seed_dataset(self) -> None:
167
+ pass
168
+
169
+ def _construct_prompt(self, examples: List[DataPoint]) -> str:
170
+ r"""Construct a prompt for generating new datapoints
171
+ using a fixed sample of examples from the seed dataset.
172
+
173
+ Args:
174
+ examples (List[DataPoint]): Examples to include in the prompt.
175
+
176
+ Returns:
177
+ str: Formatted prompt with examples.
178
+ """
179
+ prompt = (
180
+ "Generate a new datapoint similar to the following examples:\n\n"
181
+ )
182
+ for i, example in enumerate(examples, 1):
183
+ prompt += f"Example {i}:\n"
184
+ prompt += f"Question: {example.question}\n"
185
+ if example.rationale is not None:
186
+ prompt += f"Rationale: {example.rationale}\n"
187
+ else:
188
+ prompt += "Rationale: None\n"
189
+ prompt += f"Final Answer: {example.final_answer}\n\n"
190
+ prompt += "New datapoint:"
191
+ return prompt
192
+
193
+ async def generate_new(
194
+ self,
195
+ n: int,
196
+ max_retries: int = 10,
197
+ num_examples: int = 3,
198
+ **kwargs,
199
+ ) -> List[DataPoint]:
200
+ r"""Generates and validates `n` new datapoints through
201
+ few-shot prompting, with a retry limit.
202
+
203
+ Steps:
204
+ 1. Samples examples from the seed dataset.
205
+ 2. Constructs a prompt using the selected examples.
206
+ 3. Uses an agent to generate a new datapoint,
207
+ consisting of a question and code to solve the question.
208
+ 4. Executes code using a verifier to get pseudo ground truth.
209
+ 5. Stores valid datapoints in memory.
210
+
211
+ Args:
212
+ n (int): Number of valid datapoints to generate.
213
+ max_retries (int): Maximum number of retries before stopping.
214
+ (default: :obj:`10`)
215
+ num_examples (int): Number of examples to sample from the
216
+ seed dataset for few shot prompting.
217
+ (default: :obj:`3`)
218
+ **kwargs: Additional generation parameters.
219
+
220
+ Returns:
221
+ List[DataPoint]: A list of newly generated valid datapoints.
222
+
223
+ Raises:
224
+ TypeError: If the agent's output is not a dictionary (or does not
225
+ match the expected format).
226
+ KeyError: If required keys are missing from the response.
227
+ AttributeError: If the verifier response lacks attributes.
228
+ ValidationError: If a datapoint fails schema validation.
229
+ RuntimeError: If retries are exhausted before `n` valid datapoints
230
+ are generated.
231
+
232
+ Notes:
233
+ - Retries on validation failures until `n` valid datapoints exist
234
+ or `max_retries` is reached, whichever comes first.
235
+ - If retries are exhausted before reaching `n`, a `RuntimeError`
236
+ is raised.
237
+ - Metadata includes a timestamp for tracking datapoint creation.
238
+ """
239
+ valid_data_points: List[DataPoint] = []
240
+ retries = 0
241
+
242
+ while len(valid_data_points) < n and retries < max_retries:
243
+ try:
244
+ examples = [
245
+ self.seed_dataset.sample() for _ in range(num_examples)
246
+ ]
247
+ prompt = self._construct_prompt(examples)
248
+
249
+ try:
250
+ agent_output = (
251
+ self.agent.step(prompt, response_format=DataPoint)
252
+ .msgs[0]
253
+ .parsed
254
+ )
255
+ if not isinstance(agent_output, dict):
256
+ raise TypeError("Agent output must be a dictionary")
257
+ if "question" not in agent_output:
258
+ raise KeyError(
259
+ "Missing 'question' in agent"
260
+ f"output {agent_output}"
261
+ )
262
+ if "rationale" not in agent_output:
263
+ raise KeyError(
264
+ "Missing 'rationale' in agent"
265
+ f"output {agent_output}"
266
+ )
267
+ except (TypeError, KeyError) as e:
268
+ logger.warning(
269
+ f"Agent output issue: {e}, retrying... "
270
+ f"({retries + 1}/{max_retries})"
271
+ )
272
+ retries += 1
273
+ continue
274
+
275
+ rationale = agent_output.get("rationale")
276
+
277
+ if not isinstance(rationale, str):
278
+ raise TypeError(f"Rationale {rationale} is not a string.")
279
+
280
+ try:
281
+ verifier_response = await self.verifier.verify(
282
+ VerifierInput(
283
+ llm_response=rationale,
284
+ ground_truth=None,
285
+ )
286
+ )
287
+ if not verifier_response or not verifier_response.result:
288
+ raise ValueError(
289
+ "Verifier unsuccessful, response: "
290
+ f"{verifier_response}"
291
+ )
292
+ except (ValueError, AttributeError) as e:
293
+ logger.warning(
294
+ f"Verifier issue: {e}, "
295
+ f"retrying... ({retries + 1}/{max_retries})"
296
+ )
297
+ retries += 1
298
+ continue
299
+
300
+ try:
301
+ new_datapoint = DataPoint(
302
+ question=agent_output["question"],
303
+ rationale=rationale,
304
+ final_answer=verifier_response.result,
305
+ metadata={
306
+ "synthetic": str(True),
307
+ "created": datetime.now().isoformat(),
308
+ "generator": "few_shot",
309
+ },
310
+ )
311
+ except ValidationError as e:
312
+ logger.warning(
313
+ f"Datapoint validation failed: {e}, "
314
+ f"retrying... ({retries + 1}/{max_retries})"
315
+ )
316
+ retries += 1
317
+ continue
318
+
319
+ valid_data_points.append(new_datapoint)
320
+
321
+ except Exception as e:
322
+ logger.warning(
323
+ f"Unexpected error: {e}, retrying..."
324
+ f" ({retries + 1}/{max_retries})"
325
+ )
326
+ retries += 1
327
+
328
+ if len(valid_data_points) < n:
329
+ raise RuntimeError(
330
+ f"Failed to generate {n} valid datapoints "
331
+ f"after {max_retries} retries."
332
+ )
333
+
334
+ self._data.extend(valid_data_points)
335
+ return valid_data_points
@@ -0,0 +1,61 @@
1
+ # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
+ from typing import Any, Dict, Optional
15
+
16
+ from pydantic import BaseModel, Field
17
+
18
+
19
+ class DataPoint(BaseModel):
20
+ r"""A single data point in the dataset.
21
+
22
+ Attributes:
23
+ question (str): The primary question or issue to be addressed.
24
+ final_answer (str): The final answer.
25
+ rationale (Optional[str]): Logical reasoning or explanation behind the
26
+ answer. (default: :obj:`None`)
27
+ metadata Optional[Dict[str, Any]]: Additional metadata about the data
28
+ point. (default: :obj:`None`)
29
+ """
30
+
31
+ question: str = Field(
32
+ ..., description="The primary question or issue to be addressed."
33
+ )
34
+ final_answer: str = Field(..., description="The final answer.")
35
+ rationale: Optional[str] = Field(
36
+ default=None,
37
+ description="Logical reasoning or explanation behind the answer.",
38
+ )
39
+ metadata: Optional[Dict[str, Any]] = Field(
40
+ default=None, description="Additional metadata about the data point."
41
+ )
42
+
43
+ def to_dict(self) -> Dict[str, Any]:
44
+ r"""Convert DataPoint to a dictionary.
45
+
46
+ Returns:
47
+ Dict[str, Any]: Dictionary representation of the DataPoint.
48
+ """
49
+ return self.dict()
50
+
51
+ @classmethod
52
+ def from_dict(cls, data: Dict[str, Any]) -> 'DataPoint':
53
+ r"""Create a DataPoint from a dictionary.
54
+
55
+ Args:
56
+ data (Dict[str, Any]): Dictionary containing DataPoint fields.
57
+
58
+ Returns:
59
+ DataPoint: New DataPoint instance.
60
+ """
61
+ return cls(**data)