aient 1.2.1__tar.gz → 1.2.2__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.1 → aient-1.2.2}/PKG-INFO +1 -1
  2. {aient-1.2.1 → aient-1.2.2}/aient/architext/architext/core.py +15 -3
  3. {aient-1.2.1 → aient-1.2.2}/aient/architext/test/test.py +34 -0
  4. {aient-1.2.1 → aient-1.2.2}/aient.egg-info/PKG-INFO +1 -1
  5. {aient-1.2.1 → aient-1.2.2}/pyproject.toml +1 -1
  6. {aient-1.2.1 → aient-1.2.2}/LICENSE +0 -0
  7. {aient-1.2.1 → aient-1.2.2}/README.md +0 -0
  8. {aient-1.2.1 → aient-1.2.2}/aient/__init__.py +0 -0
  9. {aient-1.2.1 → aient-1.2.2}/aient/architext/architext/__init__.py +0 -0
  10. {aient-1.2.1 → aient-1.2.2}/aient/architext/test/openai_client.py +0 -0
  11. {aient-1.2.1 → aient-1.2.2}/aient/architext/test/test_save_load.py +0 -0
  12. {aient-1.2.1 → aient-1.2.2}/aient/core/__init__.py +0 -0
  13. {aient-1.2.1 → aient-1.2.2}/aient/core/log_config.py +0 -0
  14. {aient-1.2.1 → aient-1.2.2}/aient/core/models.py +0 -0
  15. {aient-1.2.1 → aient-1.2.2}/aient/core/request.py +0 -0
  16. {aient-1.2.1 → aient-1.2.2}/aient/core/response.py +0 -0
  17. {aient-1.2.1 → aient-1.2.2}/aient/core/test/test_base_api.py +0 -0
  18. {aient-1.2.1 → aient-1.2.2}/aient/core/test/test_geminimask.py +0 -0
  19. {aient-1.2.1 → aient-1.2.2}/aient/core/test/test_image.py +0 -0
  20. {aient-1.2.1 → aient-1.2.2}/aient/core/test/test_payload.py +0 -0
  21. {aient-1.2.1 → aient-1.2.2}/aient/core/utils.py +0 -0
  22. {aient-1.2.1 → aient-1.2.2}/aient/models/__init__.py +0 -0
  23. {aient-1.2.1 → aient-1.2.2}/aient/models/audio.py +0 -0
  24. {aient-1.2.1 → aient-1.2.2}/aient/models/base.py +0 -0
  25. {aient-1.2.1 → aient-1.2.2}/aient/models/chatgpt.py +0 -0
  26. {aient-1.2.1 → aient-1.2.2}/aient/plugins/__init__.py +0 -0
  27. {aient-1.2.1 → aient-1.2.2}/aient/plugins/arXiv.py +0 -0
  28. {aient-1.2.1 → aient-1.2.2}/aient/plugins/config.py +0 -0
  29. {aient-1.2.1 → aient-1.2.2}/aient/plugins/excute_command.py +0 -0
  30. {aient-1.2.1 → aient-1.2.2}/aient/plugins/get_time.py +0 -0
  31. {aient-1.2.1 → aient-1.2.2}/aient/plugins/image.py +0 -0
  32. {aient-1.2.1 → aient-1.2.2}/aient/plugins/list_directory.py +0 -0
  33. {aient-1.2.1 → aient-1.2.2}/aient/plugins/read_file.py +0 -0
  34. {aient-1.2.1 → aient-1.2.2}/aient/plugins/read_image.py +0 -0
  35. {aient-1.2.1 → aient-1.2.2}/aient/plugins/readonly.py +0 -0
  36. {aient-1.2.1 → aient-1.2.2}/aient/plugins/registry.py +0 -0
  37. {aient-1.2.1 → aient-1.2.2}/aient/plugins/run_python.py +0 -0
  38. {aient-1.2.1 → aient-1.2.2}/aient/plugins/websearch.py +0 -0
  39. {aient-1.2.1 → aient-1.2.2}/aient/plugins/write_file.py +0 -0
  40. {aient-1.2.1 → aient-1.2.2}/aient/utils/__init__.py +0 -0
  41. {aient-1.2.1 → aient-1.2.2}/aient/utils/prompt.py +0 -0
  42. {aient-1.2.1 → aient-1.2.2}/aient/utils/scripts.py +0 -0
  43. {aient-1.2.1 → aient-1.2.2}/aient.egg-info/SOURCES.txt +0 -0
  44. {aient-1.2.1 → aient-1.2.2}/aient.egg-info/dependency_links.txt +0 -0
  45. {aient-1.2.1 → aient-1.2.2}/aient.egg-info/requires.txt +0 -0
  46. {aient-1.2.1 → aient-1.2.2}/aient.egg-info/top_level.txt +0 -0
  47. {aient-1.2.1 → aient-1.2.2}/setup.cfg +0 -0
  48. {aient-1.2.1 → aient-1.2.2}/test/test_Web_crawler.py +0 -0
  49. {aient-1.2.1 → aient-1.2.2}/test/test_ddg_search.py +0 -0
  50. {aient-1.2.1 → aient-1.2.2}/test/test_google_search.py +0 -0
  51. {aient-1.2.1 → aient-1.2.2}/test/test_ollama.py +0 -0
  52. {aient-1.2.1 → aient-1.2.2}/test/test_plugin.py +0 -0
  53. {aient-1.2.1 → aient-1.2.2}/test/test_search.py +0 -0
  54. {aient-1.2.1 → aient-1.2.2}/test/test_url.py +0 -0
  55. {aient-1.2.1 → aient-1.2.2}/test/test_whisper.py +0 -0
  56. {aient-1.2.1 → aient-1.2.2}/test/test_yjh.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -297,6 +297,16 @@ class Message(ABC):
297
297
  self._items: List[ContextProvider] = processed_items
298
298
  self._parent_messages: Optional['Messages'] = None
299
299
 
300
+ @property
301
+ def content(self) -> Optional[Union[str, List[Dict[str, Any]]]]:
302
+ """
303
+ Renders the message content.
304
+ For simple text messages, returns a string.
305
+ For multimodal messages, returns a list of content blocks.
306
+ """
307
+ rendered_dict = self.to_dict()
308
+ return rendered_dict.get('content') if rendered_dict else None
309
+
300
310
  def _render_content(self) -> str:
301
311
  final_parts = []
302
312
  for item in self._items:
@@ -444,15 +454,17 @@ class ToolCalls(Message):
444
454
  class ToolResults(Message):
445
455
  """Represents a tool message with the result of a single tool call."""
446
456
  def __init__(self, tool_call_id: str, content: str):
447
- super().__init__("tool")
457
+ # We pass a Texts provider to the parent so it can be rendered,
458
+ # but the primary way to access content for ToolResults is via its dict representation.
459
+ super().__init__("tool", Texts(text=content))
448
460
  self.tool_call_id = tool_call_id
449
- self.content = content
461
+ self._content = content
450
462
 
451
463
  def to_dict(self) -> Dict[str, Any]:
452
464
  return {
453
465
  "role": self.role,
454
466
  "tool_call_id": self.tool_call_id,
455
- "content": self.content
467
+ "content": self._content
456
468
  }
457
469
 
458
470
  # 4. 顶层容器: Messages
@@ -1102,6 +1102,40 @@ Current time: {Texts(lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"))}
1102
1102
  self.assertIn("Third explanation.", rendered_final[0]['content'])
1103
1103
  self.assertIn("Some other text.", rendered_final[0]['content'])
1104
1104
 
1105
+ async def test_z9_rolemessage_content_access(self):
1106
+ """测试是否支持 RoleMessage.content 来访问渲染好的内容"""
1107
+ # 1. 创建一个简单的 UserMessage
1108
+ user_message = UserMessage("你好, Architext!")
1109
+ # 对于简单的 Texts, refresh 不是必须的, 但这是个好习惯
1110
+ # Message 类本身没有 refresh, 调用其 providers 的 refresh
1111
+ for p in user_message.providers():
1112
+ await p.refresh()
1113
+
1114
+ # 2. 直接访问 .content 属性
1115
+ # 在实现该功能前,这行代码会因 AttributeError 而失败
1116
+ self.assertEqual(user_message.content, "你好, Architext!")
1117
+
1118
+ # 3. 创建一个多模态消息
1119
+ multimodal_message = AssistantMessage(
1120
+ "这是一张图片:",
1121
+ Images(url="data:image/png;base64,FAKE_IMG_DATA")
1122
+ )
1123
+ for p in multimodal_message.providers():
1124
+ await p.refresh()
1125
+
1126
+ # 4. 访问多模态消息的 .content 属性,期望返回一个列表
1127
+ content_list = multimodal_message.content
1128
+ self.assertIsInstance(content_list, list)
1129
+ self.assertEqual(len(content_list), 2)
1130
+ self.assertEqual(content_list[0]['type'], 'text')
1131
+ self.assertEqual(content_list[1]['type'], 'image_url')
1132
+
1133
+ # 5. 测试通过 RoleMessage 工厂创建的消息
1134
+ role_message = RoleMessage('user', "通过工厂创建的内容")
1135
+ for p in role_message.providers():
1136
+ await p.refresh()
1137
+ self.assertEqual(role_message.content, "通过工厂创建的内容")
1138
+
1105
1139
  # ==============================================================================
1106
1140
  # 6. 演示
1107
1141
  # ==============================================================================
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.2.1
3
+ Version: 1.2.2
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.1"
3
+ version = "1.2.2"
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes