camel-ai 0.2.71a12__py3-none-any.whl → 0.2.72__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 (42) hide show
  1. camel/__init__.py +1 -1
  2. camel/agents/chat_agent.py +260 -488
  3. camel/memories/agent_memories.py +39 -0
  4. camel/memories/base.py +8 -0
  5. camel/models/gemini_model.py +30 -2
  6. camel/models/moonshot_model.py +36 -4
  7. camel/models/openai_model.py +29 -15
  8. camel/societies/workforce/prompts.py +24 -14
  9. camel/societies/workforce/single_agent_worker.py +9 -7
  10. camel/societies/workforce/workforce.py +44 -16
  11. camel/storages/vectordb_storages/__init__.py +1 -0
  12. camel/storages/vectordb_storages/surreal.py +415 -0
  13. camel/toolkits/__init__.py +10 -1
  14. camel/toolkits/base.py +57 -1
  15. camel/toolkits/human_toolkit.py +5 -1
  16. camel/toolkits/hybrid_browser_toolkit/config_loader.py +127 -414
  17. camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py +783 -1626
  18. camel/toolkits/hybrid_browser_toolkit/ws_wrapper.py +489 -0
  19. camel/toolkits/markitdown_toolkit.py +2 -2
  20. camel/toolkits/message_integration.py +592 -0
  21. camel/toolkits/note_taking_toolkit.py +195 -26
  22. camel/toolkits/openai_image_toolkit.py +5 -5
  23. camel/toolkits/origene_mcp_toolkit.py +97 -0
  24. camel/toolkits/screenshot_toolkit.py +213 -0
  25. camel/toolkits/search_toolkit.py +115 -36
  26. camel/toolkits/terminal_toolkit.py +379 -165
  27. camel/toolkits/video_analysis_toolkit.py +13 -13
  28. camel/toolkits/video_download_toolkit.py +11 -11
  29. camel/toolkits/web_deploy_toolkit.py +1024 -0
  30. camel/types/enums.py +6 -3
  31. camel/types/unified_model_type.py +16 -4
  32. camel/utils/mcp_client.py +8 -0
  33. {camel_ai-0.2.71a12.dist-info → camel_ai-0.2.72.dist-info}/METADATA +6 -3
  34. {camel_ai-0.2.71a12.dist-info → camel_ai-0.2.72.dist-info}/RECORD +36 -36
  35. camel/toolkits/hybrid_browser_toolkit/actions.py +0 -417
  36. camel/toolkits/hybrid_browser_toolkit/agent.py +0 -311
  37. camel/toolkits/hybrid_browser_toolkit/browser_session.py +0 -739
  38. camel/toolkits/hybrid_browser_toolkit/snapshot.py +0 -227
  39. camel/toolkits/hybrid_browser_toolkit/stealth_script.js +0 -0
  40. camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js +0 -1002
  41. {camel_ai-0.2.71a12.dist-info → camel_ai-0.2.72.dist-info}/WHEEL +0 -0
  42. {camel_ai-0.2.71a12.dist-info → camel_ai-0.2.72.dist-info}/licenses/LICENSE +0 -0
@@ -36,6 +36,7 @@ class SearchToolkit(BaseToolkit):
36
36
  self,
37
37
  timeout: Optional[float] = None,
38
38
  number_of_result_pages: int = 10,
39
+ exclude_domains: Optional[List[str]] = None,
39
40
  ):
40
41
  r"""Initializes the RedditToolkit with the specified number of retries
41
42
  and delay.
@@ -45,9 +46,14 @@ class SearchToolkit(BaseToolkit):
45
46
  (default: :obj:`None`)
46
47
  number_of_result_pages (int): The number of result pages to
47
48
  retrieve. (default: :obj:`10`)
49
+ exclude_domains (Optional[List[str]]): List of domains to
50
+ exclude from search results. Currently only supported
51
+ by the `search_google` function.
52
+ (default: :obj:`None`)
48
53
  """
49
54
  super().__init__(timeout=timeout)
50
55
  self.number_of_result_pages = number_of_result_pages
56
+ self.exclude_domains = exclude_domains
51
57
 
52
58
  @dependencies_required("wikipedia")
53
59
  def search_wiki(self, entity: str) -> str:
@@ -434,23 +440,39 @@ class SearchToolkit(BaseToolkit):
434
440
  (None, 'SEARCH_ENGINE_ID'),
435
441
  ]
436
442
  )
437
- def search_google(self, query: str) -> List[Dict[str, Any]]:
443
+ def search_google(
444
+ self,
445
+ query: str,
446
+ search_type: str = "web",
447
+ ) -> List[Dict[str, Any]]:
438
448
  r"""Use Google search engine to search information for the given query.
439
449
 
440
450
  Args:
441
451
  query (str): The query to be searched.
452
+ search_type (str): The type of search to perform. Either "web" for
453
+ web pages or "image" for image search. (default: "web")
442
454
 
443
455
  Returns:
444
456
  List[Dict[str, Any]]: A list of dictionaries where each dictionary
445
- represents a website.
446
- Each dictionary contains the following keys:
457
+ represents a search result.
458
+
459
+ For web search, each dictionary contains:
447
460
  - 'result_id': A number in order.
448
461
  - 'title': The title of the website.
449
462
  - 'description': A brief description of the website.
450
463
  - 'long_description': More detail of the website.
451
464
  - 'url': The URL of the website.
452
465
 
453
- Example:
466
+ For image search, each dictionary contains:
467
+ - 'result_id': A number in order.
468
+ - 'title': The title of the image.
469
+ - 'image_url': The URL of the image.
470
+ - 'display_link': The website hosting the image.
471
+ - 'context_url': The URL of the page containing the image.
472
+ - 'width': Image width in pixels (if available).
473
+ - 'height': Image height in pixels (if available).
474
+
475
+ Example web result:
454
476
  {
455
477
  'result_id': 1,
456
478
  'title': 'OpenAI',
@@ -462,7 +484,17 @@ class SearchToolkit(BaseToolkit):
462
484
  benefit humanity as a whole',
463
485
  'url': 'https://www.openai.com'
464
486
  }
465
- title, description, url of a website.
487
+
488
+ Example image result:
489
+ {
490
+ 'result_id': 1,
491
+ 'title': 'Beautiful Sunset',
492
+ 'image_url': 'https://example.com/image.jpg',
493
+ 'display_link': 'example.com',
494
+ 'context_url': 'https://example.com/page.html',
495
+ 'width': 800,
496
+ 'height': 600
497
+ }
466
498
  """
