当前位置: 首页 > article >正文

‌GraphRAG 知识图谱,设置适配阿里云百炼平台实战教程【上】

1、首先使用uv新增一个Graphrag项目

uv init graphrag

2、切换进项目目录

cd graphrag

3、激活项目

source .venv/bin/activate

4、安装graphrag依赖

uv pip install graphrag

5、新增目录存在用于存放graphrag ,并且把微软的测试数据下载到目录下

 mkdir -p ./openl/input

curl https://www.gutenberg.org/cache/epub/24022/pg24022 -o ./openl/input/book.txt

6、初始化项目

graphrag init --root ./openl

7、修改./openl 目录下的settings.yaml 和 .env 文件(只要一个key,改成自己即可),标红部分属于修改或者添加

models:
  default_chat_model:
    type: openai_chat # or azure_openai_chat
    api_base: https://dashscope.aliyuncs.com/compatible-mode/v1
    # api_version: 2024-05-01-preview
    auth_type: api_key # or azure_managed_identity
    api_key: ${GRAPHRAG_API_KEY} # set this in the generated .env file
    # audience: "https://cognitiveservices.azure.com/.default"
    # organization: <organization_id>
    encoding_model: cl100k_base  # 关键参数,适配阿里百炼encoding
    model: qwen-plus #修改成千问的市场模型
    # deployment_name: <azure_model_deployment_name>
    # encoding_model: cl100k_base # automatically set by tiktoken if left undefined
    model_supports_json: true # recommended if this is available for your model.
    concurrent_requests: 25 # max number of simultaneous LLM requests allowed
    async_mode: threaded # or asyncio
    retry_strategy: native
    max_retries: -1                   # set to -1 for dynamic retry logic (most optimal setting based on server response)
    tokens_per_minute: 0              # set to 0 to disable rate limiting
    requests_per_minute: 0            # set to 0 to disable rate limiting
embedding_model 配置修改

  default_embedding_model:
    type: openai_embedding # or azure_openai_embedding
    api_base: https://dashscope.aliyuncs.com/compatible-mode/v1
    # api_version: 2024-05-01-preview

    auth_type: api_key # or azure_managed_identity
    api_key: ${GRAPHRAG_API_KEY}
    # audience: "https://cognitiveservices.azure.com/.default"
    # organization: <organization_id>
    encoding_model: cl100k_base  # 显式指定编码器
    model: text-embedding-v3     # 使用阿里云官方的嵌入模型名称
    # deployment_name: <azure_model_deployment_name>
    # encoding_model: cl100k_base # automatically set by tiktoken if left undefined
    model_supports_json: true # recommended if this is available for your model.
    concurrent_requests: 25 # max number of simultaneous LLM requests allowed
    async_mode: threaded # or asyncio
    retry_strategy: native
    max_retries: -1                   # set to -1 for dynamic retry logic (most optimal setting based on server response)
    tokens_per_minute: 0              # set to 0 to disable rate limiting
    requests_per_minute: 0            # set to 0 to disable rate limiting

就修改这个地方,执行索引,代码就能运行起来

graphrag index --root ./openl

最后结果是失败的


http://www.kler.cn/a/614855.html

相关文章:

  • 第三卷:覆舟山决战(73-108回)正反人物群像
  • 前端常问的宏观“大”问题详解(二)
  • Unity编辑器功能及拓展(3) —[Attribute]特性
  • Scala 数组
  • IDEA如何设置以新窗口打开新项目
  • 直流电机类型及其控制技术
  • 【Qt】Qt 类的继承与内存管理详解:QObject、信号槽与隐式共享
  • 【学习】前端工程化(webpack5)
  • 实战经验深度解析 | 博睿数据制造行业精选案例集发布!
  • DFS飞机降落
  • Mysql-经典实战案例(11):深度解析Sysbench压测(从入门到MySQL服务器性能验证)
  • 东芝Toshiba DP-4528A 打印机信息
  • nacos 外置mysql数据库操作(docker 环境)
  • Visual Studio中创建和配置设置文件(Settings.settings) - 详细步骤指南
  • Reidis介绍
  • 在分布式中如何应对网络分区
  • Postman 全局 Header 如何设置?全局设置了解一下
  • 【Goalng】第九弹-----文件操作、JSON处理
  • Linux Mem -- Slub内存分配器的几点疑问及解答
  • 【设计模式】抽象工厂模式(含与工厂方法模式的对比)