camel-ai 0.2.1__tar.gz → 0.2.2__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 (199) hide show
  1. {camel_ai-0.2.1 → camel_ai-0.2.2}/PKG-INFO +15 -12
  2. {camel_ai-0.2.1 → camel_ai-0.2.2}/README.md +1 -1
  3. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/__init__.py +1 -1
  4. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/chat_agent.py +245 -60
  5. camel_ai-0.2.2/camel/bots/__init__.py +20 -0
  6. camel_ai-0.2.2/camel/bots/discord_bot.py +206 -0
  7. camel_ai-0.2.2/camel/bots/telegram_bot.py +82 -0
  8. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/gemini_config.py +1 -1
  9. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/loaders/unstructured_io.py +35 -1
  10. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/messages/func_message.py +2 -2
  11. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/openai_compatibility_model.py +19 -6
  12. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/retrievers/vector_retriever.py +32 -15
  13. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/societies/role_playing.py +12 -0
  14. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/__init__.py +2 -0
  15. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/graph_storages/__init__.py +2 -0
  16. camel_ai-0.2.2/camel/storages/graph_storages/nebula_graph.py +547 -0
  17. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/types/enums.py +3 -0
  18. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/prompts.py +7 -3
  19. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/single_agent_worker.py +6 -7
  20. {camel_ai-0.2.1 → camel_ai-0.2.2}/pyproject.toml +22 -2
  21. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/__init__.py +0 -0
  22. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/base.py +0 -0
  23. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/critic_agent.py +0 -0
  24. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/deductive_reasoner_agent.py +0 -0
  25. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/embodied_agent.py +0 -0
  26. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/knowledge_graph_agent.py +0 -0
  27. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/role_assignment_agent.py +0 -0
  28. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/search_agent.py +0 -0
  29. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/task_agent.py +0 -0
  30. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/tool_agents/__init__.py +0 -0
  31. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/tool_agents/base.py +0 -0
  32. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/agents/tool_agents/hugging_face_tool_agent.py +0 -0
  33. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/__init__.py +0 -0
  34. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/anthropic_config.py +0 -0
  35. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/base_config.py +0 -0
  36. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/groq_config.py +0 -0
  37. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/litellm_config.py +0 -0
  38. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/mistral_config.py +0 -0
  39. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/ollama_config.py +0 -0
  40. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/openai_config.py +0 -0
  41. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/reka_config.py +0 -0
  42. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/samba_config.py +0 -0
  43. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/togetherai_config.py +0 -0
  44. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/vllm_config.py +0 -0
  45. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/configs/zhipuai_config.py +0 -0
  46. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/embeddings/__init__.py +0 -0
  47. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/embeddings/base.py +0 -0
  48. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/embeddings/mistral_embedding.py +0 -0
  49. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/embeddings/openai_embedding.py +0 -0
  50. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/embeddings/sentence_transformers_embeddings.py +0 -0
  51. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/embeddings/vlm_embedding.py +0 -0
  52. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/generators.py +0 -0
  53. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/human.py +0 -0
  54. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/interpreters/__init__.py +0 -0
  55. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/interpreters/base.py +0 -0
  56. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/interpreters/docker_interpreter.py +0 -0
  57. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/interpreters/internal_python_interpreter.py +0 -0
  58. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/interpreters/interpreter_error.py +0 -0
  59. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/interpreters/ipython_interpreter.py +0 -0
  60. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/interpreters/subprocess_interpreter.py +0 -0
  61. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/loaders/__init__.py +0 -0
  62. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/loaders/base_io.py +0 -0
  63. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/loaders/firecrawl_reader.py +0 -0
  64. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/loaders/jina_url_reader.py +0 -0
  65. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/__init__.py +0 -0
  66. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/agent_memories.py +0 -0
  67. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/base.py +0 -0
  68. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/blocks/__init__.py +0 -0
  69. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/blocks/chat_history_block.py +0 -0
  70. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/blocks/vectordb_block.py +0 -0
  71. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/context_creators/__init__.py +0 -0
  72. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/context_creators/score_based.py +0 -0
  73. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/memories/records.py +0 -0
  74. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/messages/__init__.py +0 -0
  75. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/messages/base.py +0 -0
  76. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/__init__.py +0 -0
  77. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/anthropic_model.py +0 -0
  78. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/azure_openai_model.py +0 -0
  79. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/base_model.py +0 -0
  80. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/gemini_model.py +0 -0
  81. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/groq_model.py +0 -0
  82. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/litellm_model.py +0 -0
  83. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/mistral_model.py +0 -0
  84. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/model_factory.py +0 -0
  85. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/nemotron_model.py +0 -0
  86. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/ollama_model.py +0 -0
  87. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/open_source_model.py +0 -0
  88. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/openai_audio_models.py +0 -0
  89. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/openai_model.py +0 -0
  90. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/reka_model.py +0 -0
  91. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/samba_model.py +0 -0
  92. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/stub_model.py +0 -0
  93. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/togetherai_model.py +0 -0
  94. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/vllm_model.py +0 -0
  95. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/models/zhipuai_model.py +0 -0
  96. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/__init__.py +0 -0
  97. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/ai_society.py +0 -0
  98. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/base.py +0 -0
  99. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/code.py +0 -0
  100. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/evaluation.py +0 -0
  101. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/generate_text_embedding_data.py +0 -0
  102. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/image_craft.py +0 -0
  103. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/misalignment.py +0 -0
  104. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/multi_condition_image_craft.py +0 -0
  105. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/object_recognition.py +0 -0
  106. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/prompt_templates.py +0 -0
  107. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/role_description_prompt_template.py +0 -0
  108. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/solution_extraction.py +0 -0
  109. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/task_prompt_template.py +0 -0
  110. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/translation.py +0 -0
  111. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/prompts/video_description_prompt.py +0 -0
  112. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/responses/__init__.py +0 -0
  113. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/responses/agent_responses.py +0 -0
  114. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/retrievers/__init__.py +0 -0
  115. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/retrievers/auto_retriever.py +0 -0
  116. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/retrievers/base.py +0 -0
  117. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/retrievers/bm25_retriever.py +0 -0
  118. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/retrievers/cohere_rerank_retriever.py +0 -0
  119. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/societies/__init__.py +0 -0
  120. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/societies/babyagi_playing.py +0 -0
  121. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/graph_storages/base.py +0 -0
  122. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/graph_storages/graph_element.py +0 -0
  123. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/graph_storages/neo4j_graph.py +0 -0
  124. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/key_value_storages/__init__.py +0 -0
  125. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/key_value_storages/base.py +0 -0
  126. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/key_value_storages/in_memory.py +0 -0
  127. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/key_value_storages/json.py +0 -0
  128. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/key_value_storages/redis.py +0 -0
  129. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/object_storages/__init__.py +0 -0
  130. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/object_storages/amazon_s3.py +0 -0
  131. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/object_storages/azure_blob.py +0 -0
  132. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/object_storages/base.py +0 -0
  133. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/object_storages/google_cloud.py +0 -0
  134. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/vectordb_storages/__init__.py +0 -0
  135. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/vectordb_storages/base.py +0 -0
  136. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/vectordb_storages/milvus.py +0 -0
  137. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/storages/vectordb_storages/qdrant.py +0 -0
  138. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/tasks/__init__.py +0 -0
  139. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/tasks/task.py +0 -0
  140. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/tasks/task_prompt.py +0 -0
  141. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/terminators/__init__.py +0 -0
  142. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/terminators/base.py +0 -0
  143. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/terminators/response_terminator.py +0 -0
  144. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/terminators/token_limit_terminator.py +0 -0
  145. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/__init__.py +0 -0
  146. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/base.py +0 -0
  147. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/code_execution.py +0 -0
  148. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/dalle_toolkit.py +0 -0
  149. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/github_toolkit.py +0 -0
  150. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/google_maps_toolkit.py +0 -0
  151. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/linkedin_toolkit.py +0 -0
  152. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/math_toolkit.py +0 -0
  153. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/biztoc/__init__.py +0 -0
  154. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/biztoc/ai-plugin.json +0 -0
  155. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/biztoc/openapi.yaml +0 -0
  156. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/coursera/__init__.py +0 -0
  157. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/coursera/openapi.yaml +0 -0
  158. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/create_qr_code/__init__.py +0 -0
  159. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/create_qr_code/openapi.yaml +0 -0
  160. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/klarna/__init__.py +0 -0
  161. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/klarna/openapi.yaml +0 -0
  162. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/nasa_apod/__init__.py +0 -0
  163. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/nasa_apod/openapi.yaml +0 -0
  164. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/outschool/__init__.py +0 -0
  165. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/outschool/ai-plugin.json +0 -0
  166. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/outschool/openapi.yaml +0 -0
  167. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/outschool/paths/__init__.py +0 -0
  168. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/outschool/paths/get_classes.py +0 -0
  169. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/outschool/paths/search_teachers.py +0 -0
  170. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/security_config.py +0 -0
  171. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/speak/__init__.py +0 -0
  172. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/speak/openapi.yaml +0 -0
  173. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/web_scraper/__init__.py +0 -0
  174. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/web_scraper/ai-plugin.json +0 -0
  175. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/web_scraper/openapi.yaml +0 -0
  176. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/web_scraper/paths/__init__.py +0 -0
  177. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_specs/web_scraper/paths/scraper.py +0 -0
  178. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/open_api_toolkit.py +0 -0
  179. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/openai_function.py +0 -0
  180. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/reddit_toolkit.py +0 -0
  181. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/retrieval_toolkit.py +0 -0
  182. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/search_toolkit.py +0 -0
  183. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/slack_toolkit.py +0 -0
  184. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/twitter_toolkit.py +0 -0
  185. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/toolkits/weather_toolkit.py +0 -0
  186. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/types/__init__.py +0 -0
  187. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/types/openai_types.py +0 -0
  188. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/utils/__init__.py +0 -0
  189. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/utils/async_func.py +0 -0
  190. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/utils/commons.py +0 -0
  191. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/utils/constants.py +0 -0
  192. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/utils/token_counting.py +0 -0
  193. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/__init__.py +0 -0
  194. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/base.py +0 -0
  195. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/role_playing_worker.py +0 -0
  196. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/task_channel.py +0 -0
  197. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/utils.py +0 -0
  198. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/worker.py +0 -0
  199. {camel_ai-0.2.1 → camel_ai-0.2.2}/camel/workforce/workforce.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: camel-ai
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Communicative Agents for AI Society Study
5
5
  Home-page: https://www.camel-ai.org/
6
6
  License: Apache-2.0
@@ -18,7 +18,9 @@ Provides-Extra: huggingface-agent
18
18
  Provides-Extra: kv-stroages
19
19
  Provides-Extra: model-platforms
20
20
  Provides-Extra: object-storages
21
+ Provides-Extra: rag
21
22
  Provides-Extra: retrievers
23
+ Provides-Extra: search-tools
22
24
  Provides-Extra: test
23
25
  Provides-Extra: tools
24
26
  Provides-Extra: vector-databases
@@ -29,7 +31,7 @@ Requires-Dist: anthropic (>=0.29.0,<0.30.0)
29
31
  Requires-Dist: azure-storage-blob (>=12.21.0,<13.0.0) ; extra == "object-storages" or extra == "all"
30
32
  Requires-Dist: beautifulsoup4 (>=4,<5) ; extra == "tools" or extra == "all"
31
33
  Requires-Dist: botocore (>=1.35.3,<2.0.0) ; extra == "object-storages" or extra == "all"
32
- Requires-Dist: cohere (>=4.56,<5.0) ; extra == "retrievers" or extra == "all"
34
+ Requires-Dist: cohere (>=4.56,<5.0) ; extra == "rag" or extra == "retrievers" or extra == "all"
33
35
  Requires-Dist: colorama (>=0,<1)
34
36
  Requires-Dist: curl_cffi (==0.6.2)
35
37
  Requires-Dist: datasets (>=2,<3) ; extra == "huggingface-agent" or extra == "all"
@@ -38,7 +40,7 @@ Requires-Dist: discord.py (>=2.3.2,<3.0.0) ; extra == "tools" or extra == "all"
38
40
  Requires-Dist: docker (>=7.1.0,<8.0.0) ; extra == "tools" or extra == "all"
39
41
  Requires-Dist: docstring-parser (>=0.15,<0.16)
40
42
  Requires-Dist: docx2txt (>=0.8,<0.9) ; extra == "tools" or extra == "all"
41
- Requires-Dist: duckduckgo-search (>=6.1.0,<7.0.0) ; extra == "tools" or extra == "all"
43
+ Requires-Dist: duckduckgo-search (>=6.2.12,<7.0.0) ; extra == "search-tools" or extra == "tools" or extra == "all"
42
44
  Requires-Dist: eval-type-backport (==0.2.0)
43
45
  Requires-Dist: firecrawl-py (>=1.0.0,<2.0.0) ; extra == "tools" or extra == "all"
44
46
  Requires-Dist: google-cloud-storage (>=2.18.0,<3.0.0) ; extra == "object-storages" or extra == "all"
@@ -52,7 +54,8 @@ Requires-Dist: jupyter_client (>=8.6.2,<9.0.0) ; extra == "tools" or extra == "a
52
54
  Requires-Dist: litellm (>=1.38.1,<2.0.0) ; extra == "model-platforms" or extra == "all"
53
55
  Requires-Dist: mistralai (>=1.0.0,<2.0.0) ; extra == "model-platforms" or extra == "all"
54
56
  Requires-Dist: mock (>=5,<6) ; extra == "test"
55
- Requires-Dist: neo4j (>=5.18.0,<6.0.0) ; extra == "graph-storages" or extra == "all"
57
+ Requires-Dist: nebula3-python (==3.8.2) ; extra == "rag" or extra == "graph-storages" or extra == "all"
58
+ Requires-Dist: neo4j (>=5.18.0,<6.0.0) ; extra == "rag" or extra == "graph-storages" or extra == "all"
56
59
  Requires-Dist: newspaper3k (>=0.2.8,<0.3.0) ; extra == "tools" or extra == "all"
57
60
  Requires-Dist: nltk (==3.8.1) ; extra == "tools" or extra == "all"
58
61
  Requires-Dist: numpy (>=1,<2)
@@ -69,16 +72,16 @@ Requires-Dist: pyTelegramBotAPI (>=4.18.0,<5.0.0) ; extra == "tools" or extra ==
69
72
  Requires-Dist: pydantic (>=1.9,<3)
70
73
  Requires-Dist: pydub (>=0.25.1,<0.26.0) ; extra == "tools" or extra == "all"
71
74
  Requires-Dist: pygithub (>=2.3.0,<3.0.0) ; extra == "tools" or extra == "all"
72
- Requires-Dist: pymilvus (>=2.4.0,<3.0.0) ; extra == "vector-databases" or extra == "all"
75
+ Requires-Dist: pymilvus (>=2.4.0,<3.0.0) ; extra == "rag" or extra == "vector-databases" or extra == "all"
73
76
  Requires-Dist: pyowm (>=3.3.0,<4.0.0) ; extra == "tools" or extra == "all"
74
77
  Requires-Dist: pytest (>=7,<8) ; extra == "test"
75
78
  Requires-Dist: pytest-asyncio (>=0.23.0,<0.24.0) ; extra == "test"
76
- Requires-Dist: qdrant-client (>=1.9.0,<2.0.0) ; extra == "vector-databases" or extra == "all"
77
- Requires-Dist: rank-bm25 (>=0.2.2,<0.3.0) ; extra == "retrievers" or extra == "all"
79
+ Requires-Dist: qdrant-client (>=1.9.0,<2.0.0) ; extra == "rag" or extra == "vector-databases" or extra == "all"
80
+ Requires-Dist: rank-bm25 (>=0.2.2,<0.3.0) ; extra == "rag" or extra == "retrievers" or extra == "all"
78
81
  Requires-Dist: redis (>=5.0.6,<6.0.0) ; extra == "kv-stroages" or extra == "all"
79
82
  Requires-Dist: reka-api (>=3.0.8,<4.0.0) ; extra == "model-platforms" or extra == "all"
80
83
  Requires-Dist: requests_oauthlib (>=1.3.1,<2.0.0) ; extra == "tools" or extra == "all"
