memory

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package memory 提供基于 SQLite 的 ADK memory.Service 实现。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID             string
	Content        *genai.Content
	Author         string
	Timestamp      time.Time
	CustomMetadata map[string]any
}

Entry 单条记忆。

type SQLiteService

type SQLiteService struct {
	// contains filtered or unexported fields
}

SQLiteService 基于 SQLite 的持久化 memory.Service。

func NewSQLiteService

func NewSQLiteService(db *sql.DB) (*SQLiteService, error)

NewSQLiteService 创建 SQLite memory 服务。 db 必须是已打开的 *sql.DB 连接。

func (*SQLiteService) AddSessionToMemory

func (s *SQLiteService) AddSessionToMemory(ctx context.Context, sess session.Session) error

AddSessionToMemory 从 session 的 LLM 响应中提取记忆并存储。

func (*SQLiteService) SearchMemory

func (s *SQLiteService) SearchMemory(ctx context.Context, req *SearchRequest) (*SearchResponse, error)

SearchMemory 搜索与查询匹配的记忆。

type SearchRequest

type SearchRequest struct {
	Query   string
	UserID  string
	AppName string
}

SearchRequest 记忆搜索请求。

type SearchResponse

type SearchResponse struct {
	Memories []Entry
}

SearchResponse 记忆搜索响应。

type Service

type Service interface {
	AddSessionToMemory(ctx context.Context, s session.Session) error
	SearchMemory(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
}

Service 是 memory 服务的接口,与 ADK-Go memory.Service 兼容。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL