Documentation
¶
Index ¶
- func VectorLiteral(v []float32) string
- type Embedder
- type InMemoryStore
- func (s *InMemoryStore) Delete(_ context.Context, namespace string, id uuid.UUID) error
- func (s *InMemoryStore) List(_ context.Context, namespace string, tags []string, limit int) ([]Memory, error)
- func (s *InMemoryStore) Search(_ context.Context, namespace, query string, tags []string, limit int) ([]Memory, error)
- func (s *InMemoryStore) Store(_ context.Context, namespace, content string, tags []string, sourceRun string, ...) (*Memory, error)
- type Memory
- type NoopEmbedder
- type OpenAIEmbedder
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VectorLiteral ¶
VectorLiteral converts a vector to the pgvector literal format.
Types ¶
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore is a small process-local Store implementation for SDK clients that do not need durable storage. Search uses simple substring keyword matching, not vector similarity — for true semantic search, plug in a Store backed by a vector database.
func NewInMemoryStore ¶
func NewInMemoryStore() *InMemoryStore
NewInMemoryStore returns an empty in-memory memory store.
type Memory ¶
type Memory struct {
ID uuid.UUID `json:"id"`
Namespace string `json:"namespace"`
Content string `json:"content"`
Tags []string `json:"tags"`
SourceRun string `json:"source_run"`
Metadata json.RawMessage `json:"metadata"`
Similarity float64 `json:"similarity,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Memory represents a single stored memory entry.
type NoopEmbedder ¶
type NoopEmbedder struct {
Dimension int
}
NoopEmbedder returns all-zero embeddings and is useful for local examples.
type OpenAIEmbedder ¶
type OpenAIEmbedder struct {
// contains filtered or unexported fields
}
OpenAIEmbedder embeds text through the OpenAI embeddings API.
func NewOpenAIEmbedder ¶
func NewOpenAIEmbedder(auth *openai.OpenAIAuthSession, baseURL string, model string) *OpenAIEmbedder
func (*OpenAIEmbedder) SetHTTPClient ¶
func (e *OpenAIEmbedder) SetHTTPClient(client *http.Client)
SetHTTPClient overrides the HTTP client, mainly for tests.
type Store ¶
type Store interface {
Store(ctx context.Context, namespace, content string, tags []string, sourceRun string, metadata json.RawMessage) (*Memory, error)
Search(ctx context.Context, namespace, query string, tags []string, limit int) ([]Memory, error)
List(ctx context.Context, namespace string, tags []string, limit int) ([]Memory, error)
Delete(ctx context.Context, namespace string, id uuid.UUID) error
}
Store persists and retrieves semantic memories.