aient 1.2.15__tar.gz → 1.2.16__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.
Files changed (56) hide show
  1. {aient-1.2.15 → aient-1.2.16}/PKG-INFO +1 -1
  2. {aient-1.2.15 → aient-1.2.16}/aient/architext/architext/core.py +7 -0
  3. {aient-1.2.15 → aient-1.2.16}/aient/architext/test/test.py +45 -0
  4. {aient-1.2.15 → aient-1.2.16}/aient.egg-info/PKG-INFO +1 -1
  5. {aient-1.2.15 → aient-1.2.16}/pyproject.toml +1 -1
  6. {aient-1.2.15 → aient-1.2.16}/LICENSE +0 -0
  7. {aient-1.2.15 → aient-1.2.16}/README.md +0 -0
  8. {aient-1.2.15 → aient-1.2.16}/aient/__init__.py +0 -0
  9. {aient-1.2.15 → aient-1.2.16}/aient/architext/architext/__init__.py +0 -0
  10. {aient-1.2.15 → aient-1.2.16}/aient/architext/test/openai_client.py +0 -0
  11. {aient-1.2.15 → aient-1.2.16}/aient/architext/test/test_save_load.py +0 -0
  12. {aient-1.2.15 → aient-1.2.16}/aient/core/__init__.py +0 -0
  13. {aient-1.2.15 → aient-1.2.16}/aient/core/log_config.py +0 -0
  14. {aient-1.2.15 → aient-1.2.16}/aient/core/models.py +0 -0
  15. {aient-1.2.15 → aient-1.2.16}/aient/core/request.py +0 -0
  16. {aient-1.2.15 → aient-1.2.16}/aient/core/response.py +0 -0
  17. {aient-1.2.15 → aient-1.2.16}/aient/core/test/test_base_api.py +0 -0
  18. {aient-1.2.15 → aient-1.2.16}/aient/core/test/test_geminimask.py +0 -0
  19. {aient-1.2.15 → aient-1.2.16}/aient/core/test/test_image.py +0 -0
  20. {aient-1.2.15 → aient-1.2.16}/aient/core/test/test_payload.py +0 -0
  21. {aient-1.2.15 → aient-1.2.16}/aient/core/utils.py +0 -0
  22. {aient-1.2.15 → aient-1.2.16}/aient/models/__init__.py +0 -0
  23. {aient-1.2.15 → aient-1.2.16}/aient/models/audio.py +0 -0
  24. {aient-1.2.15 → aient-1.2.16}/aient/models/base.py +0 -0
  25. {aient-1.2.15 → aient-1.2.16}/aient/models/chatgpt.py +0 -0
  26. {aient-1.2.15 → aient-1.2.16}/aient/plugins/__init__.py +0 -0
  27. {aient-1.2.15 → aient-1.2.16}/aient/plugins/arXiv.py +0 -0
  28. {aient-1.2.15 → aient-1.2.16}/aient/plugins/config.py +0 -0
  29. {aient-1.2.15 → aient-1.2.16}/aient/plugins/excute_command.py +0 -0
  30. {aient-1.2.15 → aient-1.2.16}/aient/plugins/get_time.py +0 -0
  31. {aient-1.2.15 → aient-1.2.16}/aient/plugins/image.py +0 -0
  32. {aient-1.2.15 → aient-1.2.16}/aient/plugins/list_directory.py +0 -0
  33. {aient-1.2.15 → aient-1.2.16}/aient/plugins/read_file.py +0 -0
  34. {aient-1.2.15 → aient-1.2.16}/aient/plugins/read_image.py +0 -0
  35. {aient-1.2.15 → aient-1.2.16}/aient/plugins/readonly.py +0 -0
  36. {aient-1.2.15 → aient-1.2.16}/aient/plugins/registry.py +0 -0
  37. {aient-1.2.15 → aient-1.2.16}/aient/plugins/run_python.py +0 -0
  38. {aient-1.2.15 → aient-1.2.16}/aient/plugins/websearch.py +0 -0
  39. {aient-1.2.15 → aient-1.2.16}/aient/plugins/write_file.py +0 -0
  40. {aient-1.2.15 → aient-1.2.16}/aient/utils/__init__.py +0 -0
  41. {aient-1.2.15 → aient-1.2.16}/aient/utils/prompt.py +0 -0
  42. {aient-1.2.15 → aient-1.2.16}/aient/utils/scripts.py +0 -0
  43. {aient-1.2.15 → aient-1.2.16}/aient.egg-info/SOURCES.txt +0 -0
  44. {aient-1.2.15 → aient-1.2.16}/aient.egg-info/dependency_links.txt +0 -0
  45. {aient-1.2.15 → aient-1.2.16}/aient.egg-info/requires.txt +0 -0
  46. {aient-1.2.15 → aient-1.2.16}/aient.egg-info/top_level.txt +0 -0
  47. {aient-1.2.15 → aient-1.2.16}/setup.cfg +0 -0
  48. {aient-1.2.15 → aient-1.2.16}/test/test_Web_crawler.py +0 -0
  49. {aient-1.2.15 → aient-1.2.16}/test/test_ddg_search.py +0 -0
  50. {aient-1.2.15 → aient-1.2.16}/test/test_google_search.py +0 -0
  51. {aient-1.2.15 → aient-1.2.16}/test/test_ollama.py +0 -0
  52. {aient-1.2.15 → aient-1.2.16}/test/test_plugin.py +0 -0
  53. {aient-1.2.15 → aient-1.2.16}/test/test_search.py +0 -0
  54. {aient-1.2.15 → aient-1.2.16}/test/test_url.py +0 -0
  55. {aient-1.2.15 → aient-1.2.16}/test/test_whisper.py +0 -0
  56. {aient-1.2.15 → aient-1.2.16}/test/test_yjh.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.2.15
3
+ Version: 1.2.16
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -96,6 +96,13 @@ class ContextProvider(ABC):
96
96
  return ContentBlock(self.name, self._cached_content)
97
97
  return None
98
98
 
99
+ def __add__(self, other):
100
+ if isinstance(other, Message):
101
+ # Create a new message of the same type as `other`, with `self` prepended.
102
+ new_items = [self] + other.provider()
103
+ return type(other)(*new_items)
104
+ return NotImplemented
105
+
99
106
  class Texts(ContextProvider):
100
107
  def __init__(self, text: Optional[Union[str, Callable[[], str]]] = None, name: Optional[str] = None, visible: bool = True):
101
108
  if text is None and name is None:
@@ -1341,6 +1341,51 @@ Files: {Files(visible=True, name="files")}
1341
1341
  if os.path.exists(test_file_path):
1342
1342
  os.remove(test_file_path)
1343
1343
 
1344
+ async def test_zg_provider_plus_message_addition(self):
1345
+ """测试所有 ContextProvider 子类与 Message 子类相加的功能"""
1346
+ # 1. 准备 providers
1347
+ text_provider = Texts("Some text.")
1348
+ tools_provider = Tools([{"name": "a_tool"}])
1349
+
1350
+ test_file = "test_provider_addition.txt"
1351
+ with open(test_file, "w") as f: f.write("File content.")
1352
+ files_provider = Files(test_file)
1353
+
1354
+ providers_to_test = [text_provider, tools_provider, files_provider]
1355
+
1356
+ # 2. 准备 message aclsdd
1357
+ messages_to_test = [
1358
+ UserMessage(Texts("Initial user message.")),
1359
+ SystemMessage(Texts("Initial system message.")),
1360
+ AssistantMessage(Texts("Initial assistant message."))
1361
+ ]
1362
+
1363
+ try:
1364
+ for provider in providers_to_test:
1365
+ for message in messages_to_test:
1366
+ with self.subTest(provider=type(provider).__name__, message=type(message).__name__):
1367
+ # 执行加法操作
1368
+ result_message = provider + message
1369
+
1370
+ # 验证结果类型是否与原始 message 相同
1371
+ self.assertIsInstance(result_message, type(message), f"结果应为 {type(message).__name__} 类型")
1372
+
1373
+ # 验证 provider 数量
1374
+ self.assertEqual(len(result_message), 2, "结果消息应包含两个 provider")
1375
+
1376
+ # 验证 provider 的类型和顺序
1377
+ result_providers = result_message.provider()
1378
+ self.assertIsInstance(result_providers[0], type(provider), f"第一个 provider 应为 {type(provider).__name__} 类型")
1379
+ self.assertIsInstance(result_providers[1], Texts, "第二个 provider 应为 Texts 类型")
1380
+
1381
+ # 验证原始消息没有被修改
1382
+ self.assertEqual(len(message), 1)
1383
+
1384
+ finally:
1385
+ # 3. 清理文件
1386
+ if os.path.exists(test_file):
1387
+ os.remove(test_file)
1388
+
1344
1389
 
1345
1390
  # ==============================================================================
1346
1391
  # 6. 演示
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.2.15
3
+ Version: 1.2.16
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "aient"
3
- version = "1.2.15"
3
+ version = "1.2.16"
4
4
  description = "Aient: The Awakening of Agent."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes