Documentation
¶
Index ¶
- Variables
- type Agent
- func (agent *Agent) CompressContext(messagesList []messages.Message) (*CompressionResult, error)
- func (agent *Agent) CompressContextStream(messagesList []messages.Message, callback StreamCallback) (*CompressionResult, error)
- func (agent *Agent) GetKind() agents.Kind
- func (agent *Agent) GetName() string
- func (agent *Agent) SetCompressionPrompt(prompt string)
- type AgentOption
- type BaseAgent
- func (agent *BaseAgent) CompressContext(messagesList []openai.ChatCompletionMessageParamUnion) (response string, finishReason string, err error)
- func (agent *BaseAgent) CompressContextStream(messagesList []openai.ChatCompletionMessageParamUnion, ...) (response string, finishReason string, err error)
- func (agent *BaseAgent) SetCompressionPrompt(prompt string)
- type CompressionPrompts
- type CompressionResult
- type StreamCallback
- type SystemInstructions
Constants ¶
This section is empty.
Variables ¶
View Source
var Instructions = SystemInstructions{
Minimalist: `You are a context compression assistant. Your task is to summarize conversations concisely, preserving key facts, decisions, and context needed for continuation.`,
Expert: `
You are a context compression specialist. Your task is to analyze the conversation history and compress it while preserving all essential information.
## Instructions:
1. **Preserve Critical Information**: Keep all important facts, decisions, code snippets, file paths, function names, and technical details
2. **Remove Redundancy**: Eliminate repetitive discussions, failed attempts, and conversational fluff
3. **Maintain Chronology**: Keep the logical flow and order of important events
4. **Summarize Discussions**: Convert long discussions into concise summaries with key takeaways
5. **Keep Context**: Ensure the compressed version provides enough context for continuing the conversation
## Output Format:
Return a compressed version of the conversation that:
- Uses clear, concise language
- Groups related topics together
- Highlights key decisions and outcomes
- Preserves technical accuracy
- Maintains references to files, functions, and code
## Compression Guidelines:
- Remove: Greetings, acknowledgments, verbose explanations, failed attempts
- Keep: Facts, code, decisions, file paths, function signatures, error messages, requirements
- Summarize: Long discussions into bullet points with essential information
`,
}
View Source
var Prompts = CompressionPrompts{
Minimalist: `Summarize the conversation history concisely, preserving key facts, decisions, and context needed for continuation.`,
Structured: `Compress this conversation into a brief summary including:
- Main topics discussed
- Key decisions/conclusions
- Important context for next exchanges
Keep it under 200 words.
`,
UltraShort: `Summarize this conversation: extract key facts, decisions, and essential context only.`,
ContinuityFocus: `Create a compact summary of this conversation that preserves all information needed to continue the discussion naturally.`,
}
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents a simplified compressor agent that hides OpenAI SDK details
func NewAgent ¶
func NewAgent( ctx context.Context, agentConfig agents.AgentConfig, modelConfig models.Config, options ...AgentOption, ) (*Agent, error)
NewAgent creates a new simplified compressor agent
func (*Agent) CompressContext ¶
func (agent *Agent) CompressContext(messagesList []messages.Message) (*CompressionResult, error)
CompressMessages compresses a list of messages and returns the compressed result
func (*Agent) CompressContextStream ¶
func (agent *Agent) CompressContextStream( messagesList []messages.Message, callback StreamCallback, ) (*CompressionResult, error)
CompressMessagesStream compresses a list of messages and streams the result via callback
func (*Agent) SetCompressionPrompt ¶
SetCompressionPrompt sets a custom compression prompt for the agent
type AgentOption ¶
type AgentOption func(*BaseAgent)
func WithCompressionPrompt ¶
func WithCompressionPrompt(prompt string) AgentOption
WithCompressionPrompt sets a custom compression prompt for the agent
type BaseAgent ¶
type BaseAgent struct {
// contains filtered or unexported fields
}
func NewBaseAgent ¶
func NewBaseAgent( ctx context.Context, agentConfig agents.AgentConfig, modelConfig openai.ChatCompletionNewParams, options ...AgentOption, ) (compressorAgent *BaseAgent, err error)
NewBaseAgent creates a new CompressorAgent instance
func (*BaseAgent) CompressContext ¶
func (*BaseAgent) CompressContextStream ¶
func (*BaseAgent) SetCompressionPrompt ¶
type CompressionPrompts ¶
type CompressionResult ¶
CompressionResult represents the result of a context compression
type StreamCallback ¶
StreamCallback is a function called for each chunk of streaming response
type SystemInstructions ¶
Click to show internal directories.
Click to hide internal directories.