函数定义#
AddDocument#
详细描述#
AddDocument(knowledgeBaseName string, documentName string, document string, metadata map[string]any, opts ...any) error
参数名 | 参数类型 | 参数解释 |
---|
knowledgeBaseName | string | |
documentName | string | |
document | string | |
metadata | map[string]any | |
opts | ...any | |
返回值#
BuildCollectionFromFile#
详细描述#
BuildCollectionFromFile(kbName string, path string, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)
参数名 | 参数类型 | 参数解释 |
---|
kbName | string | |
path | string | |
option | ...any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | <-chan *schema.KnowledgeBaseEntry | |
r2 | error | |
BuildCollectionFromRaw#
详细描述#
BuildCollectionFromRaw(kbName string, content []byte, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)
参数名 | 参数类型 | 参数解释 |
---|
kbName | string | |
content | []byte | |
option | ...any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | <-chan *schema.KnowledgeBaseEntry | |
r2 | error | |
BuildCollectionFromReader#
详细描述#
BuildCollectionFromReader(kbName string, reader io.Reader, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)
参数名 | 参数类型 | 参数解释 |
---|
kbName | string | |
reader | io.Reader | |
option | ...any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | <-chan *schema.KnowledgeBaseEntry | |
r2 | error | |
BuildKnowledgeFromEntityRepos#
详细描述#
BuildKnowledgeFromEntityRepos(name string, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)
参数名 | 参数类型 | 参数解释 |
---|
name | string | |
option | ...any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | <-chan *schema.KnowledgeBaseEntry | |
r2 | error | |
DeleteCollection#
详细描述#
DeleteCollection(name string) error
返回值#
DeleteDocument#
详细描述#
DeleteDocument(knowledgeBaseName string, documentName string, opts ...any) error
参数名 | 参数类型 | 参数解释 |
---|
knowledgeBaseName | string | |
documentName | string | |
opts | ...any | |
返回值#
EnableMockMode#
详细描述#
EnableMockMode()
GetCollection#
详细描述#
GetCollection(name string, i ...any) (*RAGSystem, error)
参数名 | 参数类型 | 参数解释 |
---|
name | string | |
i | ...any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | *RAGSystem | |
r2 | error | |
GetCollectionInfo#
详细描述#
GetCollectionInfo(name string) (*rag.CollectionInfo, error)
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | *rag.CollectionInfo | |
r2 | error | |
ListCollection#
详细描述#
ListCollection() []string
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | []string | |
NewRagDatabase#
详细描述#
NewRagDatabase(path string) (*gorm.DB, error)
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | *gorm.DB | |
r2 | error | |
NewTempRagDatabase#
详细描述#
NewTempRagDatabase() (*gorm.DB, error)
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | *gorm.DB | |
r2 | error | |
Query#
详细描述#
Query(query string, opts ...RAGQueryOption) (<-chan *RAGSearchResult, error)
参数名 | 参数类型 | 参数解释 |
---|
query | string | |
opts | ...RAGQueryOption | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | <-chan *RAGSearchResult | |
r2 | error | |
QueryDocuments#
详细描述#
QueryDocuments(knowledgeBaseName string, query string, limit int, opts ...any) ([]rag.SearchResult, error)
参数名 | 参数类型 | 参数解释 |
---|
knowledgeBaseName | string | |
query | string | |
limit | int | |
opts | ...any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | []rag.SearchResult | |
r2 | error | |
QueryDocumentsWithAISummary#
详细描述#
QueryDocumentsWithAISummary(knowledgeBaseName string, query string, limit int, opts ...any) (string, error)
参数名 | 参数类型 | 参数解释 |
---|
knowledgeBaseName | string | |
query | string | |
limit | int | |
opts | ...any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | string | |
r2 | error | |
buildFilter#
详细描述#
buildFilter(filter *ypb.EntityFilter) KHopQueryOption
参数名 | 参数类型 | 参数解释 |
---|
filter | *ypb.EntityFilter | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | KHopQueryOption | |
buildQuery#
详细描述#
buildQuery(query string) KHopQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | KHopQueryOption | |
ctx#
详细描述#
ctx(ctx context.Context) AnalysisOption
参数名 | 参数类型 | 参数解释 |
---|
ctx | context.Context | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | AnalysisOption | |
docMetadata#
详细描述#
docMetadata(key string, value any) DocumentOption
参数名 | 参数类型 | 参数解释 |
---|
key | string | |
value | any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | DocumentOption | |
docRawMetadata#
详细描述#
docRawMetadata(i map[string]any) DocumentOption
参数名 | 参数类型 | 参数解释 |
---|
i | map[string]any | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | DocumentOption | |
entryLength#
详细描述#
entryLength(length int) RefineOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RefineOption | |
extraPrompt#
详细描述#
extraPrompt(prompt string) AnalysisOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | AnalysisOption | |
getEntityFilter#
详细描述#
getEntityFilter(reposName string, entityTypes []string, names []string, HiddenIndex []string, keywords []string) *ypb.EntityFilter
参数名 | 参数类型 | 参数解释 |
---|
reposName | string | |
entityTypes | []string | |
names | []string | |
HiddenIndex | []string | |
keywords | []string | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | *ypb.EntityFilter | |
khopLimit#
详细描述#
khopLimit(k int) KHopQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | KHopQueryOption | |
khopk#
详细描述#
WithKHopK 设置k-hop的跳数,k>=2时返回k-hop路径,k=0返回所有路径
khopk(k int) KHopQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | KHopQueryOption | |
khopkMax#
详细描述#
WithKHopKMax 设置最大路径长度,最小值为2
khopkMax(kMax int) KHopQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | KHopQueryOption | |
khopkMin#
详细描述#
WithKHopKMin 设置最小路径长度,最小值为2
khopkMin(kMin int) KHopQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | KHopQueryOption | |
log#
详细描述#
log(handler func(format string, args ...any)) AnalysisOption
参数名 | 参数类型 | 参数解释 |
---|
handler | func(format string, args ...any) | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | AnalysisOption | |
pathDepth#
详细描述#
pathDepth(deep int) KHopQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | KHopQueryOption | |
queryCollection#
详细描述#
WithRAGCollectionName 指定搜索的集合名称
queryCollection(collectionName string) RAGQueryOption
参数名 | 参数类型 | 参数解释 |
---|
collectionName | string | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
queryConcurrent#
详细描述#
WithRAGConcurrent 设置并发数
queryConcurrent(concurrent int) RAGQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
queryCtx#
详细描述#
WithRAGCtx 设置上下文
queryCtx(ctx context.Context) RAGQueryOption
参数名 | 参数类型 | 参数解释 |
---|
ctx | context.Context | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
queryEnhance#
详细描述#
WithRAGEnhance 启用或禁用增强搜索
queryEnhance(enhancePlan ...string) RAGQueryOption
参数名 | 参数类型 | 参数解释 |
---|
enhancePlan | ...string | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
queryLimit#
详细描述#
WithRAGLimit 设置查询结果限制
queryLimit(limit int) RAGQueryOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
queryScoreLimit#
详细描述#
WithRAGCollectionScoreLimit 设置集合搜索分数阈值
queryScoreLimit(scoreLimit float64) RAGQueryOption
参数名 | 参数类型 | 参数解释 |
---|
scoreLimit | float64 | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
queryStatus#
详细描述#
queryStatus(i func(label string, i any, tags ...string)) RAGQueryOption
参数名 | 参数类型 | 参数解释 |
---|
i | func(label string, i any, tags ...string) | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
queryType#
详细描述#
queryType(documentType ...string) RAGQueryOption
参数名 | 参数类型 | 参数解释 |
---|
documentType | ...string | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGQueryOption | |
ragCosineDistance#
详细描述#
ragCosineDistance()
ragDescription#
详细描述#
ragDescription(description string) RAGOption
参数名 | 参数类型 | 参数解释 |
---|
description | string | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGOption | |
ragEmbeddingModel#
详细描述#
WithEmbeddingModel 设置embedding模型
ragEmbeddingModel(model string) RAGOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGOption | |
ragForceNew#
详细描述#
ragForceNew(i ...bool) RAGOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGOption | |
ragHNSWParameters#
详细描述#
WithHNSWParameters 批量设置HNSW参数
ragHNSWParameters(m int, ml float64, efSearch int, efConstruct int) RAGOption
参数名 | 参数类型 | 参数解释 |
---|
m | int | |
ml | float64 | |
efSearch | int | |
efConstruct | int | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGOption | |
ragModelDimension#
详细描述#
WithModelDimension 设置模型维度
ragModelDimension(dimension int) RAGOption
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | RAGOption | |
statusCard#
详细描述#
statusCard(handler func(id string, data any, tags ...string)) AnalysisOption
参数名 | 参数类型 | 参数解释 |
---|
handler | func(id string, data any, tags ...string) | |
返回值#
返回值(顺序) | 返回值类型 | 返回值解释 |
---|
r1 | AnalysisOption | |