aient 1.2.22__tar.gz → 1.2.23__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.22 → aient-1.2.23}/PKG-INFO +1 -1
  2. {aient-1.2.22 → aient-1.2.23}/aient/plugins/read_file.py +20 -9
  3. {aient-1.2.22 → aient-1.2.23}/aient.egg-info/PKG-INFO +1 -1
  4. {aient-1.2.22 → aient-1.2.23}/pyproject.toml +1 -1
  5. {aient-1.2.22 → aient-1.2.23}/LICENSE +0 -0
  6. {aient-1.2.22 → aient-1.2.23}/README.md +0 -0
  7. {aient-1.2.22 → aient-1.2.23}/aient/__init__.py +0 -0
  8. {aient-1.2.22 → aient-1.2.23}/aient/architext/architext/__init__.py +0 -0
  9. {aient-1.2.22 → aient-1.2.23}/aient/architext/architext/core.py +0 -0
  10. {aient-1.2.22 → aient-1.2.23}/aient/architext/test/openai_client.py +0 -0
  11. {aient-1.2.22 → aient-1.2.23}/aient/architext/test/test.py +0 -0
  12. {aient-1.2.22 → aient-1.2.23}/aient/architext/test/test_save_load.py +0 -0
  13. {aient-1.2.22 → aient-1.2.23}/aient/core/__init__.py +0 -0
  14. {aient-1.2.22 → aient-1.2.23}/aient/core/log_config.py +0 -0
  15. {aient-1.2.22 → aient-1.2.23}/aient/core/models.py +0 -0
  16. {aient-1.2.22 → aient-1.2.23}/aient/core/request.py +0 -0
  17. {aient-1.2.22 → aient-1.2.23}/aient/core/response.py +0 -0
  18. {aient-1.2.22 → aient-1.2.23}/aient/core/test/test_base_api.py +0 -0
  19. {aient-1.2.22 → aient-1.2.23}/aient/core/test/test_geminimask.py +0 -0
  20. {aient-1.2.22 → aient-1.2.23}/aient/core/test/test_image.py +0 -0
  21. {aient-1.2.22 → aient-1.2.23}/aient/core/test/test_payload.py +0 -0
  22. {aient-1.2.22 → aient-1.2.23}/aient/core/utils.py +0 -0
  23. {aient-1.2.22 → aient-1.2.23}/aient/models/__init__.py +0 -0
  24. {aient-1.2.22 → aient-1.2.23}/aient/models/audio.py +0 -0
  25. {aient-1.2.22 → aient-1.2.23}/aient/models/base.py +0 -0
  26. {aient-1.2.22 → aient-1.2.23}/aient/models/chatgpt.py +0 -0
  27. {aient-1.2.22 → aient-1.2.23}/aient/plugins/__init__.py +0 -0
  28. {aient-1.2.22 → aient-1.2.23}/aient/plugins/arXiv.py +0 -0
  29. {aient-1.2.22 → aient-1.2.23}/aient/plugins/config.py +0 -0
  30. {aient-1.2.22 → aient-1.2.23}/aient/plugins/excute_command.py +0 -0
  31. {aient-1.2.22 → aient-1.2.23}/aient/plugins/get_time.py +0 -0
  32. {aient-1.2.22 → aient-1.2.23}/aient/plugins/image.py +0 -0
  33. {aient-1.2.22 → aient-1.2.23}/aient/plugins/list_directory.py +0 -0
  34. {aient-1.2.22 → aient-1.2.23}/aient/plugins/read_image.py +0 -0
  35. {aient-1.2.22 → aient-1.2.23}/aient/plugins/readonly.py +0 -0
  36. {aient-1.2.22 → aient-1.2.23}/aient/plugins/registry.py +0 -0
  37. {aient-1.2.22 → aient-1.2.23}/aient/plugins/run_python.py +0 -0
  38. {aient-1.2.22 → aient-1.2.23}/aient/plugins/websearch.py +0 -0
  39. {aient-1.2.22 → aient-1.2.23}/aient/plugins/write_file.py +0 -0
  40. {aient-1.2.22 → aient-1.2.23}/aient/utils/__init__.py +0 -0
  41. {aient-1.2.22 → aient-1.2.23}/aient/utils/prompt.py +0 -0
  42. {aient-1.2.22 → aient-1.2.23}/aient/utils/scripts.py +0 -0
  43. {aient-1.2.22 → aient-1.2.23}/aient.egg-info/SOURCES.txt +0 -0
  44. {aient-1.2.22 → aient-1.2.23}/aient.egg-info/dependency_links.txt +0 -0
  45. {aient-1.2.22 → aient-1.2.23}/aient.egg-info/requires.txt +0 -0
  46. {aient-1.2.22 → aient-1.2.23}/aient.egg-info/top_level.txt +0 -0
  47. {aient-1.2.22 → aient-1.2.23}/setup.cfg +0 -0
  48. {aient-1.2.22 → aient-1.2.23}/test/test_Web_crawler.py +0 -0
  49. {aient-1.2.22 → aient-1.2.23}/test/test_ddg_search.py +0 -0
  50. {aient-1.2.22 → aient-1.2.23}/test/test_google_search.py +0 -0
  51. {aient-1.2.22 → aient-1.2.23}/test/test_ollama.py +0 -0
  52. {aient-1.2.22 → aient-1.2.23}/test/test_plugin.py +0 -0
  53. {aient-1.2.22 → aient-1.2.23}/test/test_search.py +0 -0
  54. {aient-1.2.22 → aient-1.2.23}/test/test_url.py +0 -0
  55. {aient-1.2.22 → aient-1.2.23}/test/test_whisper.py +0 -0
  56. {aient-1.2.22 → aient-1.2.23}/test/test_yjh.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.2.22
