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

毕设做网站些什么比较简单西安抖音seo

毕设做网站些什么比较简单,西安抖音seo,吉林企业网络推广方法,网站模板建设教程好久没有体验新技术了,今天来玩一下GraphRAG 顾名思义,一种检索增强的方法,利用图谱来实现RAG 1.配置环境 conda create -n GraphRAG python3.11 conda activate GraphRAG pip install graphrag 2.构建GraphRAG mkdir -p ./ragtest/i…

好久没有体验新技术了,今天来玩一下GraphRAG

顾名思义,一种检索增强的方法,利用图谱来实现RAG

1.配置环境

conda  create -n GraphRAG python=3.11
conda activate  GraphRAG
pip install graphrag

2.构建GraphRAG 

mkdir -p ./ragtest/input
#这本书详细介绍了如何通过提示工程技巧来引导像ChatGPT这样的语言模型生成高质量的文本。
curl https://raw.githubusercontent.com/win4r/mytest/main/book.txt > ./ragtest/input/book.txt#初始化空间
python3 -m graphrag.index --init --root ./ragtest然后填写.env里面的内容,可以直接写openai的key,如下GRAPHRAG_API_KEY=sk-ZZvxAMzrl.....................或者可以写GRAPHRAG_API_KEY=ollama
1)如果是ollama的话
进入settings.yaml里面
# api_base: https://<instance>.openai.azure.com
取消注释,并改为 api_base: http://127.0.0.1:11434/v1
同时将model改为llama3(你自己的ollama模型)
2)用key的话,将模型改为model: gpt-3.5-turbo-1106
文档28行还有一个词嵌入模型,根据自己的选择更改
但是这个embeddings模型只能用openai的
如果上面用的是ollama的模型,这里要将api_base改一下,改为api_base: https://api.openai.com/v1
不然当进行到这一步的时候,会继承访问上面ollama设置的base——url,从而产生报错
#进行索引操作
python3 -m graphrag.index --root ./ragtest构建完成
encoding_model: cl100k_base
skip_workflows: []
llm:api_key: ${GRAPHRAG_API_KEY}type: openai_chat # or azure_openai_chatmodel: llama3model_supports_json: true # recommended if this is available for your model.# max_tokens: 4000# request_timeout: 180.0api_base: http://192.168.1.138:11434/v1# 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-smallapi_base: https://api.openai.com/v1# 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 don't allow chunks to cross documentsinput:type: file # or blobfile_type: text # or csvbase_dir: "input"file_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_name>storage:type: file # or blobbase_dir: "output/${timestamp}/artifacts"# connection_string: <azure_blob_storage_connection_string># container_name: <azure_blob_storage_container_name>reporting:type: file # or console, blobbase_dir: "output/${timestamp}/reports"# connection_string: <azure_blob_storage_connection_string># container_name: <azure_blob_storage_container_name>entity_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.txt"entity_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.txt"max_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.txt"description: "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.txt"max_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

3. 全局检索和本地检索

python3 -m graphrag.query \
--root ./ragtest \
--method global \
"show me some Prompts about Interpretable Soft Prompts."python3 -m graphrag.query \
--root ./ragtest \
--method local \
"show me some Prompts about Knowledge Generation."

4.可视化

#pip3 install chainlitimport chainlit as cl
import subprocess
import shlex@cl.on_chat_start
def start():cl.user_session.set("history", [])@cl.on_message
async def main(message: cl.Message):history = cl.user_session.get("history")# 从 Message 对象中提取文本内容query = message.content# 构建命令cmd = ["python3", "-m", "graphrag.query","--root", "./ragtest","--method", "local",]# 安全地添加查询到命令中cmd.append(shlex.quote(query))# 运行命令并捕获输出try:result = subprocess.run(cmd, capture_output=True, text=True, check=True)output = result.stdout# 提取 "SUCCESS: Local Search Response:" 之后的内容response = output.split("SUCCESS: Local Search Response:", 1)[-1].strip()history.append((query, response))cl.user_session.set("history", history)await cl.Message(content=response).send()except subprocess.CalledProcessError as e:error_message = f"An error occurred: {e.stderr}"await cl.Message(content=error_message).send()if __name__ == "__main__":cl.run()

http://www.hrbkazy.com/news/24877.html

相关文章:

  • 广州学生做网站黑科技引流工具
  • 网站名称没有排名2023全民核酸又开始了
  • 政府网站建设回顾公司查询
  • 做网站文章要一篇一篇的写吗优秀网页设计作品
  • 找公司做网站多少钱武汉网站seo公司
  • 旧域名怎么做新网站什么时候网络推广
  • 福州seo按天付费网站建设推广优化
  • 做网站的一般步骤seo快速排名关键词
  • wordpress adminajax.php搜索引擎优化的基本方法
  • 自己做网站系统必应搜索引擎首页
  • 做网站需要学会哪些北京网站优化排名
  • 企业网站优化设计应该把什么放在首位seo网站优化培训价格
  • 重庆电商网站友缘在线官网
  • wordpress安装完成访问不了seo标签怎么优化
  • 深圳定制建设网站微博营销成功案例8个
  • 有经验的南昌网站制作外贸网络营销推广
  • 实验室网站建设的意义网络营销的五大优势
  • 北京建网站公司推广标题怎么写
  • 老河口建设局网站杭州seo网站
  • 静态网页制作总结王通seo赚钱培训
  • 济南网站建设哪家公司好网站优化公司收费
  • 模板网站怎么做网站seo置顶 乐云践新专家
  • 广西两学一做网站武汉seo首页优化技巧
  • b站直接进入链接2023百度推广公司哪家比较靠谱
  • 专门做装修的网站有哪些交换链接的例子
  • 美观网站建设物美价廉java培训机构十强
  • 上海网站优化哪家好seo视频
  • seo网站开发零基础能做网络推广吗
  • wordpress两个站合并百度推广网页版
  • 寻找做项目的网站宁波如何做抖音seo搜索优化