467
499
  import requests
468
500
 
@@ -475,14 +507,30 @@ class SearchToolkit(BaseToolkit):
475
507
  start_page_idx = 1
476
508
  # Different language may get different result
477
509
  search_language = "en"
510
+
511
+ modified_query = query
512
+ if self.exclude_domains:
513
+ # Use Google's -site: operator to exclude domains
514
+ exclusion_terms = " ".join(
515
+ [f"-site:{domain}" for domain in self.exclude_domains]
516
+ )
517
+ modified_query = f"{query} {exclusion_terms}"
518
+ logger.debug(f"Excluded domains, modified query: {modified_query}")
519
+
478
520
  # Constructing the URL
479
521
  # Doc: https://developers.google.com/custom-search/v1/using_rest
480
- url = (
522
+ base_url = (
481
523
  f"https://www.googleapis.com/customsearch/v1?"
482
- f"key={GOOGLE_API_KEY}&cx={SEARCH_ENGINE_ID}&q={query}&start="
524
+ f"key={GOOGLE_API_KEY}&cx={SEARCH_ENGINE_ID}&q={modified_query}&start="
483
525
  f"{start_page_idx}&lr={search_language}&num={self.number_of_result_pages}"
484
526
  )
485
527
 
528
+ # Add searchType parameter for image search
529
+ if search_type == "image":
530
+ url = base_url + "&searchType=image"
531
+ else:
532
+ url = base_url
533
+
486
534
  responses = []
487
535
  # Fetch the results given the URL
488
536
  try:
@@ -494,37 +542,68 @@ class SearchToolkit(BaseToolkit):
494
542
  if "items" in data:
495
543
  search_items = data.get("items")
496
544
 
497
- # Iterate over 10 results found
545
+ # Iterate over results found
498
546
  for i, search_item in enumerate(search_items, start=1):
499
- # Check metatags are present
500
- if "pagemap" not in search_item:
501
- continue
502
- if "metatags" not in search_item["pagemap"]:
503
- continue
504
- if (
505
- "og:description"
506
- in search_item["pagemap"]["metatags"][0]
507
- ):
508
- long_description = search_item["pagemap"]["metatags"][
509
- 0
510
- ]["og:description"]
547
+ if search_type == "image":
548
+ # Process image search results
549
+ title = search_item.get("title")
550
+ image_url = search_item.get("link")
551
+ display_link = search_item.get("displayLink")
552
+
553
+ # Get context URL (page containing the image)
554
+ image_info = search_item.get("image", {})
555
+ context_url = image_info.get("contextLink", "")
556
+
557
+ # Get image dimensions if available
558
+ width = image_info.get("width")
559
+ height = image_info.get("height")
560
+
561
+ response = {
562
+ "result_id": i,
563
+ "title": title,
564
+ "image_url": image_url,
565
+ "display_link": display_link,
566
+ "context_url": context_url,
567
+ }
568
+
569
+ # Add dimensions if available
570
+ if width:
571
+ response["width"] = int(width)
572
+ if height:
573
+ response["height"] = int(height)
574
+
575
+ responses.append(response)
511
576
  else:
512
- long_description = "N/A"
513
- # Get the page title
514
- title = search_item.get("title")
515
- # Page snippet
516
- snippet = search_item.get("snippet")
517
-
518
- # Extract the page url
519
- link = search_item.get("link")
520
- response = {
521
- "result_id": i,
522
- "title": title,
523
- "description": snippet,
524
- "long_description": long_description,
525
- "url": link,
526
- }
527
- responses.append(response)
577
+ # Process web search results (existing logic)
578
+ # Check metatags are present
579
+ if "pagemap" not in search_item:
580
+ continue
581
+ if "metatags" not in search_item["pagemap"]:
582
+ continue
583
+ if (
584
+ "og:description"
585
+ in search_item["pagemap"]["metatags"][0]
586
+ ):
587
+ long_description = search_item["pagemap"][
588
+ "metatags"
589
+ ][0]["og:description"]
590
+ else:
591
+ long_description = "N/A"
592
+ # Get the page title
593
+ title = search_item.get("title")
594
+ # Page snippet
595
+ snippet = search_item.get("snippet")
596
+
597
+ # Extract the page url
598
+ link = search_item.get("link")
599
+ response = {
600
+ "result_id": i,
601
+ "title": title,
602
+ "description": snippet,
603
+ "long_description": long_description,
604
+ "url": link,
605
+ }
606
+ responses.append(response)
528
607
  else:
529
608
  error_info = data.get("error", {})
530
609
  logger.error(