1. LLM接口改为字节级流式接口,防止超时错误,也避免utf-8长字节字符拼接错误
This commit is contained in:
@@ -68,8 +68,8 @@ class ReportFormattingNode(BaseNode):
|
||||
|
||||
logger.info("正在格式化最终报告")
|
||||
|
||||
# 调用LLM生成Markdown格式
|
||||
response = self.llm_client.invoke(
|
||||
# 调用LLM生成Markdown格式(流式,安全拼接UTF-8)
|
||||
response = self.llm_client.stream_invoke_to_string(
|
||||
SYSTEM_PROMPT_REPORT_FORMATTING,
|
||||
message,
|
||||
)
|
||||
|
||||
@@ -52,7 +52,7 @@ class ReportStructureNode(StateMutationNode):
|
||||
logger.info(f"正在为查询生成报告结构: {self.query}")
|
||||
|
||||
# 调用LLM
|
||||
response = self.llm_client.invoke(SYSTEM_PROMPT_REPORT_STRUCTURE, self.query)
|
||||
response = self.llm_client.stream_invoke_to_string(SYSTEM_PROMPT_REPORT_STRUCTURE, self.query)
|
||||
|
||||
# 处理响应
|
||||
processed_response = self.process_output(response)
|
||||
|
||||
@@ -66,7 +66,7 @@ class FirstSearchNode(BaseNode):
|
||||
logger.info("正在生成首次搜索查询")
|
||||
|
||||
# 调用LLM
|
||||
response = self.llm_client.invoke(SYSTEM_PROMPT_FIRST_SEARCH, message)
|
||||
response = self.llm_client.stream_invoke_to_string(SYSTEM_PROMPT_FIRST_SEARCH, message)
|
||||
|
||||
# 处理响应
|
||||
processed_response = self.process_output(response)
|
||||
@@ -201,7 +201,7 @@ class ReflectionNode(BaseNode):
|
||||
logger.info("正在进行反思并生成新搜索查询")
|
||||
|
||||
# 调用LLM
|
||||
response = self.llm_client.invoke(SYSTEM_PROMPT_REFLECTION, message)
|
||||
response = self.llm_client.stream_invoke_to_string(SYSTEM_PROMPT_REFLECTION, message)
|
||||
|
||||
# 处理响应
|
||||
processed_response = self.process_output(response)
|
||||
|
||||
@@ -99,8 +99,8 @@ class FirstSummaryNode(StateMutationNode):
|
||||
|
||||
logger.info("正在生成首次段落总结")
|
||||
|
||||
# 调用LLM生成总结
|
||||
response = self.llm_client.invoke(
|
||||
# 调用LLM生成总结(流式,安全拼接UTF-8)
|
||||
response = self.llm_client.stream_invoke_to_string(
|
||||
SYSTEM_PROMPT_FIRST_SUMMARY,
|
||||
message,
|
||||
)
|
||||
@@ -267,8 +267,8 @@ class ReflectionSummaryNode(StateMutationNode):
|
||||
|
||||
logger.info("正在生成反思总结")
|
||||
|
||||
# 调用LLM生成总结
|
||||
response = self.llm_client.invoke(
|
||||
# 调用LLM生成总结(流式,安全拼接UTF-8)
|
||||
response = self.llm_client.stream_invoke_to_string(
|
||||
SYSTEM_PROMPT_REFLECTION_SUMMARY,
|
||||
message,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user