Documentation
¶
Index ¶
- Variables
- func CosineSimilarity(a, b []float32) float64
- func EntityText(e memory.Entity) string
- type Config
- type DocEmbedding
- type DocResult
- type DocStore
- type EmbeddingProvider
- type EntityEmbedding
- type EntityOpener
- type EntityResult
- type GraphReader
- type Indexer
- type SemanticSearcher
- func (ss *SemanticSearcher) Enabled() bool
- func (ss *SemanticSearcher) IndexDocs(ctx context.Context, repo string)
- func (ss *SemanticSearcher) ScheduleIndexEntities(names []string)
- func (ss *SemanticSearcher) SearchDocs(ctx context.Context, query, repo string, topK int) ([]DocResult, int, error)
- func (ss *SemanticSearcher) SearchEntities(ctx context.Context, query string, topK int) ([]EntityResult, int, error)
- type VectorStore
- func (vs *VectorStore) DeleteDocByID(docID string) error
- func (vs *VectorStore) DeleteEntityByName(entityName string) error
- func (vs *VectorStore) LoadDocEmbeddings(modelKey string) ([]DocEmbedding, error)
- func (vs *VectorStore) LoadEntityEmbeddings(modelKey string) ([]EntityEmbedding, error)
- func (vs *VectorStore) UpsertDoc(docID, contentHash, modelKey string, vector []float32) error
- func (vs *VectorStore) UpsertEntity(entityName, obsHash, modelKey string, vector []float32) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRateLimit = errors.New("openai: rate limit exceeded (HTTP 429)")
Functions ¶
func CosineSimilarity ¶
func EntityText ¶
Types ¶
type Config ¶
func ConfigFromEnv ¶
func ConfigFromEnv() Config
type DocEmbedding ¶
type EmbeddingProvider ¶
type EmbeddingProvider interface {
Embed(ctx context.Context, texts []string) ([][]float32, error)
ModelKey() string
}
func NewOllamaProvider ¶
func NewOllamaProvider(baseURL, model string) EmbeddingProvider
func NewOpenAIProvider ¶
func NewOpenAIProvider(apiKey, model string) EmbeddingProvider
func NewOpenAIProviderWithURL ¶
func NewOpenAIProviderWithURL(apiKey, model, baseURL string) EmbeddingProvider
func NewProvider ¶
func NewProvider(cfg Config) EmbeddingProvider
type EntityEmbedding ¶
type EntityOpener ¶
type EntityOpener interface {
OpenNodes(names []string) (memory.KnowledgeGraph, error)
}
type EntityResult ¶
type GraphReader ¶
type GraphReader interface {
ReadGraph() (memory.KnowledgeGraph, error)
}
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
func NewIndexer ¶
func NewIndexer(provider EmbeddingProvider, store *VectorStore, docs DocStore, entities EntityOpener) *Indexer
func (*Indexer) IndexEntities ¶
func (*Indexer) ScheduleEntities ¶
type SemanticSearcher ¶
type SemanticSearcher struct {
// contains filtered or unexported fields
}
func NewSemanticSearcher ¶
func NewSemanticSearcher(provider EmbeddingProvider, store *VectorStore, indexer *Indexer, docs DocStore, entities GraphReader) *SemanticSearcher
func (*SemanticSearcher) Enabled ¶
func (ss *SemanticSearcher) Enabled() bool
func (*SemanticSearcher) IndexDocs ¶
func (ss *SemanticSearcher) IndexDocs(ctx context.Context, repo string)
func (*SemanticSearcher) ScheduleIndexEntities ¶
func (ss *SemanticSearcher) ScheduleIndexEntities(names []string)
func (*SemanticSearcher) SearchDocs ¶
func (*SemanticSearcher) SearchEntities ¶
func (ss *SemanticSearcher) SearchEntities(ctx context.Context, query string, topK int) ([]EntityResult, int, error)
type VectorStore ¶
type VectorStore struct {
// contains filtered or unexported fields
}
func NewVectorStore ¶
func NewVectorStore(db *gorm.DB) (*VectorStore, error)
func (*VectorStore) DeleteDocByID ¶
func (vs *VectorStore) DeleteDocByID(docID string) error
func (*VectorStore) DeleteEntityByName ¶
func (vs *VectorStore) DeleteEntityByName(entityName string) error
func (*VectorStore) LoadDocEmbeddings ¶
func (vs *VectorStore) LoadDocEmbeddings(modelKey string) ([]DocEmbedding, error)
func (*VectorStore) LoadEntityEmbeddings ¶
func (vs *VectorStore) LoadEntityEmbeddings(modelKey string) ([]EntityEmbedding, error)
func (*VectorStore) UpsertDoc ¶
func (vs *VectorStore) UpsertDoc(docID, contentHash, modelKey string, vector []float32) error
func (*VectorStore) UpsertEntity ¶
func (vs *VectorStore) UpsertEntity(entityName, obsHash, modelKey string, vector []float32) error
Click to show internal directories.
Click to hide internal directories.