LangChain-Chatchat本地运行调用在线模型API

1. 说明

最轻模式本地部署方案,该模式的配置方式与常规模式相同,但无需安装 torch 等重依赖,通过在线API实现 LLM 和 Ebeddings 相关功能,适合没有显卡的电脑使用

参考文档:
开发环境部署
参数配置

2. 步骤

2.1 下载代码

从Github拉取代码:https://github.com/chatchat-space/Langchain-Chatchat.git

2.2 修改

访问http://127.0.0.1:8501/

问题记录

No module named ‘configs.basic_config’

运行报错:ModuleNotFoundError: No module named ‘configs.basic_config’
执行:python copy_config_example.py

No module named ‘pwd’

执行python startup.py -a –lite报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
(Langchain-Chatchat) PS D:\code\source\Langchain-Chatchat> python startup.py -a --lite
Traceback (most recent call last):
File "D:\code\source\Langchain-Chatchat\startup.py", line 37, in <module>
from server.knowledge_base.migrate import create_tables
File "D:\code\source\Langchain-Chatchat\server\knowledge_base\migrate.py", line 6, in <module>
from server.knowledge_base.utils import (
File "D:\soft\Anaconda3\envs\Langchain-Chatchat\Lib\site-packages\langchain\document_loaders\__init__.py", line 18, in <module>
from langchain_community.document_loaders.acreom import AcreomLoader
File "D:\soft\Anaconda3\envs\Langchain-Chatchat\Lib\site-packages\langchain_community\document_loaders\__init__.py", line 163, in <module>
from langchain_community.document_loaders.pebblo import PebbloSafeLoader
File "D:\soft\Anaconda3\envs\Langchain-Chatchat\Lib\site-packages\langchain_community\document_loaders\pebblo.py", line 5, in <module>
import pwd
ModuleNotFoundError: No module named 'pwd'

https://github.com/chatchat-space/Langchain-Chatchat/issues/3004
原因:需要在Linux环境下执行,Windows没有这个命令
解决:pip install langchain-community==0.0.19或者在requirements.txt添加langchain-community==0.0.19并执行pip install -r requirements.txt

utils.py[line:40] - ERROR: TypeError: Caught exception: object of type ‘NoneType’ has no len()

https://github.com/chatchat-space/Langchain-Chatchat/issues/2062
requirements.txt添加dashscope==1.15.0

ValueError: ‘text-embedding-v1’ is not in list

https://github.com/chatchat-space/Langchain-Chatchat/issues/3450