搭建智能RAG问题

早就试了,一样的报错

要不您咨询一下百炼的客服试试,这个问题有些奇怪,我们之前自己内部测试以及现场活动时用户试用都没有遇到过这个问题,我也很好奇是什么原因导致的。

另外,您能用 http 调试工具例如 postman 来尝试发送请求看看能否成功吗?

删除 .cache
poetry install

yyai@ubuntu:~/ai-workshop-2024$ poetry install                      
Creating virtualenv ai-workshop-MjiVjgAq-py3.10 in /data/yyai/.cache/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 87 installs, 0 updates, 0 removals

  - Installing certifi (2024.8.30)
  - Installing charset-normalizer (3.4.0)
  - Installing exceptiongroup (1.2.2)
  - Installing h11 (0.14.0)
  - Installing idna (3.10)
  - Installing sniffio (1.3.1)
  - Installing typing-extensions (4.12.2)
  - Installing urllib3 (2.2.3)
  - Installing annotated-types (0.7.0)
  - Installing anyio (4.6.0)
  - Installing httpcore (1.0.6)
  - Installing pydantic-core (2.23.4)
  - Installing requests (2.32.3)
  - Installing attrs (24.2.0)
  - Installing httpx (0.27.2)
  - Installing jsonpointer (3.0.0)
  - Installing orjson (3.10.7)
  - Installing pydantic (2.9.2)
  - Installing requests-toolbelt (1.0.0)
  - Installing rpds-py (0.20.0)
  - Installing frozenlist (1.4.1)
  - Installing jsonpatch (1.33)
  - Installing langsmith (0.1.132)
  - Installing multidict (6.1.0)
  - Installing packaging (24.1)
  - Installing propcache (0.2.0)
  - Installing pyyaml (6.0.2)
  - Installing referencing (0.35.1)
  - Installing tenacity (8.5.0)
  - Installing aiohappyeyeballs (2.4.3)
  - Installing aiosignal (1.3.1)
  - Installing async-timeout (4.0.3)
  - Installing greenlet (3.1.1)
  - Installing jsonschema-specifications (2024.10.1)
  - Installing langchain-core (0.3.15)
  - Installing markupsafe (3.0.1)
  - Installing mdurl (0.1.2)
  - Installing mypy-extensions (1.0.0)
  - Installing six (1.16.0)
  - Installing smmap (5.0.1)
  - Installing yarl (1.14.0)
  - Installing aiohttp (3.10.9)
  - Installing distro (1.9.0)
  - Installing gitdb (4.0.11)
  - Installing jinja2 (3.1.4)
  - Installing jiter (0.6.1)
  - Installing jsonschema (4.23.0)
  - Installing langchain-text-splitters (0.3.0)
  - Installing markdown-it-py (3.0.0)
  - Installing marshmallow (3.22.0)
  - Installing narwhals (1.9.2)
  - Installing numpy (1.26.4)
  - Installing pygments (2.18.0)
  - Installing pymysql (1.1.1)
  - Installing python-dateutil (2.9.0.post0)
  - Installing python-dotenv (1.0.1)
  - Installing pytz (2024.2)
  - Installing regex (2024.9.11)
  - Installing sqlalchemy (2.0.35)
  - Installing tqdm (4.66.5)
  - Installing typing-inspect (0.9.0)
  - Installing tzdata (2024.2)
  - Installing aiomysql (0.2.0)
  - Installing altair (5.4.1)
  - Installing blinker (1.8.2)
  - Installing cachetools (5.5.0)
  - Installing click (8.1.7)
  - Installing dataclasses-json (0.6.7)
  - Installing gitpython (3.1.43)
  - Installing httpx-sse (0.4.0)
  - Installing langchain (0.3.7)
  - Installing openai (1.51.2)
  - Installing pandas (2.2.3)
  - Installing pillow (10.4.0)
  - Installing protobuf (5.28.2)
  - Installing pyarrow (17.0.0)
  - Installing pydantic-settings (2.5.2)
  - Installing pydeck (0.9.1)
  - Installing rich (13.9.2)
  - Installing tiktoken (0.8.0)
  - Installing toml (0.10.2)
  - Installing tornado (6.4.1)
  - Installing watchdog (5.0.3)
  - Installing langchain-community (0.3.5)
  - Installing langchain-openai (0.2.2)
  - Installing pyobvector (0.1.14)
  - Installing streamlit (1.39.0)
yyai@ubuntu:~/ai-workshop-2024$
yyai@ubuntu:~/ai-workshop-2024$ poetry run python embed_docs.py --doc_base doc_repos/oceanbase-doc/zh-CN/640.ob-vector-search
Traceback (most recent call last):
  File "/data/yyai/ai-workshop-2024/embed_docs.py", line 8, in <module>
    from langchain_community.vectorstores import OceanBase
ImportError: cannot import name 'OceanBase' from 'langchain_community.vectorstores' (/data/yyai/.cache/pypoetry/virtualenvs/ai-workshop-MjiVjgAq-py3.10/lib/python3.10/site-packages/langchain_community/vectorstores/__init__.py)
yyai@ubuntu:~/ai-workshop-2024$ poetry show | grep -i lang               
langchain                 0.3.9       Building applications with LLMs throu...
langchain-community       0.3.5       Community contributed LangChain integ...
langchain-core            0.3.21      Building applications with LLMs throu...
langchain-openai          0.2.10      An integration package connecting Ope...
langchain-text-splitters  0.3.2       LangChain text splitting utilities
langsmith                 0.1.147     Client library to connect to the Lang...
yyai@ubuntu:~/ai-workshop-2024$ 

langchain-community 模块明明有安装 还报找不到的错误。莫名奇妙
信心快被消耗完了

只是感觉poetry 不是很可靠,就按同样的步骤重新走一遍,结果报的错误 很可能不一样。

您能试试直接根据官方文档调用能否成功吗? 像下面这张图里所示的样子,直接用 curl,填入 api-key 之后在命令行里发送。

参考文档 阿里云登录 - 欢迎登录阿里云,安全稳定的云计算服务平台

您有修改 pyproject.toml 文件吗?我们提供的 pyproject.toml 里面的 langchain-community 是引用的我们自己的仓库,如果修改了这一项会出现找不到 OceanBase VectorStore 的问题

可以正常调用

好的,那说明模型调用服务正常开通了。我们拉个钉钉群沟通一下吧,我怎么能加上您的钉钉呢?

没有动,文件内容如下:

$ cat pyproject.toml 
[tool.poetry]
name = "ai-workshop"
version = "0.1.0"
description = ""
authors = ["yuyi <yuyi.wsy@oceanbase.com>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = ">=3.9,<3.9.7 || >3.9.7,<4.0"
langchain = "^0.3.0"
langchain-openai = "^0.2.0"
streamlit = "^1.38.0"
pyobvector = "^0.1.14"
langchain-community = "0.3.5"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[[tool.poetry.source]]
name = "PyPI"
priority = "supplemental"

[[tool.poetry.source]]
name = "aliyun"
url = "https://mirrors.aliyun.com/pypi/simple/"
priority = "primary"

您克隆的仓库分支是哪一个呀?仓库里的 pyproject.toml 应该是下面这样的

建议您克隆下面这个代码仓库 tongyi 分支的代码,并且按照这个仓库的 README 步骤进行操作

很棒