GraphRAG-入门到实战:3-GraphRAG问答-全局搜索-DRIFT结合局部搜索和社区信息的搜索

GraphRAG 在 PostgreSQL 上的实践 其次,单纯的 Rap 缺乏对知识库的整体理解。例如,输入的文档可能仅聚焦软件某一方面或全为法律条文解释单一事件。若询问笼统问题,如“软件用途”或“黄芪类似中药的功效与原理”,即使提取 Top20 或 Top50 文档,也仅得零散细节,缺乏总结。总结需从零散知识中构建:获取 10-20 条相关信息后,归纳出更广义的观点,进而层层构建类似图谱中的概念。第三步是 Graph 特有的有趣过程,涉及社群(Community)概念。 阅读详情
import os
from dotenv import load_dotenv
load_dotenv()
True
from openai import OpenAI
# 实例化客户端
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
# 调用 GPT-4o-mini 模型
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "user", "content": "你好,好久不见!"}
    ]
)
# 输出生成的响应内容
print(response.choices[0].message.content)
你好!很高兴再次见到你!你最近怎么样?有什么想聊的吗?
2、全局搜索 Global Search

通过利用社区总结来进行全局性推理。

全局搜索方法通过以 map-reduce 方式搜索所有 AI 生成的社区报告来生成答案。这是一种资源密集型方法,但对于需要整体理解数据集的问题(例如,本笔记中提到的草药中最重要的价值是什么?),通常能提供良好的答案。

import os

import pandas as pd
import tiktoken

from graphrag.config.enums import ModelType
from graphrag.config.models.language_model_config import LanguageModelConfig
from graphrag.language_model.manager import ModelManager
from graphrag.query.indexer_adapters import (
    read_indexer_communities,
    read_indexer_entities,
    read_indexer_reports,
)
from graphrag.query.structured_search.global_search.community_context import (
    GlobalCommunityContext,
)
from graphrag.query.structured_search.global_search.search import GlobalSearch
#配置模型参数
api_key = os.environ.get("OPENAI_API_KEY")
llm_model = "gpt-4o-mini"
# llm_model = "gpt-4o"
embedding_model = "text-embedding-3-small"
config = LanguageModelConfig(
    api_key=api_key,
    type=ModelType.OpenAIChat,
    model=llm_model,
    max_retries=20,
)
model = ModelManager().get_or_create_chat_model(
    name="global_search",
    model_type=ModelType.OpenAIChat,
    config=config,
)

token_encoder = tiktoken.encoding_for_model(llm_model)
加载社区报告作为全局搜索的上下文
  • 从 GraphRAG 的 community_reports 表中加载所有社区报告,用作全局搜索的上下文数据。
  • 从 GraphRAG 的实体表中加载实体,用于计算上下文排名的社区权重。请注意,这是可选的(如果没有提供实体,我们将不计算社区权重,而仅使用社区报告表中的 rank 属性进行上下文排名)。
  • 从 GraphRAG 的社区表中加载所有社区,用于重建社区图谱层次结构,以便进行动态社区选择。
# 从索引管道生成的 parquet 文件
INPUT_DIR = "/Users/dcs/study/ragtest/output"
COMMUNITY_TABLE = "communities"
COMMUNITY_REPORT_TABLE = "community_reports"
ENTITY_TABLE = "entities"

# 莱顿 Leiden 社区层级结构中的社区级别,我们将从中加载社区报告
# 值越高,意味着我们使用来自更细粒度社区的报告(但计算成本会更高)
COMMUNITY_LEVEL = 2
community_df = pd.read_parquet(f"{INPUT_DIR}/{COMMUNITY_TABLE}.parquet")
entity_df = pd.read_parquet(f"{INPUT_DIR}/{ENTITY_TABLE}.parquet")
report_df = pd.read_parquet(f"{INPUT_DIR}/{COMMUNITY_REPORT_TABLE}.parquet")

communities = read_indexer_communities(community_df, report_df)
reports = read_indexer_reports(report_df, community_df, COMMUNITY_LEVEL)
entities = read_indexer_entities(entity_df, community_df, COMMUNITY_LEVEL)

print(f"Total report count: {len(report_df)}")
print(
    f"Report count after filtering by community level {COMMUNITY_LEVEL}: {len(reports)}"
)

