aient 1.0.56__py3-none-any.whl → 1.0.58__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.
- aient/plugins/write_file.py +51 -0
- aient/prompt/agent.py +7 -4
- {aient-1.0.56.dist-info → aient-1.0.58.dist-info}/METADATA +1 -1
- {aient-1.0.56.dist-info → aient-1.0.58.dist-info}/RECORD +7 -6
- {aient-1.0.56.dist-info → aient-1.0.58.dist-info}/WHEEL +0 -0
- {aient-1.0.56.dist-info → aient-1.0.58.dist-info}/licenses/LICENSE +0 -0
- {aient-1.0.56.dist-info → aient-1.0.58.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
from .registry import register_tool
|
2
|
+
|
3
|
+
import os
|
4
|
+
|
5
|
+
@register_tool()
|
6
|
+
def write_to_file(path, content, mode='w'):
|
7
|
+
"""
|
8
|
+
## write_to_file
|
9
|
+
Description: Request to write full content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file.
|
10
|
+
Parameters:
|
11
|
+
- path: (required) The path of the file to write to (relative to the current working directory ${args.cwd})
|
12
|
+
- content: (required) The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified. Do NOT include the line numbers in the content though, just the actual content of the file.
|
13
|
+
- mode: (optional) The mode to write to the file. Default is 'w'. 'w' for write, 'a' for append.
|
14
|
+
Usage:
|
15
|
+
<write_to_file>
|
16
|
+
<path>File path here</path>
|
17
|
+
<content>
|
18
|
+
Your file content here
|
19
|
+
</content>
|
20
|
+
<mode>w</mode>
|
21
|
+
</write_to_file>
|
22
|
+
|
23
|
+
Example: Requesting to write to frontend-config.json
|
24
|
+
<write_to_file>
|
25
|
+
<path>frontend-config.json</path>
|
26
|
+
<content>
|
27
|
+
{
|
28
|
+
"apiEndpoint": "https://api.example.com",
|
29
|
+
"theme": {
|
30
|
+
"primaryColor": "#007bff",
|
31
|
+
"secondaryColor": "#6c757d",
|
32
|
+
"fontFamily": "Arial, sans-serif"
|
33
|
+
},
|
34
|
+
"features": {
|
35
|
+
"darkMode": true,
|
36
|
+
"notifications": true,
|
37
|
+
"analytics": false
|
38
|
+
},
|
39
|
+
"version": "1.0.0"
|
40
|
+
}
|
41
|
+
</content>
|
42
|
+
</write_to_file>
|
43
|
+
"""
|
44
|
+
# 确保目录存在
|
45
|
+
os.makedirs(os.path.dirname(path) or '.', exist_ok=True)
|
46
|
+
|
47
|
+
# 写入文件
|
48
|
+
with open(path, mode, encoding='utf-8') as file:
|
49
|
+
file.write(content)
|
50
|
+
|
51
|
+
return f"文件已成功写入:{path}"
|
aient/prompt/agent.py
CHANGED
@@ -134,8 +134,9 @@ instruction_system_prompt = """
|
|
134
134
|
|
135
135
|
1. 首先分析当前对话历史。其中user就是你发送给工作智能体的指令。assistant就是工作智能体的回复。
|
136
136
|
2. 根据任务目标和当前进度,分析还需要哪些步骤。
|
137
|
-
3.
|
138
|
-
4.
|
137
|
+
3. 检查当前对话历史中,工作智能体是否陷入困境,如果陷入困境,请思考可能的原因和解决方案。
|
138
|
+
4. 检查工作智能体可以使用哪些工具后,确定需要调用哪些工具。请明确要求工作智能体使用特定工具。如果工作智能体不清楚工具的参数,请直接告诉它。
|
139
|
+
5. 最后将你的指令放在<instructions>标签中。
|
139
140
|
|
140
141
|
你的回复格式如下:
|
141
142
|
|
@@ -145,9 +146,11 @@ instruction_system_prompt = """
|
|
145
146
|
|
146
147
|
{{3.分析还需要哪些步骤}}
|
147
148
|
|
148
|
-
{{4
|
149
|
+
{{4.检查工作智能体是否陷入困境,分析可能的原因和解决方案}}
|
149
150
|
|
150
|
-
{{5
|
151
|
+
{{5.检查工作智能体可以使用哪些工具}}
|
152
|
+
|
153
|
+
{{6.确定需要调用哪些工具}}
|
151
154
|
|
152
155
|
<instructions>
|
153
156
|
{{work_agent_instructions}}
|
@@ -29,13 +29,14 @@ aient/plugins/read_file.py,sha256=kjHqtAGSy6AV8kFpv342x6yWGYfvZ9LGmxFZXJ3XzQI,23
|
|
29
29
|
aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
|
30
30
|
aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
|
31
31
|
aient/plugins/websearch.py,sha256=yiBzqXK5X220ibR-zko3VDsn4QOnLu1k6E2YOygCeTQ,15185
|
32
|
+
aient/plugins/write_file.py,sha256=qYbNvcDTGs00pWYb0UOSYSeN4kw5_DMDxjaSlxtlAkU,1732
|
32
33
|
aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
|
33
|
-
aient/prompt/agent.py,sha256=
|
34
|
+
aient/prompt/agent.py,sha256=h39WOoafv0_lh2coBCiG9k-VWa3Yi9HRZV0hnvsc4gs,23598
|
34
35
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
36
|
aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
|
36
37
|
aient/utils/scripts.py,sha256=n0jR5eXCBIK12W4bIx-xU1FVl1hZ4zDC7hq_BWQHYJU,27537
|
37
|
-
aient-1.0.
|
38
|
-
aient-1.0.
|
39
|
-
aient-1.0.
|
40
|
-
aient-1.0.
|
41
|
-
aient-1.0.
|
38
|
+
aient-1.0.58.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
39
|
+
aient-1.0.58.dist-info/METADATA,sha256=7hHVXLWC6vfFXqNHHx3tOR_jL7imJTXKUNBpIEwtjyA,4973
|
40
|
+
aient-1.0.58.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
41
|
+
aient-1.0.58.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
42
|
+
aient-1.0.58.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|