3
+ Version: 1.2.23
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -7,7 +7,7 @@ from .registry import register_tool
7
7
 
8
8
  # 读取文件内容
9
9
  @register_tool()
10
- def read_file(file_path):
10
+ def read_file(file_path, head: int = None):
11
11
  """
12
12
  Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string.
13
13
 
@@ -16,6 +16,7 @@ Description: Request to read the contents of a file at the specified path. Use t
16
16
 
17
17
  参数:
18
18
  file_path: 要读取的文件路径,(required) The path of the file to read (relative to the current working directory)
19
+ head: (可选) 读取文件的前N行,默认为None,读取整个文件
19
20
 
20
21
  返回:
21
22
  文件内容的字符串
@@ -161,13 +162,23 @@ Examples:
161
162
  # 捕获在此块中可能发生的其他错误,例如未被早期检查捕获的文件读取问题
162
163
  return f"<tool_error>处理通用文件 '{file_path}' 时发生错误: {e}</tool_error>"
163
164
 
164
- if file_path.lower().endswith('.csv'):
165
- lines = text_content.splitlines(True)
166
- if len(lines) > 500:
167
- top_lines = lines[:250]
168
- bottom_lines = lines[-250:]
169
- omitted_count = len(lines) - 500
170
- text_content = "".join(top_lines) + f"\n... (中间省略了 {omitted_count} 行) ...\n" + "".join(bottom_lines)
165
+ if head is not None:
166
+ try:
167
+ num_lines = int(head)
168
+ if num_lines > 0:
169
+ lines = text_content.splitlines(True)
170
+ return "".join(lines[:num_lines])
171
+ except (ValueError, TypeError):
172
+ # Invalid head value, ignore and proceed with normal logic.
173
+ pass
174
+
175
+ # if file_path.lower().endswith('.csv'):
176
+ # lines = text_content.splitlines(True)
177
+ # if len(lines) > 500:
178
+ # top_lines = lines[:250]
179
+ # bottom_lines = lines[-250:]
180
+ # omitted_count = len(lines) - 500
181
+ # text_content = "".join(top_lines) + f"\n... (中间省略了 {omitted_count} 行) ...\n" + "".join(bottom_lines)
171
182
 
172
183
  # 返回文件内容
173
184
  return text_content
@@ -182,6 +193,6 @@ Examples:
182
193
 
183
194
  if __name__ == "__main__":
184
195
  # python -m beswarm.aient.aient.plugins.read_file
185
- result = read_file("./work/cax/Lenia Notebook.ipynb")
196
+ result = read_file("./work/cax/Lenia Notebook.ipynb", head=10)
186
197
  print(result)
187
198
  print(len(result))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.2.22
3
+ Version: 1.2.23
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.22"
3
+ version = "1.2.23"
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