camel-ai 0.2.14__py3-none-any.whl → 0.2.15a0__py3-none-any.whl

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.

camel/utils/commons.py CHANGED
@@ -388,7 +388,8 @@ def json_to_function_code(json_obj: Dict) -> str:
388
388
  }
389
389
 
390
390
  for prop in required:
391
- description = properties[prop]['description']
391
+ # if no description, return empty string
392
+ description = properties[prop].get('description', "")
392
393
  prop_type = properties[prop]['type']
393
394
  python_type = prop_to_python.get(prop_type, prop_type)
394
395
  args.append(f"{prop}: {python_type}")
@@ -606,3 +607,39 @@ def retry_request(
606
607
  time.sleep(delay)
607
608
  else:
608
609
  raise
610
+
611
+
612
+ def generate_prompt_for_structured_output(
613
+ response_format: Optional[Type[BaseModel]],
614
+ user_message: str,
615
+ ) -> str:
616
+ """
617
+ This function generates a prompt based on the provided Pydantic model and
618
+ user message.
619
+
620
+ Args:
621
+ response_format (Type[BaseModel]): The Pydantic model class.
622
+ user_message (str): The user message to be used in the prompt.
623
+
624
+ Returns:
625
+ str: A prompt string for the LLM.
626
+ """
627
+ if response_format is None:
628
+ return user_message
629
+
630
+ json_schema = response_format.model_json_schema()
631
+ sys_prompt = (
632
+ "Given the user message, please generate a JSON response adhering "
633
+ "to the following JSON schema:\n"
634
+ f"{json_schema}\n"
635
+ "Make sure the JSON response is valid and matches the EXACT structure "
636
+ "defined in the schema. Your result should only be a valid json "
637
+ "object, without any other text or comments.\n"
638
+ )
639
+ user_prompt = f"User message: {user_message}\n"
640
+
641
+ final_prompt = f"""
642
+ {sys_prompt}
643
+ {user_prompt}
644
+ """
645
+ return final_prompt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: camel-ai
3
- Version: 0.2.14
3
+ Version: 0.2.15a0
4
4
  Summary: Communicative Agents for AI Society Study
5
5
  Home-page: https://www.camel-ai.org/
6
6
  License: Apache-2.0
@@ -48,7 +48,7 @@ Requires-Dist: discord.py (>=2.3.2,<3.0.0) ; extra == "tools" or extra == "all"
48
48
  Requires-Dist: docker (>=7.1.0,<8.0.0) ; extra == "tools" or extra == "runtime" or extra == "all"
49
49
  Requires-Dist: docstring-parser (>=0.15,<0.16)
50
50
  Requires-Dist: docx2txt (>=0.8,<0.9) ; extra == "tools" or extra == "all"
51
- Requires-Dist: duckduckgo-search (>=6.2.12,<7.0.0) ; extra == "search-tools" or extra == "tools" or extra == "all"
51
+ Requires-Dist: duckduckgo-search (>=6.3.5,<7.0.0) ; extra == "search-tools" or extra == "tools" or extra == "all"
52
52
  Requires-Dist: e2b-code-interpreter (>=1.0.3,<2.0.0) ; extra == "tools" or extra == "all"
53
53
  Requires-Dist: eval-type-backport (==0.2.0)
54
54
  Requires-Dist: ffmpeg-python (>=0.2.0,<0.3.0) ; extra == "tools" or extra == "all"
@@ -263,7 +263,7 @@ conda create --name camel python=3.10
263
263
  conda activate camel
264
264
 
265
265
  # Clone github repo
266
- git clone -b v0.2.14 https://github.com/camel-ai/camel.git
266
+ git clone -b v0.2.15a0 https://github.com/camel-ai/camel.git
267
267
 
268
268
  # Change directory into project directory
269
269
  cd camel
@@ -1,7 +1,7 @@
1
- camel/__init__.py,sha256=CFY0R6Dg37pCUN8WDaG7Dabv2IlGKd3iHbWlb1QjJ_c,912
1
+ camel/__init__.py,sha256=g2eFYaNvjdxxXv9ZTE1XGUhTxwDHJdDyNZQkuXHaYSU,914
2
2
  camel/agents/__init__.py,sha256=LcS4m8s97-yADfznvcaAdUe9W0E9h3m6zrSc9H6m9so,1545
3
3
  camel/agents/base.py,sha256=c4bJYL3G3Z41SaFdMPMn8ZjLdFiFaVOFO6EQIfuCVR8,1124
4
- camel/agents/chat_agent.py,sha256=-czR5ppfBLMeYp-tidH9oeLdmjXQh14U13TsJY7qHAo,51469
4
+ camel/agents/chat_agent.py,sha256=fBIFcajsBrlMg_37umFMsrrO__WPejJmSFzsLX1X1P0,55818
5
5
  camel/agents/critic_agent.py,sha256=qFVlHlQo0CVgmPWfWYLT8_oP_KyzCLFsQw_nN_vu5Bs,7487
6
6
  camel/agents/deductive_reasoner_agent.py,sha256=6BZGaq1hR6hKJuQtOfoYQnk_AkZpw_Mr7mUy2MspQgs,13540
7
7
  camel/agents/embodied_agent.py,sha256=XBxBu5ZMmSJ4B2U3Z7SMwvLlgp6yNpaBe8HNQmY9CZA,7536
@@ -45,10 +45,12 @@ camel/data_collector/__init__.py,sha256=UWZya21xeJ6DvyLcf54XlYPg7ShOsNJmNR88kfRL
45
45
  camel/data_collector/alpaca_collector.py,sha256=fqS_kws1EU9mDWlVxPXcoD1GhJ7lEzC28muGIMxiUpg,4683
46
46
  camel/data_collector/base.py,sha256=AOX-4xAf88g_5h_chD5fjNK4oz3f4Em1u2lr7NQ_EIY,6727
47
47
  camel/data_collector/sharegpt_collector.py,sha256=CnXvbo1K--67Tlym01Xx6Q1ZxmyKk8EKbgPVbsCLYXc,7219
48
+ camel/datagen/__init__.py,sha256=l0y6V_m-l7pDRSNARX3QQJiQPweSIwBxtfkIyrfMyyA,773
49
+ camel/datagen/o1datagen.py,sha256=nEFJHsQvNWlaewxHsYHVlAGe94Xc8ISaFwD8MJ61QN0,17129
48
50
  camel/datahubs/__init__.py,sha256=1a8fRuzgirO2pHtPnuisZ76iF_AN9GxMFq9gwFKWE5I,906
49
51
  camel/datahubs/base.py,sha256=4QKWiJaeL5ReQpyTAbOtzHs-2CzAYbVyoMngYwdpZGU,4357
50
52
  camel/datahubs/huggingface.py,sha256=Pg7Sp_u4ESbKmSzWovDmNZwEsrKNuV2z4jryes4X11s,14707
51
- camel/datahubs/models.py,sha256=e_jkKz1ShwmMLwveDOE1xGJk-w3-j1p2hSc0j-4cEuQ,903
53
+ camel/datahubs/models.py,sha256=oVNkBoptIeRVUT_e0FFkhtTJBGlEvRQDBKQBGL3flx4,994
52
54
  camel/embeddings/__init__.py,sha256=uOPul-p528_0TcCoBIe8-jhU4p1z1r5Lnsy0IFle3HQ,1200
53
55
  camel/embeddings/base.py,sha256=mxqFkWh2AfbxuVKPOqVx16fCznmuSh9QXGjaEeZHvoY,2190
54
56
  camel/embeddings/mistral_embedding.py,sha256=hU58FkRlQxTMlR0IMXln3F4M7stdX2Kbw9neAD6aZT0,3235
@@ -91,7 +93,7 @@ camel/messages/conversion/conversation_models.py,sha256=f2ybtYdCbILq9IYgaHkQ57yY
91
93
  camel/messages/conversion/sharegpt/__init__.py,sha256=oWUuHV5w85kxqhz_hoElLmCfzLm-ccku-fM9SnUJ5zI,794
92
94
  camel/messages/conversion/sharegpt/function_call_formatter.py,sha256=cn7e7CfmxEVFlfOqhjhNuA8nuWvWD6hXYn-3okXNxxQ,1832
93
95
  camel/messages/conversion/sharegpt/hermes/__init__.py,sha256=mxuMSm-neaTgInIjYXuIVdC310E6jKJzM3IdtaJ4qY4,812
94
- camel/messages/conversion/sharegpt/hermes/hermes_function_formatter.py,sha256=zJ9q7KFFMlQ27-WuFxf4LLL9DQt2bpeGJ2IzoUzmqZg,4552
96
+ camel/messages/conversion/sharegpt/hermes/hermes_function_formatter.py,sha256=-9TT8iOQ-ieKSKR_PmJSA5Bi0uBx-qR7WQ6vxuFkorM,4639
95
97
  camel/messages/func_message.py,sha256=MTkkJksMCd640QJx5pzRHI__6jJyh86u3B-02hi2Csk,5639
96
98
  camel/models/__init__.py,sha256=7h04fxeP2Ze3st9Xc23uEfAPcutf-dNveWTrJoMPJn4,2393
97
99
  camel/models/anthropic_model.py,sha256=JuXUsCy6bjieT6DY1TuKfbZ2ips8Y53-kvylESyw9qo,6501
@@ -148,11 +150,11 @@ camel/prompts/video_description_prompt.py,sha256=t-5B_VlTMEjEoRgziixcZLfxcZR2xu7
148
150
  camel/responses/__init__.py,sha256=8QQ0T0NH16825WYk6S3dCSWsz8hqLEfdPtVHxwNsCRk,789
149
151
  camel/responses/agent_responses.py,sha256=a9c2YeZ21AhZtFYezI-Mn-ILJkNpdgA9elKek-GceuM,1765
150
152
  camel/retrievers/__init__.py,sha256=d-H8Ke5bVRjzIt3GyTm6yrqKQItpbf-Ckc1LsZWsNcI,1053
151
- camel/retrievers/auto_retriever.py,sha256=QdeZzuEb7UNJY_J1asGU85RaA-tuLuDLlh3cd8iKQgI,9581
153
+ camel/retrievers/auto_retriever.py,sha256=z0GqfNYuqH1chUYId5EEF4AEPwUVDADjPcRqABw-slU,9853
152
154
  camel/retrievers/base.py,sha256=Sx66VHuNOJE31u59DX5XBwota4XqubeVm0feqLV7i28,2640
153
155
  camel/retrievers/bm25_retriever.py,sha256=feQgn3dwnbQG8H7KSbFzjaFAw3KtKObfoyA6gmL836A,5149
154
156
  camel/retrievers/cohere_rerank_retriever.py,sha256=tzMS3HG4wD3gbIAVcHsC5fTbFxuiNrT4qJ10oJMJ0BA,4032
155
- camel/retrievers/vector_retriever.py,sha256=LkOKwPJIeZJp8bovpUbsCZgakrQDX19BLGbUF8ZSQX4,10609
157
+ camel/retrievers/vector_retriever.py,sha256=qWR9aUpXyhfv_t6rdgnOCASzfB13FkOWhx3BttIqNa8,10748
156
158
  camel/runtime/__init__.py,sha256=QFxG8qYixImqSmC5bLXgT4_gkC5V8nq9dr9XlY4iZZM,1125
157
159
  camel/runtime/api.py,sha256=NBSg1C0v6RqlooTIzPEDKcHNixPTaQImFvWmWsaskhc,3095
158
160
  camel/runtime/base.py,sha256=KKBLO6PwWEWBXbYaVtO9JXqBT8110iYpMhgNSIxQvYQ,1512
@@ -169,7 +171,7 @@ camel/schemas/openai_converter.py,sha256=heyQesFAAjo4RF4R5BB1SPpF4mbNt9UhTvszxyJ
169
171
  camel/schemas/outlines_converter.py,sha256=OYKPR1fNyrYs9eh5RiXEAccMbnRc9WTwSVJYbh9HkKE,8738
170
172
  camel/societies/__init__.py,sha256=NOHjtlsY-gV9UCF2xXgcbG-xXyuigmbwbpLpNsDgEJ4,826
171
173
  camel/societies/babyagi_playing.py,sha256=KbTdpHfZ2V8AripVck0bNTOyF-RSaMPCRARz3DvzWfQ,11855
172
- camel/societies/role_playing.py,sha256=I7xCYauJwGex1Fj9p1S6UxHI25lVshyidAeY8_6gE2o,23809
174
+ camel/societies/role_playing.py,sha256=BhM42niGOaQctdOsOHtr6-ZA6oYvhf12eriSDj9Mhf8,23865
173
175
  camel/societies/workforce/__init__.py,sha256=bkTI-PE-MSK9AQ2V2gR6cR2WY-R7Jqy_NmXRtAoqo8o,920
174
176
  camel/societies/workforce/base.py,sha256=4uSTmBQsWk_UX1xUrEbjo0X7OuYRbGWoroTV71Tvg8U,1947
175
177
  camel/societies/workforce/prompts.py,sha256=KBiBWDXhclpJLvdUmk2anX2J9eeUDD7xHYwSeZJD_Hc,6178
@@ -178,12 +180,12 @@ camel/societies/workforce/single_agent_worker.py,sha256=RgZveQhinTLJA9XPRb_ph_mG
178
180
  camel/societies/workforce/task_channel.py,sha256=9t5hoinfGYnbRavX4kx34Jk1FOy05SnJZYbNzb5M-CQ,7140
179
181
  camel/societies/workforce/utils.py,sha256=yPbcLx8lNZStl15C4UXRBl5qsTrGA-hiIGynnGi53WQ,2384
180
182
  camel/societies/workforce/worker.py,sha256=Do6FDpEraICQVptBH-LiG5KDYYQzD83sLoYO9J8NAbc,3933
181
- camel/societies/workforce/workforce.py,sha256=pnyLnV4Fo5awuddf_kMWGwoHyyIw8STdIYfEQqVGkQE,18276
183
+ camel/societies/workforce/workforce.py,sha256=kO5t5RaEsz4SZ6l3Lb8JxvyeOtePW2y0NrRV94KHBao,18302
182
184
  camel/storages/__init__.py,sha256=jXff0PfC9VzAlSAgwlPv3uzZQlhuc82Did_OPNLJJuY,1617
183
185
  camel/storages/graph_storages/__init__.py,sha256=G29BNn651C0WTOpjCl4QnVM-4B9tcNh8DdmsCiONH8Y,948
184
186
  camel/storages/graph_storages/base.py,sha256=uSe9jWuLudfm5jtfo6E-L_kNzITwK1_Ef-6L4HWw-JM,2852
185
187
  camel/storages/graph_storages/graph_element.py,sha256=v7Gzl63VhN00vlsI3G8GCZkbgiOCyonFCpNsPCo90Pk,2617
186
- camel/storages/graph_storages/nebula_graph.py,sha256=bDwLpX3KcjEm0t7_AqANt1aoPjTvX3fpVsp4MjGVl4Y,18857
188
+ camel/storages/graph_storages/nebula_graph.py,sha256=1PaxntaIrIHfpU_aojLh646gpMpEr2X1eZtrIKfpx-I,19597
187
189
  camel/storages/graph_storages/neo4j_graph.py,sha256=Ny4MZYQjwP-h3AJAt1qziTcbDl7RdCuivqn-rTcC2SY,22132
188
190
  camel/storages/key_value_storages/__init__.py,sha256=le_hl7MYoQvaiYaJHwomy8c0cvTemicZbmwxgCJUpOs,962
189
191
  camel/storages/key_value_storages/base.py,sha256=FSfxeLuG7SPvn-Mg-OQxtRKPtQBnRkB7lYeDaFOefpk,2177
@@ -258,16 +260,16 @@ camel/toolkits/video_toolkit.py,sha256=n1P7F_cjdnC2jfUQQiJnhueRYA83GIjUF7HWIrES5
258
260
  camel/toolkits/weather_toolkit.py,sha256=qHAMD56zqd5GWnEWiaA_0aBDwvgacdx0pAHScinY4GY,6965
259
261
  camel/toolkits/whatsapp_toolkit.py,sha256=H_83AFCIoBMvZUcfUvfRTIAjfR2DR79xP2J-rfQKtNo,6326
260
262
  camel/types/__init__.py,sha256=NkjLAPjxo_BReMzRrnv7hfEIQX42F9GHoBK1T_J-WxM,2187
261
- camel/types/enums.py,sha256=YdxHWflANL2UkmKOsyY2sJZXmj7SfK3w6WxRRTF0fiI,23563
263
+ camel/types/enums.py,sha256=i6yRjCH-oGlKOscRZID9pe9UMbv-HrGF_Q4urbQ6OAA,23700
262
264
  camel/types/openai_types.py,sha256=7tfrPHScqyerPwIP7dPmKss87lVkvsb175cT-jLJWyg,2222
263
- camel/types/unified_model_type.py,sha256=ocNxJM98xdCDeqCt1F7Fcvd4Hw1ZxMgsMRZqetGWndo,3819
264
- camel/utils/__init__.py,sha256=PS-QW4kT3DefTtjUEkHvBkxMK06ar_uACbkszQWWPTM,2313
265
+ camel/types/unified_model_type.py,sha256=uOSD-rd563evRD1hOpoL6fxmEKtRY9v_wXJ9-0ziBgI,3987
266
+ camel/utils/__init__.py,sha256=XgQT_XGeiNZ5KdyvpumS_4ChYkY5Jvh1HpE1a-baoj0,2401
265
267
  camel/utils/async_func.py,sha256=4esRhhGrvfm-iJRloUbU-sYWyHp_mt0bBBXpwyCv6vc,1556
266
- camel/utils/commons.py,sha256=fcAP_BgSkyssmQUjVaPjfo9zYaqPnvlUJuVApJM2htw,17523
268
+ camel/utils/commons.py,sha256=Dx7Ljm_yOsnfOMudUTcspp1cbvAcQ-7Nu_23psMEEmI,18664
267
269
  camel/utils/constants.py,sha256=MQD3bgLIq_NATp0D1iFkrwfkCwVX-PAOSXheTkkEdkY,1410
268
270
  camel/utils/response_format.py,sha256=9KrbwtOM9cA3LSjTgLiK7oKy-53_uMh1cvpyNwwJpng,2419
269
271
  camel/utils/token_counting.py,sha256=cS8sS3lVjn79lzHi5N8z2j7a9vtw2DZy4PwzHcQIv_Q,15337
270
- camel_ai-0.2.14.dist-info/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
271
- camel_ai-0.2.14.dist-info/METADATA,sha256=9N74TIEATILUa0_u2I3WTmH1xMq7h6xvpqtxKPRJtdE,32318
272
- camel_ai-0.2.14.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
273
- camel_ai-0.2.14.dist-info/RECORD,,
272
+ camel_ai-0.2.15a0.dist-info/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
273
+ camel_ai-0.2.15a0.dist-info/METADATA,sha256=f49ykXSEVJqziH0wwl25pZ0wEzFdAZ9MQhcVuFNM0VQ,32321
274
+ camel_ai-0.2.15a0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
275
+ camel_ai-0.2.15a0.dist-info/RECORD,,