aient 1.2.37__tar.gz → 1.2.39__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.
- {aient-1.2.37 → aient-1.2.39}/PKG-INFO +1 -1
- {aient-1.2.37 → aient-1.2.39}/aient/models/chatgpt.py +5 -15
- {aient-1.2.37 → aient-1.2.39}/aient.egg-info/PKG-INFO +1 -1
- {aient-1.2.37 → aient-1.2.39}/pyproject.toml +1 -1
- {aient-1.2.37 → aient-1.2.39}/LICENSE +0 -0
- {aient-1.2.37 → aient-1.2.39}/README.md +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/__init__.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/architext/architext/__init__.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/architext/architext/core.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/architext/test/openai_client.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/architext/test/test.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/architext/test/test_save_load.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/__init__.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/log_config.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/models.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/request.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/response.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/test/test_base_api.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/test/test_geminimask.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/test/test_image.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/test/test_payload.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/core/utils.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/models/__init__.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/models/audio.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/models/base.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/__init__.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/arXiv.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/config.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/excute_command.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/get_time.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/image.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/list_directory.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/read_file.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/read_image.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/readonly.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/registry.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/run_python.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/websearch.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/plugins/write_file.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/utils/__init__.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/utils/prompt.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient/utils/scripts.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient.egg-info/SOURCES.txt +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient.egg-info/dependency_links.txt +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient.egg-info/requires.txt +0 -0
- {aient-1.2.37 → aient-1.2.39}/aient.egg-info/top_level.txt +0 -0
- {aient-1.2.37 → aient-1.2.39}/setup.cfg +0 -0
- {aient-1.2.37 → aient-1.2.39}/test/test_Web_crawler.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/test/test_ddg_search.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/test/test_google_search.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/test/test_ollama.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/test/test_plugin.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/test/test_url.py +0 -0
- {aient-1.2.37 → aient-1.2.39}/test/test_whisper.py +0 -0
@@ -108,6 +108,7 @@ class chatgpt(BaseLLM):
|
|
108
108
|
cache_messages: list = None,
|
109
109
|
logger: logging.Logger = None,
|
110
110
|
check_done: bool = False,
|
111
|
+
retry_count: int = 999999,
|
111
112
|
) -> None:
|
112
113
|
"""
|
113
114
|
Initialize Chatbot with API key (from https://platform.openai.com/account/api-keys)
|
@@ -119,7 +120,7 @@ class chatgpt(BaseLLM):
|
|
119
120
|
self.function_calls_counter = {}
|
120
121
|
self.function_call_max_loop = function_call_max_loop
|
121
122
|
self.check_done = check_done
|
122
|
-
|
123
|
+
self.retry_count = retry_count
|
123
124
|
if logger:
|
124
125
|
self.logger = logger
|
125
126
|
else:
|
@@ -659,17 +660,6 @@ class chatgpt(BaseLLM):
|
|
659
660
|
self.add_to_conversation(full_response, response_role, convo_id=convo_id, total_tokens=total_tokens, pass_history=pass_history)
|
660
661
|
self.function_calls_counter = {}
|
661
662
|
|
662
|
-
# 清理翻译引擎相关的历史记录
|
663
|
-
if pass_history <= 2 and len(self.conversation[convo_id]) >= 2 \
|
664
|
-
and (
|
665
|
-
"You are a translation engine" in self.conversation[convo_id][-2]["content"] \
|
666
|
-
or "You are a translation engine" in safe_get(self.conversation, convo_id, -2, "content", 0, "text", default="") \
|
667
|
-
or "你是一位精通简体中文的专业翻译" in self.conversation[convo_id][-2]["content"] \
|
668
|
-
or "你是一位精通简体中文的专业翻译" in safe_get(self.conversation, convo_id, -2, "content", 0, "text", default="")
|
669
|
-
):
|
670
|
-
self.conversation[convo_id].pop(-1)
|
671
|
-
self.conversation[convo_id].pop(-1)
|
672
|
-
|
673
663
|
async def _ask_stream_handler(
|
674
664
|
self,
|
675
665
|
prompt: list,
|
@@ -708,7 +698,8 @@ class chatgpt(BaseLLM):
|
|
708
698
|
# 发送请求并处理响应
|
709
699
|
retry_times = 0
|
710
700
|
error_to_raise = None
|
711
|
-
while
|
701
|
+
while retry_times < self.retry_count:
|
702
|
+
retry_times += 1
|
712
703
|
tmp_post_json = copy.deepcopy(json_post)
|
713
704
|
if need_done_prompt:
|
714
705
|
tmp_post_json["messages"].extend(need_done_prompt)
|
@@ -821,8 +812,7 @@ class chatgpt(BaseLLM):
|
|
821
812
|
error_message = "您输入了无效的API URL,请使用正确的URL并使用`/start`命令重新设置API URL。具体错误如下:\n\n" + str(e)
|
822
813
|
raise ConfigurationError(error_message)
|
823
814
|
# 最后一次重试失败,向上抛出异常
|
824
|
-
retry_times
|
825
|
-
if retry_times == 9:
|
815
|
+
if retry_times == self.retry_count:
|
826
816
|
raise RetryFailedError(str(e))
|
827
817
|
|
828
818
|
if error_to_raise:
|
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
|
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
|