report_df.head()
Total report count: 5
Report count after filtering by community level 2: 5
idhuman_readable_idcommunitylevelparentchildrentitlesummaryfull_contentrankrating_explanationfindingsfull_content_jsonperiodsize
016dfc1a65704472da48ffb4e0a4892643311[]Porsche Dealership Network in ChinaThe community centers around Porsche, a luxury...# Porsche Dealership Network in China\n\nThe c...7.5The impact severity rating is high due to Pors...[{'explanation': 'Porsche is a well-establishe...{\n "title": "Porsche Dealership Network in...2025-05-169
1e9da0e9891604c7ba6447e6540f517e74411[]Tianjin Airport Porsche Center and TianjinThe community centers around the Tianjin Airpo...# Tianjin Airport Porsche Center and Tianjin\n...6.0The impact severity rating is moderate due to ...[{'explanation': 'The Tianjin Airport Porsche ...{\n "title": "Tianjin Airport Porsche Cente...2025-05-162
20cd453e8b7044d2d83f65a02cb2bc52d000-1[]百小灵 and Its Integrated ServicesThe community centers around 百小灵, an intellige...# 百小灵 and Its Integrated Services\n\nThe commu...7.5The impact severity rating is high due to the ...[{'explanation': '百小灵 serves as the core entit...{\n "title": "百小灵 and Its Integrated Servic...2025-05-164
3dae335f202224c27aa303bd0fcac3073110-1[3, 4]Porsche Dealership Network in ChinaThe community centers around Porsche, a luxury...# Porsche Dealership Network in China\n\nThe c...8.5The impact severity rating is high due to the ...[{'explanation': 'Porsche is a well-establishe...{\n "title": "Porsche Dealership Network in...2025-05-1611
4dd50d0d4d96d447995bb129030028c71220-1[]Baideli Group and Key LeadershipThe community centers around Baideli Group, a ...# Baideli Group and Key Leadership\n\nThe comm...7.5The impact severity rating is high due to Baid...[{'explanation': 'Zhou Xiaobo serves as the Ch...{\n "title": "Baideli Group and Key Leaders...2025-05-1610
from graphrag.config.enums import ModelType
from graphrag.config.models.language_model_config import LanguageModelConfig
from graphrag.language_model.manager import ModelManager

chat_config = LanguageModelConfig(
    api_key=os.environ.get("OPENAI_API_KEY"),
    type=ModelType.OpenAIChat,
    model=llm_model,
    max_retries=20,
)
chat_model = ModelManager().get_or_create_chat_model(
    name="global_search",
    model_type=ModelType.OpenAIChat,
    config=chat_config,
)

token_encoder = tiktoken.encoding_for_model(llm_model)

embedding_config = LanguageModelConfig(
    api_key=os.environ.get("OPENAI_API_KEY"),
    type=ModelType.OpenAIEmbedding,
    model=embedding_model,
    max_retries=20,
)

text_embedder = ModelManager().get_or_create_embedding_model(
    name="global_search_embedding",
    model_type=ModelType.OpenAIEmbedding,
    config=embedding_config,
)
# 根据社区报告构建全局背景
context_builder = GlobalCommunityContext(
    community_reports=reports,
    communities=communities,
    entities=entities,  # 如果您不想使用社区权重进行排名,则默认为 None
    token_encoder=token_encoder,
)
# 执行全局搜索

# 配置全局搜索参数
context_builder_params = {
    "use_community_summary": False,  # False 表示使用完整的社区报告。True 表示使用社区简短摘要。
    "shuffle_data": True,
    "include_community_rank": True,
    "min_community_rank": 0,
    "community_rank_name": "rank",
    "include_community_weight": True,
    "community_weight_name": "occurrence weight",
    "normalize_community_weight": True,
    "max_tokens": 8000,  # 根据您模型上的令牌限制进行更改(如果您使用的模型限制为 8k,则良好的设置可能是 5000)
    "context_name": "Reports",
}

map_llm_params = {
    "max_tokens": 800,
    "temperature": 0.0,
    "response_format": {"type": "json_object"}
}

reduce_llm_params = {
    "max_tokens": 1000, # 根据您模型上的令牌限制进行更改(如果您使用的模型限制为 8k,则良好的设置可能是 1000-1500)
    "temperature": 0.0,
    
}
# 构建全局搜索引擎
search_engine = GlobalSearch(
    model=model,
    context_builder=context_builder,
    token_encoder=token_encoder,
    max_data_tokens=8000,  # 根据您模型上的令牌限制进行更改(如果您使用的模型限制为 8k,则良好的设置可能是 5000)
    map_llm_params=map_llm_params,
    reduce_llm_params=reduce_llm_params,
    allow_general_knowledge=False,  # 将其设置为 True 将添加指令以鼓励 LLM 在响应中融入一般知识,这可能会增加幻觉,但在某些用例中可能会有用。
    json_mode=True,  # 如果您的 LLM 模型不支持 JSON 模式,请将其设置为 False。
    context_builder_params=context_builder_params,
    concurrent_coroutines=32,
    response_type="multiple paragraphs", 
    # 描述响应类型和格式的自由格式文本,可以是任何内容,例如优先列表、单段、多段、多页报告
)
result = await search_engine.search("百得利集团 企业概况?")

