Documentation
¶
Index ¶
- func CosineSimilarity(a, b []float32) float32
- func DecodeVector(b []byte) []float32
- func EncodeVector(v []float32) []byte
- type Chunk
- type ChunkWithEmbedding
- type Claim
- type Community
- type Document
- type Entity
- type Relationship
- type Stats
- type Store
- func (s *Store) AllChunkEmbeddings(ctx context.Context, model string) ([]ChunkWithEmbedding, error)
- func (s *Store) AllCommunities(ctx context.Context) ([]*Community, error)
- func (s *Store) AllEntities(ctx context.Context) ([]*Entity, error)
- func (s *Store) AllRelationships(ctx context.Context) ([]*Relationship, error)
- func (s *Store) BatchInsertChunks(ctx context.Context, chunks []*Chunk) error
- func (s *Store) BatchInsertClaims(ctx context.Context, claims []*Claim) error
- func (s *Store) BatchInsertCommunityMembers(ctx context.Context, communityID string, entityIDs []string) error
- func (s *Store) BatchInsertRelationships(ctx context.Context, rels []*Relationship) error
- func (s *Store) BatchUpdateEntityCommunities(ctx context.Context, assignments map[string]string) error
- func (s *Store) BatchUpdateEntityRanks(ctx context.Context, ranks map[string]int) error
- func (s *Store) BatchUpsertEmbeddings(ctx context.Context, model string, chunkIDs []string, vectors [][]float32) error
- func (s *Store) BatchUpsertEntities(ctx context.Context, entities []*Entity) error
- func (s *Store) ClearCommunities(ctx context.Context) error
- func (s *Store) Close() error
- func (s *Store) CommunityMembers(ctx context.Context, communityID string) ([]*Entity, error)
- func (s *Store) DB() *sql.DB
- func (s *Store) FindRelationships(ctx context.Context, fromID, toID, predicate string) ([]*Relationship, error)
- func (s *Store) GetChunk(ctx context.Context, id string) (*Chunk, error)
- func (s *Store) GetCommunity(ctx context.Context, id string) (*Community, error)
- func (s *Store) GetDocument(ctx context.Context, id string) (*Document, error)
- func (s *Store) GetDocumentByHash(ctx context.Context, hash string) (*Document, error)
- func (s *Store) GetDocumentByPath(ctx context.Context, path string) (*Document, error)
- func (s *Store) GetDocumentVersions(ctx context.Context, canonicalID string) ([]*Document, error)
- func (s *Store) GetEntitiesByNames(ctx context.Context, names []string) (map[string]*Entity, error)
- func (s *Store) GetEntity(ctx context.Context, id string) (*Entity, error)
- func (s *Store) GetEntityByName(ctx context.Context, name string) (*Entity, error)
- func (s *Store) GetStats(ctx context.Context) (*Stats, error)
- func (s *Store) GraphFingerprint(ctx context.Context) (entities, relationships, communities int, err error)
- func (s *Store) InsertChunk(ctx context.Context, c *Chunk) error
- func (s *Store) InsertClaim(ctx context.Context, c *Claim) error
- func (s *Store) InsertCommunityMember(ctx context.Context, communityID, entityID string) error
- func (s *Store) InsertRelationship(ctx context.Context, r *Relationship) error
- func (s *Store) ListChunksByDoc(ctx context.Context, docID string) ([]*Chunk, error)
- func (s *Store) ListCommunities(ctx context.Context, level int) ([]*Community, error)
- func (s *Store) ListDocuments(ctx context.Context, docType string, limit, offset int) ([]*Document, error)
- func (s *Store) ListEntities(ctx context.Context, typ string, limit, offset int) ([]*Entity, error)
- func (s *Store) RelationshipsForEntity(ctx context.Context, entityID string, depth int) ([]*Relationship, error)
- func (s *Store) SupersedeDocument(ctx context.Context, id string) error
- func (s *Store) UpdateDocumentStructured(ctx context.Context, id, structured string) error
- func (s *Store) UpdateEntityCommunity(ctx context.Context, entityID, communityID string) error
- func (s *Store) UpdateEntityRank(ctx context.Context, entityID string, rank int) error
- func (s *Store) UpsertCommunity(ctx context.Context, c *Community) error
- func (s *Store) UpsertDocument(ctx context.Context, doc *Document) error
- func (s *Store) UpsertEmbedding(ctx context.Context, chunkID, model string, vector []float32) error
- func (s *Store) UpsertEntity(ctx context.Context, e *Entity) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CosineSimilarity ¶
func DecodeVector ¶
func EncodeVector ¶
Types ¶
type ChunkWithEmbedding ¶
type Document ¶
type Document struct {
ID string `json:"id"`
Path string `json:"path"`
Title string `json:"title"`
DocType string `json:"doc_type"`
FileHash string `json:"file_hash,omitempty"`
Structured string `json:"structured,omitempty"`
Version int `json:"version,omitempty"`
CanonicalID string `json:"canonical_id,omitempty"` // empty on v1; ID of first version on v2+
IsLatest bool `json:"is_latest,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
func (*Document) CanonicalOrID ¶
CanonicalOrID returns CanonicalID if set, otherwise the document's own ID. This is the stable identifier across all versions of a file.
type Relationship ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps the single SQLite database.
func (*Store) AllChunkEmbeddings ¶
func (*Store) AllCommunities ¶
func (*Store) AllRelationships ¶
func (s *Store) AllRelationships(ctx context.Context) ([]*Relationship, error)
func (*Store) BatchInsertChunks ¶
BatchInsertChunks inserts multiple chunks in one transaction.
func (*Store) BatchInsertClaims ¶
BatchInsertClaims inserts multiple claims in one transaction.
func (*Store) BatchInsertCommunityMembers ¶
func (s *Store) BatchInsertCommunityMembers(ctx context.Context, communityID string, entityIDs []string) error
BatchInsertCommunityMembers inserts community memberships in one transaction.
func (*Store) BatchInsertRelationships ¶
func (s *Store) BatchInsertRelationships(ctx context.Context, rels []*Relationship) error
BatchInsertRelationships inserts multiple relationships in one transaction.
func (*Store) BatchUpdateEntityCommunities ¶
func (s *Store) BatchUpdateEntityCommunities(ctx context.Context, assignments map[string]string) error
BatchUpdateEntityCommunities updates community_id for multiple entities in one transaction.
func (*Store) BatchUpdateEntityRanks ¶
BatchUpdateEntityRanks updates rank for multiple entities in one transaction.
func (*Store) BatchUpsertEmbeddings ¶
func (s *Store) BatchUpsertEmbeddings(ctx context.Context, model string, chunkIDs []string, vectors [][]float32) error
BatchUpsertEmbeddings upserts multiple embeddings in one transaction.
func (*Store) BatchUpsertEntities ¶
BatchUpsertEntities upserts multiple entities in one transaction.
func (*Store) CommunityMembers ¶
func (*Store) FindRelationships ¶
func (*Store) GetCommunity ¶
func (*Store) GetDocument ¶
func (*Store) GetDocumentByHash ¶
func (*Store) GetDocumentByPath ¶
func (*Store) GetDocumentVersions ¶
GetDocumentVersions returns all versions of a document by canonical ID, oldest first.
func (*Store) GetEntitiesByNames ¶
GetEntitiesByNames fetches entities for a set of names in one query. Returns map name→Entity.
func (*Store) GetEntityByName ¶
func (*Store) GraphFingerprint ¶
func (s *Store) GraphFingerprint(ctx context.Context) (entities, relationships, communities int, err error)
GraphFingerprint returns counts of entities, relationships, and communities to detect whether the graph has changed since last finalization.
func (*Store) InsertCommunityMember ¶
func (*Store) InsertRelationship ¶
func (s *Store) InsertRelationship(ctx context.Context, r *Relationship) error
func (*Store) ListChunksByDoc ¶
func (*Store) ListCommunities ¶
func (*Store) ListDocuments ¶
func (*Store) ListEntities ¶
func (*Store) RelationshipsForEntity ¶
func (*Store) SupersedeDocument ¶
SupersedeDocument marks a document as no longer the latest version.