aient 1.1.93__tar.gz → 1.1.94__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.1.93 → aient-1.1.94}/PKG-INFO +1 -1
  2. {aient-1.1.93 → aient-1.1.94}/aient/architext/architext/core.py +7 -3
  3. {aient-1.1.93 → aient-1.1.94}/aient/architext/test/test.py +27 -0
  4. {aient-1.1.93 → aient-1.1.94}/aient.egg-info/PKG-INFO +1 -1
  5. {aient-1.1.93 → aient-1.1.94}/pyproject.toml +1 -1
  6. {aient-1.1.93 → aient-1.1.94}/LICENSE +0 -0
  7. {aient-1.1.93 → aient-1.1.94}/README.md +0 -0
  8. {aient-1.1.93 → aient-1.1.94}/aient/__init__.py +0 -0
  9. {aient-1.1.93 → aient-1.1.94}/aient/architext/architext/__init__.py +0 -0
  10. {aient-1.1.93 → aient-1.1.94}/aient/architext/test/openai_client.py +0 -0
  11. {aient-1.1.93 → aient-1.1.94}/aient/architext/test/test_save_load.py +0 -0
  12. {aient-1.1.93 → aient-1.1.94}/aient/core/__init__.py +0 -0
  13. {aient-1.1.93 → aient-1.1.94}/aient/core/log_config.py +0 -0
  14. {aient-1.1.93 → aient-1.1.94}/aient/core/models.py +0 -0
  15. {aient-1.1.93 → aient-1.1.94}/aient/core/request.py +0 -0
  16. {aient-1.1.93 → aient-1.1.94}/aient/core/response.py +0 -0
  17. {aient-1.1.93 → aient-1.1.94}/aient/core/test/test_base_api.py +0 -0
  18. {aient-1.1.93 → aient-1.1.94}/aient/core/test/test_geminimask.py +0 -0
  19. {aient-1.1.93 → aient-1.1.94}/aient/core/test/test_image.py +0 -0
  20. {aient-1.1.93 → aient-1.1.94}/aient/core/test/test_payload.py +0 -0
  21. {aient-1.1.93 → aient-1.1.94}/aient/core/utils.py +0 -0
  22. {aient-1.1.93 → aient-1.1.94}/aient/models/__init__.py +0 -0
  23. {aient-1.1.93 → aient-1.1.94}/aient/models/audio.py +0 -0
  24. {aient-1.1.93 → aient-1.1.94}/aient/models/base.py +0 -0
  25. {aient-1.1.93 → aient-1.1.94}/aient/models/chatgpt.py +0 -0
  26. {aient-1.1.93 → aient-1.1.94}/aient/plugins/__init__.py +0 -0
  27. {aient-1.1.93 → aient-1.1.94}/aient/plugins/arXiv.py +0 -0
  28. {aient-1.1.93 → aient-1.1.94}/aient/plugins/config.py +0 -0
  29. {aient-1.1.93 → aient-1.1.94}/aient/plugins/excute_command.py +0 -0
  30. {aient-1.1.93 → aient-1.1.94}/aient/plugins/get_time.py +0 -0
  31. {aient-1.1.93 → aient-1.1.94}/aient/plugins/image.py +0 -0
  32. {aient-1.1.93 → aient-1.1.94}/aient/plugins/list_directory.py +0 -0
  33. {aient-1.1.93 → aient-1.1.94}/aient/plugins/read_file.py +0 -0
  34. {aient-1.1.93 → aient-1.1.94}/aient/plugins/read_image.py +0 -0
  35. {aient-1.1.93 → aient-1.1.94}/aient/plugins/readonly.py +0 -0
  36. {aient-1.1.93 → aient-1.1.94}/aient/plugins/registry.py +0 -0
  37. {aient-1.1.93 → aient-1.1.94}/aient/plugins/run_python.py +0 -0
  38. {aient-1.1.93 → aient-1.1.94}/aient/plugins/websearch.py +0 -0
  39. {aient-1.1.93 → aient-1.1.94}/aient/plugins/write_file.py +0 -0
  40. {aient-1.1.93 → aient-1.1.94}/aient/utils/__init__.py +0 -0
  41. {aient-1.1.93 → aient-1.1.94}/aient/utils/prompt.py +0 -0
  42. {aient-1.1.93 → aient-1.1.94}/aient/utils/scripts.py +0 -0
  43. {aient-1.1.93 → aient-1.1.94}/aient.egg-info/SOURCES.txt +0 -0
  44. {aient-1.1.93 → aient-1.1.94}/aient.egg-info/dependency_links.txt +0 -0
  45. {aient-1.1.93 → aient-1.1.94}/aient.egg-info/requires.txt +0 -0
  46. {aient-1.1.93 → aient-1.1.94}/aient.egg-info/top_level.txt +0 -0
  47. {aient-1.1.93 → aient-1.1.94}/setup.cfg +0 -0
  48. {aient-1.1.93 → aient-1.1.94}/test/test_Web_crawler.py +0 -0
  49. {aient-1.1.93 → aient-1.1.94}/test/test_ddg_search.py +0 -0
  50. {aient-1.1.93 → aient-1.1.94}/test/test_google_search.py +0 -0
  51. {aient-1.1.93 → aient-1.1.94}/test/test_ollama.py +0 -0
  52. {aient-1.1.93 → aient-1.1.94}/test/test_plugin.py +0 -0
  53. {aient-1.1.93 → aient-1.1.94}/test/test_search.py +0 -0
  54. {aient-1.1.93 → aient-1.1.94}/test/test_url.py +0 -0
  55. {aient-1.1.93 → aient-1.1.94}/test/test_whisper.py +0 -0
  56. {aient-1.1.93 → aient-1.1.94}/test/test_yjh.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.1.93
3
+ Version: 1.1.94
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -32,7 +32,10 @@ class ContextProvider(ABC):
32
32
  return None
33
33
 
34
34
  class Texts(ContextProvider):
35
- def __init__(self, text: Union[str, Callable[[], str]], name: Optional[str] = None):
35
+ def __init__(self, text: Optional[Union[str, Callable[[], str]]] = None, name: Optional[str] = None):
36
+ if text is None and name is None:
37
+ raise ValueError("Either 'text' or 'name' must be provided.")
38
+
36
39
  self._text = text
37
40
  self._is_dynamic = callable(self._text)
38
41
 
@@ -41,7 +44,8 @@ class Texts(ContextProvider):
41
44
  import uuid
42
45
  _name = f"dynamic_text_{uuid.uuid4().hex[:8]}"
43
46
  else:
44
- h = hashlib.sha1(self._text.encode()).hexdigest()
47
+ # Handle the case where text is None during initialization
48
+ h = hashlib.sha1(self._text.encode() if self._text else b'').hexdigest()
45
49
  _name = f"text_{h[:8]}"
46
50
  else:
47
51
  _name = name
@@ -57,7 +61,7 @@ class Texts(ContextProvider):
57
61
  self._is_dynamic = callable(self._text)
58
62
  self.mark_stale()
59
63
 
60
- async def render(self) -> str:
64
+ async def render(self) -> Optional[str]:
61
65
  if self._is_dynamic:
62
66
  return self._text()
63
67
  return self._text
@@ -872,6 +872,33 @@ class TestContextManagement(unittest.IsolatedAsyncioTestCase):
872
872
  # 5. 验证两次内容不同(因为时间戳变了)
873
873
  self.assertNotEqual(content1, content2, "包含静态前缀的动态 provider 内容应该更新")
874
874
 
875
+ async def test_z3_deferred_text_update_via_provider(self):
876
+ """测试 Texts(name=...) 初始化, 然后通过 provider 更新内容"""
877
+ # This test is expected to fail with a TypeError on the next line
878
+ # because the current Texts.__init__ requires 'text'.
879
+ deferred_text_provider = Texts(name="deferred_content")
880
+
881
+ messages = Messages(UserMessage(deferred_text_provider))
882
+
883
+ # Initial render: with no text, it should probably render to an empty string.
884
+ # If there's no content, the message itself might not be rendered.
885
+ # Let's assume an empty provider results in the message not rendering.
886
+ await deferred_text_provider.refresh()
887
+ self.assertIsNone(deferred_text_provider.get_content_block())
888
+
889
+ rendered_initial = await messages.render_latest()
890
+ self.assertEqual(len(rendered_initial), 0)
891
+
892
+ # 3. Get provider and update content
893
+ provider = messages.provider("deferred_content")
894
+ self.assertIsNotNone(provider)
895
+ provider.update("This is the new content.")
896
+
897
+ # 4. Re-render and validate
898
+ rendered_updated = await messages.render_latest()
899
+ self.assertEqual(len(rendered_updated), 1)
900
+ self.assertEqual(rendered_updated[0]['content'], "This is the new content.")
901
+
875
902
 
876
903
  # ==============================================================================
877
904
  # 6. 演示
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.1.93
3
+ Version: 1.1.94
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.1.93"
3
+ version = "1.1.94"
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