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

网站架构图wrix 网站开发

网站架构图,wrix 网站开发,网站搭建东莞,零食铺网站建设策划书GraphRAG的介绍 目前微软已经开源了GraphRAG的完整项目代码。对于某一些LLM的下游任务则可以使用GraphRAG去增强自己业务的RAG的表现。项目给出了两种使用方式#xff1a; 在打包好的项目状态下运行#xff0c;可进行尝试使用。在源码基础上运行#xff0c;适合为了下游任…GraphRAG的介绍 目前微软已经开源了GraphRAG的完整项目代码。对于某一些LLM的下游任务则可以使用GraphRAG去增强自己业务的RAG的表现。项目给出了两种使用方式 在打包好的项目状态下运行可进行尝试使用。在源码基础上运行适合为了下游任务的微调时使用。 如果需要利用Ollama部署本地大模型的可以参考我的另一篇博客 以下在通过自身的实践之后的给出对这两种方式的使用教程如果还有什么问题在评论区交流。 一、在源码基础上运行便于后续修改 1. 准备环境在终端运行 1创建虚拟环境已安装好anaconda此处建议使用python3.11: conda create -n GraphRAG python3.11 conda activate GraphRAG2. 下载源码并进入目录 git clone https://github.com/microsoft/graphrag.git cd graphrag3. 下载依赖并初始化项目 (1)安装poetry资源包管理工具及相关依赖 pip install poetry poetry install2初始化 poetry run poe index --init --root . 正确运行后此处会在graphrag目录下生成output、prompts、.env、settings.yaml文件 4. 下载并将待检索的文档document放入./input/目录下 mkdir ./input curl https://www.xxx.com/xxx.txt ./input/book.txt #示例可以替换为任何的txt文件5.修改相关配置文件 1修改.env文件默认是隐藏的中的api_key vi .env #进入.env文件并修改为自己的api_key修改后是全局配置后续不需要再次修改了 2修改settings.yaml文件修改其中的使用的llm模型和对应的api_base 提前说明因为GraphRAG需要多次调用大模型和Embedding默认使用的是openai的GPT-4,花费及其昂贵土豪当我没说配置也不需要改 建议大家可以使用其他模型或国产大模型的api 我这里使用的是agicto提供的APIkey(主要是新用户注册可以免费获取到10块钱的调用额度白嫖还是挺爽的)。我在这里主要就修改了API地址和调用模型的名称修改完成后的settings文件完整内容如下 代码行后有标记的为需要修改的地方如果用的是agicto则则不用修改settings.yaml encoding_model: cl100k_base skip_workflows: [] llm:api_key: ${GRAPHRAG_API_KEY}type: openai_chat # or azure_openai_chatmodel: deepseek-chat #修改model_supports_json: false # recommended if this is available for your model.api_base: https://api.agicto.cn/v1 #修改# max_tokens: 4000# request_timeout: 180.0# api_version: 2024-02-15-preview# organization: organization_id# deployment_name: azure_model_deployment_name# tokens_per_minute: 150_000 # set a leaky bucket throttle# requests_per_minute: 10_000 # set a leaky bucket throttle# max_retries: 10# max_retry_wait: 10.0# sleep_on_rate_limit_recommendation: true # whether to sleep when azure suggests wait-times# concurrent_requests: 25 # the number of parallel inflight requests that may be madeparallelization:stagger: 0.3# num_threads: 50 # the number of threads to use for parallel processingasync_mode: threaded # or asyncioembeddings:## parallelization: override the global parallelization settings for embeddingsasync_mode: threaded # or asynciollm:api_key: ${GRAPHRAG_API_KEY}type: openai_embedding # or azure_openai_embeddingmodel: text-embedding-3-small #修改api_base: https://api.agicto.cn/v1 #修改# api_base: https://instance.openai.azure.com# api_version: 2024-02-15-preview# organization: organization_id# deployment_name: azure_model_deployment_name# tokens_per_minute: 150_000 # set a leaky bucket throttle# requests_per_minute: 10_000 # set a leaky bucket throttle# max_retries: 10# max_retry_wait: 10.0# sleep_on_rate_limit_recommendation: true # whether to sleep when azure suggests wait-times# concurrent_requests: 25 # the number of parallel inflight requests that may be made# batch_size: 16 # the number of documents to send in a single request# batch_max_tokens: 8191 # the maximum number of tokens to send in a single request# target: required # or optionalchunks:size: 300overlap: 100group_by_columns: [id] # by default, we dont allow chunks to cross documentsinput:type: file # or blobfile_type: text # or csvbase_dir: inputfile_encoding: utf-8file_pattern: .*\\.txt$cache:type: file # or blobbase_dir: cache# connection_string: azure_blob_storage_connection_string# container_name: azure_blob_storage_container_namestorage:type: file # or blobbase_dir: output/${timestamp}/artifacts# connection_string: azure_blob_storage_connection_string# container_name: azure_blob_storage_container_namereporting:type: file # or console, blobbase_dir: output/${timestamp}/reports# connection_string: azure_blob_storage_connection_string# container_name: azure_blob_storage_container_nameentity_extraction:## llm: override the global llm settings for this task## parallelization: override the global parallelization settings for this task## async_mode: override the global async_mode settings for this taskprompt: prompts/entity_extraction.txtentity_types: [organization,person,geo,event]max_gleanings: 0summarize_descriptions:## llm: override the global llm settings for this task## parallelization: override the global parallelization settings for this task## async_mode: override the global async_mode settings for this taskprompt: prompts/summarize_descriptions.txtmax_length: 500claim_extraction:## llm: override the global llm settings for this task## parallelization: override the global parallelization settings for this task## async_mode: override the global async_mode settings for this task# enabled: trueprompt: prompts/claim_extraction.txtdescription: Any claims or facts that could be relevant to information discovery.max_gleanings: 0community_report:## llm: override the global llm settings for this task## parallelization: override the global parallelization settings for this task## async_mode: override the global async_mode settings for this taskprompt: prompts/community_report.txtmax_length: 2000max_input_length: 8000cluster_graph:max_cluster_size: 10embed_graph:enabled: false # if true, will generate node2vec embeddings for nodes# num_walks: 10# walk_length: 40# window_size: 2# iterations: 3# random_seed: 597832umap:enabled: false # if true, will generate UMAP embeddings for nodessnapshots:graphml: falseraw_entities: falsetop_level_nodes: falselocal_search:# text_unit_prop: 0.5# community_prop: 0.1# conversation_history_max_turns: 5# top_k_mapped_entities: 10# top_k_relationships: 10# max_tokens: 12000global_search:# max_tokens: 12000# data_max_tokens: 12000# map_max_tokens: 1000# reduce_max_tokens: 2000# concurrency: 326.构建GraphRAG的索引耗时较长取决于document的长度 poetry run poe index --root . 成功后如下 ⠋ GraphRAG Indexer ├── Loading Input (InputFileType.text) - 1 files loaded (0 filtered) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 0:00:00 ├── create_base_text_units ├── create_base_extracted_entities ├── create_summarized_entities ├── create_base_entity_graph ├── create_final_entities ├── create_final_nodes ├── create_final_communities ├── join_text_units_to_entity_ids ├── create_final_relationships ├── join_text_units_to_relationship_ids ├── create_final_community_reports ├── create_final_text_units ├── create_base_documents └── create_final_documentsAll workflows completed successfully.7.进行查询 此处GraphRAG提供了两种查询方式 1全局查询 更侧重全文理解 poetry run poe query --root . --method global 本文主要讲了什么 运行成功后可以看到输出结果 2局部查询更侧重细节 poetry run poe query --root . --method local 本文主要讲了什么 运行成功后可以看到输出结果 8. 总结 上述过程为已经验证过的如果报错可以检查是否正确配置api_key及api_base 二、在python包的基础上进行快速尝试 1. 环境安装 pip install graphrag2. 初始化项目 创建一个临时的文件夹graphrag用于存在运行时数据 mkdir ./graphrag/input curl https://www.xxx.com/xxx.txt ./myTest/input/book.txt // 这里是示例代码根据实际情况放入自己要测试的txt文本即可。 cd ./graphrag python -m graphrag.index --init3. 配置相关文件可参考上述的配置文件过程 4. 执行并构建图索引 python -m graphrag.index5.进行查询 1全局查询 python -m graphrag.query --root ../myTest --method global 这篇文章主要讲述了什么内容?2局部查询 python -m graphrag.query --root ../myTest --method local 这篇文章主要讲述了什么内容?总结 通过以上两种方式我们已经尝试了利用源码和python资源包进行配置GraphRAG的方式。大家可以按照自己的需求尝试以上两种方法。如果还有问题欢迎在评论区讨论
http://www.hkea.cn/news/14570453/

