Documentation
¶
Index ¶
- Constants
- Variables
- type AliyunOptions
- type DeleteOptions
- type Embedder
- type FactoryOptions
- type GetOptions
- type KnowledgeHandler
- type KnowledgeProvider
- type ListOptions
- type ListResult
- type NvidiaEmbedClient
- type QdrantHandler
- func (qh *QdrantHandler) Delete(ctx context.Context, ids []string, options *DeleteOptions) error
- func (qh *QdrantHandler) Get(ctx context.Context, ids []string, options *GetOptions) ([]Record, error)
- func (qh *QdrantHandler) List(ctx context.Context, options *ListOptions) (*ListResult, error)
- func (qh *QdrantHandler) Provider() string
- func (qh *QdrantHandler) Query(ctx context.Context, text string, options *QueryOptions) ([]QueryResult, error)
- func (qh *QdrantHandler) Upsert(ctx context.Context, records []Record, options *UpsertOptions) error
- type QdrantOptions
- type QueryOptions
- type QueryResult
- type Record
- type RerankResult
- type SiliconFlowRerankClient
- type UpsertOptions
Constants ¶
View Source
const ( // KnowledgeAliyun Aliyun Bailian Knowledge Base KnowledgeAliyun = "aliyun" // KnowledgeQdrant Qdrant Vector Database KnowledgeQdrant = "qdrant" )
Variables ¶
View Source
var ErrUnsupportedKnowledgeProvider = errors.New("unsupported knowledge provider")
Functions ¶
This section is empty.
Types ¶
type AliyunOptions ¶
type AliyunOptions struct{}
type DeleteOptions ¶
type DeleteOptions struct {
Namespace string
}
type FactoryOptions ¶
type FactoryOptions struct {
Qdrant *QdrantOptions
Aliyun *AliyunOptions
}
type GetOptions ¶
type GetOptions struct {
Namespace string
}
type KnowledgeHandler ¶
type KnowledgeHandler interface {
Provider() string
Upsert(ctx context.Context, records []Record, options *UpsertOptions) error
Query(ctx context.Context, text string, options *QueryOptions) ([]QueryResult, error)
Get(ctx context.Context, ids []string, options *GetOptions) ([]Record, error)
List(ctx context.Context, options *ListOptions) (*ListResult, error)
Delete(ctx context.Context, ids []string, options *DeleteOptions) error
}
func New ¶
func New(provider string, opts *FactoryOptions) (KnowledgeHandler, error)
type KnowledgeProvider ¶
type KnowledgeProvider string
KnowledgeProvider common provider type
func (KnowledgeProvider) ToString ¶
func (kp KnowledgeProvider) ToString() string
ToString toString for llm
type ListOptions ¶
type ListResult ¶
type NvidiaEmbedClient ¶
type QdrantHandler ¶
type QdrantHandler struct {
BaseURL string
APIKey string
Collection string
HTTPClient *http.Client
Embedder Embedder
}
func (*QdrantHandler) Delete ¶
func (qh *QdrantHandler) Delete(ctx context.Context, ids []string, options *DeleteOptions) error
func (*QdrantHandler) Get ¶
func (qh *QdrantHandler) Get(ctx context.Context, ids []string, options *GetOptions) ([]Record, error)
func (*QdrantHandler) List ¶
func (qh *QdrantHandler) List(ctx context.Context, options *ListOptions) (*ListResult, error)
func (*QdrantHandler) Provider ¶
func (qh *QdrantHandler) Provider() string
func (*QdrantHandler) Query ¶
func (qh *QdrantHandler) Query(ctx context.Context, text string, options *QueryOptions) ([]QueryResult, error)
func (*QdrantHandler) Upsert ¶
func (qh *QdrantHandler) Upsert(ctx context.Context, records []Record, options *UpsertOptions) error
type QdrantOptions ¶
type QueryResult ¶
type RerankResult ¶
type SiliconFlowRerankClient ¶
type SiliconFlowRerankClient struct {
BaseURL string
APIKey string
Model string
HTTPClient *http.Client
}
func (*SiliconFlowRerankClient) Rerank ¶
func (c *SiliconFlowRerankClient) Rerank(ctx context.Context, query string, documents []string, topN int) ([]RerankResult, error)
type UpsertOptions ¶
Click to show internal directories.
Click to hide internal directories.