Implementation:666ghj BettaFish ReflectionSummaryNode run
| Knowledge Sources | |
|---|---|
| Domains | NLP, Summarization, LLM_Prompting |
| Last Updated | 2026-10-08 00:00 GMT |
Overview
Concrete node that updates a paragraph summary by incorporating new reflection search results with the existing summary, shared across all three search engine pipelines.
Description
The ReflectionSummaryNode is a StateMutationNode that extends the FirstSummaryNode pattern. It takes the paragraph's existing summary (paragraph_latest_state) along with new search results from the reflection query, and asks the LLM to produce an enriched summary that integrates the new findings. Like FirstSummaryNode, it optionally reads the latest HOST speech from the forum log for moderator guidance.
Usage
Import this node when implementing the reflection loop's summarization step. It runs after the ReflectionNode generates a new search query and the search tool returns new results.
Code Reference
Source Location
- Repository: BettaFish
- Files:
- `InsightEngine/nodes/summary_node.py:L199-362`
- `MediaEngine/nodes/summary_node.py:L199-368`
- `QueryEngine/nodes/summary_node.py:L199-368`
Signature
class ReflectionSummaryNode(StateMutationNode):
def __init__(self, llm_client):
"""
Args:
llm_client: LLMClient - OpenAI-compatible LLM client
"""
def run(self, input_data: Any, **kwargs) -> str:
"""
Call LLM to update paragraph summary with new search results.
Args:
input_data: dict with 'title', 'content', 'search_query',
'search_results', and 'paragraph_latest_state' keys
Returns:
str: Updated paragraph summary text
"""
Import
from InsightEngine.nodes import ReflectionSummaryNode # or MediaEngine/QueryEngine
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| title | str | Yes | Paragraph title |
| content | str | Yes | Paragraph content description |
| search_query | str | Yes | The reflection search query |
| search_results | List | Yes | New search results from reflection query |
| paragraph_latest_state | str | Yes | Current summary to be enriched |
| host_speech | str | No | Latest HOST moderator speech (auto-read) |
Outputs
| Name | Type | Description |
|---|---|---|
| summary | str | Updated paragraph summary integrating new findings |
Usage Examples
Enrich Summary with Reflection Results
from InsightEngine.nodes import ReflectionSummaryNode
from InsightEngine.llms import LLMClient
llm = LLMClient(api_key="sk-...", model_name="moonshot-v1-8k", base_url="https://api.moonshot.cn/v1")
node = ReflectionSummaryNode(llm)
input_data = {
"title": "技术发展现状",
"content": "分析AI技术在教育领域的最新进展",
"search_query": "AI教育技术 实际案例 效果评估",
"search_results": [...], # New results from reflection search
"paragraph_latest_state": "AI技术在教育领域应用广泛..." # Previous summary
}
updated_summary = node.run(input_data)
print(updated_summary[:200])
Related Pages
Implements Principle
- Principle:666ghj_BettaFish_Search_Result_Summarization
- Principle:666ghj_BettaFish_Reflection_Loop
- Principle:666ghj_BettaFish_File_Based_Inter_Agent_Communication