camel-ai 0.2.75a0__py3-none-any.whl → 0.2.75a3__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/__init__.py CHANGED
@@ -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.75a0'
17
+ __version__ = '0.2.75a3'
18
18
 
19
19
  __all__ = [
20
20
  '__version__',
@@ -2148,9 +2148,9 @@ class ChatAgent(BaseAgent):
2148
2148
  if tool_calls := response.choices[0].message.tool_calls:
2149
2149
  tool_call_requests = []
2150
2150
  for tool_call in tool_calls:
2151
- tool_name = tool_call.function.name
2151
+ tool_name = tool_call.function.name # type: ignore[union-attr]
2152
2152
  tool_call_id = tool_call.id
2153
- args = json.loads(tool_call.function.arguments)
2153
+ args = json.loads(tool_call.function.arguments) # type: ignore[union-attr]
2154
2154
  tool_call_request = ToolCallRequest(
2155
2155
  tool_name=tool_name, args=args, tool_call_id=tool_call_id
2156
2156
  )
@@ -61,7 +61,9 @@ class MoonshotModel(OpenAICompatibleModel):
61
61
  api_key (Optional[str], optional): The API key for authenticating with
62
62
  the Moonshot service. (default: :obj:`None`)
63
63
  url (Optional[str], optional): The url to the Moonshot service.
64
- (default: :obj:`https://api.moonshot.cn/v1`)
64
+ For Chinese users, use :obj:`https://api.moonshot.cn/v1`.
65
+ For overseas users, the default endpoint will be used.
66
+ (default: :obj:`https://api.moonshot.ai/v1`)
65
67
  token_counter (Optional[BaseTokenCounter], optional): Token counter to
66
68
  use for the model. If not provided, :obj:`OpenAITokenCounter(
67
69
  ModelType.GPT_4)` will be used.
@@ -82,7 +84,7 @@ class MoonshotModel(OpenAICompatibleModel):
82
84
  model_type: Union[ModelType, str],
83
85
  model_config_dict: Optional[Dict[str, Any]] = None,
84
86
  api_key: Optional[str] = None,
85
- url: Optional[str] = None,
87
+ url: Optional[str] = "https://api.moonshot.ai/v1",
86
88
  token_counter: Optional[BaseTokenCounter] = None,
87
89
  timeout: Optional[float] = None,
88
90
  max_retries: int = 3,
@@ -91,10 +93,7 @@ class MoonshotModel(OpenAICompatibleModel):
91
93
  if model_config_dict is None:
92
94
  model_config_dict = MoonshotConfig().as_dict()
93
95
  api_key = api_key or os.environ.get("MOONSHOT_API_KEY")
94
- url = url or os.environ.get(
95
- "MOONSHOT_API_BASE_URL",
96
- "https://api.moonshot.cn/v1",
97
- )
96
+ url = url or os.environ.get("MOONSHOT_API_BASE_URL")
98
97
  timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))
99
98
  super().__init__(
100
99
  model_type=model_type,
@@ -61,14 +61,7 @@ Each assignment dictionary should have:
61
61
  - "dependencies": list of task IDs that this task depends on (empty list if no dependencies)
62
62
 
63
63
  Example valid response:
64
- {{
65
- "assignments": [
66
- {{"task_id": "task_1", "assignee_id": "node_12345", "dependencies": []}},
67
- {{"task_id": "task_2", "assignee_id": "node_67890", "dependencies": ["task_1"]}},
68
- {{"task_id": "task_3", "assignee_id": "node_12345", "dependencies": []}},
69
- {{"task_id": "task_4", "assignee_id": "node_67890", "dependencies": ["task_1", "task_2"]}}
70
- ]
71
- }}
64
+ {{"assignments": [{{"task_id": "task_1", "assignee_id": "node_12345", "dependencies": []}}, {{"task_id": "task_2", "assignee_id": "node_67890", "dependencies": ["task_1"]}}, {{"task_id": "task_3", "assignee_id": "node_12345", "dependencies": []}}, {{"task_id": "task_4", "assignee_id": "node_67890", "dependencies": ["task_1", "task_2"]}}]}}
72
65
 
73
66
  ***CRITICAL: DEPENDENCY MANAGEMENT IS YOUR IMPORTANT RESPONSIBILITY.***
74
67
  Carefully analyze the sequence of tasks. A task's dependencies MUST include the IDs of all prior tasks whose outputs are necessary for its execution. For example, a task to 'Summarize Paper X' MUST depend on the task that 'Finds/Retrieves Paper X'. Similarly, a task that 'Compiles a report from summaries' MUST depend on all 'Summarize Paper X' tasks. **Incorrect or missing dependencies will lead to critical operational failures and an inability to complete the overall objective.** Be meticulous in defining these relationships.
@@ -68,7 +68,6 @@ from .pubmed_toolkit import PubMedToolkit
68
68
  from .data_commons_toolkit import DataCommonsToolkit
69
69
  from .thinking_toolkit import ThinkingToolkit
70
70
  from .pyautogui_toolkit import PyAutoGUIToolkit
71
- from .openai_agent_toolkit import OpenAIAgentToolkit
72
71
  from .searxng_toolkit import SearxNGToolkit
73
72
  from .jina_reranker_toolkit import JinaRerankerToolkit
74
73
  from .pulse_mcp_search_toolkit import PulseMCPSearchToolkit
@@ -143,7 +142,6 @@ __all__ = [
143
142
  'DataCommonsToolkit',
144
143
  'ThinkingToolkit',
145
144
  'PyAutoGUIToolkit',
146
- 'OpenAIAgentToolkit',
147
145
  'SearxNGToolkit',
148
146
  'JinaRerankerToolkit',
149
147
  'OrigeneToolkit',
@@ -13,7 +13,6 @@
13
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
14
  import os
15
15
  from typing import Any, Dict, List, Literal, Optional, TypeAlias, Union, cast
16
- from urllib.parse import quote
17
16
 
18
17
  import requests
19
18
 
@@ -459,17 +458,21 @@ class SearchToolkit(BaseToolkit):
459
458
 
460
459
  Args:
461
460
  query (str): The query to be searched.
462
- search_type (str): The type of search to perform. Either "web" for
463
- web pages or "image" for image search. (default: "web")
461
+ search_type (str): The type of search to perform. Must be either
462
+ "web" for web pages or "image" for image search. Any other
463
+ value will raise a ValueError. (default: "web")
464
464
  number_of_result_pages (int): The number of result pages to
465
- retrieve. Adjust this based on your task - use fewer results
466
- for focused searches and more for comprehensive searches.
467
- (default: :obj:`10`)
468
- start_page (int): The result page to start from. Use this for
469
- pagination - e.g., start_page=1 for results 1-10,
470
- start_page=11 for results 11-20, etc. This allows agents to
471
- check initial results and continue searching if needed.
472
- (default: :obj:`1`)
465
+ retrieve. Must be a positive integer between 1 and 10.
466
+ Google Custom Search API limits results to 10 per request.
467
+ If a value greater than 10 is provided, it will be capped
468
+ at 10 with a warning. Adjust this based on your task - use
469
+ fewer results for focused searches and more for comprehensive
470
+ searches. (default: :obj:`10`)
471
+ start_page (int): The result page to start from. Must be a
472
+ positive integer (>= 1). Use this for pagination - e.g.,
473
+ start_page=1 for results 1-10, start_page=11 for results
474
+ 11-20, etc. This allows agents to check initial results
475
+ and continue searching if needed. (default: :obj:`1`)
473
476
 
474
477
  Returns:
475
478
  List[Dict[str, Any]]: A list of dictionaries where each dictionary
@@ -515,6 +518,8 @@ class SearchToolkit(BaseToolkit):
515
518
  'height': 600
516
519
  }
517
520
  """
521
+ from urllib.parse import quote
522
+
518
523
  import requests
519
524
 
520
525
  # Validate input parameters
@@ -578,8 +583,8 @@ class SearchToolkit(BaseToolkit):
578
583
  responses = []
579
584
  # Fetch the results given the URL
580
585
  try:
581
- result = requests.get(url, timeout=30)
582
- result.raise_for_status() # Raise exception for bad status codes
586
+ # Make the get
587
+ result = requests.get(url)
583
588
  data = result.json()
584
589
 
585
590
  # Get the result items
@@ -610,7 +615,6 @@ class SearchToolkit(BaseToolkit):
610
615
  "context_url": context_url,
611
616
  }
612
617
 
613
- # Add dimensions if available
614
618
  if width:
615
619
  response["width"] = int(width)
616
620
  if height:
@@ -618,31 +622,23 @@ class SearchToolkit(BaseToolkit):
618
622
 
619
623
  responses.append(response)
620
624
  else:
621
- title = search_item.get("title", "")
622
- snippet = search_item.get("snippet", "")
623
- link = search_item.get("link", "")
624
-
625
- long_description = "N/A"
625
+ if "pagemap" not in search_item:
626
+ continue
627
+ if "metatags" not in search_item["pagemap"]:
628
+ continue
626
629
  if (
627
- "pagemap" in search_item
628
- and "metatags" in search_item["pagemap"]
630
+ "og:description"
631
+ in search_item["pagemap"]["metatags"][0]
629
632
  ):
630
- metatags = search_item["pagemap"]["metatags"]
631
- if metatags and len(metatags) > 0:
632
- meta = metatags[0]
633
- long_description = (
634
- meta.get("og:description")
635
- or meta.get("description")
636
- or meta.get("twitter:description")
637
- or "N/A"
638
- )
639
-
640
- if not title and not snippet and not link:
641
- logger.debug(
642
- f"Skipping result {i} due to missing essential fields"
643
- )
644
- continue
633
+ long_description = search_item["pagemap"][
634
+ "metatags"
635
+ ][0]["og:description"]
636
+ else:
637
+ long_description = "N/A"
638
+ title = search_item.get("title")
639
+ snippet = search_item.get("snippet")
645
640
 
641
+ link = search_item.get("link")
646
642
  response = {
647
643
  "result_id": i,
648
644
  "title": title,
@@ -652,74 +648,39 @@ class SearchToolkit(BaseToolkit):
652
648
  }
653
649
  responses.append(response)
654
650
  else:
655
- logger.debug(f"Google API response without items: {data}")
656
- error_info = data.get("error", {})
657
- if error_info:
658
- error_code = error_info.get("code", "Unknown")
659
- error_message = error_info.get("message", "Unknown error")
660
- error_details = f"Error {error_code}: {error_message}"
661
- else:
662
- error_details = (
663
- "No results found or API returned empty response"
651
+ if "error" in data:
652
+ error_info = data.get("error", {})
653
+ logger.error(
654
+ f"Google search failed - API response: {error_info}"
664
655
  )
665
-
666
- logger.error(f"Google search failed - {error_details}")
667
- responses.append(
668
- {"error": f"Google search failed - {error_details}"}
669
- )
670
-
671
- except requests.exceptions.Timeout:
672
- logger.error("Google search request timed out")
673
- responses.append(
674
- {"error": "Google search request timed out after 30 seconds"}
675
- )
676
- except requests.exceptions.HTTPError as e:
677
- error_message = f"Google API HTTP error: {e}"
678
- try:
679
- error_data = e.response.json()
680
- if "error" in error_data and "message" in error_data["error"]:
681
- api_error_message = error_data["error"]["message"]
682
- error_code = error_data["error"].get(
683
- "code", e.response.status_code
656
+ responses.append(
657
+ {
658
+ "error": f"Google search failed - "
659
+ f"API response: {error_info}"
660
+ }
661
+ )
662
+ elif "searchInformation" in data:
663
+ search_info = data.get("searchInformation", {})
664
+ total_results = search_info.get("totalResults", "0")
665
+ if total_results == "0":
666
+ logger.info(f"No results found for query: {query}")
667
+ # Return empty list to indicate no results (not an error)
668
+ responses = []
669
+ else:
670
+ logger.warning(
671
+ f"Google search returned no items but claims {total_results} results"
672
+ )
673
+ responses = []
674
+ else:
675
+ logger.error(
676
+ f"Unexpected Google API response format: {data}"
684
677
  )
685
- error_message = (
686
- f"Google API error {error_code}: {api_error_message}"
678
+ responses.append(
679
+ {"error": "Unexpected response format from Google API"}
687
680
  )
688
681
 
689
- if e.response.status_code == 429:
690
- error_message = f"Google API rate limit exceeded: {api_error_message}"
691
- elif e.response.status_code == 400:
692
- if "API key" in api_error_message:
693
- error_message = (
694
- f"Invalid Google API key: {api_error_message}"
695
- )
696
- else:
697
- error_message = f"Bad request to Google API: {api_error_message}"
698
- except (ValueError, KeyError):
699
- if e.response.status_code == 429:
700
- error_message = "Google API rate limit exceeded. Please try again later."
701
- elif e.response.status_code == 400:
702
- error_message = "Google API bad request. Please check your API key and search engine ID."
703
- elif e.response.status_code == 403:
704
- error_message = "Google API access forbidden. Please check your API key permissions."
705
-
706
- logger.error(error_message)
707
- responses.append({"error": error_message})
708
- except requests.exceptions.RequestException as e:
709
- logger.error(f"Google search network error: {e}")
710
- responses.append(
711
- {"error": f"Network error during Google search: {e!s}"}
712
- )
713
- except ValueError as e:
714
- logger.error(f"Google search response parsing error: {e}")
715
- responses.append(
716
- {"error": f"Failed to parse Google search response: {e!s}"}
717
- )
718
682
  except Exception as e:
719
- logger.error(f"Unexpected error during Google search: {e}")
720
- responses.append(
721
- {"error": f"Unexpected error during Google search: {e!s}"}
722
- )
683
+ responses.append({"error": f"google search failed: {e!s}"})
723
684
  return responses
724
685
 
725
686
  def tavily_search(
camel/types/__init__.py CHANGED
@@ -41,8 +41,8 @@ from .openai_types import (
41
41
  ChatCompletionAssistantMessageParam,
42
42
  ChatCompletionChunk,
43
43
  ChatCompletionMessage,
44
+ ChatCompletionMessageFunctionToolCall,
44
45
  ChatCompletionMessageParam,
45
- ChatCompletionMessageToolCall,
46
46
  ChatCompletionSystemMessageParam,
47
47
  ChatCompletionToolMessageParam,
48
48
  ChatCompletionUserMessageParam,
@@ -71,7 +71,7 @@ __all__ = [
71
71
  'ChatCompletionUserMessageParam',
72
72
  'ChatCompletionAssistantMessageParam',
73
73
  'ChatCompletionToolMessageParam',
74
- 'ChatCompletionMessageToolCall',
74
+ 'ChatCompletionMessageFunctionToolCall',
75
75
  'CompletionUsage',
76
76
  'OpenAIImageType',
77
77
  'OpenAIVisionDetailType',
camel/types/enums.py CHANGED
@@ -30,7 +30,7 @@ class RoleType(Enum):
30
30
 
31
31
 
32
32
  class ModelType(UnifiedModelType, Enum):
33
- DEFAULT = os.getenv("DEFAULT_MODEL_TYPE", "gpt-4.1-mini-2025-04-14")
33
+ DEFAULT = os.getenv("DEFAULT_MODEL_TYPE", "gpt-5-mini")
34
34
 
35
35
  GPT_3_5_TURBO = "gpt-3.5-turbo"
36
36
  GPT_4 = "gpt-4"
@@ -48,6 +48,9 @@ class ModelType(UnifiedModelType, Enum):
48
48
  O4_MINI = "o4-mini"
49
49
  O3 = "o3"
50
50
  O3_PRO = "o3-pro"
51
+ GPT_5 = "gpt-5"
52
+ GPT_5_MINI = "gpt-5-mini"
53
+ GPT_5_NANO = "gpt-5-nano"
51
54
 
52
55
  AWS_CLAUDE_3_7_SONNET = "anthropic.claude-3-7-sonnet-20250219-v1:0"
53
56
  AWS_CLAUDE_3_5_SONNET = "anthropic.claude-3-5-sonnet-20241022-v2:0"
@@ -498,6 +501,9 @@ class ModelType(UnifiedModelType, Enum):
498
501
  ModelType.GPT_4_1,
499
502
  ModelType.GPT_4_1_MINI,
500
503
  ModelType.GPT_4_1_NANO,
504
+ ModelType.GPT_5,
505
+ ModelType.GPT_5_MINI,
506
+ ModelType.GPT_5_NANO,
501
507
  ModelType.O4_MINI,
502
508
  ModelType.O3,
503
509
  }
@@ -539,6 +545,7 @@ class ModelType(UnifiedModelType, Enum):
539
545
  ModelType.GPT_4_1,
540
546
  ModelType.GPT_4_1_MINI,
541
547
  ModelType.GPT_4_1_NANO,
548
+ ModelType.GPT_5,
542
549
  ModelType.O4_MINI,
543
550
  ModelType.O3,
544
551
  }
@@ -1176,6 +1183,9 @@ class ModelType(UnifiedModelType, Enum):
1176
1183
  ModelType.O1_PREVIEW,
1177
1184
  ModelType.O1_MINI,
1178
1185
  ModelType.GPT_4_5_PREVIEW,
1186
+ ModelType.GPT_5,
1187
+ ModelType.GPT_5_NANO,
1188
+ ModelType.GPT_5_MINI,
1179
1189
  ModelType.MISTRAL_LARGE,
1180
1190
  ModelType.MISTRAL_NEMO,
1181
1191
  ModelType.MISTRAL_PIXTRAL_12B,
@@ -33,7 +33,7 @@ from openai.types.chat.chat_completion_user_message_param import (
33
33
  from openai.types.completion_usage import CompletionUsage
34
34
  from openai.types.chat import ParsedChatCompletion
35
35
  from openai._types import NOT_GIVEN, NotGiven
36
- from openai.types.chat import ChatCompletionMessageToolCall
36
+ from openai.types.chat import ChatCompletionMessageFunctionToolCall
37
37
 
38
38
  __all__ = [
39
39
  "Choice",
@@ -45,7 +45,7 @@ __all__ = [
45
45
  "ChatCompletionUserMessageParam",
46
46
  "ChatCompletionAssistantMessageParam",
47
47
  "ChatCompletionToolMessageParam",
48
- "ChatCompletionMessageToolCall",
48
+ "ChatCompletionMessageFunctionToolCall",
49
49
  "CompletionUsage",
50
50
  "ParsedChatCompletion",
51
51
  "NOT_GIVEN",
@@ -133,7 +133,11 @@ class OpenAITokenCounter(BaseTokenCounter):
133
133
  self.tokens_per_message = 4
134
134
  # If there's a name, the role is omitted
135
135
  self.tokens_per_name = -1
136
- elif ("gpt-3.5-turbo" in self.model) or ("gpt-4" in self.model):
136
+ elif (
137
+ ("gpt-3.5-turbo" in self.model)
138
+ or ("gpt-4" in self.model)
139
+ or ("gpt-5" in self.model)
140
+ ):
137
141
  self.tokens_per_message = 3
138
142
  self.tokens_per_name = 1
139
143
  elif (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: camel-ai
3
- Version: 0.2.75a0
3
+ Version: 0.2.75a3
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
@@ -235,6 +235,7 @@ Requires-Dist: docx>=0.2.4; extra == 'eigent'
235
235
  Requires-Dist: duckduckgo-search<7,>=6.3.5; extra == 'eigent'
236
236
  Requires-Dist: exa-py<2,>=1.10.0; extra == 'eigent'
237
237
  Requires-Dist: ffmpeg-python<0.3,>=0.2.0; extra == 'eigent'
238
+ Requires-Dist: google-api-python-client==2.166.0; extra == 'eigent'
238
239
  Requires-Dist: html2text>=2024.2.26; extra == 'eigent'
239
240
  Requires-Dist: imageio[pyav]<3,>=2.34.2; extra == 'eigent'
240
241
  Requires-Dist: markitdown[all]>=0.1.1; extra == 'eigent'
@@ -1,4 +1,4 @@
1
- camel/__init__.py,sha256=ZL8kyz2leHtcCUSj1kezLiqKMrsRPPabrpaGy_1tv14,901
1
+ camel/__init__.py,sha256=700Qx-U389P5R9yaCb-KQVk4xdMQWzsrmTGUuos90kc,901
2
2
  camel/generators.py,sha256=JRqj9_m1PF4qT6UtybzTQ-KBT9MJQt18OAAYvQ_fr2o,13844
3
3
  camel/human.py,sha256=Xg8x1cS5KK4bQ1SDByiHZnzsRpvRP-KZViNvmu38xo4,5475
4
4
  camel/logger.py,sha256=WgEwael_eT6D-lVAKHpKIpwXSTjvLbny5jbV1Ab8lnA,5760
@@ -7,7 +7,7 @@ camel/agents/__init__.py,sha256=64weKqdvmpZcGWyVkO-OKASAmVUdrQjv60JApgPk_SA,1644
7
7
  camel/agents/_types.py,sha256=MeFZzay2kJA6evALQ-MbBTKW-0lu_0wBuKsxzH_4gWI,1552
8
8
  camel/agents/_utils.py,sha256=AR7Qqgbkmn4X2edYUQf1rdksGUyV5hm3iK1z-Dn0Mcg,6266
9
9
  camel/agents/base.py,sha256=c4bJYL3G3Z41SaFdMPMn8ZjLdFiFaVOFO6EQIfuCVR8,1124
10
- camel/agents/chat_agent.py,sha256=fxZ8dBVhLwA-ZsBJbOvTxvQc4zHCKi4D3qwLz2URiW0,151815
10
+ camel/agents/chat_agent.py,sha256=9-g2hB7NN_OnNDV35bgbQnnTFkbImSm9Qe0NPNHtboM,151871
11
11
  camel/agents/critic_agent.py,sha256=L6cTbYjyZB0DCa51tQ6LZLA6my8kHLC4nktHySH78H4,10433
12
12
  camel/agents/deductive_reasoner_agent.py,sha256=6BZGaq1hR6hKJuQtOfoYQnk_AkZpw_Mr7mUy2MspQgs,13540
13
13
  camel/agents/embodied_agent.py,sha256=XBxBu5ZMmSJ4B2U3Z7SMwvLlgp6yNpaBe8HNQmY9CZA,7536
@@ -193,7 +193,7 @@ camel/models/mistral_model.py,sha256=m8ssQ04bWSevkexXNj4MJ_IcJb1HCxaEFx-oCt3dSNs
193
193
  camel/models/model_factory.py,sha256=8b-LEXovPnpmD3GFKOdbtcgjCwpa91IPCJxikPxhdMs,12114
194
194
  camel/models/model_manager.py,sha256=ln3bCV_QWM3V5BrwKwjmxIeRN8ojIvPEBMMHun0MliU,9942
195
195
  camel/models/modelscope_model.py,sha256=OgZiFi2XBrElRZ8fqBZiqyXDeS5msTWejn1vuTARKYg,10211
196
- camel/models/moonshot_model.py,sha256=S83DyBOmIuuTAkmJSdFFLHZldKygMryA_xmx8CvqRIg,7079
196
+ camel/models/moonshot_model.py,sha256=YFSNztk5awES1CW9oFHvzuBlp1R5AUoPQOzGvJawhEQ,7175
197
197
  camel/models/nemotron_model.py,sha256=onAFWR7pbAFbqhx68LelUPIyQb9r6yMvXWJYWwq3qkA,2952
198
198
  camel/models/netmind_model.py,sha256=wfI3XUxiIa3aZbBN1WJDkZBbixfa2SUX1ouvGlMLKKA,3698
199
199
  camel/models/novita_model.py,sha256=9rmiAShSQOIxTzdhxZaI7Xw1ZQkYeQ-yiL1VmIWqsWc,3665
@@ -273,7 +273,7 @@ camel/societies/babyagi_playing.py,sha256=KbTdpHfZ2V8AripVck0bNTOyF-RSaMPCRARz3D
273
273
  camel/societies/role_playing.py,sha256=0XScr3WfxX1QOC71RhBLmrcS5y2c7DMQB_mAFOHU34M,31421
274
274
  camel/societies/workforce/__init__.py,sha256=bkTI-PE-MSK9AQ2V2gR6cR2WY-R7Jqy_NmXRtAoqo8o,920
275
275
  camel/societies/workforce/base.py,sha256=z2DmbTP5LL5-aCAAqglznQqCLfPmnyM5zD3w6jjtsb8,2175
276
- camel/societies/workforce/prompts.py,sha256=TDDgdlhT_ZzdJ8M54jW00fLI4TkPGYYHg4YCWm0wQhg,19082
276
+ camel/societies/workforce/prompts.py,sha256=WetbTS0x_vb2XZ8AsotxhGXUhnPHJ6ndeR9Z_jQuJtI,19058
277
277
  camel/societies/workforce/role_playing_worker.py,sha256=Zm89lZTlV0T3o9C-DJ0HAV68Iq2Kdg8QqJRWs1TV9_A,10320
278
278
  camel/societies/workforce/single_agent_worker.py,sha256=c7gXxeTGofYWfnQdv3id1c4G2B2jqAakYN-BaSw3BwY,19396
279
279
  camel/societies/workforce/structured_output_handler.py,sha256=xr8szFN86hg3jQ825aEkJTjkSFQnTlbinVg4j1vZJVI,17870
@@ -317,7 +317,7 @@ camel/terminators/__init__.py,sha256=t8uqrkUnXEOYMXQDgaBkMFJ0EXFKI0kmx4cUimli3Ls
317
317
  camel/terminators/base.py,sha256=xmJzERX7GdSXcxZjAHHODa0rOxRChMSRboDCNHWSscs,1511
318
318
  camel/terminators/response_terminator.py,sha256=n3G5KP6Oj7-7WlRN0yFcrtLpqAJKaKS0bmhrWlFfCgQ,4982
319
319
  camel/terminators/token_limit_terminator.py,sha256=YWv6ZR8R9yI2Qnf_3xES5bEE_O5bb2CxQ0EUXfMh34c,2118
320
- camel/toolkits/__init__.py,sha256=ug0QbctUQWLUfVI4fSufMyqvorttPYDKy3cI33-v9Ho,6086
320
+ camel/toolkits/__init__.py,sha256=x8-NkxamsTRvk-HO4ogFumF1HSDN8cF-9qZS-hAuOCE,6007
321
321
  camel/toolkits/aci_toolkit.py,sha256=39AsXloBb16hHB7DKi6mFU6NPZ3iVpM2FZgaP4o4eLE,16060
322
322
  camel/toolkits/arxiv_toolkit.py,sha256=mw629nIN_ozaAxNv3nbvhonJKNI2-97ScRCBS3gVqNo,6297
323
323
  camel/toolkits/ask_news_toolkit.py,sha256=WfWaqwEo1Apbil3-Rb5y65Ws43NU4rAFWZu5VHe4los,23448
@@ -358,7 +358,6 @@ camel/toolkits/note_taking_toolkit.py,sha256=FWnkKdPyTENzHDPSFKo9zOrhhONfJkFpRvn
358
358
  camel/toolkits/notion_mcp_toolkit.py,sha256=ie_6Z-7DqDhgTiwYX8L3X47rfWGwzgwQH_s2DaK1ckc,8362
359
359
  camel/toolkits/notion_toolkit.py,sha256=jmmVWk_WazRNWnx4r9DAvhFTAL-n_ige0tb32UHJ_ik,9752
360
360
  camel/toolkits/open_api_toolkit.py,sha256=Venfq8JwTMQfzRzzB7AYmYUMEX35hW0BjIv_ozFMiNk,23316
361
- camel/toolkits/openai_agent_toolkit.py,sha256=hT2ancdQigngAiY1LNnGJzZeiBDHUxrRGv6BdZTJizc,4696
362
361
  camel/toolkits/openai_image_toolkit.py,sha256=RDCPYnEPWibFmAgyQNUck0UWKguD7fni93lpMBMh1UQ,11180
363
362
  camel/toolkits/openbb_toolkit.py,sha256=8yBZL9E2iSgskosBQhD3pTP56oV6gerWpFjIJc_2UMo,28935
364
363
  camel/toolkits/origene_mcp_toolkit.py,sha256=og3H-F5kWRRIyOyhF7BR-ig_JIpZPKE0DCA1QJZw5BY,3354
@@ -371,7 +370,7 @@ camel/toolkits/pyautogui_toolkit.py,sha256=Q810fm8cFvElRory7B74aqS2YV6BOpdRE6jke
371
370
  camel/toolkits/reddit_toolkit.py,sha256=x0XAT1zQJVNHUr1R1HwWCgIlkamU-kPmbfb_H1WIv-w,8036
372
371
  camel/toolkits/retrieval_toolkit.py,sha256=BKjEyOqW3cGEPTS5yHPYb-Qg795iNNPIs1wjowfuq3U,3825
373
372
  camel/toolkits/screenshot_toolkit.py,sha256=IwfvfLSfqrEywvPlDbtYJe1qcbrO5uC3Mxxv87VYveo,8237
374
- camel/toolkits/search_toolkit.py,sha256=nco3_EQhYz4S_RupWTgcH5r5-nH-K0f6WAwUZ4DteXc,57654
373
+ camel/toolkits/search_toolkit.py,sha256=eMRawlLKVzCvRqjWeahX_Dcf0qopWfJch6KdJ923Lfo,55607
375
374
  camel/toolkits/searxng_toolkit.py,sha256=a2GtE4FGSrmaIVvX6Yide-abBYD1wsHqitnDlx9fdVg,7664
376
375
  camel/toolkits/semantic_scholar_toolkit.py,sha256=Rh7eA_YPxV5pvPIzhjjvpr3vtlaCniJicrqzkPWW9_I,11634
377
376
  camel/toolkits/slack_toolkit.py,sha256=iBVkDIpfsR5QwaNCqA4O4UkCwpdLhJjYCA8Gka7U9e8,12050
@@ -437,10 +436,10 @@ camel/toolkits/open_api_specs/web_scraper/ai-plugin.json,sha256=jjHvbj0DQ4AYcL9J
437
436
  camel/toolkits/open_api_specs/web_scraper/openapi.yaml,sha256=u_WalQ01e8W1D27VnZviOylpGmJ-zssYrfAgkzqdoyk,2191
438
437
  camel/toolkits/open_api_specs/web_scraper/paths/__init__.py,sha256=OKCZrQCDwaWtXIN_2rA9FSqEvgpQRieRoHh7Ek6N16A,702
439
438
  camel/toolkits/open_api_specs/web_scraper/paths/scraper.py,sha256=aWy1_ppV4NVVEZfnbN3tu9XA9yAPAC9bRStJ5JuXMRU,1117
440
- camel/types/__init__.py,sha256=pFTg3CWGSCfwFdoxPDTf4dKV8DdJS1x-bBPuEOmtdf0,2549
441
- camel/types/enums.py,sha256=5iIyQ2ZBGovKkRUahwJK8oG4FuOyyZGlmFYyS5s6HvY,63674
439
+ camel/types/__init__.py,sha256=EOmWlqS7aE5cB51_Vv7vHUexKeBbx9FSsfynl5vKjwo,2565
440
+ camel/types/enums.py,sha256=5L4KfHVRDdIIlaMaU-Lv-P5de3AOHeh6EfZfQBveJz4,63964
442
441
  camel/types/mcp_registries.py,sha256=dl4LgYtSaUhsqAKpz28k_SA9La11qxqBvDLaEuyzrFE,4971
443
- camel/types/openai_types.py,sha256=8ZFzLe-zGmKNPfuVZFzxlxAX98lGf18gtrPhOgMmzus,2104
442
+ camel/types/openai_types.py,sha256=m7oWb8nWYWOAwBRY1mP9mS9RVufXeDVj-fGvHAhXuMU,2120
444
443
  camel/types/unified_model_type.py,sha256=U3NUZux7QuMIxPW2H0qDp9BOyDJFHAx6jUmDNw5_9KM,5912
445
444
  camel/types/agents/__init__.py,sha256=cbvVkogPoZgcwZrgxLH6EtpGXk0kavF79nOic0Dc1vg,786
446
445
  camel/types/agents/tool_calling_record.py,sha256=xG0a9TJu-nQQ9aAxpZwYmgqnpjEbnm2cRjjG8uDSIbg,1979
@@ -455,7 +454,7 @@ camel/utils/mcp.py,sha256=igLAww4tB2Oippb5nlfhWoj6TI6Td5boKfpoxkxZlQI,5081
455
454
  camel/utils/mcp_client.py,sha256=o-EPdJ5EL5M9sjkSADvLBz9IoHhtXteKGidauIxw3ps,37584
456
455
  camel/utils/message_summarizer.py,sha256=7AvPDlevle5uU3mXtfvSFS--nDjp9yqfrf546qTe9rE,5939
457
456
  camel/utils/response_format.py,sha256=xZcx6xBxeg3A0e7R0JCMJdNm2oQ1-diqVLs0JsiCkZU,5319
458
- camel/utils/token_counting.py,sha256=l7gNU5Ggksusj0ZVH5u1Xr4Mx5YVrdwnSqSKXDVxit0,18084
457
+ camel/utils/token_counting.py,sha256=GYXMUi23t56c8ht2gssJHFWFnqw3icMcwemsYpssPYo,18159
459
458
  camel/utils/tool_result.py,sha256=0dKMb22cwuxnjeO4K9wbM4gwwPHV1yfoSJquLTUJVXs,1813
460
459
  camel/utils/chunker/__init__.py,sha256=6iN6HL6sblIjDuJTILk-9qKcHBZ97t8b6tZCWPZ0OYI,899
461
460
  camel/utils/chunker/base.py,sha256=9CuqymFCRncyAdEST-IcRonB732YAPhusznqH-RES3E,960
@@ -467,7 +466,7 @@ camel/verifiers/math_verifier.py,sha256=tA1D4S0sm8nsWISevxSN0hvSVtIUpqmJhzqfbuMo
467
466
  camel/verifiers/models.py,sha256=GdxYPr7UxNrR1577yW4kyroRcLGfd-H1GXgv8potDWU,2471
468
467
  camel/verifiers/physics_verifier.py,sha256=c1grrRddcrVN7szkxhv2QirwY9viIRSITWeWFF5HmLs,30187
469
468
  camel/verifiers/python_verifier.py,sha256=ogTz77wODfEcDN4tMVtiSkRQyoiZbHPY2fKybn59lHw,20558
470
- camel_ai-0.2.75a0.dist-info/METADATA,sha256=D_Q2rnHl_K05FdNr9TPHLnN6pY3FrdyQmWx0jlcJOyU,52221
471
- camel_ai-0.2.75a0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
472
- camel_ai-0.2.75a0.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
473
- camel_ai-0.2.75a0.dist-info/RECORD,,
469
+ camel_ai-0.2.75a3.dist-info/METADATA,sha256=86OHr9M5A_cTjIAvHhESEpWG4t091n5rCO3QS5o7GQM,52289
470
+ camel_ai-0.2.75a3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
471
+ camel_ai-0.2.75a3.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
472
+ camel_ai-0.2.75a3.dist-info/RECORD,,
@@ -1,135 +0,0 @@
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 os
16
- from typing import List, Optional
17
-
18
- from openai import OpenAI
19
-
20
- from camel.logger import get_logger
21
- from camel.models import BaseModelBackend, ModelFactory
22
- from camel.toolkits.base import BaseToolkit
23
- from camel.toolkits.function_tool import FunctionTool
24
- from camel.types import ModelPlatformType, ModelType
25
- from camel.utils import api_keys_required
26
-
27
- logger = get_logger(__name__)
28
-
29
-
30
- class OpenAIAgentToolkit(BaseToolkit):
31
- r"""Toolkit for accessing OpenAI's agent tools including web search and
32
- file search.
33
-
34
- Provides access to OpenAI's web search and file search capabilities
35
- through the Responses API, allowing agents to retrieve information from
36
- the web and search through uploaded files.
37
- """
38
-
39
- @api_keys_required(
40
- [
41
- (None, "OPENAI_API_KEY"),
42
- ]
43
- )
44
- def __init__(
45
- self,
46
- model: Optional[BaseModelBackend] = None,
47
- api_key: Optional[str] = None,
48
- timeout: Optional[float] = None,
49
- ) -> None:
50
- r"""Initialize the OpenAI agent toolkit.
51
-
52
- Args:
53
- model (BaseModelBackend): The OpenAI model to use for responses.
54
- If None, defaults to gpt-4o-mini. (default: :obj:`None`)
55
- api_key (str): OpenAI API key. If not provided, will attempt to
56
- use OPENAI_API_KEY environment variable. (default: :obj:`None`)
57
- timeout (Optional[float]): The timeout value for API requests
58
- in seconds. If None, no timeout is applied.
59
- (default: :obj:`None`)
60
- """
61
- super().__init__(timeout=timeout)
62
- self.api_key = api_key or os.getenv("OPENAI_API_KEY")
63
- self.client = OpenAI(api_key=self.api_key)
64
- self.model = model or ModelFactory.create(
65
- model_platform=ModelPlatformType.OPENAI,
66
- model_type=ModelType.GPT_4O_MINI,
67
- )
68
-
69
- def web_search(self, query: str) -> str:
70
- r"""Perform a web search using OpenAI's web search tool.
71
-
72
- Args:
73
- query (str): The search query.
74
-
75
- Returns:
76
- str: The search result or error message.
77
- """
78
- try:
79
- response = self.client.responses.create(
80
- model=str(self.model.model_type),
81
- tools=[{"type": "web_search_preview"}],
82
- input=query,
83
- )
84
- return response.output_text
85
-
86
- except Exception as e:
87
- logger.error(f"Web search failed: {e!s}")
88
- return f"Web search failed: {e!s}"
89
-
90
- def file_search(
91
- self,
92
- query: str,
93
- vector_store_id: str,
94
- ) -> str:
95
- r"""Search through files using OpenAI's file search tool.
96
-
97
- Args:
98
- query (str): The search query.
99
- vector_store_id (str): The vector store ID to search in.
100
-
101
- Returns:
102
- str: The search result or error message.
103
- """
104
- if not vector_store_id.strip():
105
- logger.error("Empty vector store ID provided.")
106
- return "Empty vector store ID provided, it cannot be empty."
107
-
108
- try:
109
- response = self.client.responses.create(
110
- model=str(self.model.model_type),
111
- tools=[
112
- {
113
- "type": "file_search",
114
- "vector_store_ids": [vector_store_id],
115
- }
116
- ],
117
- input=query,
118
- )
119
- return response.output_text
120
-
121
- except Exception as e:
122
- logger.error(f"File search failed: {e!s}")
123
- return f"File search failed: {e!s}"
124
-
125
- def get_tools(self) -> List[FunctionTool]:
126
- r"""Retrieve available toolkit functions as FunctionTool objects.
127
-
128
- Returns:
129
- List[FunctionTool]: Collection of FunctionTool objects representing
130
- the available search functions in this toolkit.
131
- """
132
- return [
133
- FunctionTool(self.web_search),
134
- FunctionTool(self.file_search),
135
- ]