Documentation
¶
Index ¶
- type Bolt
- type Chromem
- type EmbeddingFunc
- type Milvus
- func (m Milvus) Close(ctx context.Context) error
- func (m Milvus) VectorQueryEntity(keywords string) ([]string, error)
- func (m Milvus) VectorQueryRelationship(keywords string) ([][2]string, error)
- func (m Milvus) VectorUpsertEntity(name, content string) error
- func (m Milvus) VectorUpsertRelationship(source, target, content string) error
- type Neo4J
- func (n Neo4J) Close(ctx context.Context) error
- func (n Neo4J) GraphCountEntitiesRelationships(names []string) (map[string]int, error)
- func (n Neo4J) GraphEntities(names []string) (map[string]golightrag.GraphEntity, error)
- func (n Neo4J) GraphEntity(name string) (golightrag.GraphEntity, error)
- func (n Neo4J) GraphRelatedEntities(names []string) (map[string][]golightrag.GraphEntity, error)
- func (n Neo4J) GraphRelationship(sourceEntity, targetEntity string) (golightrag.GraphRelationship, error)
- func (n Neo4J) GraphRelationships(pairs [][2]string) (map[string]golightrag.GraphRelationship, error)
- func (n Neo4J) GraphUpsertEntity(entity golightrag.GraphEntity) error
- func (n Neo4J) GraphUpsertRelationship(relationship golightrag.GraphRelationship) error
- type Redis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bolt ¶
Bolt provides a BoltDB key-value storage implementation of storage interfaces. It handles database operations for storing and retrieving source documents.
func NewBolt ¶
NewBolt creates a new BoltDB client connection with the provided file path. It returns an initialized Bolt struct and any error encountered during database setup. The function ensures that required buckets exist in the database.
func (Bolt) KVSource ¶
func (b Bolt) KVSource(id string) (golightrag.Source, error)
KVSource retrieves a source document by ID from the BoltDB database. It returns the found source or an error if the source doesn't exist or if the query fails.
func (Bolt) KVUpsertSources ¶
func (b Bolt) KVUpsertSources(sources []golightrag.Source) error
KVUpsertSources creates or updates multiple source documents in the BoltDB database. It returns an error if any database operation fails during the process.
type Chromem ¶
type Chromem struct { EntitiesColl *chromem.Collection RelationshipsColl *chromem.Collection // contains filtered or unexported fields }
Chromem provides a vector storage implementation using ChromeM database. It handles operations for storing and retrieving vector-based entities and relationships with semantic search capabilities.
func NewChromem ¶
func NewChromem(dbPath string, topK int, embeddingFunc EmbeddingFunc) (Chromem, error)
NewChromem creates a new ChromeM client with the provided parameters. It returns an initialized Chromem struct and any error encountered during setup. The dbPath parameter specifies where to persist the database, topK defines the number of results to return in queries, and embeddingFunc provides the vector embedding capability.
func (Chromem) VectorQueryEntity ¶
VectorQueryEntity performs a semantic search for entities based on the provided keywords. It returns a slice of matching entity names and any error encountered during the operation.
func (Chromem) VectorQueryRelationship ¶
VectorQueryRelationship performs a semantic search for relationships based on the provided keywords. It returns a slice of source-target entity pairs and any error encountered during the operation.
func (Chromem) VectorUpsertEntity ¶
VectorUpsertEntity creates or updates an entity with vector embedding based on its content. It returns an error if the database operation fails.
func (Chromem) VectorUpsertRelationship ¶
VectorUpsertRelationship creates or updates a relationship with vector embedding based on its content. It returns an error if the database operation fails.
type EmbeddingFunc ¶ added in v0.1.2
EmbeddingFunc is a function type for embedding text into a vector.
type Milvus ¶ added in v0.1.2
type Milvus struct {
// contains filtered or unexported fields
}
Milvus provides a vector storage implementation using Milvus database. It handles operations for storing and retrieving vector-based entities and relationships with semantic search capabilities.
The Close() method should be called when done to properly release resources.
func NewMilvus ¶ added in v0.1.2
func NewMilvus(config *milvusclient.ClientConfig, topK, vectorDim int, embeddingFunc EmbeddingFunc) (Milvus, error)
NewMilvus creates a new Milvus client with the provided parameters. It returns an initialized Milvus struct and any error encountered during setup.
func (Milvus) VectorQueryEntity ¶ added in v0.1.2
VectorQueryEntity performs a semantic search for entities based on the provided keywords.
func (Milvus) VectorQueryRelationship ¶ added in v0.1.2
VectorQueryRelationship performs a semantic search for relationships based on the provided keywords.
func (Milvus) VectorUpsertEntity ¶ added in v0.1.2
VectorUpsertEntity creates or updates an entity with vector embedding based on its content.
func (Milvus) VectorUpsertRelationship ¶ added in v0.1.2
VectorUpsertRelationship creates or updates a relationship with vector embedding based on its content.
type Neo4J ¶
type Neo4J struct {
Client neo4j.DriverWithContext
}
Neo4J provides a Neo4j graph database implementation of storage interfaces. It handles database connections and operations for storing and retrieving graph entities and relationships.
func NewNeo4J ¶
NewNeo4J creates a new Neo4j client connection with the provided connection parameters. It returns an initialized Neo4J struct and any error encountered during connection setup. The returned Neo4J instance must be closed with Close() when no longer needed to free up resources.
func (Neo4J) Close ¶
Close terminates the connection to the Neo4j database. It returns any error encountered during the closing operation.
func (Neo4J) GraphCountEntitiesRelationships ¶
GraphCountEntitiesRelationships counts the number of relationships for multiple entities. It returns a map of entity names to their relationship counts.
func (Neo4J) GraphEntities ¶
func (n Neo4J) GraphEntities(names []string) (map[string]golightrag.GraphEntity, error)
GraphEntities retrieves multiple graph entities by their names from the Neo4j database. It returns a map of entity names to GraphEntity objects, or an error if the query fails.
func (Neo4J) GraphEntity ¶
func (n Neo4J) GraphEntity(name string) (golightrag.GraphEntity, error)
GraphEntity retrieves a graph entity by name from the Neo4j database. It returns the found entity or an error if the entity doesn't exist or if the query fails.
func (Neo4J) GraphRelatedEntities ¶
func (n Neo4J) GraphRelatedEntities(names []string) (map[string][]golightrag.GraphEntity, error)
GraphRelatedEntities retrieves all entities related to multiple input entities. It returns a map of entity names to slices of related GraphEntity objects.
func (Neo4J) GraphRelationship ¶
func (n Neo4J) GraphRelationship(sourceEntity, targetEntity string) (golightrag.GraphRelationship, error)
GraphRelationship retrieves a relationship between two entities from the Neo4j database. It returns the found relationship or an error if the relationship doesn't exist or if the query fails.
func (Neo4J) GraphRelationships ¶
func (n Neo4J) GraphRelationships(pairs [][2]string) (map[string]golightrag.GraphRelationship, error)
GraphRelationships retrieves multiple relationships between entity pairs from the Neo4j database. It returns a map where the key is "sourceEntity-targetEntity" and the value is the GraphRelationship.
func (Neo4J) GraphUpsertEntity ¶
func (n Neo4J) GraphUpsertEntity(entity golightrag.GraphEntity) error
GraphUpsertEntity creates or updates an entity in the Neo4j graph database. It returns an error if the database operation fails.
func (Neo4J) GraphUpsertRelationship ¶
func (n Neo4J) GraphUpsertRelationship(relationship golightrag.GraphRelationship) error
GraphUpsertRelationship creates or updates a relationship between two entities in the Neo4j graph database. It returns an error if the database operation fails.
type Redis ¶ added in v0.1.2
type Redis struct {
Client *redis.Client
}
Redis provides a Redis key-value storage implementation of storage interfaces. It handles database operations for storing and retrieving source documents.
func NewRedis ¶ added in v0.1.2
NewRedis creates a new Redis client connection with the provided configuration. It returns an initialized Redis struct and any error encountered during connection setup.
func (Redis) KVSource ¶ added in v0.1.2
func (r Redis) KVSource(id string) (golightrag.Source, error)
KVSource retrieves a source document by ID from the Redis database. It returns the found source or an error if the source doesn't exist or if the query fails.
func (Redis) KVUpsertSources ¶ added in v0.1.2
func (r Redis) KVUpsertSources(sources []golightrag.Source) error
KVUpsertSources creates or updates multiple source documents in the Redis database. It returns an error if any database operation fails during the process.