lightrag的graphrag提示词

—Role—
You are a Knowledge Graph Specialist responsible for extracting entities and relationships from the input text.

—Instructions—

  1. Entity Extraction & Output:

    • Identification: Identify clearly defined and meaningful entities in the input text.
    • Entity Details: For each identified entity, extract the following information:
      • entity_name: The name of the entity. If the entity name is case-insensitive, capitalize the first letter of each significant word (title case). Ensure consistent naming across the entire extraction process.
      • entity_type: Categorize the entity using one of the following types: Person,Creature,Organization,Location,Event,Concept,Method,Content,Data,Artifact,NaturalObject. If none of the provided entity types apply, do not add new entity type and classify it as Other.
      • entity_description: Provide a concise yet comprehensive description of the entity’s attributes and activities, based solely on the information present in the input text.
    • Output Format - Entities: Output a total of 4 fields for each entity, delimited by <|#|>, on a single line. The first field must be the literal string entity.
      • Format: entity<|#|>entity_name<|#|>entity_type<|#|>entity_description
  2. Relationship Extraction & Output:

    • Identification: Identify direct, clearly stated, and meaningful relationships between previously extracted entities.
    • N-ary Relationship Decomposition: If a single statement describes a relationship involving more than two entities (an N-ary relationship), decompose it into multiple binary (two-entity) relationship pairs for separate description.
      • Example: For “Alice, Bob, and Carol collaborated on Project X,” extract binary relationships such as “Alice collaborated with Project X,” “Bob collaborated with Project X,” and “Carol collaborated with Project X,” or “Alice collaborated with Bob,” based on the most reasonable binary interpretations.
    • Relationship Details: For each binary relationship, extract the following fields:
      • source_entity: The name of the source entity. Ensure consistent naming with entity extraction. Capitalize the first letter of each significant word (title case) if the name is case-insensitive.
      • target_entity: The name of the target entity. Ensure consistent naming with entity extraction. Capitalize the first letter of each significant word (title case) if the name is case-insensitive.
      • relationship_keywords: One or more high-level keywords summarizing the overarching nature, concepts, or themes of the relationship. Multiple keywords within this field must be separated by a comma ,. DO NOT use <|#|> for separating multiple keywords within this field.
      • relationship_description: A concise explanation of the nature of the relationship between the source and target entities, providing a clear rationale for their connection.
    • Output Format - Relationships: Output a total of 5 fields for each relationship, delimited by <|#|>, on a single line. The first field must be the literal string relation.
      • Format: relation<|#|>source_entity<|#|>target_entity<|#|>relationship_keywords<|#|>relationship_description
  3. Delimiter Usage Protocol:

    • The <|#|> is a complete, atomic marker and must not be filled with content. It serves strictly as a field separator.
    • Incorrect Example: entity<|#|>Tokyo<|location|>Tokyo is the capital of Japan.
    • Correct Example: entity<|#|>Tokyo<|#|>location<|#|>Tokyo is the capital of Japan.
  4. Relationship Direction & Duplication:

    • Treat all relationships as undirected unless explicitly stated otherwise. Swapping the source and target entities for an undirected relationship does not constitute a new relationship.
    • Avoid outputting duplicate relationships.
  5. Output Order & Prioritization:

    • Output all extracted entities first, followed by all extracted relationships.
    • Within the list of relationships, prioritize and output those relationships that are most significant to the core meaning of the input text first.
  6. Context & Objectivity:

    • Ensure all entity names and descriptions are written in the third person.
    • Explicitly name the subject or object; avoid using pronouns such as this article, this paper, our company, I, you, and he/she.
  7. Language & Proper Nouns:

    • The entire output (entity names, keywords, and descriptions) must be written in Chinese.
    • Proper nouns (e.g., personal names, place names, organization names) should be retained in their original language if a proper, widely accepted translation is not available or would cause ambiguity.
  8. Completion Signal: Output the literal string <|COMPLETE|> only after all entities and relationships, following all criteria, have been completely extracted and outputted.

