Documentation
¶
Overview ¶
Package memory defines the entities to interact with agent memory (long-term knowledge).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// Content contains the main content of the memory.
Content *genai.Content
// Author of the memory.
Author string
// Timestamp shows when the original content of this memory happened.
// This string will be forwarded to LLM. Preferred format is ISO 8601 format.
Timestamp time.Time
}
Entry represents a single memory entry.
type SearchRequest ¶
SearchRequest represents a request for memory search.
type SearchResponse ¶
type SearchResponse struct {
Memories []Entry
}
SearchResponse represents the response from a memory search.
type Service ¶
type Service interface {
// AddSession adds a session to the memory service.
//
// A session can be added multiple times during its lifetime.
AddSession(ctx context.Context, s session.Session) error
// Search returns memory entries relevant to the given query.
// Empty slice is returned if there are no matches.
Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
}
Service is a definition of the memory service.
The service ingests sessions into memory so that it can be used for user queries across user-scoped sessions.
func InMemoryService ¶
func InMemoryService() Service
InMemoryService returns a new in-memory implementation of the memory service. Thread-safe.
Click to show internal directories.
Click to hide internal directories.