Documentation
¶
Index ¶
- func Ask[T any](ctx context.Context, llm gollem.LLMClient, prompt string, opts ...AskOption[T]) (*T, error)
- func NewCompactionMiddleware(llmClient gollem.LLMClient, logger *slog.Logger) gollem.ContentBlockMiddleware
- func NewCompactionStreamMiddleware(llmClient gollem.LLMClient) gollem.ContentStreamMiddleware
- func Summary[T any](ctx context.Context, llm gollem.LLMClient, prompt string, data []T, ...) (string, error)
- type AskOption
- type SummaryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCompactionMiddleware ¶ added in v0.5.0
func NewCompactionMiddleware(llmClient gollem.LLMClient, logger *slog.Logger) gollem.ContentBlockMiddleware
NewCompactionMiddleware creates a content block middleware for automatic conversation history compaction. It compresses the oldest 70% of conversation history when the history grows too large, reducing token usage and preventing context window overflow.
func NewCompactionStreamMiddleware ¶ added in v0.5.0
func NewCompactionStreamMiddleware(llmClient gollem.LLMClient) gollem.ContentStreamMiddleware
NewCompactionStreamMiddleware creates a content stream middleware for automatic conversation history compaction.
Types ¶
type AskOption ¶
type AskOption[T any] func(*askConfig[T])
func WithMaxRetry ¶
func WithRetryPrompt ¶
func WithValidate ¶
type SummaryOption ¶
type SummaryOption func(*summaryConfig)
func WithMaxPartSize ¶
func WithMaxPartSize(maxPartSize int) SummaryOption
Click to show internal directories.
Click to hide internal directories.