Llm事件摘要生成器(Summarizer)

class LlmEventSummarizer(val model: Model, val promptTemplate: String = DEFAULT_PROMPT_TEMPLATE) : EventSummarizer

An LLM-based event summarizer for context compaction.

This class is responsible for summarizing a provided list of events into a single compacted event. It is designed to be used as part of a context-compaction process such as sliding-window or tail-retention compaction.

When summarizeEvents is called with a list of events, this class formats the events, generates a summary using the model, and returns a new Event containing the summary within a com.google.adk.kt.events.EventCompaction on its Event.actions.

构造函数(Constructors)

Link copied to clipboard
constructor(model: Model, promptTemplate: String = DEFAULT_PROMPT_TEMPLATE)
constructor(model: Model)

使用默认的提示模板创建一个摘要生成器。Java调用者需要这个功能,因为…… `promptTemplate`它的默认值对他们来说是不可见的,其值也是私有的(即只有拥有该值的用户才能知道该值)。

属性(Properties)

Link copied to clipboard

用于总结的 large language model(大型语言模型)。

Link copied to clipboard

这是一个可选的模板字符串,用于生成摘要提示。如果未提供该字符串,系统将使用默认模板。该模板必须包含以下内容: "{conversation_history}" 这个占位符会被格式化后的事件历史记录所替换。

函数

Link copied to clipboard
open suspend override fun summarizeEvents(events: List<Event>): Event?

压缩给定的内容。 事件 合并成一个 事件.