Documentation
¶
Index ¶
- type Config
- type ESConfig
- type ESVectorStore
- func (s *ESVectorStore) Close() error
- func (s *ESVectorStore) CreateIndex(ctx context.Context, indexName string) error
- func (s *ESVectorStore) DeleteDocument(ctx context.Context, indexName, documentID string) error
- func (s *ESVectorStore) GetClient() *elasticsearch.Client
- func (s *ESVectorStore) GetKnowledgeBaseList(ctx context.Context, indexName string) ([]string, error)
- func (s *ESVectorStore) IndexExists(ctx context.Context, indexName string) (bool, error)
- func (s *ESVectorStore) SearchDocuments(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
- type QdrantConfig
- type QdrantSearchQuery
- type QdrantVectorStore
- func (s *QdrantVectorStore) Close() error
- func (s *QdrantVectorStore) CreateIndex(ctx context.Context, indexName string) error
- func (s *QdrantVectorStore) DeleteDocument(ctx context.Context, indexName, documentID string) error
- func (s *QdrantVectorStore) GetClient() *qdrant.Client
- func (s *QdrantVectorStore) GetKnowledgeBaseList(ctx context.Context, indexName string) ([]string, error)
- func (s *QdrantVectorStore) IndexExists(ctx context.Context, indexName string) (bool, error)
- func (s *QdrantVectorStore) SearchDocuments(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
- type SearchRequest
- type SearchResponse
- type VectorStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Type string // 类型:es 或 qdrant
IndexName string // 索引名称
ES *ESConfig // ES 配置
Qdrant *QdrantConfig // Qdrant 配置
}
Config 向量存储配置
type ESVectorStore ¶
type ESVectorStore struct {
// contains filtered or unexported fields
}
ESVectorStore Elasticsearch 向量存储实现
func NewESVectorStore ¶
func NewESVectorStore(cfg *ESConfig) (*ESVectorStore, error)
NewESVectorStore 创建 ES 向量存储实例
func (*ESVectorStore) CreateIndex ¶
func (s *ESVectorStore) CreateIndex(ctx context.Context, indexName string) error
CreateIndex 创建索引
func (*ESVectorStore) DeleteDocument ¶
func (s *ESVectorStore) DeleteDocument(ctx context.Context, indexName, documentID string) error
DeleteDocument 删除文档
func (*ESVectorStore) GetClient ¶
func (s *ESVectorStore) GetClient() *elasticsearch.Client
GetClient 获取 ES 客户端(用于兼容现有代码)
func (*ESVectorStore) GetKnowledgeBaseList ¶
func (s *ESVectorStore) GetKnowledgeBaseList(ctx context.Context, indexName string) ([]string, error)
GetKnowledgeBaseList 获取知识库列表
func (*ESVectorStore) IndexExists ¶
IndexExists 检查索引是否存在
func (*ESVectorStore) SearchDocuments ¶
func (s *ESVectorStore) SearchDocuments(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
SearchDocuments 搜索文档
type QdrantConfig ¶
QdrantConfig Qdrant 配置
type QdrantSearchQuery ¶
QdrantSearchQuery Qdrant 搜索查询
type QdrantVectorStore ¶
type QdrantVectorStore struct {
// contains filtered or unexported fields
}
QdrantVectorStore Qdrant 向量存储实现
func NewQdrantVectorStore ¶
func NewQdrantVectorStore(cfg *QdrantConfig) (*QdrantVectorStore, error)
NewQdrantVectorStore 创建 Qdrant 向量存储实例
func (*QdrantVectorStore) CreateIndex ¶
func (s *QdrantVectorStore) CreateIndex(ctx context.Context, indexName string) error
CreateIndex 创建集合
func (*QdrantVectorStore) DeleteDocument ¶
func (s *QdrantVectorStore) DeleteDocument(ctx context.Context, indexName, documentID string) error
DeleteDocument 删除文档
func (*QdrantVectorStore) GetClient ¶
func (s *QdrantVectorStore) GetClient() *qdrant.Client
GetClient 获取 Qdrant 客户端(用于兼容现有代码)
func (*QdrantVectorStore) GetKnowledgeBaseList ¶
func (s *QdrantVectorStore) GetKnowledgeBaseList(ctx context.Context, indexName string) ([]string, error)
GetKnowledgeBaseList 获取知识库列表
func (*QdrantVectorStore) IndexExists ¶
IndexExists 检查集合是否存在
func (*QdrantVectorStore) SearchDocuments ¶
func (s *QdrantVectorStore) SearchDocuments(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
SearchDocuments 搜索文档
type SearchRequest ¶
type SearchRequest struct {
IndexName string
Query interface{} // 查询条件,不同实现可能不同
Size int
KnowledgeName string
DocIDs []string
}
SearchRequest 搜索请求
type SearchResponse ¶
SearchResponse 搜索响应
type VectorStore ¶
type VectorStore interface {
// CreateIndex 创建索引
CreateIndex(ctx context.Context, indexName string) error
// IndexExists 检查索引是否存在
IndexExists(ctx context.Context, indexName string) (bool, error)
// DeleteDocument 删除文档
DeleteDocument(ctx context.Context, indexName, documentID string) error
// GetKnowledgeBaseList 获取知识库列表
GetKnowledgeBaseList(ctx context.Context, indexName string) ([]string, error)
// SearchDocuments 搜索文档
SearchDocuments(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
// Close 关闭连接
Close() error
}
VectorStore 向量存储接口
Click to show internal directories.
Click to hide internal directories.