camel-ai 0.2.74a5__py3-none-any.whl → 0.2.75__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.

Files changed (80) hide show
  1. camel/__init__.py +1 -1
  2. camel/agents/chat_agent.py +149 -95
  3. camel/configs/__init__.py +3 -0
  4. camel/configs/nebius_config.py +103 -0
  5. camel/interpreters/e2b_interpreter.py +34 -1
  6. camel/models/__init__.py +2 -0
  7. camel/models/aiml_model.py +1 -16
  8. camel/models/anthropic_model.py +6 -22
  9. camel/models/aws_bedrock_model.py +1 -16
  10. camel/models/azure_openai_model.py +1 -16
  11. camel/models/base_model.py +0 -12
  12. camel/models/cohere_model.py +1 -16
  13. camel/models/crynux_model.py +1 -16
  14. camel/models/deepseek_model.py +1 -16
  15. camel/models/gemini_model.py +1 -16
  16. camel/models/groq_model.py +1 -17
  17. camel/models/internlm_model.py +1 -16
  18. camel/models/litellm_model.py +1 -16
  19. camel/models/lmstudio_model.py +1 -17
  20. camel/models/mistral_model.py +1 -16
  21. camel/models/model_factory.py +2 -0
  22. camel/models/modelscope_model.py +1 -16
  23. camel/models/moonshot_model.py +6 -22
  24. camel/models/nebius_model.py +83 -0
  25. camel/models/nemotron_model.py +0 -5
  26. camel/models/netmind_model.py +1 -16
  27. camel/models/novita_model.py +1 -16
  28. camel/models/nvidia_model.py +1 -16
  29. camel/models/ollama_model.py +4 -19
  30. camel/models/openai_compatible_model.py +0 -3
  31. camel/models/openai_model.py +1 -22
  32. camel/models/openrouter_model.py +1 -17
  33. camel/models/ppio_model.py +1 -16
  34. camel/models/qianfan_model.py +1 -16
  35. camel/models/qwen_model.py +1 -16
  36. camel/models/reka_model.py +1 -16
  37. camel/models/samba_model.py +0 -32
  38. camel/models/sglang_model.py +1 -16
  39. camel/models/siliconflow_model.py +1 -16
  40. camel/models/stub_model.py +0 -4
  41. camel/models/togetherai_model.py +1 -16
  42. camel/models/vllm_model.py +1 -16
  43. camel/models/volcano_model.py +0 -17
  44. camel/models/watsonx_model.py +1 -16
  45. camel/models/yi_model.py +1 -16
  46. camel/models/zhipuai_model.py +1 -16
  47. camel/societies/workforce/prompts.py +1 -8
  48. camel/societies/workforce/task_channel.py +120 -27
  49. camel/societies/workforce/workforce.py +35 -3
  50. camel/toolkits/__init__.py +0 -2
  51. camel/toolkits/github_toolkit.py +104 -17
  52. camel/toolkits/hybrid_browser_toolkit/config_loader.py +3 -0
  53. camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit_ts.py +260 -5
  54. camel/toolkits/hybrid_browser_toolkit/ts/src/browser-session.ts +288 -37
  55. camel/toolkits/hybrid_browser_toolkit/ts/src/config-loader.ts +3 -1
  56. camel/toolkits/hybrid_browser_toolkit/ts/src/hybrid-browser-toolkit.ts +209 -41
  57. camel/toolkits/hybrid_browser_toolkit/ts/src/types.ts +22 -3
  58. camel/toolkits/hybrid_browser_toolkit/ts/websocket-server.js +28 -1
  59. camel/toolkits/hybrid_browser_toolkit/ws_wrapper.py +101 -0
  60. camel/toolkits/hybrid_browser_toolkit_py/actions.py +158 -0
  61. camel/toolkits/hybrid_browser_toolkit_py/browser_session.py +55 -8
  62. camel/toolkits/hybrid_browser_toolkit_py/config_loader.py +43 -0
  63. camel/toolkits/hybrid_browser_toolkit_py/hybrid_browser_toolkit.py +312 -3
  64. camel/toolkits/hybrid_browser_toolkit_py/snapshot.py +10 -4
  65. camel/toolkits/hybrid_browser_toolkit_py/unified_analyzer.js +45 -4
  66. camel/toolkits/math_toolkit.py +64 -10
  67. camel/toolkits/mcp_toolkit.py +39 -14
  68. camel/toolkits/openai_image_toolkit.py +55 -24
  69. camel/toolkits/search_toolkit.py +153 -29
  70. camel/types/__init__.py +2 -2
  71. camel/types/enums.py +54 -10
  72. camel/types/openai_types.py +2 -2
  73. camel/types/unified_model_type.py +5 -0
  74. camel/utils/mcp.py +2 -2
  75. camel/utils/token_counting.py +18 -3
  76. {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75.dist-info}/METADATA +9 -15
  77. {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75.dist-info}/RECORD +79 -78
  78. camel/toolkits/openai_agent_toolkit.py +0 -135
  79. {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75.dist-info}/WHEEL +0 -0
  80. {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75.dist-info}/licenses/LICENSE +0 -0