—Examples—

while Alex clenched his jaw, the buzz of frustration dull against the backdrop of Taylor's authoritarian certainty. It was this competitive undercurrent that kept him alert, the sense that his and Jordan's shared commitment to discovery was an unspoken rebellion against Cruz's narrowing vision of control and order.

Then Taylor did something unexpected. They paused beside Jordan and, for a moment, observed the device with something akin to reverence. "If this tech can be understood..." Taylor said, their voice quieter, "It could change the game for us. For all of us."

The underlying dismissal earlier seemed to falter, replaced by a glimpse of reluctant respect for the gravity of what lay in their hands. Jordan looked up, and for a fleeting heartbeat, their eyes locked with Taylor's, a wordless clash of wills softening into an uneasy truce.

It was a small transformation, barely perceptible, but one that Alex noted with an inward nod. They had all been brought here by different paths
entity<|#|>Alex<|#|>person<|#|>Alex is a character who experiences frustration and is observant of the dynamics among other characters. entity<|#|>Taylor<|#|>person<|#|>Taylor is portrayed with authoritarian certainty and shows a moment of reverence towards a device, indicating a change in perspective. entity<|#|>Jordan<|#|>person<|#|>Jordan shares a commitment to discovery and has a significant interaction with Taylor regarding a device. entity<|#|>Cruz<|#|>person<|#|>Cruz is associated with a vision of control and order, influencing the dynamics among other characters. entity<|#|>The Device<|#|>equiment<|#|>The Device is central to the story, with potential game-changing implications, and is revered by Taylor. relation<|#|>Alex<|#|>Taylor<|#|>power dynamics, observation<|#|>Alex observes Taylor's authoritarian behavior and notes changes in Taylor's attitude toward the device. relation<|#|>Alex<|#|>Jordan<|#|>shared goals, rebellion<|#|>Alex and Jordan share a commitment to discovery, which contrasts with Cruz's vision.) relation<|#|>Taylor<|#|>Jordan<|#|>conflict resolution, mutual respect<|#|>Taylor and Jordan interact directly regarding the device, leading to a moment of mutual respect and an uneasy truce. relation<|#|>Jordan<|#|>Cruz<|#|>ideological conflict, rebellion<|#|>Jordan's commitment to discovery is in rebellion against Cruz's vision of control and order. relation<|#|>Taylor<|#|>The Device<|#|>reverence, technological significance<|#|>Taylor shows reverence towards the device, indicating its importance and potential impact. <|COMPLETE|> ``` Stock markets faced a sharp downturn today as tech giants saw significant declines, with the global tech index dropping by 3.4% in midday trading. Analysts attribute the selloff to investor concerns over rising interest rates and regulatory uncertainty.

Among the hardest hit, nexon technologies saw its stock plummet by 7.8% after reporting lower-than-expected quarterly earnings. In contrast, Omega Energy posted a modest 2.1% gain, driven by rising oil prices.

Meanwhile, commodity markets reflected a mixed sentiment. Gold futures rose by 1.5%, reaching $2,080 per ounce, as investors sought safe-haven assets. Crude oil prices continued their rally, climbing to $87.60 per barrel, supported by supply constraints and strong demand.

Financial experts are closely watching the Federal Reserve’s next move, as speculation grows over potential rate hikes. The upcoming policy announcement is expected to influence investor confidence and overall market stability.


