aient 1.0.34__py3-none-any.whl → 1.0.36__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 CHANGED
@@ -60,6 +60,8 @@ class chatgpt(BaseLLM):
60
60
  use_plugins: bool = True,
61
61
  print_log: bool = False,
62
62
  tools: Optional[Union[list, str, Callable]] = [],
63
+ function_call_max_loop: int = 3,
64
+ cut_history_by_function_name: str = "",
63
65
  ) -> None:
64
66
  """
65
67
  Initialize Chatbot with API key (from https://platform.openai.com/account/api-keys)
@@ -74,7 +76,8 @@ class chatgpt(BaseLLM):
74
76
  ],
75
77
  }
76
78
  self.function_calls_counter = {}
77
- self.function_call_max_loop = 3
79
+ self.function_call_max_loop = function_call_max_loop
80
+ self.cut_history_by_function_name = cut_history_by_function_name
78
81
 
79
82
 
80
83
  # 注册和处理传入的工具
@@ -123,6 +126,11 @@ class chatgpt(BaseLLM):
123
126
  if function_name == "" and message and message != None:
124
127
  self.conversation[convo_id].append({"role": role, "content": message})
125
128
  elif function_name != "" and message and message != None:
129
+ # 删除从 cut_history_by_function_name 以后的所有历史记录
130
+ if function_name == self.cut_history_by_function_name:
131
+ matching_message = next(filter(lambda x: safe_get(x, "tool_calls", 0, "function", "name", default="") == 'get_next_pdf', self.conversation[convo_id]), None)
132
+ if matching_message is not None:
133
+ self.conversation[convo_id] = self.conversation[convo_id][:self.conversation[convo_id].index(matching_message)]
126
134
  self.conversation[convo_id].append({
127
135
  "role": "assistant",
128
136
  "tool_calls": [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.0.34
3
+ Version: 1.0.36
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -12,7 +12,7 @@ aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhF
12
12
  aient/models/__init__.py,sha256=ouNDNvoBBpIFrLsk09Q_sq23HR0GbLAKfGLIFmfEuXE,219
13
13
  aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
14
14
  aient/models/base.py,sha256=Loyt2F2WrDMBbK-sdmTtgkLVtdUXxK5tg4qoI6nc0Xo,7527
15
- aient/models/chatgpt.py,sha256=d7ZGc2WTrpwevXCFzIX4HU0zZ0T_mwfYkrStZ8yW5v0,37063
15
+ aient/models/chatgpt.py,sha256=RIybztUTsxnGCM08zWVeyrBpIxUCSX5ApS-2IU9vC2Y,37748
16
16
  aient/models/claude.py,sha256=thK9P8qkaaoUN3OOJ9Shw4KDs-pAGKPoX4FOPGFXva8,28597
17
17
  aient/models/duckduckgo.py,sha256=1l7vYCs9SG5SWPCbcl7q6pCcB5AUF_r-a4l9frz3Ogo,8115
18
18
  aient/models/gemini.py,sha256=chGLc-8G_DAOxr10HPoOhvVFW1RvMgHd6mt--VyAW98,14730
@@ -29,8 +29,8 @@ aient/plugins/websearch.py,sha256=yiBzqXK5X220ibR-zko3VDsn4QOnLu1k6E2YOygCeTQ,15
29
29
  aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
31
31
  aient/utils/scripts.py,sha256=O-0IXN3mezPauFs6fw83WDDgklpXTDvcbJBNTDrsIG0,8201
32
- aient-1.0.34.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
33
- aient-1.0.34.dist-info/METADATA,sha256=lmRxPK3h4FqU1crAZW6BOpAqMNUx2zbr52_yPZ9J_6k,4986
34
- aient-1.0.34.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
35
- aient-1.0.34.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
36
- aient-1.0.34.dist-info/RECORD,,
32
+ aient-1.0.36.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
33
+ aient-1.0.36.dist-info/METADATA,sha256=b70xJDgX9xQ4ga67B8NXYelG21cn9HDh8GanBhOR1R4,4986
34
+ aient-1.0.36.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
35
+ aient-1.0.36.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
36
+ aient-1.0.36.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (78.0.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5