@@ -64,11 +64,16 @@ class HybridBrowserToolkit(BaseToolkit, RegisteredAgentToolkit):
64
64
  "browser_select",
65
65
  "browser_scroll",
66
66
  "browser_enter",
67
+ "browser_mouse_control",
68
+ "browser_mouse_drag",
69
+ "browser_press_key",
67
70
  "browser_wait_user",
68
71
  "browser_solve_task",
69
72
  "browser_switch_tab",
70
73
  "browser_close_tab",
71
74
  "browser_get_tab_info",
75
+ "browser_console_view",
76
+ "browser_console_exec",
72
77
  ]
73
78
 
74
79
  def __init__(
@@ -669,12 +674,29 @@ class HybridBrowserToolkit(BaseToolkit, RegisteredAgentToolkit):
669
674
  "total_tabs": 0,
670
675
  }
671
676
 
672
- async def browser_type(self, *, ref: str, text: str) -> Dict[str, Any]:
673
- r"""Types text into an input element on the page.
677
+ async def browser_type(
678
+ self,
679
+ *,
680
+ ref: Optional[str] = None,
681
+ text: Optional[str] = None,
682
+ inputs: Optional[List[Dict[str, str]]] = None,
683
+ ) -> Dict[str, Any]:
684
+ r"""Types text into one or more input elements on the page.
685
+
686
+ This method supports two modes:
687
+ 1. Single input mode (backward compatible): Provide 'ref' and 'text'
688
+ 2. Multiple inputs mode: Provide 'inputs' as a list of dictionaries
689
+ with 'ref' and 'text' keys
674
690
 
675
691
  Args:
676
- ref (str): The `ref` ID of the input element, from a snapshot.
677
- text (str): The text to type into the element.
692
+ ref (Optional[str]): The `ref` ID of the input element, from a
693
+ snapshot. Required when using single input mode.
694
+ text (Optional[str]): The text to type into the element. Required
695
+ when using single input mode.
696
+ inputs (Optional[List[Dict[str, str]]]): List of dictionaries,
697
+ each containing 'ref' and 'text' keys for typing into multiple
698
+ elements. Example: [{'ref': '1', 'text': 'username'},
699
+ {'ref': '2', 'text': 'password'}]
678
700
 
679
701
  Returns:
680
702
  Dict[str, Any]: A dictionary with the result of the action:
@@ -684,10 +706,23 @@ class HybridBrowserToolkit(BaseToolkit, RegisteredAgentToolkit):
684
706
  - "tabs" (List[Dict]): Information about all open tabs.
685
707
  - "current_tab" (int): Index of the active tab.
686
708
  - "total_tabs" (int): Total number of open tabs.
709
+ - "details" (Dict[str, Any]): When using multiple inputs,
710
+ contains success/error status for each ref.
687
711
  """
688
712
  try:
689
713
  ws_wrapper = await self._get_ws_wrapper()
690
- result = await ws_wrapper.type(ref, text)
714
+
715
+ # Handle single input mode (backward compatibility)
716
+ if ref is not None and text is not None:
717
+ result = await ws_wrapper.type(ref, text)
718
+ # Handle multiple inputs mode
719
+ elif inputs is not None:
720
+ result = await ws_wrapper.type_multiple(inputs)
721
+ else:
722
+ raise ValueError(
723
+ "Either provide 'ref' and 'text' for single input, "
724
+ "or 'inputs' for multiple inputs"
725
+ )
691
726
 
692
727
  # Add tab information
693
728
  tab_info = await ws_wrapper.get_tab_info()
@@ -863,6 +898,156 @@ class HybridBrowserToolkit(BaseToolkit, RegisteredAgentToolkit):
863
898
  "total_tabs": 0,
864
899
  }
865
900
 
901
+ async def browser_mouse_control(
902
+ self, *, control: str, x: float, y: float
903
+ ) -> Dict[str, Any]:
904
+ r"""Control the mouse to interact with browser with x, y coordinates
905
+
906
+ Args:
907
+ control ([str]): The action to perform: 'click', 'right_click'
908
+ or 'dblclick'.
909
+ x (float): x-coordinate for the control action.
910
+ y (float): y-coordinate for the control action.
911
+
912
+ Returns:
913
+ Dict[str, Any]: A dictionary with the result of the action:
914
+ - "result" (str): Confirmation of the action.
915
+ - "snapshot" (str): A snapshot of the page after mouse
916
+ control action.
917
+ - "tabs" (List[Dict]): Information about all open tabs.
918
+ - "current_tab" (int): Index of the active tab.
919
+ - "total_tabs" (int): Total number of open tabs.
920
+ """
921
+ try:
922
+ ws_wrapper = await self._get_ws_wrapper()
923
+ result = await ws_wrapper.mouse_control(control, x, y)
924
+
925
+ # Add tab information
926
+ tab_info = await ws_wrapper.get_tab_info()
927
+ result.update(
928
+ {
929
+ "tabs": tab_info,
930
+ "current_tab": next(
931
+ (
932
+ i
933
+ for i, tab in enumerate(tab_info)
934
+ if tab.get("is_current")
935
+ ),
936
+ 0,
937
+ ),
938
+ "total_tabs": len(tab_info),
939
+ }
940
+ )
941
+
942
+ return result
943
+ except Exception as e:
944
+ logger.error(f"Failed to control mouse: {e}")
945
+ return {
946
+ "result": f"Error with mouse control: {e}",
947
+ "snapshot": "",
948
+ "tabs": [],
949
+ "current_tab": 0,
950
+ "total_tabs": 0,
951
+ }
952
+
953
+ async def browser_mouse_drag(
954
+ self, *, from_ref: str, to_ref: str
955
+ ) -> Dict[str, Any]:
956
+ r"""Control the mouse to drag and drop in the browser using ref IDs.
957
+
958
+ Args:
959
+ from_ref (str): The `ref` ID of the source element to drag from.
960
+ to_ref (str): The `ref` ID of the target element to drag to.
961
+
962
+ Returns:
963
+ Dict[str, Any]: A dictionary with the result of the action:
964
+ - "result" (str): Confirmation of the action.
965
+ - "snapshot" (str): A new page snapshot.
966
+ - "tabs" (List[Dict]): Information about all open tabs.
967
+ - "current_tab" (int): Index of the active tab.
968
+ - "total_tabs" (int): Total number of open tabs.
969
+ """
970
+ try:
971
+ ws_wrapper = await self._get_ws_wrapper()
972
+ result = await ws_wrapper.mouse_drag(from_ref, to_ref)
973
+
974
+ # Add tab information
975
+ tab_info = await ws_wrapper.get_tab_info()
976
+ result.update(
977
+ {
978
+ "tabs": tab_info,
979
+ "current_tab": next(
980
+ (
981
+ i
982
+ for i, tab in enumerate(tab_info)
983
+ if tab.get("is_current")
984
+ ),
985
+ 0,
986
+ ),
987
+ "total_tabs": len(tab_info),
988
+ }
989
+ )
990
+
991
+ return result
992
+ except Exception as e:
993
+ logger.error(f"Error with mouse drag and drop: {e}")
994
+ return {
995
+ "result": f"Error with mouse drag and drop: {e}",
996
+ "snapshot": "",
997
+ "tabs": [],
998
+ "current_tab": 0,
999
+ "total_tabs": 0,
1000
+ }
1001
+
1002
+ async def browser_press_key(self, *, keys: List[str]) -> Dict[str, Any]:
1003
+ r"""Press key and key combinations.
1004
+ Supports single key press or combination of keys by concatenating
1005
+ them with '+' separator.
1006
+
1007
+ Args:
1008
+ keys (List[str]): key or list of keys.
1009
+
1010
+ Returns:
1011
+ Dict[str, Any]: A dictionary with the result of the action:
1012
+ - "result" (str): Confirmation of the action.
1013
+ - "snapshot" (str): A snapshot of the page after
1014
+ press key action.
1015
+ - "tabs" (List[Dict]): Information about all open tabs.
1016
+ - "current_tab" (int): Index of the active tab.
1017
+ - "total_tabs" (int): Total number of open tabs.
1018
+ """
1019
+ try:
1020
+ ws_wrapper = await self._get_ws_wrapper()
1021
+ result = await ws_wrapper.press_key(keys)
1022
+
1023
+ # Add tab information
1024
+ tab_info = await ws_wrapper.get_tab_info()
1025
+ result.update(
1026
+ {
1027
+ "tabs": tab_info,
1028
+ "current_tab": next(
1029
+ (
1030
+ i
1031
+ for i, tab in enumerate(tab_info)
1032
+ if tab.get("is_current")
1033
+ ),
1034
+ 0,
1035
+ ),
1036
+ "total_tabs": len(tab_info),
1037
+ }
1038
+ )
1039
+
1040
+ return result
1041
+ except Exception as e:
1042
+ logger.error(f"Failed to press key: {e}")
1043
+ return {
1044
+ "result": f"Error with press key: {e}",
1045
+ "snapshot": "",
1046
+ "tabs": [],
1047
+ "current_tab": 0,
1048
+ "total_tabs": 0,
1049
+ }
1050
+
866
1051
  async def browser_switch_tab(self, *, tab_id: str) -> Dict[str, Any]:
867
1052
  r"""Switches to a different browser tab using its ID.
