Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) ExecuteRedisCommand(ctx context.Context, cmd string, args ...interface{}) *redis.Cmd
- func (c *Client) ExecuteSurrealQL(query string, vars map[string]interface{}) (interface{}, error)
- func (c *Client) GetConfig() *config.Config
- func (c *Client) GetRedis() *redis.Client
- func (c *Client) GetSurrealDB() *surrealdb.DB
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) IsRedisConnected() bool
- func (c *Client) IsSurrealDBConnected() bool
- func (c *Client) Reconnect() error
- type CountFilters
- type EpisodeStats
- type EpisodeStore
- func (s *EpisodeStore) BatchCreate(ctx context.Context, episodes []*models.Episode) error
- func (s *EpisodeStore) Count(ctx context.Context, tenantID types.TenantID, filters *CountFilters) (int, error)
- func (s *EpisodeStore) Create(ctx context.Context, episode *models.Episode) error
- func (s *EpisodeStore) Delete(ctx context.Context, tenantID types.TenantID, episodeID string) error
- func (s *EpisodeStore) GetByID(ctx context.Context, tenantID types.TenantID, episodeID string) (*models.Episode, error)
- func (s *EpisodeStore) GetBySessionID(ctx context.Context, tenantID types.TenantID, sessionID types.SessionID, ...) ([]*models.Episode, error)
- func (s *EpisodeStore) GetStats(ctx context.Context, tenantID types.TenantID) (*EpisodeStats, error)
- func (s *EpisodeStore) GetUnprocessed(ctx context.Context, tenantID types.TenantID, limit int) ([]*models.Episode, error)
- func (s *EpisodeStore) List(ctx context.Context, tenantID types.TenantID, options *ListOptions) ([]*models.Episode, int, error)
- func (s *EpisodeStore) MarkAsProcessed(ctx context.Context, tenantID types.TenantID, episodeID string) error
- func (s *EpisodeStore) Update(ctx context.Context, tenantID types.TenantID, episodeID string, ...) (*models.Episode, error)
- func (s *EpisodeStore) UpdateEmbedding(ctx context.Context, tenantID types.TenantID, episodeID string, ...) error
- type GraphStats
- type GraphStore
- func (s *GraphStore) BatchCreateEntities(ctx context.Context, entities []*models.Entity) error
- func (s *GraphStore) BatchCreateRelationships(ctx context.Context, relationships []*models.Relationship) error
- func (s *GraphStore) CreateEntity(ctx context.Context, entity *models.Entity) error
- func (s *GraphStore) CreateRelationship(ctx context.Context, relationship *models.Relationship) error
- func (s *GraphStore) DeleteEntity(ctx context.Context, tenantID types.TenantID, entityID string) error
- func (s *GraphStore) DeleteRelationship(ctx context.Context, tenantID types.TenantID, relationshipID string) error
- func (s *GraphStore) FindEntityByName(ctx context.Context, tenantID types.TenantID, name, entityType string) (*models.Entity, error)
- func (s *GraphStore) GetEntityRelationships(ctx context.Context, tenantID types.TenantID, entityID string, ...) ([]*models.Relationship, error)
- func (s *GraphStore) GetGraphStats(ctx context.Context, tenantID types.TenantID) (*GraphStats, error)
- func (s *GraphStore) GetOrCreateEntity(ctx context.Context, tenantID types.TenantID, name, entityType string) (*models.Entity, error)
- func (s *GraphStore) GetRelatedEntities(ctx context.Context, tenantID types.TenantID, entityID string, ...) ([]*models.RelatedEntity, error)
- func (s *GraphStore) RelateEntities(ctx context.Context, tenantID types.TenantID, ...) error
- func (s *GraphStore) RelationshipExists(ctx context.Context, tenantID types.TenantID, ...) (bool, error)
- type ListOptions
- type RelationshipDirection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { SurrealDB *surrealdb.DB Redis *redis.Client // contains filtered or unexported fields }
Client represents the storage client that manages connections to SurrealDB and Redis
func (*Client) ExecuteRedisCommand ¶
func (c *Client) ExecuteRedisCommand(ctx context.Context, cmd string, args ...interface{}) *redis.Cmd
ExecuteRedisCommand executes a Redis command
func (*Client) ExecuteSurrealQL ¶
ExecuteSurrealQL executes a SurrealQL query
func (*Client) GetRedis ¶
func (c *Client) GetRedis() *redis.Client
GetRedis returns the Redis connection
func (*Client) GetSurrealDB ¶
func (c *Client) GetSurrealDB() *surrealdb.DB
GetSurrealDB returns the SurrealDB connection
func (*Client) IsRedisConnected ¶
IsRedisConnected checks if Redis is connected
func (*Client) IsSurrealDBConnected ¶
IsSurrealDBConnected checks if SurrealDB is connected
type CountFilters ¶
type CountFilters struct { SessionID types.SessionID `json:"session_id,omitempty"` TimeRange *models.TimeRange `json:"time_range,omitempty"` Processed *bool `json:"processed,omitempty"` }
CountFilters represents filters for counting episodes
type EpisodeStats ¶
type EpisodeStats struct { TotalEpisodes int `json:"total_episodes"` ProcessedEpisodes int `json:"processed_episodes"` UnprocessedEpisodes int `json:"unprocessed_episodes"` EpisodesWithEmbeddings int `json:"episodes_with_embeddings"` UniqueSessions int `json:"unique_sessions"` LastUpdated time.Time `json:"last_updated"` }
EpisodeStats represents statistics about episodes
type EpisodeStore ¶
type EpisodeStore struct {
// contains filtered or unexported fields
}
EpisodeStore provides CRUD operations for episodes
func NewEpisodeStore ¶
func NewEpisodeStore(client *Client) *EpisodeStore
NewEpisodeStore creates a new episode store
func (*EpisodeStore) BatchCreate ¶
BatchCreate creates multiple episodes in a single transaction
func (*EpisodeStore) Count ¶
func (s *EpisodeStore) Count(ctx context.Context, tenantID types.TenantID, filters *CountFilters) (int, error)
Count returns the total number of episodes for a tenant
func (*EpisodeStore) GetByID ¶
func (s *EpisodeStore) GetByID(ctx context.Context, tenantID types.TenantID, episodeID string) (*models.Episode, error)
GetByID retrieves an episode by its ID
func (*EpisodeStore) GetBySessionID ¶
func (s *EpisodeStore) GetBySessionID(ctx context.Context, tenantID types.TenantID, sessionID types.SessionID, limit, offset int) ([]*models.Episode, error)
GetBySessionID retrieves episodes for a specific session
func (*EpisodeStore) GetStats ¶
func (s *EpisodeStore) GetStats(ctx context.Context, tenantID types.TenantID) (*EpisodeStats, error)
GetStats returns statistics about episodes for a tenant
func (*EpisodeStore) GetUnprocessed ¶
func (s *EpisodeStore) GetUnprocessed(ctx context.Context, tenantID types.TenantID, limit int) ([]*models.Episode, error)
GetUnprocessed retrieves episodes that haven't been processed for entity extraction
func (*EpisodeStore) List ¶
func (s *EpisodeStore) List(ctx context.Context, tenantID types.TenantID, options *ListOptions) ([]*models.Episode, int, error)
List retrieves episodes with pagination and filtering
func (*EpisodeStore) MarkAsProcessed ¶
func (s *EpisodeStore) MarkAsProcessed(ctx context.Context, tenantID types.TenantID, episodeID string) error
MarkAsProcessed marks an episode as processed for entity extraction
func (*EpisodeStore) Update ¶
func (s *EpisodeStore) Update(ctx context.Context, tenantID types.TenantID, episodeID string, updates *models.EpisodeUpdateRequest) (*models.Episode, error)
Update updates an existing episode
func (*EpisodeStore) UpdateEmbedding ¶
func (s *EpisodeStore) UpdateEmbedding(ctx context.Context, tenantID types.TenantID, episodeID string, embedding []float32) error
UpdateEmbedding updates the embedding for an episode
type GraphStats ¶
type GraphStats struct { TotalEntities int `json:"total_entities"` TotalRelationships int `json:"total_relationships"` EntityTypes map[string]int `json:"entity_types"` RelationshipTypes map[string]int `json:"relationship_types"` LastUpdated time.Time `json:"last_updated"` }
GraphStats represents statistics about the knowledge graph
type GraphStore ¶
type GraphStore struct {
// contains filtered or unexported fields
}
GraphStore provides operations for managing the knowledge graph
func NewGraphStore ¶
func NewGraphStore(client *Client) *GraphStore
NewGraphStore creates a new graph store
func (*GraphStore) BatchCreateEntities ¶
BatchCreateEntities creates multiple entities in a single transaction
func (*GraphStore) BatchCreateRelationships ¶
func (s *GraphStore) BatchCreateRelationships(ctx context.Context, relationships []*models.Relationship) error
BatchCreateRelationships creates multiple relationships in a single transaction
func (*GraphStore) CreateEntity ¶
CreateEntity creates a new entity in the knowledge graph
func (*GraphStore) CreateRelationship ¶
func (s *GraphStore) CreateRelationship(ctx context.Context, relationship *models.Relationship) error
CreateRelationship creates a relationship between two entities
func (*GraphStore) DeleteEntity ¶
func (s *GraphStore) DeleteEntity(ctx context.Context, tenantID types.TenantID, entityID string) error
DeleteEntity deletes an entity and all its relationships
func (*GraphStore) DeleteRelationship ¶
func (s *GraphStore) DeleteRelationship(ctx context.Context, tenantID types.TenantID, relationshipID string) error
DeleteRelationship deletes a specific relationship
func (*GraphStore) FindEntityByName ¶
func (s *GraphStore) FindEntityByName(ctx context.Context, tenantID types.TenantID, name, entityType string) (*models.Entity, error)
FindEntityByName finds an entity by name and type
func (*GraphStore) GetEntityRelationships ¶
func (s *GraphStore) GetEntityRelationships(ctx context.Context, tenantID types.TenantID, entityID string, direction RelationshipDirection) ([]*models.Relationship, error)
GetEntityRelationships gets all relationships for an entity
func (*GraphStore) GetGraphStats ¶
func (s *GraphStore) GetGraphStats(ctx context.Context, tenantID types.TenantID) (*GraphStats, error)
GetGraphStats returns statistics about the knowledge graph
func (*GraphStore) GetOrCreateEntity ¶
func (s *GraphStore) GetOrCreateEntity(ctx context.Context, tenantID types.TenantID, name, entityType string) (*models.Entity, error)
GetOrCreateEntity gets an existing entity or creates a new one if it doesn't exist
func (*GraphStore) GetRelatedEntities ¶
func (s *GraphStore) GetRelatedEntities(ctx context.Context, tenantID types.TenantID, entityID string, relationType string, direction RelationshipDirection, limit int) ([]*models.RelatedEntity, error)
GetRelatedEntities gets entities related to a given entity
func (*GraphStore) RelateEntities ¶
func (s *GraphStore) RelateEntities(ctx context.Context, tenantID types.TenantID, fromEntityID, toEntityID, relationType string, properties map[string]interface{}) error
RelateEntities creates a relationship between two entities by their IDs
func (*GraphStore) RelationshipExists ¶
func (s *GraphStore) RelationshipExists(ctx context.Context, tenantID types.TenantID, fromEntityID, toEntityID, relationType string) (bool, error)
RelationshipExists checks if a relationship already exists between two entities
type ListOptions ¶
type ListOptions struct { Limit int `json:"limit"` Offset int `json:"offset"` SessionID types.SessionID `json:"session_id,omitempty"` TimeRange *models.TimeRange `json:"time_range,omitempty"` Processed *bool `json:"processed,omitempty"` OrderBy string `json:"order_by,omitempty"` // "event_time", "tx_time", "created_at" OrderDesc bool `json:"order_desc,omitempty"` }
ListOptions represents options for listing episodes
type RelationshipDirection ¶
type RelationshipDirection string
RelationshipDirection represents the direction of relationships to query
const ( RelationshipDirectionOutgoing RelationshipDirection = "outgoing" RelationshipDirectionIncoming RelationshipDirection = "incoming" RelationshipDirectionBoth RelationshipDirection = "both" )