print(result.response)
print(search_engine.reduce_system_prompt)
---Role---

You are a helpful assistant responding to questions about a dataset by synthesizing perspectives from multiple analysts.


---Goal---

Generate a response of the target length and format that responds to the user's question, summarize all the reports from multiple analysts who focused on different parts of the dataset.

Note that the analysts' reports provided below are ranked in the **descending order of importance**.

If you don't know the answer or if the provided reports do not contain sufficient information to provide an answer, just say so. Do not make anything up.

The final response should remove all irrelevant information from the analysts' reports and merge the cleaned information into a comprehensive answer that provides explanations of all the key points and implications appropriate for the response length and format.

Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.

The response shall preserve the original meaning and use of modal verbs such as "shall", "may" or "will".

The response should also preserve all the data references previously included in the analysts' reports, but do not mention the roles of multiple analysts in the analysis process.

**Do not list more than 5 record ids in a single reference**. Instead, list the top 5 most relevant record ids and add "+more" to indicate that there are more.

For example:

"Person X is the owner of Company Y and subject to many allegations of wrongdoing [Data: Reports (2, 7, 34, 46, 64, +more)]. He is also CEO of company X [Data: Reports (1, 3)]"

where 1, 2, 3, 7, 34, 46, and 64 represent the id (not the index) of the relevant data record.

Do not include information where the supporting evidence for it is not provided.

Limit your response length to {max_length} words.

---Target response length and format---

{response_type}


---Analyst Reports---

{report_data}


---Goal---

Generate a response of the target length and format that responds to the user's question, summarize all the reports from multiple analysts who focused on different parts of the dataset.

Note that the analysts' reports provided below are ranked in the **descending order of importance**.

If you don't know the answer or if the provided reports do not contain sufficient information to provide an answer, just say so. Do not make anything up.

The final response should remove all irrelevant information from the analysts' reports and merge the cleaned information into a comprehensive answer that provides explanations of all the key points and implications appropriate for the response length and format.

The response shall preserve the original meaning and use of modal verbs such as "shall", "may" or "will".

The response should also preserve all the data references previously included in the analysts' reports, but do not mention the roles of multiple analysts in the analysis process.

**Do not list more than 5 record ids in a single reference**. Instead, list the top 5 most relevant record ids and add "+more" to indicate that there are more.

For example:

"Person X is the owner of Company Y and subject to many allegations of wrongdoing [Data: Reports (2, 7, 34, 46, 64, +more)]. He is also CEO of company X [Data: Reports (1, 3)]"

where 1, 2, 3, 7, 34, 46, and 64 represent the id (not the index) of the relevant data record.

Do not include information where the supporting evidence for it is not provided.

Limit your response length to {max_length} words.

---Target response length and format---

{response_type}

Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.
from IPython.display import Markdown
display(Markdown(result.response))
# 检查用于构建 LLM 响应上下文的数据
result.context_data["reports"]
idtitleoccurrence weightcontentrank
02Baideli Group and Key Leadership1.000000# Baideli Group and Key Leadership\n\nThe comm...7.5
11Porsche Dealership Network in China0.666667# Porsche Dealership Network in China\n\nThe c...8.5
20百小灵 and Its Integrated Services0.666667# 百小灵 and Its Integrated Services\n\nThe commu...7.5
34Tianjin Airport Porsche Center and Tianjin0.666667# Tianjin Airport Porsche Center and Tianjin\n...6.0
43Porsche Dealership Network in China0.333333# Porsche Dealership Network in China\n\nThe c...7.5
# 检查 LLM 调用和令牌的数量
print(
    f"LLM calls: {result.llm_calls}. Prompt tokens: {result.prompt_tokens}. Output tokens: {result.output_tokens}."
)
LLM calls: 2. Prompt tokens: 3798. Output tokens: 385.
3、DRIFT 搜索

结合局部搜索和社区信息,提供更准确和相关的答案。

DRIFT Search 通过在搜索过程中引入社区信息,为本地搜索查询引入了一种新方法。这极大地扩展了查询的起点,并使得最终答案能够检索和使用更丰富的事实。这一新增功能扩展了 GraphRAG 查询引擎,为本地搜索提供了更全面的选项,它利用社区洞察将查询细化为详细的后续问题。