868
1053
 
@@ -1002,6 +1187,71 @@ class HybridBrowserToolkit(BaseToolkit, RegisteredAgentToolkit):
1002
1187
  "total_tabs": 0,
1003
1188
  }
1004
1189
 
1190
+ async def browser_console_view(self) -> Dict[str, Any]:
1191
+ r"""View current page console logs.
1192
+
1193
+ Returns:
1194
+ Dict[str, Any]: A dictionary with tab information:
1195
+ - "console_messages" (List[Dict]) : List of messages logged
1196
+ in the current page
1197
+
1198
+ """
1199
+ try:
1200
+ ws_wrapper = await self._get_ws_wrapper()
1201
+ console_logs = await ws_wrapper.console_view()
1202
+
1203
+ return {"console_messages": console_logs}
1204
+ except Exception as e:
1205
+ logger.error(f"Failed to get console view: {e}")
1206
+ return {"console_messages": []}
1207
+
1208
+ async def browser_console_exec(self, code: str) -> Dict[str, Any]:
1209
+ r"""Execute javascript code in the console of the current page and get
1210
+ results.
1211
+
1212
+ Args:
1213
+ code (str): JavaScript code to execute in the browser console.
1214
+
1215
+ Returns:
1216
+ Dict[str, Any]: A dictionary with the result of the action:
1217
+ - "result" (str): Confirmation of the action.
1218
+ - "snapshot" (str): A snapshot of the active tab after
1219
+ console execute action.
1220
+ - "tabs" (List[Dict]): Information about remaining tabs.
1221
+ - "current_tab" (int): Index of the new active tab.
1222
+ - "total_tabs" (int): Total number of remaining tabs.
1223
+ """
1224
+ try:
1225
+ ws_wrapper = await self._get_ws_wrapper()
1226
+ result = await ws_wrapper.console_exec(code)
1227
+
1228
+ tab_info = await ws_wrapper.get_tab_info()
1229
+ result.update(
1230
+ {
1231
+ "tabs": tab_info,
1232
+ "current_tab": next(
1233
+ (
1234
+ i
1235
+ for i, tab in enumerate(tab_info)
1236
+ if tab.get("is_current")
1237
+ ),
1238
+ 0,
1239
+ ),
1240
+ "total_tabs": len(tab_info),
1241
+ }
1242
+ )
1243
+
1244
+ return result
1245
+ except Exception as e:
1246
+ logger.error(f"Failed to execute javascript in console: {e}")
1247
+ return {
1248
+ "result": f"Error in code execution: {e}",
1249
+ "snapshot": "",
1250
+ "tabs": [],
1251
+ "current_tab": 0,
1252
+ "total_tabs": 0,
1253
+ }
1254
+
1005
1255
  # Additional methods for backward compatibility
1006
1256
  async def browser_wait_user(
1007
1257
  self, timeout_sec: Optional[float] = None
@@ -1146,10 +1396,15 @@ class HybridBrowserToolkit(BaseToolkit, RegisteredAgentToolkit):
1146
1396
  "browser_select": self.browser_select,
1147
1397
  "browser_scroll": self.browser_scroll,
1148
1398
  "browser_enter": self.browser_enter,
1399
+ "browser_mouse_click": self.browser_mouse_control,
1400
+ "browser_mouse_drag": self.browser_mouse_drag,
1401
+ "browser_press_key": self.browser_press_key,
1149
1402
  "browser_wait_user": self.browser_wait_user,
1150
1403
  "browser_switch_tab": self.browser_switch_tab,
1151
1404
  "browser_close_tab": self.browser_close_tab,
1152
1405
  "browser_get_tab_info": self.browser_get_tab_info,
1406
+ "browser_console_view": self.browser_console_view,
1407
+ "browser_console_exec": self.browser_console_exec,
1153
1408
  }
1154
1409
 
1155
1410
  enabled_tools = []