相关文章:

  • 做pc端网站流程镇江网站建设 找思创
  • 网站建设论文linux精通网站建设工资多少
  • 东莞市网络seo推广服务机构陕西seo经理
  • 做网站被骗怎么办wordpress demo怎么下载
  • 做网站的投入赣州网站建设策划
  • 现在都不用dw做网站了吗沈阳做网站的公司推荐
  • 苏州住建网站妇产科医生免费咨询
  • 做网站需要商标注册吗网站建设服务中企动力
  • asp.net网站的数据库配置华为手机软文范文300
  • 网站 水印宿迁网站建设流程
  • 电商网站开发环境怎么写谷歌搜索引擎镜像
  • 网站搭建软件d聚名网
  • 比较好的平面设计网站个人网站建设的步骤
  • 做有关兼职网站的需求分析网站服务器重做系统怎么做
  • 织梦cms做电影网站wordpress做图集
  • 网站生成app网页设计
  • 房产网站建设一个网站如何做桌面快捷链接
  • 小说网站seo排名怎么做怎么做正规网站
  • 望京做网站的公司哪家好嘉兴有哪些做网站的公司
  • 个人网站 cmswordpress优秀的主题
  • 网站共用数据库苏州网站建设logo
  • 深圳美容网站建微网站案例
  • 做谷歌推广对网站的要求网站建设费用如何列支
  • 网站搭建技术了解网络营销相应的网站
  • 网站帮助文档怎么写定制网站制作
  • php商城网站开发网站注册流程和费用
  • 盐城高端网站制作公司施工企业在施工过程中发现设计文件和图纸有差错的应当
  • 网站默认数据库地址新冠咳嗽吃什么药
  • 答辩学网站开发知识能力要求免费建立网页
  • 网站建设 推广 公司壹起航网络推广的目标