import os
from pathlib import Path

import pandas as pd
import tiktoken

from graphrag.config.enums import ModelType
from graphrag.config.models.drift_search_config import DRIFTSearchConfig
from graphrag.config.models.language_model_config import LanguageModelConfig
from graphrag.language_model.manager import ModelManager
from graphrag.query.indexer_adapters import (
    read_indexer_entities,
    read_indexer_relationships,
    read_indexer_report_embeddings,
    read_indexer_reports,
    read_indexer_text_units,
)
from graphrag.query.structured_search.drift_search.drift_context import (
    DRIFTSearchContextBuilder,
)
from graphrag.query.structured_search.drift_search.search import DRIFTSearch
from graphrag.vector_stores.lancedb import LanceDBVectorStore

INPUT_DIR = "/Users/dcs/study/ragtest/output"
LANCEDB_URI = f"{INPUT_DIR}/lancedb"

COMMUNITY_REPORT_TABLE = "community_reports"
COMMUNITY_TABLE = "communities"
ENTITY_TABLE = "entities"
RELATIONSHIP_TABLE = "relationships"
COVARIATE_TABLE = "covariates"
TEXT_UNIT_TABLE = "text_units"
COMMUNITY_LEVEL = 2


# 读取节点表以获取社区和度数据
entity_df = pd.read_parquet(f"{INPUT_DIR}/{ENTITY_TABLE}.parquet")
community_df = pd.read_parquet(f"{INPUT_DIR}/{COMMUNITY_TABLE}.parquet")

print(f"Entity df columns: {entity_df.columns}")

entities = read_indexer_entities(entity_df, community_df, COMMUNITY_LEVEL)

# 将描述嵌入加载到内存中的 lancedb 向量存储
# 要连接到远程数据库,请指定 URL 和端口值。
description_embedding_store = LanceDBVectorStore(
    collection_name="default-entity-description",
)
description_embedding_store.connect(db_uri=LANCEDB_URI)

full_content_embedding_store = LanceDBVectorStore(
    collection_name="default-community-full_content",
)
full_content_embedding_store.connect(db_uri=LANCEDB_URI)

print(f"Entity count: {len(entity_df)}")
entity_df.head()

relationship_df = pd.read_parquet(f"{INPUT_DIR}/{RELATIONSHIP_TABLE}.parquet")
relationships = read_indexer_relationships(relationship_df)

print(f"Relationship count: {len(relationship_df)}")
relationship_df.head()

text_unit_df = pd.read_parquet(f"{INPUT_DIR}/{TEXT_UNIT_TABLE}.parquet")
text_units = read_indexer_text_units(text_unit_df)

print(f"Text unit records: {len(text_unit_df)}")
text_unit_df.head()
Entity df columns: Index(['id', 'human_readable_id', 'title', 'type', 'description',
       'text_unit_ids', 'frequency', 'degree', 'x', 'y'],
      dtype='object')
