tooluniverse.compose_scripts.output_summarizer 模块¶
输出汇总生成脚本
该脚本通过以下步骤实现工具输出的智能摘要:1. 将大型输出拆分为可管理的块 2. 使用人工智能驱动的摘要技术处理每个块 3. 将各摘要块合并为连贯的最终摘要
该脚本利用 ToolUniverse 的 AgenticTool 基础架构,提供智能且具上下文感知的摘要,重点突出与原始查询相关的信息。
- tooluniverse.compose_scripts.output_summarizer.compose(arguments, tooluniverse, call_tool)[源代码]¶
用于输出摘要的主要组合功能。
此功能负责协调完整的摘要工作流程: - 将输入文本拆分为可管理的片段 - 使用人工智能对每个片段进行摘要 - 将各片段摘要合并为最终连贯的结果
- 参数:
arguments (
Dict[str, Any]) –Dictionary containing: - tool_output (str): The original tool output to be summarized - query_context (str): Context about the original query - tool_name (str): Name of the tool that generated the output - chunk_size (int, optional): Size of each chunk for processing - focus_areas (str, optional): Areas to focus on in summarization - max_summary_length (int, optional): Maximum length of final
摘要
tooluniverse – 用于工具执行的 ToolUniverse 实例
call_tool – 在组合内调用其他工具的功能
- 退货
- Dict[str, Any]: Dictionary containing:
success (bool): 是否成功完成摘要
original_length(int):原始输出的长度
summary_length (int):最终摘要的长度
chunks_processed(整数):已处理的数据块数量
摘要 (str): 汇总输出
tool_name(字符串):原始工具的名称
error(str,可选):若摘要失败时的错误信息