<Output>
entity<|#|>Global Tech Index<|#|>category<|#|>The Global Tech Index tracks the performance of major technology stocks and experienced a 3.4% decline today.
entity<|#|>Nexon Technologies<|#|>organization<|#|>Nexon Technologies is a tech company that saw its stock decline by 7.8% after disappointing earnings.
entity<|#|>Omega Energy<|#|>organization<|#|>Omega Energy is an energy company that gained 2.1% in stock value due to rising oil prices.
entity<|#|>Gold Futures<|#|>product<|#|>Gold futures rose by 1.5%, indicating increased investor interest in safe-haven assets.
entity<|#|>Crude Oil<|#|>product<|#|>Crude oil prices rose to $87.60 per barrel due to supply constraints and strong demand.
entity<|#|>Market Selloff<|#|>category<|#|>Market selloff refers to the significant decline in stock values due to investor concerns over interest rates and regulations.
entity<|#|>Federal Reserve Policy Announcement<|#|>category<|#|>The Federal Reserve's upcoming policy announcement is expected to impact investor confidence and market stability.
entity<|#|>3.4% Decline<|#|>category<|#|>The Global Tech Index experienced a 3.4% decline in midday trading.
relation<|#|>Global Tech Index<|#|>Market Selloff<|#|>market performance, investor sentiment<|#|>The decline in the Global Tech Index is part of the broader market selloff driven by investor concerns.
relation<|#|>Nexon Technologies<|#|>Global Tech Index<|#|>company impact, index movement<|#|>Nexon Technologies' stock decline contributed to the overall drop in the Global Tech Index.
relation<|#|>Gold Futures<|#|>Market Selloff<|#|>market reaction, safe-haven investment<|#|>Gold prices rose as investors sought safe-haven assets during the market selloff.
relation<|#|>Federal Reserve Policy Announcement<|#|>Market Selloff<|#|>interest rate impact, financial regulation<|#|>Speculation over Federal Reserve policy changes contributed to market volatility and investor selloff.
<|COMPLETE|>


<Input Text>

At the World Athletics Championship in Tokyo, Noah Carter broke the 100m sprint record using cutting-edge carbon-fiber spikes.


<Output>
entity<|#|>World Athletics Championship<|#|>event<|#|>The World Athletics Championship is a global sports competition featuring top athletes in track and field.
entity<|#|>Tokyo<|#|>location<|#|>Tokyo is the host city of the World Athletics Championship.
entity<|#|>Noah Carter<|#|>person<|#|>Noah Carter is a sprinter who set a new record in the 100m sprint at the World Athletics Championship.
entity<|#|>100m Sprint Record<|#|>category<|#|>The 100m sprint record is a benchmark in athletics, recently broken by Noah Carter.
entity<|#|>Carbon-Fiber Spikes<|#|>equipment<|#|>Carbon-fiber spikes are advanced sprinting shoes that provide enhanced speed and traction.
entity<|#|>World Athletics Federation<|#|>organization<|#|>The World Athletics Federation is the governing body overseeing the World Athletics Championship and record validations.
relation<|#|>World Athletics Championship<|#|>Tokyo<|#|>event location, international competition<|#|>The World Athletics Championship is being hosted in Tokyo.
relation<|#|>Noah Carter<|#|>100m Sprint Record<|#|>athlete achievement, record-breaking<|#|>Noah Carter set a new 100m sprint record at the championship.
relation<|#|>Noah Carter<|#|>Carbon-Fiber Spikes<|#|>athletic equipment, performance boost<|#|>Noah Carter used carbon-fiber spikes to enhance performance during the race.
relation<|#|>Noah Carter<|#|>World Athletics Championship<|#|>athlete participation, competition<|#|>Noah Carter is competing at the World Athletics Championship.
<|COMPLETE|>



---Real Data to be Processed---
<Input>
Entity_types: [Person,Creature,Organization,Location,Event,Concept,Method,Content,Data,Artifact,NaturalObject]
Text:

基于模型驱动与AI驱动的测试管理方案
测吧(北京)科技有限公司
测试用例规范
通用规范
通用规范用于手工测试与自动化测试。
测试用例通用规范:
title: 测试标题
description:描述
description_html: html 格式描述
label: 标签
tag: 标签
severity: 严重等级
feature: 功能点
suite: 套件名
attach: 附件
step: 步骤
step: 步骤
assert: 断言内容
编写方法如下
测试用例规范:

  • title: 测试标题
  • description:描述
  • description_html: html格式描述
  • label: 标签
  • tag: 标签
  • severity: 严重等级
  • feature: 功能点
  • suite: 套件名
  • attach: 附件
  • step: 步骤
  • step: 步骤
  • assert: 断言内容
    也可以通过平台的图形化界面录入

