xusenlinzy / api-for-open-llm

Openai style api for open large language models, using LLMs just as chatgpt! Support for LLaMA, LLaMA-2, BLOOM, Falcon, Baichuan, Qwen, Xverse, SqlCoder, CodeLLaMA, ChatGLM, ChatGLM2, ChatGLM3 etc. 开源大模型的统一后端接口
Apache License 2.0
2.33k stars 264 forks source link

EMBEDDING_API_BASE获取不到str expected, not NoneType #270

Closed chukangkang closed 5 months ago

chukangkang commented 5 months ago

提交前必须检查以下项目 | The following items must be checked before submission

问题类型 | Type of problem

效果问题 | Effectiveness issues

操作系统 | Operating system

Linux

详细描述问题 | Detailed description of the problem

streamlit-demo streamlit run streamlit_app.py

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501 Network URL: http://172.22.6.54:8501

Dependencies

streamlit-demo pip list
Package Version


aiohttp 3.9.5 aiosignal 1.3.1 altair 5.3.0 annotated-types 0.6.0 anyio 4.3.0 async-timeout 4.0.3 attrs 23.2.0 blinker 1.8.1 blis 0.7.11 cachetools 5.3.3 catalogue 2.0.10 certifi 2020.6.20 chardet 4.0.0 charset-normalizer 3.3.2 click 8.1.7 cloudpathlib 0.16.0 confection 0.1.4 cymem 2.0.8 dataclasses-json 0.6.4 decorator 5.1.1 deprecation 2.1.0 distro 1.9.0 exceptiongroup 1.2.1 frozenlist 1.4.1 gitdb 4.0.11 GitPython 3.1.43 google-search-results 2.4.2 greenlet 3.0.3 h11 0.14.0 httpcore 1.0.5 httplib2 0.18.1 httpx 0.27.0 idna 2.10 importlib-metadata 7.1.0 iotop 0.6 Jinja2 3.1.3 joblib 1.4.0 jsonpatch 1.33 jsonpointer 2.4 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 jupyter-client 8.6.1 jupyter-core 5.7.2 lancedb 0.6.11 langchain 0.1.16 langchain-community 0.0.34 langchain-core 0.1.46 langchain-openai 0.1.4 langchain-text-splitters 0.0.1 langcodes 3.4.0 langsmith 0.1.51 language-data 1.2.0 loguru 0.7.2 marisa-trie 1.1.0 markdown-it-py 3.0.0 MarkupSafe 2.1.5 marshmallow 3.21.1 mdurl 0.1.2 multidict 6.0.5 murmurhash 1.0.10 mypy-extensions 1.0.0 nltk 3.8.1 numpy 1.26.4 openai 1.23.6 orjson 3.10.1 overrides 7.7.0 packaging 23.2 pandas 2.2.2 pillow 10.3.0 pip 20.3.4 platformdirs 4.2.1 preshed 3.0.9 protobuf 4.25.3 py 1.11.0 pyarrow 15.0.0 pycurl 7.43.0.6 pydantic 2.7.1 pydantic-core 2.18.2 pydeck 0.9.0b1 pygments 2.17.2 pylance 0.10.12 PyMySQL 1.1.0 PySimpleSOAP 1.16.2 python-apt 2.2.1 python-dateutil 2.9.0.post0 python-debian 0.1.39 python-debianbts 3.1.0 python-dotenv 1.0.0 pytz 2024.1 PyYAML 6.0.1 pyzmq 26.0.2 ratelimiter 1.2.0.post0 referencing 0.35.0 regex 2024.4.28 reportbug 7.10.3+deb11u1 requests 2.31.0 retry 0.9.2 rich 13.7.1 rpds-py 0.18.0 semver 3.0.2 setuptools 52.0.0 six 1.16.0 smart-open 6.4.0 smmap 5.0.1 sniffio 1.3.1 spacy 3.7.4 spacy-legacy 3.0.12 spacy-loggers 1.0.5 SQLAlchemy 1.4.52 srsly 2.4.8 streamlit 1.33.0 tenacity 8.2.3 thinc 8.2.3 tiktoken 0.6.0 toml 0.10.2 toolz 0.12.1 tornado 6.4 tqdm 4.66.2 traitlets 5.14.3 typer 0.9.4 typing-extensions 4.11.0 typing-inspect 0.9.0 tzdata 2024.1 urllib3 1.26.5 wasabi 1.1.2 watchdog 4.0.0 weasel 0.3.4 wheel 0.34.2 yarl 1.9.4 zipp 3.18.1

运行日志或截图 | Runtime logs or screenshots

TypeError: str expected, not NoneType Traceback: File "/usr/local/lib/python3.9/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 584, in _run_script exec(code, module.dict) File "/root/xinglin-data/api-for-open-llm-main/streamlit-demo/streamlit_app.py", line 67, in main() File "/root/xinglin-data/api-for-open-llm-main/streamlit-demo/streamlit_app.py", line 10, in main from streamlit_gallery.components import chat, doc_chat File "/root/xinglin-data/api-for-open-llm-main/streamlit-demo/streamlit_gallery/components/init.py", line 2, in from .doc_chat.streamlit_app import main as doc_chat File "/root/xinglin-data/api-for-open-llm-main/streamlit-demo/streamlit_gallery/components/doc_chat/streamlit_app.py", line 9, in from .utils import DocServer, DOCQA_PROMPT File "/root/xinglin-data/api-for-open-llm-main/streamlit-demo/streamlit_gallery/components/doc_chat/utils.py", line 18, in os.environ["CO_API_URL"] = EMBEDDING_API_BASE File "/usr/lib/python3.9/os.py", line 684, in setitem value = self.encodevalue(value) File "/usr/lib/python3.9/os.py", line 756, in encode raise TypeError("str expected, not %s" % type(value).name)

xusenlinzy commented 5 months ago
cp .env.example .env

修改一下里面的EMBEDDING_API_BASE

chukangkang commented 5 months ago

CHAT_API_BASE = "http://172.22.6.54:7891/v1" # 聊天接口地址

SQL_CHAT_API_BASE = "http://172.22.6.54:7891/v1" # sql生成模型接口地址(可选)

TOOL_CHAT_API_BASE = "http://172.22.6.54:7891/v1" # 调用工具模型接口地址(可选)

EMBEDDING_API_BASE = "http://172.22.6.54:7891/v1" # 嵌入模型接口地址(可选)

API_KEY = "xxx" # 默认不需要配置

EMBEDDING_NAME = "m3e-large" # 使用本地嵌入模型的路径(可选,EMBEDDING_API_BASE 和 EMBEDDING_NAME 两种方式选一种即可)

SERPAPI_API_KEY = "" # 搜索功能需要

IPYKERNEL = "llm" # python解释器名称

INTERPRETER_CHAT_API_BASE = "http://172.22.6.54:7891/v1" # 代码解释器模型接口地址(可选)

chukangkang commented 5 months ago
cp .env.example .env

修改一下EMBEDDING_API_BASE里面的东西

您好,这里是这要配置嘛

xusenlinzy commented 5 months ago

是的

NCCurry30 commented 3 months ago
cp .env.example .env

修改一下EMBEDDING_API_BASE里面的东西

您好,这里是这要配置嘛

请问这个属性的配置是依据什么信息进行配置的呢