Documentation
¶
Overview ¶
Package memory provides in-memory implementations for testing and development.
Index ¶
- type HashEmbedder
- type KnowledgeGraph
- func (kg *KnowledgeGraph) AddEdge(ctx context.Context, edge graph.Edge) error
- func (kg *KnowledgeGraph) AddEdgeBatch(ctx context.Context, edges []graph.Edge) error
- func (kg *KnowledgeGraph) AddNode(ctx context.Context, node graph.Node) error
- func (kg *KnowledgeGraph) AddNodeBatch(ctx context.Context, nodes []graph.Node) error
- func (kg *KnowledgeGraph) DeleteEdge(ctx context.Context, from, to, edgeType string) error
- func (kg *KnowledgeGraph) DeleteNode(ctx context.Context, id string) error
- func (kg *KnowledgeGraph) DeleteNodeBatch(ctx context.Context, ids []string) error
- func (kg *KnowledgeGraph) EdgeCount() int
- func (kg *KnowledgeGraph) FindNodes(ctx context.Context, nodeType string, filters map[string]string) ([]graph.Node, error)
- func (kg *KnowledgeGraph) Name() string
- func (kg *KnowledgeGraph) NodeCount() int
- func (kg *KnowledgeGraph) Traverse(ctx context.Context, startNodes []string, opts graph.TraversalOptions) (*graph.TraversalResult, error)
- func (kg *KnowledgeGraph) UpsertEdge(ctx context.Context, edge graph.Edge) error
- func (kg *KnowledgeGraph) UpsertEdgeBatch(ctx context.Context, edges []graph.Edge) error
- func (kg *KnowledgeGraph) UpsertNode(ctx context.Context, node graph.Node) error
- func (kg *KnowledgeGraph) UpsertNodeBatch(ctx context.Context, nodes []graph.Node) error
- type VectorIndex
- func (idx *VectorIndex) Count() int
- func (idx *VectorIndex) Delete(ctx context.Context, id string) error
- func (idx *VectorIndex) DeleteBatch(ctx context.Context, ids []string) error
- func (idx *VectorIndex) Insert(ctx context.Context, node vector.Node) error
- func (idx *VectorIndex) InsertBatch(ctx context.Context, nodes []vector.Node) error
- func (idx *VectorIndex) Name() string
- func (idx *VectorIndex) Search(ctx context.Context, embedding []float32, k int, filters map[string]string) ([]vector.SearchResult, error)
- func (idx *VectorIndex) Upsert(ctx context.Context, node vector.Node) error
- func (idx *VectorIndex) UpsertBatch(ctx context.Context, nodes []vector.Node) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashEmbedder ¶
type HashEmbedder struct {
// contains filtered or unexported fields
}
HashEmbedder creates deterministic embeddings using hashing. This is for testing only - not suitable for production.
func NewHashEmbedder ¶
func NewHashEmbedder(dimensions int) *HashEmbedder
NewHashEmbedder creates a new hash-based embedder.
func (*HashEmbedder) EmbedBatch ¶
EmbedBatch implements vector.Embedder.
func (*HashEmbedder) Model ¶
func (e *HashEmbedder) Model() string
Model implements vector.Embedder.
type KnowledgeGraph ¶
type KnowledgeGraph struct {
// contains filtered or unexported fields
}
KnowledgeGraph is an in-memory knowledge graph.
func NewKnowledgeGraph ¶
func NewKnowledgeGraph(name string) *KnowledgeGraph
NewKnowledgeGraph creates a new in-memory knowledge graph.
func (*KnowledgeGraph) AddEdgeBatch ¶
AddEdgeBatch implements graph.BatchKnowledgeGraph.
func (*KnowledgeGraph) AddNodeBatch ¶
AddNodeBatch implements graph.BatchKnowledgeGraph.
func (*KnowledgeGraph) DeleteEdge ¶
func (kg *KnowledgeGraph) DeleteEdge(ctx context.Context, from, to, edgeType string) error
DeleteEdge implements graph.KnowledgeGraph.
func (*KnowledgeGraph) DeleteNode ¶
func (kg *KnowledgeGraph) DeleteNode(ctx context.Context, id string) error
DeleteNode implements graph.KnowledgeGraph.
func (*KnowledgeGraph) DeleteNodeBatch ¶
func (kg *KnowledgeGraph) DeleteNodeBatch(ctx context.Context, ids []string) error
DeleteNodeBatch implements graph.BatchKnowledgeGraph.
func (*KnowledgeGraph) EdgeCount ¶
func (kg *KnowledgeGraph) EdgeCount() int
EdgeCount returns the number of edges in the graph.
func (*KnowledgeGraph) FindNodes ¶
func (kg *KnowledgeGraph) FindNodes(ctx context.Context, nodeType string, filters map[string]string) ([]graph.Node, error)
FindNodes implements graph.KnowledgeGraph.
func (*KnowledgeGraph) Name ¶
func (kg *KnowledgeGraph) Name() string
Name implements graph.KnowledgeGraph.
func (*KnowledgeGraph) NodeCount ¶
func (kg *KnowledgeGraph) NodeCount() int
NodeCount returns the number of nodes in the graph.
func (*KnowledgeGraph) Traverse ¶
func (kg *KnowledgeGraph) Traverse(ctx context.Context, startNodes []string, opts graph.TraversalOptions) (*graph.TraversalResult, error)
Traverse implements graph.KnowledgeGraph.
func (*KnowledgeGraph) UpsertEdge ¶
UpsertEdge implements graph.KnowledgeGraph.
func (*KnowledgeGraph) UpsertEdgeBatch ¶
UpsertEdgeBatch implements graph.BatchKnowledgeGraph.
func (*KnowledgeGraph) UpsertNode ¶
UpsertNode implements graph.KnowledgeGraph.
func (*KnowledgeGraph) UpsertNodeBatch ¶
UpsertNodeBatch implements graph.BatchKnowledgeGraph.
type VectorIndex ¶
type VectorIndex struct {
// contains filtered or unexported fields
}
VectorIndex is an in-memory vector index using brute-force search.
func NewVectorIndex ¶
func NewVectorIndex(name string) *VectorIndex
NewVectorIndex creates a new in-memory vector index.
func (*VectorIndex) Count ¶
func (idx *VectorIndex) Count() int
Count returns the number of nodes in the index.
func (*VectorIndex) Delete ¶
func (idx *VectorIndex) Delete(ctx context.Context, id string) error
Delete implements vector.Index.
func (*VectorIndex) DeleteBatch ¶
func (idx *VectorIndex) DeleteBatch(ctx context.Context, ids []string) error
DeleteBatch implements vector.BatchIndex.
func (*VectorIndex) InsertBatch ¶
InsertBatch implements vector.BatchIndex.
func (*VectorIndex) Search ¶
func (idx *VectorIndex) Search(ctx context.Context, embedding []float32, k int, filters map[string]string) ([]vector.SearchResult, error)
Search implements vector.Index.
func (*VectorIndex) UpsertBatch ¶
UpsertBatch implements vector.BatchIndex.