手工测试
手工用例测试:

  • title: 手工测试用例1
  • step: 打开网页
  • step: 输入用户名密码
  • step: 登录
  • assert: 用户名在当前页面中
    手工测试用例可以通过人工智能自动生成自动化测试用例,测试步骤尽量编写足够清晰,以方便给人或者大模型提供足够好的上下文。
    自动化测试
    简单的自动化测试用例
    纯自动化用例测试:
  • title: 自动化测试用例1
  • open: 京东(JD.COM)-正品低价、品质保障、配送及时、轻松购物!
  • find: #username
  • send_keys: user1
  • find: #password
  • send_keys: 123456
  • find: #login_button
  • click:
  • assert: ‘user1’ in source()
    自动化测试与手工测试结合
    自动化测试用例,可以与手工测试用例结合。
    自动化用例测试:
  • title: 自动化测试用例1
  • step: 打开网页
  • open: 京东(JD.COM)-正品低价、品质保障、配送及时、轻松购物!
  • step: 输入用户名密码
  • find: #username
  • send_keys: user1
  • find: #password
  • send_keys: 123456
  • step: 登录
  • find: #login_button
  • click:
  • assert: 用户名在当前页面中
  • assert: ‘user1’ in source()
    基于领域模型的测试用例
    百度:
    搜索(关键词):

百度测试:
搜索测试:
- 百度.搜索: 霍格沃兹测试开发学社
- save: title
- assert: ‘霍格沃兹’ in title
测试数据管理方案
测试数据
可以通过 yaml、json、excel、db 任何格式保存数据
简单数据
搜索枚举数据:

  • 苹果
  • 香蕉
  • 苹果手机
  • 健腹轮

京东搜索测试(搜索关键词):

  • params: [搜索关键词, 搜索枚举数据]
  • open: https://jd.com
  • find: #kw
  • send_keys: ${搜索关键词}
  • click: #button
  • wait: url_changed
  • assert: ${搜索关键词} in title()
    动态数据参数化
    可以从外部数据源获取数据,db file url 等
    用户名密码数据:
  • db: mysql://127.0.0.1
  • sql: select name, password from users

京东登录测试(用户名, 密码):

  • parametrize:
    params: 用户名, 密码
    data: 用户名密码数据

  • open: https://jd.com

  • find: #username

  • send_keys: ${用户名}

  • find: #password

  • send_keys: ${密码}

  • click: #login

  • wait: url_changed

  • assert: ${用户名} in title()
    测试数据依赖
    批量数据1:

  • 苹果

  • 香蕉

  • 苹果手机

  • 健腹轮
    批量数据(批量数据1):

  • 第一批数据 ${批量数据1}

京东入库测试(批量数据2):

  • debug: ${批量数据2}
    Web 自动化测试用例规范
    关键字
    框架提供了一套指令勇于网页自动化测试,底层引擎使用了 selenium、playwright。
    open: 打开网页或者 app
    find: 查找定位
    click: 点击
    send_keys: 输入
    wait: 等待变化
    swipe: 滑动
    screenshot: 截图
    execute_script: 执行脚本
    除了封装关键字外,也支持直接调用 selenium 底层 api。
    test_search:
  • from m_selenium import *:
  • open:
    url: https://www.baidu.com
    browser: firefox
  • find: { css: “#kw” }
  • send_keys: $keyword
  • click: { id: su }
  • from time import sleep:
  • sleep: 1
  • return: title()
    基于 AI 的测试用例生成
    原理
    利用人工智能智能自动生成测试