imbajin commented on code in PR #375: URL: https://github.com/apache/incubator-hugegraph-doc/pull/375#discussion_r1828881246
########## content/cn/docs/quickstart/hugegraph-ai.md: ########## @@ -9,140 +9,154 @@ hugegraph-ai 旨在探索 HugeGraph 与人工智能(AI)的融合,包括与 的 AI 能力提供全面支持。 ### 2 环境要求 -- python 3.8+ -- hugegraph 1.0.0+ +- python 3.9+ (better to use `3.10`) +- hugegraph-server 1.3+ ### 3 准备工作 -- 启动 HugeGraph 数据库,你可以通过 Docker 来实现。请参考这个[链接](https://hub.docker.com/r/hugegraph/hugegraph)获取指引。 -- 启动 gradio 交互式 demo,你可以通过以下命令启动,启动后打开 [http://127.0.0.1:8001](http://127.0.0.1:8001) -```bash -# ${PROJECT_ROOT_DIR} 为 hugegraph-ai 的根目录,需要自行配置 -export PYTHONPATH=${PROJECT_ROOT_DIR}/hugegraph-llm/src:${PROJECT_ROOT_DIR}/hugegraph-python-client/src -python3 ./hugegraph-llm/src/hugegraph_llm/utils/gradio_demo.py -``` -- 配置 HugeGraph 数据库连接信息和 LLM 模型信息,可以通过两种方式配置: - 1. 配置 `./hugegraph-llm/src/config/config.ini` 文件 - 2. 在 gradio 中,分别完成 LLM 和 HugeGraph 的配置后,点击 `Initialize configs`,将返回初始化后的完整配置文件。如图所示: -  -- 离线下载 NLTK stopwords -```bash -python3 ./hugegraph_llm/operators/common_op/nltk_helper.py -``` - -### 4 使用说明 -#### 4.1 通过 LLM 在 HugeGraph 中构建知识图谱 -##### 4.1.1 通过 gradio 交互式界面构建知识图谱 -- 参数说明: - - Text: 输入的文本。 - - Schema:接受以下两种类型的文本: - - 用户定义的 JSON 格式模式。 - - 指定 HugeGraph 图实例的名称,它将自动提取图的模式。 - - Disambiguate word sense:是否进行词义消除歧义。 - - Commit to hugegraph:是否将构建的知识图谱提交到 HugeGraph 服务器 - - +1. 启动HugeGraph数据库,可以通过 [Docker](https://hub.docker.com/r/hugegraph/hugegraph)/[Binary Package](https://hugegraph.apache.org/docs/download/download/) 运行它。 + 请参阅详细[文档](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#31-use-docker-container-convenient-for-testdev)以获取更多指导 +2. 克隆项目 + ```bash + git clone https://github.com/apache/incubator-hugegraph-ai.git + ``` +3. 安装 [hugegraph-python-client](../hugegraph-python-client) 和 [hugegraph_llm](src/hugegraph_llm) + ```bash + cd ./incubator-hugegraph-ai # better to use virtualenv (source venv/bin/activate) + pip install ./hugegraph-python-client + pip install -r ./hugegraph-llm/requirements.txt + ``` +4. 进入项目目录 + ```bash + cd ./hugegraph-llm/src + ``` +5. 启动 **Graph RAG** 的 gradio 交互 demo,可以使用以下命令运行,启动后打开 http://127.0.0.1:8001 + ```bash + python3 -m hugegraph_llm.demo.rag_demo.app + ``` + 默认主机为 `0.0.0.0` ,端口为 `8001` 。您可以通过传递命令行参数 `--host` 和 `--port` 来更改它们。 + ```bash + python3 -m hugegraph_llm.demo.rag_demo.app --host 127.0.0.1 --port 18001 + ``` +6. 启动 **Text2Gremlin** 的 gradio 交互演示,可以使用以下命令运行,启动后打开 http://127.0.0.1:8002。您还可以按上述方式更改默认主机 `0.0.0.0` 和端口 `8002` 。(🚧ing) Review Comment: fix the output (preview) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
