chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM, Qwen 与 Llama 等)基于 Langchain 与 ChatGLM 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
29.4k stars 5.16k forks source link

HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error 报错 #4307

Open cristiano-xw opened 4 days ago

cristiano-xw commented 4 days ago

遇到报错

2024-06-24 23:17:13,580 model_providers.bootstrap_web.openai_bootstrap_web 27641 INFO Received chat completion request: {'function_call': None, 'functions': None, 'max_tokens': 256, 'messages': [{'content': '你好', 'role': <Role.USER: 'user'>}, {'content': '你好!很高兴能为你提供帮助。有什么我可以协助你的吗?', 'role': <Role.ASSISTANT: 'assistant'>}, {'content': '你是什么模型', 'role': <Role.USER: 'user'>}], 'model': 'qwen2-instruct', 'n': 1, 'stop': None, 'stream': True, 'temperature': 0.75, 'tool_choice': None, 'tools': None, 'top_k': None, 'top_p': 0.75} 2024-06-24 23:17:13,635 httpx 27641 INFO HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 200 OK" 2024-06-24 23:17:13,636 uvicorn.access 27641 INFO 127.0.0.1:39304 - "POST /xinference/v1/chat/completions HTTP/1.1" 200 2024-06-24 23:17:16,912 httpx 27778 INFO HTTP Request: POST http://127.0.0.1:20000/xinference/v1/chat/completions "HTTP/1.1 200 OK" INFO: 127.0.0.1:50312 - "GET /tools HTTP/1.1" 200 OK 2024-06-24 23:17:36,706 httpx 27912 INFO HTTP Request: GET http://127.0.0.1:7861/tools "HTTP/1.1 200 OK" INFO: 127.0.0.1:58092 - "GET /tools HTTP/1.1" 200 OK 2024-06-24 23:17:41,904 httpx 27912 INFO HTTP Request: GET http://127.0.0.1:7861/tools "HTTP/1.1 200 OK" 2024-06-24 23:17:42,061 httpx 27778 INFO HTTP Request: POST http://127.0.0.1:9997/v1/embeddings "HTTP/1.1 200 OK" INFO: 127.0.0.1:58102 - "POST /chat/chat/completions HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call return await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/cors.py", line 85, in call await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 72, in app response = await func(request) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(values) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/api_server/chat_routes.py", line 96, in chat_completions tool_result = await tool.ainvoke(tool_input) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 723, in ainvoke return await run_in_executor(config, self.invoke, input, config, kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/runnables/config.py", line 557, in run_in_executor return await asyncio.get_running_loop().run_in_executor( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/runnables/config.py", line 548, in wrapper return func(*args, *kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 260, in invoke return self.run( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 452, in run raise e File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 409, in run context.run( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 750, in _run else self.func(args, kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/agent/tools_factory/search_local_knowledgebase.py", line 51, in search_local_knowledgebase ret = search_knowledgebase(query=query, database=database, config=tool_config) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/agent/tools_factory/search_local_knowledgebase.py", line 36, in search_knowledgebase docs = search_docs( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_doc_api.py", line 39, in search_docs docs = kb.search_docs(query, top_k, score_threshold) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_service/base.py", line 181, in search_docs docs = self.do_search(query, top_k, score_threshold) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_service/faiss_kb_service.py", line 66, in do_search retriever = get_Retriever("ensemble").from_vectorstore( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/file_rag/retrievers/ensemble.py", line 37, in from_vectorstore bm25_retriever = BM25Retriever.from_documents( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_community/retrievers/bm25.py", line 90, in from_documents texts, metadatas = zip(((d.page_content, d.metadata) for d in documents)) ValueError: not enough values to unpack (expected 2, got 0) 2024-06-24 23:17:42,069 httpx 27912 INFO HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error" 2024-06-24 23:17:42,070 openai._base_client 27912 INFO Retrying request to /chat/completions in 0.903778 seconds 2024-06-24 23:17:43,093 httpx 27778 INFO HTTP Request: POST http://127.0.0.1:9997/v1/embeddings "HTTP/1.1 200 OK" INFO: 127.0.0.1:58104 - "POST /chat/chat/completions HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call return await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/cors.py", line 85, in call await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 72, in app response = await func(request) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(values) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/api_server/chat_routes.py", line 96, in chat_completions tool_result = await tool.ainvoke(tool_input) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 723, in ainvoke return await run_in_executor(config, self.invoke, input, config, kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/runnables/config.py", line 557, in run_in_executor return await asyncio.get_running_loop().run_in_executor( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, self.kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/runnables/config.py", line 548, in wrapper return func(*args, *kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 260, in invoke return self.run( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 452, in run raise e File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 409, in run context.run( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 750, in _run else self.func(args, kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/agent/tools_factory/search_local_knowledgebase.py", line 51, in search_local_knowledgebase ret = search_knowledgebase(query=query, database=database, config=tool_config) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/agent/tools_factory/search_local_knowledgebase.py", line 36, in search_knowledgebase docs = search_docs( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_doc_api.py", line 39, in search_docs docs = kb.search_docs(query, top_k, score_threshold) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_service/base.py", line 181, in search_docs docs = self.do_search(query, top_k, score_threshold) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_service/faiss_kb_service.py", line 66, in do_search retriever = get_Retriever("ensemble").from_vectorstore( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/file_rag/retrievers/ensemble.py", line 37, in from_vectorstore bm25_retriever = BM25Retriever.from_documents( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_community/retrievers/bm25.py", line 90, in from_documents texts, metadatas = zip(((d.page_content, d.metadata) for d in documents)) ValueError: not enough values to unpack (expected 2, got 0) 2024-06-24 23:17:43,101 httpx 27912 INFO HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error" 2024-06-24 23:17:43,102 openai._base_client 27912 INFO Retrying request to /chat/completions in 1.859327 seconds 2024-06-24 23:17:45,102 httpx 27778 INFO HTTP Request: POST http://127.0.0.1:9997/v1/embeddings "HTTP/1.1 200 OK" INFO: 127.0.0.1:58114 - "POST /chat/chat/completions HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call return await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/cors.py", line 85, in call await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/starlette/routing.py", line 72, in app response = await func(request) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(values) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/api_server/chat_routes.py", line 96, in chat_completions tool_result = await tool.ainvoke(tool_input) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 723, in ainvoke return await run_in_executor(config, self.invoke, input, config, kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/runnables/config.py", line 557, in run_in_executor return await asyncio.get_running_loop().run_in_executor( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, self.kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/runnables/config.py", line 548, in wrapper return func(*args, *kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 260, in invoke return self.run( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 452, in run raise e File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 409, in run context.run( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_core/tools.py", line 750, in _run else self.func(args, kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/agent/tools_factory/search_local_knowledgebase.py", line 51, in search_local_knowledgebase ret = search_knowledgebase(query=query, database=database, config=tool_config) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/agent/tools_factory/search_local_knowledgebase.py", line 36, in search_knowledgebase docs = search_docs( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_doc_api.py", line 39, in search_docs docs = kb.search_docs(query, top_k, score_threshold) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_service/base.py", line 181, in search_docs docs = self.do_search(query, top_k, score_threshold) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/knowledge_base/kb_service/faiss_kb_service.py", line 66, in do_search retriever = get_Retriever("ensemble").from_vectorstore( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/server/file_rag/retrievers/ensemble.py", line 37, in from_vectorstore bm25_retriever = BM25Retriever.from_documents( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/langchain_community/retrievers/bm25.py", line 90, in from_documents texts, metadatas = zip(((d.page_content, d.metadata) for d in documents)) ValueError: not enough values to unpack (expected 2, got 0) 2024-06-24 23:17:45,121 httpx 27912 INFO HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error" 2024-06-24 23:17:45.123 Uncaught app exception Traceback (most recent call last): File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script exec(code, module.dict) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/webui.py", line 71, in dialogue_page(api=api, is_lite=is_lite) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/chatchat/webui_pages/dialogue/dialogue.py", line 304, in dialogue_page for d in client.chat.completions.create( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_utils/_utils.py", line 277, in wrapper return func(args, **kwargs) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/resources/chat/completions.py", line 640, in create return self._post( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_base_client.py", line 1250, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_base_client.py", line 931, in request return self._request( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_base_client.py", line 1015, in _request return self._retry_request( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_base_client.py", line 1063, in _retry_request return self._request( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_base_client.py", line 1015, in _request return self._retry_request( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_base_client.py", line 1063, in _retry_request return self._request( File "/home/yangxinwei/anaconda3/envs/llm/lib/python3.9/site-packages/openai/_base_client.py", line 1030, in _request raise self._make_status_error_from_response(err.response) from None openai.InternalServerError: Internal Server Error

lettergod commented 4 days ago

官方的autodl镜像,测试Langchain-Chatchat API Server的ChatChat对话, 输出内容------------------------------------- INFO: 127.0.0.1:59728 - "POST /chat/chat HTTP/1.1" 200 OK

Entering new AgentExecutor chain... user=None extra_headers=None extra_query=None extra_json=None timeout=None messages=[{'content': 'Respond to the human as helpfully and accurately as possible. You have access to the following tools:\n\n\n\nUse a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).\n\nValid "action" values: "Final Answer" or \n\nProvide only ONE action per $JSON_BLOB, as shown:\n\n\n{\n "action": $TOOL_NAME,\n "action_input": $INPUT\n}\n\n\nFollow this format:\n\nQuestion: input question to answer\nThought: consider previous and subsequent steps\nAction:\n\n$JSON_BLOB\n\nObservation: action result\n... (repeat Thought/Action/Observation N times)\nThought: I know what to respond\nAction:\n\n{\n "action": "Final Answer",\n "action_input": "Final response to human"\n}\n\nBegin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:$JSON_BLOB```then Observation', 'role': 'system'}, {'content': '恼羞成怒\n\n\n (reminder to respond in a JSON blob no matter what)', 'role': 'user'}] model='glm4-chat' frequency_penalty=None function_call=None functions=None logit_bias=None logprobs=None max_tokens=4096 n=1 presence_penalty=None response_format=None seed=None stop=['\nObservation'] stream=True temperature=0.9 tool_choice=None tools=None top_logprobs=None top_p=None INFO: 127.0.0.1:59748 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 396, in run_asgi result = await app( # type: ignore[func-returns-value] File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call return await self.app(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in call await self.app(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/routing.py", line 758, in call await self.middleware_stack(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/routing.py", line 778, in app await route.handle(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/routing.py", line 299, in handle await self.app(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/routing.py", line 79, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/starlette/routing.py", line 74, in app response = await func(request) File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app raise e File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app raw_response = await run_endpoint_function( File "/root/miniconda3/envs/chatchat/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(values) File "/root/Langchain-Chatchat/libs/chatchat-server/chatchat/server/api_server/openai_routes.py", line 135, in create_chat_completions async with get_model_client(body.model) as client: File "/root/miniconda3/envs/chatchat/lib/python3.8/contextlib.py", line 171, in aenter return await self.gen.anext() File "/root/Langchain-Chatchat/libs/chatchat-server/chatchat/server/api_server/openai_routes.py", line 52, in get_model_client key = (m, selected_platform) UnboundLocalError: local variable 'm' referenced before assignment 2024-06-25 08:33:50,294 httpx 2650 INFO HTTP Request: POST http://127.0.0.1:7861/v1/chat/completions "HTTP/1.1 500 Internal Server Error"** 2024-06-25 08:33:50,295 openai._base_client 2650 INFO Retrying request to /chat/completions in 0.797986 seconds

blvyoucan commented 3 days ago

我用的python3.10,也有这个问题

imClumsyPanda commented 1 day ago

请参考 API 调用说明

https://github.com/chatchat-space/Langchain-Chatchat/blob/dev/docs/contributing/api.md