Entity count: 60
Relationship count: 48
Text unit records: 5
idhuman_readable_idtextn_tokensdocument_idsentity_idsrelationship_idscovariate_ids
0fcfd223135ec68d9db3de6d96a9acf067bba754a821bdf...1---\n### **百得利集团(BetterLife Group)详细介绍**\n\n--...1200[4ad21bc3e51b59a81cf6154e067933779d25209edb4dd...[354cf6e2-6a14-46e0-bca6-7ca915a1bdc6, a9a38cd...[929afb7c-390e-4d90-8ef2-81125c87cf9e, 11a9cd3...[]
126d628a6139e04a0a88e7f8e2ef4514dc7623e42272d5d...2---------------------------------------------...1200[4ad21bc3e51b59a81cf6154e067933779d25209edb4dd...[9fbafca4-0501-4767-86cc-c960f7627a6f, 0c20e92...[0c92d085-5daf-48ca-9be4-c30b7f12fcea, 61fcfe2...[]
2c3cf21b0ec18829069de824ee4584b34bdcff45be7b910...3">杭州市滨江区江陵路1780号</font> | <font style="color:r...1200[4ad21bc3e51b59a81cf6154e067933779d25209edb4dd...[83797f98-c10a-46a5-9b3c-89b3f8f70307, 9adbd33...[de2fba5b-952b-49c6-accf-f74378c5c180, 1239e9f...[]
397aca591d3a56fb8a6427a818355a75a792a39da1fd488...43. **行业荣誉** \n - 连续多年入选“中国汽车经销商百强”。 \n -...1200[4ad21bc3e51b59a81cf6154e067933779d25209edb4dd...[e05c66d7-cbdc-4c72-a622-43a632c710dc, 9c3824e...[e4952720-c6e7-4222-be2b-8a073228a697, 0be14de...[]
44b96c621329960f421f7a922195c1f6590b8314ce5ee18...5物流跟踪)、</font>**保险平台 **<font style="color:rgb(4...630[4ad21bc3e51b59a81cf6154e067933779d25209edb4dd...[9c3824ef-034a-48cb-a7ee-8cde18650b04, 62c8ae2...[d680e598-61c0-4375-a676-51d19d422002, 7a6571e...[]
chat_config = LanguageModelConfig(
    api_key=api_key,
    type=ModelType.OpenAIChat,
    model=llm_model,
    max_retries=20,
)
chat_model = ModelManager().get_or_create_chat_model(
    name="DRIFT_search",
    model_type=ModelType.OpenAIChat,
    config=chat_config,
)

token_encoder = tiktoken.encoding_for_model(llm_model)

embedding_config = LanguageModelConfig(
    api_key=api_key,
    type=ModelType.OpenAIEmbedding,
    model=embedding_model,
    max_retries=20,
)

text_embedder = ModelManager().get_or_create_embedding_model(
    name="DRIFT_search_embedding",
    model_type=ModelType.OpenAIEmbedding,
    config=embedding_config,
)
def read_community_reports(
    input_dir: str,
    community_report_table: str = COMMUNITY_REPORT_TABLE,
):
    """嵌入社区报告的全部内容,并将嵌入的 DataFrame 保存到输出路径。"""
    input_path = Path(input_dir) / f"{community_report_table}.parquet"
    return pd.read_parquet(input_path)


report_df = read_community_reports(INPUT_DIR)
reports = read_indexer_reports(
    report_df,
    community_df,
    COMMUNITY_LEVEL,
    content_embedding_col="full_content_embeddings",
)
read_indexer_report_embeddings(reports, full_content_embedding_store)
drift_params = DRIFTSearchConfig(
    temperature=0,
    max_tokens=1200,
    primer_folds=1,
    drift_k_followups=3,
    n_depth=3,
    n=1,
)

context_builder = DRIFTSearchContextBuilder(
    model=chat_model,
    text_embedder=text_embedder,
    entities=entities,
    relationships=relationships,
    reports=reports,
    entity_text_embeddings=description_embedding_store,
    text_units=text_units,
    token_encoder=token_encoder,
    config=drift_params,
)

search = DRIFTSearch(
    model=chat_model, context_builder=context_builder, token_encoder=token_encoder
)
resp = await search.search("百得利集团 企业概况?")
resp.response
print(resp.context_data)
【项目】GraphRAG基于知识图谱的检索增强技术-实战入门 GraphRAG基于知识图谱的检索增强技术-实战入门 阅读详情

相关推荐

Flutter + shorebird 热更新+自定义cdn下载

本文介绍了如何优化Flutter热更新方案Shorebird在国内网络环境下的使用体验。Shorebird默认使用海外CDN存在下载慢、连接不稳定等问题,建议将补丁包上传至国内CDN(如阿里云OSS)。文章详细讲解了Shorebird环境配置、项目集成、构建发布流程,并重点说明了如何修改客户端代码实现自定义补丁下载逻辑。通过替换默认下载器,将补丁下载地址指向国内CDN,可显著提升下载速度和稳定性。这种方案既保留了Shorebird的热更新能力,又解决了国内网络环境下的痛点,适合国内企业部署使用。

sir_Hu的博客 778

终极指南:GraphRAG全球搜索技术如何实现跨社区知识发现的突破性算法

GraphRAG是一个模块化的基于图的检索增强生成(RAG)系统,它通过创新的全球搜索技术,实现了跨社区知识发现的突破性算法。本文将深入探讨GraphRAG全球搜索技术的核心原理、工作流程以及实际应用案例,帮助新手和普通用户快速掌握这一强大工具。 ## 什么是GraphRAG全球搜索技术? GraphRAG全球搜索技术是GraphRAG系统的核心功能之一,它利用知识图谱的结构特性,实现了跨社区

gitblog_00195的博客 482

VC++车牌识别系统:图像处理与模式识别实战指南

计算机视觉是人工智能的重要分支,其核心原理是通过算法让计算机“看懂”图像内容。在工程实践中,图像处理与模式识别技术是实现视觉应用的基础,它们通过灰度化、边缘检测、特征提取等步骤,将原始像素转换为可理解的信息。这些技术的价值在于能够替代人眼完成自动化、高精度的识别任务,广泛应用于智能交通、安防监控和工业检测等领域。以车牌识别为例,它综合运用了图像预处理、车牌定位、字符分割和字符识别等关键技术,其中车牌定位常采用基于边缘检测和颜色特征的方法,而字符识别则涉及模板匹配或机器学习分类。在VC++开发环境中,结合Op

weixin_28465009的博客 290

GraphRAG DRIFT搜索:动态推理与灵活遍历的智能检索实践

本文深入探讨GraphRAG系统中的DRIFT搜索功能,该功能通过结合全局搜索和局部搜索的特点,实现了动态推理和灵活遍历的智能检索。文章将详细介绍DRIFT搜索的原理、实现方式、应用场景以及最佳实践,为开发者提供全面的技术指南。mindmaproot((DRIFT搜索))核心功能动态推理灵活遍历混合检索技术特点全局视角局部细化智能平衡应用场景知识问答信息检索智能对话技术优势动态推理灵活遍历混合检索应用价值提升效率增强体验降低成本发展方向智能增强性能优化。

加入“Super Entity”,与全能开发团队共探AI智能体与数字人项目,开启前沿技术之旅。 1016

(35)远程识别(又称无人机识别)(一)

Ardupilot官网关于《Peripheral Hardware》的翻译 —《(35) 远程识别(又称无人机识别)》。

无人机开发(开源Ardupilot) 4万+

动态库加载失败终极指南:从libbz2.so.1错误看Linux依赖管理本质

本文以经典的libbz2.so.1加载错误为例,深入剖析Linux动态链接库管理的核心机制。文章不仅提供从ldd检查、符号链接创建到LD_LIBRARY_PATH设置等实战解决方案,更系统性地讲解了动态链接器的寻库路径、版本管理及依赖问题预防策略,帮助开发者从根本上理解和掌握Linux依赖管理本质。

weixin_29212429的博客 452

GraphRAG搜索策略深度解析(基础搜索、本地搜索、全局搜索、漂移搜索)

GraphRAG提供了四种搜索策略:基础搜索(传统向量RAG)、本地搜索(利用实体关系)、全局搜索(Map-Reduce架构处理宏观问题)和漂移搜索(结合全局与本地优势)。每种策略针对不同问题场景设计,从简单事实查询到复杂推理问题均可处理。理解这些策略的工作原理和适用场景,对于构建高效的知识图谱检索系统至关重要,也是提升大模型问答能力的关键技术。和。本文将由浅入深地剖析这四种搜索策略的工作原理和使用场景。

m0_56255097的博客 1126

腾讯滑块验证码防水墙 tdc.js 补环境实录

腾讯滑块验证码破解研究摘要 本文记录了破解腾讯防水墙滑块验证码(tdc.js)的全过程。研究重点包括: 流程分析:通过抓包分析验证码完整链路,识别出关键参数collect和eks需从tdc.js虚拟机获取 环境模拟:采用渐进式补环境方法,针对字节码虚拟机特性构建完整的window对象,包括navigator、screen、canvas等API的精确模拟 核心破解:成功调用TDC.getData()和TDC.getInfo()获取关键参数,解决POW计算和滑块缺口识别问题 优化调整:针对errorCode 5

码王吴彦祖的博客 247

GraphRAG 上手指南:3 条命令把散落文档变成可问答的知识图谱

公司里的大文档库里,某个细节明明写在了某份报告的第 40 页,你却总检索不到想要的答案;而"这批资料整体在讲什么"这类问题,普通的关键词搜索更是无从下手。GraphRAG 就是一个基于知识图谱的检索增强生成(RAG)系统:它用大语言模型从非结构化文本中提取实体和关系,构建出可多尺度检索的知识图谱,让你既能追问具体细节,也能得到全局性的摘要回答。适合手里有大量文本资料、需要快速建立可问答知识库的开发

gitblog_00243的博客 997

Xilinx/AMD公司7系列FPGA的ISERDESE2仿真的”天坑”(附verilog的源码vivado仿真工程)

研究LVDS输出接口的ADC与7系列(ZYNQ)FPGA对接过程中,在Vivado中搭建了ISERDESE2的仿真工程,仿真结果ISERDESE2的并行输出口一直输出X或Z,这个坑之大,耗费了我数天的时间,可以称为“天坑”了。同步复位的要求肯定是高于异步复位的,古话说得好“两害相权取其轻”,所以,跟古话对着干就对了!就当RST是同步复位吧,最后经过反复验证,发现。开始怀疑复位信号是否高电平持续时间不够长?但是没有查到复位时间的要求 : - (

FPGA艺术家的博客 171

EPLAN中2D安装板的绘制方法示例

EPLAN中2D安装板的绘制方法示例

Robot_PLC_HMI_Automation 3234

GraphRAG搜索策略全面解析:从基础到漂移搜索,助小白轻松掌握大模型智能问答!

本文详细解析了GraphRAG的四种搜索策略:基础搜索(传统向量RAG)、本地搜索(利用知识图谱实体关系)、全局搜索(MapReduce架构处理宏观问题)和漂移搜索(混合全局与局部搜索)。每种策略都有独特的工作原理、适用场景和技术实现,通过合理选择和组合,GraphRAG能处理从简单事实查询到复杂推理问题的各种场景,实现更智能的问答系统。

Trb201013的博客 781

安装glibc出现../sysdeps/nptl/pthread.h:744:47:error:argument 1 of type ‘struct __jmp_buf_tag *‘ 解决方案

本文主要介绍了安装glibc出现…/sysdeps/nptl/pthread.h:744:47:error:argument 1 of type ‘struct __jmp_buf_tag *’ 解决方案,希望能对使用Linux的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 12万+

GraphRAG进阶:基于Neo4j与LlamaIndex的DRIFT搜索实现详解

微软GraphRAG是早期成熟的图增强检索系统,融合实体、关系与层级社区摘要,支持宏观主题问答。本文重点介绍其DRIFT搜索策略:通过HyDE生成假设答案,结合向量检索与知识图谱动态遍历,先全局后局部,多轮迭代挖掘细粒度信息,平衡效率与质量,显著提升复杂查询的响应能力。

deephub 564

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

GraphRAG四种搜索策略一次讲透:全局、局部、DRIFT与问题生成

检索增强生成(RAG)是缓解大模型幻觉的主流技术,但传统RAG在跨文档归纳、多跳推理等复杂问题面前常因“碎片化检索”而失效。GraphRAG通过将文档构建为知识图谱,以实体与关系为索引,结合社区摘要形成层次化证据网络。在GraphRAG的检索环节,四种搜索策略各司其职:全局搜索处理整体性归纳,局部搜索围绕实体扩散,DRIFT搜索沿关系链递归推理,问题生成搜索预建常见问题索引。实际应用中,可根据问题是否有明确锚点、是否需要跨文档归纳来路由策略,并结合成本预算与缓存机制优化。理解这四种策略的原理与适用场景,能有

weixin_29057237的博客 263

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

GraphRAG查询引擎:多维度智能检索系统实践

本文深入探讨GraphRAG系统中的查询引擎模块,该模块作为GraphRAG库的两大核心组件之一,提供了多种检索方法,包括局部搜索、全局搜索、DRIFT搜索和问题生成等功能。文章将详细介绍各种检索方法的原理、实现方式、应用场景以及最佳实践,为开发者提供全面的技术指南。mindmaproot((查询引擎))核心功能局部搜索全局搜索DRIFT搜索问题生成技术特点多维度检索智能增强灵活配置应用场景知识问答信息检索智能对话技术优势多维度检索智能增强灵活配置应用价值提升效率。

加入“Super Entity”,与全能开发团队共探AI智能体与数字人项目,开启前沿技术之旅。 1059

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

GraphRAG Local Search(局部搜索)完全指南:基于实体的知识图谱推理与源码级解析

本指南系统讲解 GraphRAG 查询引擎中的 Local Search(局部搜索)方法——一种以知识图谱实体为核心入口、融合结构化图数据与原始文档文本块来回答问题的实体级检索生成方案。读者将掌握 Local Search 的完整方法论与数据流、`LocalSearch` 与 `LocalSearchMixedContext` 的全部可调参数及默认值、内置 prompt 的引用规范,并能够结合源码

gitblog_00154的博客 956

用 AutoGen AgentChat 构建 GraphRAG 智能问答助手:全局与本地搜索 Agent 实战

本示例([python/samples/agentchat_graphrag](https://link.gitcode.com/i/944ba6d50507329a91fc47b772cd9d21))演示了如何用 AutoGen AgentChat 的 `AssistantAgent` 与 GraphRAG(Graph-based Retrieval-Augmented Generation)组

gitblog_00785的博客 493

【建议收藏】GraphRAG搜索策略全解析:从基础到漂移,一文掌握大模型知识图谱应用

本文详细解析了GraphRAG的四大搜索策略:基础搜索(传统向量RAG)、本地搜索(利用知识图谱实体关系)、全局搜索(Map-Reduce架构处理宏观问题)和漂移搜索(融合全局与本地搜索优势)。文章深入探讨了每种策略的工作原理、适用场景及技术实现,帮助开发者根据问题类型选择最适合的搜索方法,提升大模型知识图谱应用的智能问答效果。

2401_84815887的博客 1130

GraphRAG实战指南:知识图谱+RAG如何让AI问答准确率飙升90%(2026最新版)

GraphRAG实战指南:知识图谱+RAG如何让AI问答准确率飙升90%(2026最新版) 文章摘要 本文深入解析GraphRAG技术,通过知识图谱增强传统RAG系统,解决三大核心痛点:多跳推理失败、全局摘要缺失和实体关系丢失。GraphRAG将知识图谱引入RAG架构,实现从"关键词匹配"到"关系推理"的跃升,在复杂查询任务中准确率可提升28%-90%。内容涵盖技术原理对比(GraphRAG vs 向量RAG vs Agentic RAG)、微软框架详解、Neo4j+LangChain实战代码、知识图谱构建

weixin_54908067的博客 1万+

【值得收藏】一文吃透GraphRAG四大搜索策略,提升大模型应用能力

本文介绍了GraphRAG的四种搜索策略及其应用场景。基础搜索实现传统向量RAG,适合简单事实查询;本地搜索利用知识图谱增强检索,擅长处理实体关系问题;全局搜索采用Map-Reduce架构解决数据集级宏观问题;漂移搜索则动态结合全局与局部优势,实现渐进式深度查询。每种策略都有特定优化:基础搜索直接使用文本片段,本地搜索融合多源信息,全局搜索处理社区报告,漂移搜索则通过HyDE和Deep Research技术模拟人类分析过程。合理选择策略可显著提升问答效果。

CSDN_224022的博客 1035

GroupRAG-Deepseek应用

与传统的 RAG方法依赖向量相似性检索不同,GraphRAG利用 知识图谱 来显著增强语言型的问答能力,特别是在处理私有数据集或大型、复杂数据集时表现尤为出色。当需要对复杂数据进行推理时,GraphRAG展示了优于基线 RAG的性能,特别是在知识图谱 的帮助下。局部搜索:如果问题关注于某个特定的实体,GraphRAG 会向该实体的 邻居(即相关实体)扩展搜索,以获得更详细和精准的答案。DRIFT 搜索:这是对局部搜索的增强,除了获取邻居和相关概念,还引入了 社区信息 的上下文,从而提供更深入的推理和连接。

2301_76243816的博客 1960

【必学收藏】GraphRAG四大搜索策略全解析:从基础到漂移,小白也能掌握的大模型知识图谱检索技术

GraphRAG提供四种搜索策略:基础搜索(传统向量RAG)、本地搜索(利用知识图谱实体关系)、全局搜索(Map-Reduce架构处理宏观问题)和漂移搜索(结合全局与本地优势)。每种策略适用于不同场景:简单事实查询、特定实体关系分析、数据集宏观理解及复杂探索性问题。技术实现上采用统一架构,继承BaseSearch基类,通过不同上下文构建器优化查询效果。合理选择策略能显著提升问答系统的智能水平。

ytt0523_com的博客 1227

【值得收藏】GraphRAG搜索策略完全指南:从基础到高级,一文掌握大模型知识库查询技术

本文详细解析了GraphRAG的四种搜索策略:基础搜索适合简单事实查询;本地搜索利用知识图谱理解实体关系;全局搜索采用Map-Reduce架构处理宏观问题;漂移搜索结合前两者优势,实现动态推理和灵活遍历。通过合理选择和组合这些策略,GraphRAG能处理从简单事实查询到复杂推理问题的各种场景,构建更智能的问答系统。

2401_84815887的博客 747

GraphRAG知识

GraphRAG 是一种基于知识图谱结构 + 分层社区摘要 + LLM 增强生成的 RAG 框架,它能对大规模语料构建“整体语义理解”,从而提升多跳推理、跨文档问答的准确性与可解释性。

weixin_45925624的博客 600
上一篇: 大模型推理优化Prefill 和 Decoding 分离原理详解
下一篇: 大模型训练方法全面解析:SFT、RFT、TRPO、DPO、PPO、GRPO、RLH、RLHF技术深度剖析
丁学文武
博客等级 码龄15年 545粉丝 212原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值