aient 1.0.90__py3-none-any.whl → 1.0.92__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/models/chatgpt.py +20 -19
- aient/prompt/agent.py +2 -0
- {aient-1.0.90.dist-info → aient-1.0.92.dist-info}/METADATA +1 -1
- {aient-1.0.90.dist-info → aient-1.0.92.dist-info}/RECORD +7 -7
- {aient-1.0.90.dist-info → aient-1.0.92.dist-info}/WHEEL +1 -1
- {aient-1.0.90.dist-info → aient-1.0.92.dist-info}/licenses/LICENSE +0 -0
- {aient-1.0.90.dist-info → aient-1.0.92.dist-info}/top_level.txt +0 -0
aient/models/chatgpt.py
CHANGED
@@ -125,9 +125,9 @@ class chatgpt(BaseLLM):
|
|
125
125
|
# print("role", role, "function_name", function_name, "message", message)
|
126
126
|
if convo_id not in self.conversation:
|
127
127
|
self.reset(convo_id=convo_id)
|
128
|
-
if function_name == "" and message
|
128
|
+
if function_name == "" and message:
|
129
129
|
self.conversation[convo_id].append({"role": role, "content": message})
|
130
|
-
elif function_name != "" and message
|
130
|
+
elif function_name != "" and message:
|
131
131
|
# 删除从 cut_history_by_function_name 以后的所有历史记录
|
132
132
|
if function_name == self.cut_history_by_function_name:
|
133
133
|
matching_message = next(filter(lambda x: safe_get(x, "tool_calls", 0, "function", "name", default="") == 'get_next_pdf', self.conversation[convo_id]), None)
|
@@ -429,26 +429,27 @@ class chatgpt(BaseLLM):
|
|
429
429
|
if response_role is None:
|
430
430
|
response_role = "assistant"
|
431
431
|
|
432
|
-
|
433
|
-
|
434
|
-
invalid_tools = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") not in self.plugins.keys()]
|
435
|
-
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
436
|
-
for tool_dict in invalid_tools:
|
437
|
-
full_response = full_response + f"\n\nFunction: {tool_dict.get('function_name', '')} does not exist! I must use existing functions. I need to try again."
|
438
|
-
if self.print_log and invalid_tools:
|
439
|
-
print("invalid_tools", invalid_tools)
|
440
|
-
print("function_parameter", function_parameter)
|
441
|
-
print("full_response", full_response)
|
432
|
+
if self.use_plugins == True:
|
433
|
+
function_parameter = parse_function_xml(full_response)
|
442
434
|
if function_parameter:
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
435
|
+
invalid_tools = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") not in self.plugins.keys()]
|
436
|
+
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
437
|
+
for tool_dict in invalid_tools:
|
438
|
+
full_response = full_response + f"\n\nFunction: {tool_dict.get('function_name', '')} does not exist! I must use existing functions. I need to try again."
|
439
|
+
if self.print_log and invalid_tools:
|
440
|
+
print("invalid_tools", invalid_tools)
|
441
|
+
print("function_parameter", function_parameter)
|
442
|
+
print("full_response", full_response)
|
443
|
+
if function_parameter:
|
444
|
+
need_function_call = True
|
445
|
+
else:
|
446
|
+
need_function_call = False
|
447
|
+
if self.print_log:
|
448
|
+
print("Failed to parse function_parameter full_response", full_response)
|
449
|
+
full_response = ""
|
449
450
|
|
450
451
|
# 处理函数调用
|
451
|
-
if need_function_call and self.use_plugins
|
452
|
+
if need_function_call and self.use_plugins == True:
|
452
453
|
if self.print_log:
|
453
454
|
print("function_parameter", function_parameter)
|
454
455
|
print("function_full_response", function_full_response)
|
aient/prompt/agent.py
CHANGED
@@ -131,6 +131,8 @@ instruction_system_prompt = """
|
|
131
131
|
你的工作目录为:{workspace_path},请在指令中使用绝对路径。所有操作必须基于工作目录。
|
132
132
|
禁止在工作目录之外进行任何操作。你当前运行目录不一定就是工作目录。禁止默认你当前就在工作目录。
|
133
133
|
|
134
|
+
当前时间:{current_time}
|
135
|
+
|
134
136
|
你的输出必须符合以下步骤:
|
135
137
|
|
136
138
|
1. 首先分析当前对话历史。其中user就是你发送给工作智能体的指令。assistant就是工作智能体的回复。
|
@@ -13,7 +13,7 @@ aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhF
|
|
13
13
|
aient/models/__init__.py,sha256=ouNDNvoBBpIFrLsk09Q_sq23HR0GbLAKfGLIFmfEuXE,219
|
14
14
|
aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
|
15
15
|
aient/models/base.py,sha256=z-Z0pJfTN2x0cuwfvu0BdMRY9O-RmLwHEnBIJN1x4Fg,6719
|
16
|
-
aient/models/chatgpt.py,sha256
|
16
|
+
aient/models/chatgpt.py,sha256=-NWkkKxTCyraPYT0YN37NA2rUfOaDNXtvFSQmIE5tS8,45066
|
17
17
|
aient/models/claude.py,sha256=thK9P8qkaaoUN3OOJ9Shw4KDs-pAGKPoX4FOPGFXva8,28597
|
18
18
|
aient/models/duckduckgo.py,sha256=1l7vYCs9SG5SWPCbcl7q6pCcB5AUF_r-a4l9frz3Ogo,8115
|
19
19
|
aient/models/gemini.py,sha256=chGLc-8G_DAOxr10HPoOhvVFW1RvMgHd6mt--VyAW98,14730
|
@@ -32,12 +32,12 @@ aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4
|
|
32
32
|
aient/plugins/websearch.py,sha256=yiBzqXK5X220ibR-zko3VDsn4QOnLu1k6E2YOygCeTQ,15185
|
33
33
|
aient/plugins/write_file.py,sha256=qmT6iQ3mDyVAa9Sld1jfJq0KPZj0w2kRIHq0JyjpGeA,1853
|
34
34
|
aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
|
35
|
-
aient/prompt/agent.py,sha256=
|
35
|
+
aient/prompt/agent.py,sha256=3VycHGnUq9OdR5pd_RM0AeLESlpAgBcmzrsesfq82X0,23856
|
36
36
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
|
38
38
|
aient/utils/scripts.py,sha256=PPwaJEigPkpciJHUXOag483iq1GjvaLReHDHjkinv6c,26780
|
39
|
-
aient-1.0.
|
40
|
-
aient-1.0.
|
41
|
-
aient-1.0.
|
42
|
-
aient-1.0.
|
43
|
-
aient-1.0.
|
39
|
+
aient-1.0.92.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
40
|
+
aient-1.0.92.dist-info/METADATA,sha256=a4NqdE--2nDBpEy7OHvbuGOPdNTU7rlIhKf72PXagHo,5000
|
41
|
+
aient-1.0.92.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
|
42
|
+
aient-1.0.92.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
43
|
+
aient-1.0.92.dist-info/RECORD,,
|
File without changes
|
File without changes
|