binary-husky / gpt_academic

为GPT/GLM等LLM大语言模型提供实用化交互接口,特别优化论文阅读/润色/写作体验,模块化设计,支持自定义快捷按钮&函数插件,支持Python和C++等项目剖析&自译解功能,PDF/LaTex论文翻译&总结功能,支持并行问询多种LLM模型,支持chatglm3等本地模型。接入通义千问, deepseekcoder, 讯飞星火, 文心一言, llama2, rwkv, claude2, moss等。
https://github.com/binary-husky/gpt_academic/wiki/online
GNU General Public License v3.0
62.2k stars 7.75k forks source link

[Bug]: Azure Openai 函数功能区 [测试功能] 批量总结PDF文档 失效 #938

Closed fangconquerord closed 2 months ago

fangconquerord commented 1 year ago

Installation Method | 安装方法与平台

Pip Install (I ignored requirements.txt)

Version | 版本

Latest | 最新版

OS | 操作系统

Windows

Describe the bug | 简述

[测试功能] 批量总结PDF文档 失效 .pdf 翻译与对话有效,仅该功能失效 报错内容与之前类似https://github.com/binary-husky/gpt_academic/issues/920 版本为3.43 Traceback (most recent call last): File ".\request_llm\bridge_azure_test.py", line 150, in predict_no_ui_long_connection response = openai.ChatCompletion.create(timeout=TIMEOUT_SECONDS, *payload);break ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fangc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_resources\chat_completion.py", line 25, in create return super().create(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fangc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_resources\abstract\engine_apiresource.py", line 153, in create response, , api_key = requestor.request( ^^^^^^^^^^^^^^^^^^ File "C:\Users\fangc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_requestor.py", line 226, in request resp, got_stream = self._interpret_response(result, stream) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fangc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_requestor.py", line 619, in _interpret_response self._interpret_response_line( File "C:\Users\fangc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_requestor.py", line 682, in _interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: This model's maximum context length is 8192 tokens. However, your messages resulted in 25066 tokens. Please reduce the length of the messages.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File ".\crazy_functions\crazy_utils.py", line 79, in _req_gpt result = predict_no_ui_long_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".\request_llm\bridge_all.py", line 312, in predict_no_ui_long_connection return method(inputs, llm_kwargs, history, sys_prompt, observe_window, console_slience) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".\request_llm\bridge_azure_test.py", line 154, in predict_no_ui_long_connection if retry > MAX_RETRY: raise TimeoutError ^^^^^^^^^^^^^^^^^^ TimeoutError

Screen Shot | 有帮助的截图

QQ截图20230708214150

Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)

No response

binary-husky commented 1 year ago

能提供下pdf样本吗

fangconquerord commented 1 year ago

The Ethical and Political Contours of Institutional Promotion in.pdf

fangconquerord commented 1 year ago

image

binary-husky commented 1 year ago

修复 https://github.com/binary-husky/gpt_academic/commit/b298c5416c59e695d15920b6ff3cd0df62f1b8fd

fangconquerord commented 1 year ago

好像修改后的toolbox.py仍存在问题

Traceback (most recent call last): File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\toolbox.py", line 666, in read_single_conf_with_lru_cache r = getattr(importlib.import_module('config_private'), arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1008.0_x64qbz5n2kfra8p0\Lib\importlib\init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1142, in _find_and_load_unlocked ModuleNotFoundError: No module named 'config_private'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\main.py", line 221, in main() File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\main.py", line 6, in main from request_llm.bridge_all import predict File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\request_llm\bridge_all.py", line 16, in from .bridge_chatgpt import predict_no_ui_long_connection as chatgpt_noui File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\request_llm\bridge_chatgpt.py", line 26, in get_conf('proxies', 'TIMEOUT_SECONDS', 'MAX_RETRY', 'API_ORG') File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\toolbox.py", line 692, in get_conf r = read_single_conf_with_lru_cache(arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\toolbox.py", line 669, in read_single_conf_with_lru_cache r = getattr(importlib.import_module('config'), arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1008.0_x64qbz5n2kfra8p0\Lib\importlib\init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic\config.py", line 112 AZURE_ENDPOINT = "https://autogptfang.openai.azure.com/ ^ SyntaxError: unterminated string literal (detected at line 112) PS D:\ai\OneKeyInstallerForWindowsAndMacOS\gpt_academic>

binary-husky commented 1 year ago

更新config文件

fangconquerord commented 1 year ago

已经测试OK,多谢!

fangconquerord commented 1 year ago

再次测试多个pdf总结时报错:

开始最终总结 [Local Message] 实验性函数调用出错:

Traceback (most recent call last): File ".\toolbox.py", line 122, in decorated yield from f(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT) File ".\crazy_functions\批量总结PDF文档.py", line 149, in 批量总结PDF文档 yield from 解析PDF(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt) File ".\crazy_functions\批量总结PDF文档.py", line 16, in 解析PDF file_content, page_one = read_and_clean_pdf_text(file_name) # (尝试)按照章节切割PDF ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".\crazy_functions\crazy_utils.py", line 441, in read_and_clean_pdf_text with fitz.open(fp) as doc: ^^^^^^^^^^^^^ File "C:\Users\fangc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\fitz\fitz.py", line 3982, in init raise FileNotFoundError(msg) fitz.fitz.FileNotFoundError: no such file: 'private_upload/2023-07-10-12-11-45\116NwULRev.pdf'

当前代理可用性:

代理配置 http://127.0.0.1:10809, 代理所在地:Japan