81
- Requires-Dist: sentence-transformers (>=3.0.1,<4.0.0) ; extra == "encoders" or extra == "all"
84
+ Requires-Dist: sentence-transformers (>=3.0.1,<4.0.0) ; extra == "rag" or extra == "encoders" or extra == "all"
82
85
  Requires-Dist: sentencepiece (>=0,<1) ; extra == "huggingface-agent" or extra == "all"
83
86
  Requires-Dist: slack-sdk (>=3.27.2,<4.0.0) ; extra == "tools" or extra == "all"
84
87
  Requires-Dist: soundfile (>=0,<1) ; extra == "huggingface-agent" or extra == "all"
@@ -86,9 +89,9 @@ Requires-Dist: textblob (>=0.18.0.post0,<0.19.0) ; extra == "tools" or extra ==
86
89
  Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
87
90
  Requires-Dist: torch (>=2,<3) ; extra == "huggingface-agent" or extra == "all"
88
91
  Requires-Dist: transformers (>=4,<5) ; extra == "huggingface-agent" or extra == "all"
89
- Requires-Dist: unstructured[all-docs] (>=0.10,<0.11) ; extra == "tools" or extra == "all"
90
- Requires-Dist: wikipedia (>=1,<2) ; extra == "tools" or extra == "all"
91
- Requires-Dist: wolframalpha (>=5.0.0,<6.0.0) ; extra == "tools" or extra == "all"
92
+ Requires-Dist: unstructured[all-docs] (>=0.10,<0.11) ; extra == "rag" or extra == "tools" or extra == "all"
93
+ Requires-Dist: wikipedia (>=1,<2) ; extra == "search-tools" or extra == "tools" or extra == "all"
94
+ Requires-Dist: wolframalpha (>=5.0.0,<6.0.0) ; extra == "search-tools" or extra == "tools" or extra == "all"
92
95
  Project-URL: Documentation, https://docs.camel-ai.org
93
96
  Project-URL: Repository, https://github.com/camel-ai/camel
94
97
  Description-Content-Type: text/markdown
@@ -214,7 +217,7 @@ conda create --name camel python=3.10
214
217
  conda activate camel
215
218
 
216
219
  # Clone github repo
217
- git clone -b v0.2.1 https://github.com/camel-ai/camel.git
220
+ git clone -b v0.2.2 https://github.com/camel-ai/camel.git
218
221
 
219
222
  # Change directory into project directory
220
223
  cd camel
@@ -119,7 +119,7 @@ conda create --name camel python=3.10
119
119
  conda activate camel
120
120
 
121
121
  # Clone github repo
122
- git clone -b v0.2.1 https://github.com/camel-ai/camel.git
122
+ git clone -b v0.2.2 https://github.com/camel-ai/camel.git
123
123
 
124
124
  # Change directory into project directory
125
125
  cd camel
@@ -12,7 +12,7 @@
12
12
  # limitations under the License.
13
13
  # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14
14
 
15
- __version__ = '0.2.1'
15
+ __version__ = '0.2.2'
16
16
 
17
17
  __all__ = [
18
18
  '__version__',
@@ -15,6 +15,8 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import logging
18
+ import re
19
+ import uuid
18
20
  from collections import defaultdict
19
21
  from typing import (
20
22
  TYPE_CHECKING,
@@ -28,6 +30,7 @@ from typing import (
28
30
  )
29
31
 
30
32
  from openai.types.chat import ChatCompletionMessageToolCall
33
+ from openai.types.chat.chat_completion_message_tool_call import Function
31
34
  from pydantic import BaseModel
32
35
 
33
36
  from camel.agents.base import BaseAgent
@@ -185,12 +188,12 @@ class ChatAgent(BaseAgent):
185
188
  # the tools set from `ChatAgent` will be used.
186
189
  # This design simplifies the interface while retaining tool-running
187
190
  # capabilities for `BaseModelBackend`.
188
- if all_tools and not self.model_backend.model_config_dict['tools']:
191
+ if all_tools and not self.model_backend.model_config_dict.get("tools"):
189
192
  tool_schema_list = [
190
193
  tool.get_openai_tool_schema() for tool in all_tools
191
194
  ]
192
195
  self.model_backend.model_config_dict['tools'] = tool_schema_list
193
-
196
+ self.tool_schema_list = tool_schema_list
194
197
  self.model_config_dict = self.model_backend.model_config_dict
195
198
 
196
199
  self.model_token_limit = token_limit or self.model_backend.token_limit
@@ -206,6 +209,56 @@ class ChatAgent(BaseAgent):
206
209
  self.response_terminators = response_terminators or []
207
210
  self.init_messages()
208
211
 
212
+ # ruff: noqa: E501
213
+ def _generate_tool_prompt(self, tool_schema_list: List[Dict]) -> str:
214
+ tool_prompts = []
215
+
216
+ for tool in tool_schema_list:
217
+ tool_info = tool['function']
218
+ tool_name = tool_info['name']
219
+ tool_description = tool_info['description']
220
+ tool_json = json.dumps(tool_info, indent=4)
221
+
222
+ prompt = f"Use the function '{tool_name}' to '{tool_description}':\n{tool_json}\n"
223
+ tool_prompts.append(prompt)
224
+
225
+ tool_prompt_str = "\n".join(tool_prompts)
226
+
227
+ final_prompt = f'''
228
+ # Tool prompt
229
+ TOOL_PROMPT = f"""
230
+ You have access to the following functions:
231
+
232
+ {tool_prompt_str}
233
+
234
+ If you choose to call a function ONLY reply in the following format with no prefix or suffix:
235
+
236
+ <function=example_function_name>{{"example_name": "example_value"}}</function>
237
+
238
+ Reminder:
239
+ - Function calls MUST follow the specified format, start with <function= and end with </function>
240
+ - Required parameters MUST be specified
241
+ - Only call one function at a time
242
+ - Put the entire function call reply on one line
243
+ - If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls
244
+ """
245
+ '''
246
+ return final_prompt
247
+
248
+ def _parse_tool_response(self, response: str):
249
+ function_regex = r"<function=(\w+)>(.*?)</function>"
250
+ match = re.search(function_regex, response)
251
+
252
+ if match:
253
+ function_name, args_string = match.groups()
254
+ try:
255
+ args = json.loads(args_string)
256
+ return {"function": function_name, "arguments": args}
257
+ except json.JSONDecodeError as error:
258
+ print(f"Error parsing function arguments: {error}")
259
+ return None
260
+ return None
261
+
209
262
  def reset(self):
210
263
  r"""Resets the :obj:`ChatAgent` to its initial state and returns the
211
264
  stored messages.
@@ -367,89 +420,221 @@ class ChatAgent(BaseAgent):
367
420
  a boolean indicating whether the chat session has terminated,
368
421
  and information about the chat session.
369
422
  """
370
- self.update_memory(input_message, OpenAIBackendRole.USER)
423
+ if (
424
+ isinstance(self.model_type, ModelType)
425
+ and "lama" in self.model_type.value
426
+ or isinstance(self.model_type, str)
427
+ and "lama" in self.model_type
428
+ ):
429
+ if self.model_backend.model_config_dict.get("tools", None):
430
+ tool_prompt = self._generate_tool_prompt(self.tool_schema_list)
431
+
432
+ tool_sys_msg = BaseMessage.make_assistant_message(
433
+ role_name="Assistant",
434
+ content=tool_prompt,
435
+ )
371
436
 
372
- tool_call_records: List[FunctionCallingRecord] = []
373
- while True:
374
- # Check if token has exceeded
375
- try:
376
- openai_messages, num_tokens = self.memory.get_context()
377
- except RuntimeError as e:
378
- return self._step_token_exceed(
379
- e.args[1], tool_call_records, "max_tokens_exceeded"
437
+ self.update_memory(tool_sys_msg, OpenAIBackendRole.SYSTEM)
438
+
439
+ self.update_memory(input_message, OpenAIBackendRole.USER)
440
+
441
+ tool_call_records: List[FunctionCallingRecord] = []
442
+ while True:
443
+ # Check if token has exceeded
444
+ try:
445
+ openai_messages, num_tokens = self.memory.get_context()
446
+ except RuntimeError as e:
447
+ return self._step_token_exceed(
448
+ e.args[1], tool_call_records, "max_tokens_exceeded"
449
+ )
450
+
451
+ (
452
+ response,
453
+ output_messages,
454
+ finish_reasons,
455
+ usage_dict,
456
+ response_id,
457
+ ) = self._step_model_response(openai_messages, num_tokens)
458
+ # If the model response is not a function call, meaning the
459
+ # model has generated a message response, break the loop
460
+ if (
461
+ not self.is_tools_added()
462
+ or not isinstance(response, ChatCompletion)
463
+ or "</function>" not in response.choices[0].message.content # type: ignore[operator]
464
+ ):
465
+ break
466
+
467
+ parsed_content = self._parse_tool_response(
468
+ response.choices[0].message.content # type: ignore[arg-type]
380
469
  )
381
470
 
382
- (
383
- response,
471
+ response.choices[0].message.tool_calls = [
472
+ ChatCompletionMessageToolCall(
473
+ id=str(uuid.uuid4()),
474
+ function=Function(
475
+ arguments=str(parsed_content["arguments"]).replace(
476
+ "'", '"'
477
+ ),
478
+ name=str(parsed_content["function"]),
479
+ ),
480
+ type="function",
481
+ )
482
+ ]
483
+
484
+ # Check for external tool call
485
+ tool_call_request = response.choices[0].message.tool_calls[0]
486
+ if tool_call_request.function.name in self.external_tool_names:
487
+ # if model calls an external tool, directly return the
488
+ # request
489
+ info = self._step_get_info(
490
+ output_messages,
491
+ finish_reasons,
492
+ usage_dict,
493
+ response_id,
494
+ tool_call_records,
495
+ num_tokens,
496
+ tool_call_request,
497
+ )
498
+ return ChatAgentResponse(
499
+ msgs=output_messages,
500
+ terminated=self.terminated,
501
+ info=info,
502
+ )
503
+
504
+ # Normal function calling
505
+ tool_call_records.append(
506
+ self._step_tool_call_and_update(response)
507
+ )
508
+
509
+ if (
510
+ output_schema is not None
511
+ and self.model_type.supports_tool_calling
512
+ ):
513
+ (
514
+ output_messages,
515
+ finish_reasons,
516
+ usage_dict,
517
+ response_id,
518
+ tool_call,
519
+ num_tokens,
520
+ ) = self._structure_output_with_function(output_schema)
521
+ tool_call_records.append(tool_call)
522
+
523
+ info = self._step_get_info(
384
524
  output_messages,
385
525
  finish_reasons,
386
526
  usage_dict,
387
527
  response_id,
388
- ) = self._step_model_response(openai_messages, num_tokens)
528
+ tool_call_records,
529
+ num_tokens,
530
+ )
389
531
 
390
- # If the model response is not a function call, meaning the model
391
- # has generated a message response, break the loop
392
- if (
393
- not self.is_tools_added()
394
- or not isinstance(response, ChatCompletion)
395
- or response.choices[0].message.tool_calls is None
396
- ):
397
- break
532
+ if len(output_messages) == 1:
533
+ # Auto record if the output result is a single message
534
+ self.record_message(output_messages[0])
535
+ else:
536
+ logger.warning(
537
+ "Multiple messages returned in `step()`, message won't be "
538
+ "recorded automatically. Please call `record_message()` "
539
+ "to record the selected message manually."
540
+ )
398
541
 
399
- # Check for external tool call
400
- tool_call_request = response.choices[0].message.tool_calls[0]
401
- if tool_call_request.function.name in self.external_tool_names:
402
- # if model calls an external tool, directly return the request
403
- info = self._step_get_info(
542
+ return ChatAgentResponse(
543
+ msgs=output_messages, terminated=self.terminated, info=info
544
+ )
545
+
546
+ else:
547
+ self.update_memory(input_message, OpenAIBackendRole.USER)
548
+
549
+ tool_call_records: List[FunctionCallingRecord] = [] # type: ignore[no-redef]
550
+ while True:
551
+ # Check if token has exceeded
552
+ try:
553
+ openai_messages, num_tokens = self.memory.get_context()
554
+ except RuntimeError as e:
555
+ return self._step_token_exceed(
556
+ e.args[1], tool_call_records, "max_tokens_exceeded"
557
+ )
558
+
559
+ (
560
+ response,
404
561
  output_messages,
405
562
  finish_reasons,
406
563
  usage_dict,
407
564
  response_id,
408
- tool_call_records,
409
- num_tokens,
410
- tool_call_request,
411
- )
412
- return ChatAgentResponse(
413
- msgs=output_messages, terminated=self.terminated, info=info
565
+ ) = self._step_model_response(openai_messages, num_tokens)
566
+ # If the model response is not a function call, meaning the
567
+ # model has generated a message response, break the loop
568
+ if (
569
+ not self.is_tools_added()
570
+ or not isinstance(response, ChatCompletion)
571
+ or response.choices[0].message.tool_calls is None
572
+ ):
573
+ break
574
+
575
+ # Check for external tool call
576
+ tool_call_request = response.choices[0].message.tool_calls[0]
577
+
578
+ if tool_call_request.function.name in self.external_tool_names:
579
+ # if model calls an external tool, directly return the
580
+ # request
581
+ info = self._step_get_info(
582
+ output_messages,
583
+ finish_reasons,
584
+ usage_dict,
585
+ response_id,
586
+ tool_call_records,
587
+ num_tokens,
588
+ tool_call_request,
589
+ )
590
+ return ChatAgentResponse(
591
+ msgs=output_messages,
592
+ terminated=self.terminated,
593
+ info=info,
594
+ )
595
+
596
+ # Normal function calling
597
+ tool_call_records.append(
598
+ self._step_tool_call_and_update(response)
414
599
  )
415
600
 
416
- # Normal function calling
417
- tool_call_records.append(self._step_tool_call_and_update(response))
601
+ if (
602
+ output_schema is not None
603
+ and self.model_type.supports_tool_calling
604
+ ):
605
+ (
606
+ output_messages,
607
+ finish_reasons,
608
+ usage_dict,
609
+ response_id,
610
+ tool_call,
611
+ num_tokens,
612
+ ) = self._structure_output_with_function(output_schema)
613
+ tool_call_records.append(tool_call)
418
614
 
419
- if output_schema is not None and self.model_type.supports_tool_calling:
420
- (
615
+ info = self._step_get_info(
421
616
  output_messages,
422
617
  finish_reasons,
423
618
  usage_dict,
424
619
  response_id,
425
- tool_call,
620
+ tool_call_records,
426
621
  num_tokens,
427
- ) = self._structure_output_with_function(output_schema)
428
- tool_call_records.append(tool_call)
622
+ )
429
623
 
430
- info = self._step_get_info(
431
- output_messages,
432
- finish_reasons,
433
- usage_dict,
434
- response_id,
435
- tool_call_records,
436
- num_tokens,
437
- )
624
+ if len(output_messages) == 1:
625
+ # Auto record if the output result is a single message
626
+ self.record_message(output_messages[0])
627
+ else:
628
+ logger.warning(
629
+ "Multiple messages returned in `step()`, message won't be "
630
+ "recorded automatically. Please call `record_message()` "
631
+ "to record the selected message manually."
632
+ )
438
633
 
439
- if len(output_messages) == 1:
440
- # Auto record if the output result is a single message
441
- self.record_message(output_messages[0])
442
- else:
443
- logger.warning(
444
- "Multiple messages returned in `step()`, message won't be "
445
- "recorded automatically. Please call `record_message()` to "
446
- "record the selected message manually."
634
+ return ChatAgentResponse(
635
+ msgs=output_messages, terminated=self.terminated, info=info
447
636
  )
448
637
 
449
- return ChatAgentResponse(
450
- msgs=output_messages, terminated=self.terminated, info=info
451
- )
452
-
453
638
  async def step_async(
454
639
  self,
455
640
  input_message: BaseMessage,
@@ -0,0 +1,20 @@
1
+ # =========== Copyright 2023 @ 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 @ CAMEL-AI.org. All Rights Reserved. ===========
14
+ from .discord_bot import DiscordBot
15
+ from .telegram_bot import TelegramBot
16
+
17
+ __all__ = [
18
+ 'DiscordBot',
19
+ 'TelegramBot',
20
+ ]