Skip to main content

rag

函数名函数描述/介绍
rag.AddDocument_addDocument 向指定集合添加文档
rag.BuildCollectionFromFile
rag.BuildCollectionFromRaw
rag.BuildCollectionFromReader
rag.BuildIndexKnowledgeFromFile
rag.BuildKnowledgeFromEntityRepos
rag.BuildSearchIndexKnowledgeBuildSearchIndexKnowledge builds a search index for the given text content. It generates 5-10 search questions that users might ask to find this cont...
rag.BuildSearchIndexKnowledgeFromFileBuildSearchIndexKnowledgeFromFile builds a search index from a file. It reads the file content and calls BuildSearchIndexKnowledge. Parameters: ...
rag.DeleteAllKnowledgeBase_deleteAllKnowledgeBase 删除所有知识库及其关联的 RAG 内容 清空所有: RAG 向量库、RAG 集合综述库、知识库条目库、知识库集合、问题索引库等
rag.DeleteCollection_deleteCollection 删除指定的 RAG 集合
rag.DeleteDocument_deleteDocument 从指定集合删除文档
rag.DeleteKnowledgeBase_deleteKnowledgeBase 删除指定的知识库及其关联的 RAG 内容 包括: RAG 向量库、RAG 集合综述库、知识库条目库、知识库集合、问题索引库等
rag.DeleteRAG_deleteRAG 删除指定的 RAG 系统
rag.Embedding_embedding 生成文本的嵌入向量 使用默认的嵌入服务生成文本的向量表示(优先使用在线服务,回退到本地服务)
rag.EnableMockMode
rag.Export
rag.Get
rag.GetCollection
rag.GetCollectionInfo_getCollectionInfo 获取指定集合的详细信息
rag.HasCollection_hasCollection 检查指定集合是否存在
rag.Import
rag.ListCollection_listCollection 获取所有 RAG 集合列表
rag.ListRAG_listRAG 列出所有 RAG 系统列表
rag.LocalEmbedding_localEmbedding 使用本地嵌入服务生成文本的向量表示 本地服务需要安装本地模型(如 Qwen3-Embedding-0.6B-Q4_K_M)
rag.NewRagDatabase
rag.NewTempRagDatabase_newTempRagDatabase 创建临时 RAG 数据库
rag.OnlineEmbedding_onlineEmbedding 使用在线嵌入服务生成文本的向量表示 使用 AIBalance 免费在线服务,无需安装本地模型
rag.Query
rag.QueryDocuments_queryDocuments 在指定集合中查询文档
rag.aiService
rag.aiServiceType
rag.buildFilter
rag.buildQuery
rag.chunkSize
rag.ctx
rag.db
rag.docMetadataWithDocumentMetadataKeyValue sets document metadata key-value pairs
rag.docRawMetadataWithDocumentRawMetadata sets raw document metadata
rag.documentHandler
rag.embeddingHandle_embeddingHandle 创建自定义嵌入处理器
rag.entryLength
rag.extraPrompt
rag.getEntityFilter
rag.importNameWithRAGCollectionName sets the specific collection name to query
rag.importOverwrite
rag.importRebuildGraph
rag.khopLimit
rag.khopkWithKHopK 设置k-hop的跳数,k>=2时返回k-hop路径,k=0返回所有路径
rag.khopkMaxWithKHopKMax 设置最大路径长度,最小值为2
rag.khopkMinWithKHopKMin 设置最小路径长度,最小值为2
rag.log
rag.noEntityRepository_noEntityRepository 禁用实体仓库
rag.noHNSWGraph
rag.noKnowledgeBase_noKnowledgeBase 禁用知识库
rag.noMetadata
rag.noOriginInput
rag.onlyPQCode
rag.pathDepth
rag.progressHandler
rag.queryCollectionWithRAGCollectionName sets the specific collection name to query
rag.queryConcurrentWithRAGConcurrent sets the concurrency level for query operations
rag.queryCtxWithRAGCtx sets the context for RAG query operations
rag.queryEnhanceWithRAGEnhance sets the enhancement strategies to apply
rag.queryLimitWithRAGLimit sets the maximum number of results to return
rag.queryScoreLimitWithRAGCollectionScoreLimit sets the score limit for collection filtering
rag.queryStatusWithRAGQueryStatus sets the query status callback function
rag.queryTypeWithRAGDocumentType sets the document type filter
rag.ragCosineDistance
rag.ragDescription
rag.ragEmbeddingModel
rag.ragForceNewWithForceNew sets whether to force creation of new collection
rag.ragHNSWParametersWithHNSWParameters sets HNSW parameters
rag.ragImportFile
rag.ragModelDimensionWithModelDimension sets the model dimension
rag.statusCard

函数定义#

AddDocument#

详细描述#

_addDocument 向指定集合添加文档

Example:


    err = rag.AddDocument("my_collection", "doc1", "content", {"key": "value"})

定义#

AddDocument(knowledgeBaseName string, documentName string, document string, metadata map[string]any, opts ...rag.RAGSystemConfigOption) error

参数#

参数名参数类型参数解释
knowledgeBaseNamestring
documentNamestring
documentstring
metadatamap[string]any
opts...rag.RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1error

BuildCollectionFromFile#

详细描述#

定义#

BuildCollectionFromFile(kbName string, path string, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)

参数#

参数名参数类型参数解释
kbNamestring
pathstring
option...any

返回值#

返回值(顺序)返回值类型返回值解释
r1<-chan *schema.KnowledgeBaseEntry
r2error

BuildCollectionFromRaw#

详细描述#

定义#

BuildCollectionFromRaw(kbName string, content []byte, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)

参数#

参数名参数类型参数解释
kbNamestring
content[]byte
option...any

返回值#

返回值(顺序)返回值类型返回值解释
r1<-chan *schema.KnowledgeBaseEntry
r2error

BuildCollectionFromReader#

详细描述#

定义#

BuildCollectionFromReader(kbName string, reader io.Reader, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)

参数#

参数名参数类型参数解释
kbNamestring
readerio.Reader
option...any

返回值#

返回值(顺序)返回值类型返回值解释
r1<-chan *schema.KnowledgeBaseEntry
r2error

BuildIndexKnowledgeFromFile#

详细描述#

定义#

BuildIndexKnowledgeFromFile(kbName string, path string, option ...any) error

参数#

参数名参数类型参数解释
kbNamestring
pathstring
option...any

返回值#

返回值(顺序)返回值类型返回值解释
r1error

BuildKnowledgeFromEntityRepos#

详细描述#

定义#

BuildKnowledgeFromEntityRepos(name string, option ...any) (<-chan *schema.KnowledgeBaseEntry, error)

参数#

参数名参数类型参数解释
namestring
option...any

返回值#

返回值(顺序)返回值类型返回值解释
r1<-chan *schema.KnowledgeBaseEntry
r2error

BuildSearchIndexKnowledge#

详细描述#

BuildSearchIndexKnowledge builds a search index for the given text content.

It generates 5-10 search questions that users might ask to find this content,

and stores the original content as the knowledge entry.

Parameters:

  • kbName: the knowledge base name

  • text: the content to index (e.g., tool description, usage, parameters)

  • options: optional configuration (rag options, AI options, etc.)

The function will:

  1. Use AI to generate 5-10 search questions based on the text

  2. Store the original text as the knowledge entry

  3. Set docMetadata with question_index and search_target for each question

Example:

text = `工具名:端口扫描器目标:扫描目标主机的开放端口用法:指定目标IP和端口范围,工具会返回开放的端口列表`result = rag.BuildSearchIndexKnowledge("my-tools", text)~println("Generated questions:", result.Questions)

定义#

BuildSearchIndexKnowledge(kbName string, text string, option ...any) (*aiforge.SearchIndexResult, error)

参数#

参数名参数类型参数解释
kbNamestring
textstring
option...any

返回值#

返回值(顺序)返回值类型返回值解释
r1*aiforge.SearchIndexResult
r2error

BuildSearchIndexKnowledgeFromFile#

详细描述#

BuildSearchIndexKnowledgeFromFile builds a search index from a file.

It reads the file content and calls BuildSearchIndexKnowledge.

Parameters:

  • kbName: the knowledge base name

  • filename: the path to the file containing the content to index

  • options: optional configuration (rag options, AI options, etc.)

Example:

result = rag.BuildSearchIndexKnowledgeFromFile("my-tools", "/path/to/tool-description.txt")~println("Generated questions:", result.Questions)

定义#

BuildSearchIndexKnowledgeFromFile(kbName string, filename string, option ...any) (*aiforge.SearchIndexResult, error)

参数#

参数名参数类型参数解释
kbNamestring
filenamestring
option...any

返回值#

返回值(顺序)返回值类型返回值解释
r1*aiforge.SearchIndexResult
r2error

DeleteAllKnowledgeBase#

详细描述#

_deleteAllKnowledgeBase 删除所有知识库及其关联的 RAG 内容

清空所有: RAG 向量库、RAG 集合综述库、知识库条目库、知识库集合、问题索引库等

Example:


    err = rag.DeleteAllKnowledgeBase()

定义#

DeleteAllKnowledgeBase() error

返回值#

返回值(顺序)返回值类型返回值解释
r1error

DeleteCollection#

详细描述#

_deleteCollection 删除指定的 RAG 集合

Example:


    err = rag.DeleteCollection("my_collection")

定义#

DeleteCollection(name string) error

参数#

参数名参数类型参数解释
namestring

返回值#

返回值(顺序)返回值类型返回值解释
r1error

DeleteDocument#

详细描述#

_deleteDocument 从指定集合删除文档

Example:


    err = rag.DeleteDocument("my_collection", "doc1")

定义#

DeleteDocument(knowledgeBaseName string, documentName string, opts ...rag.RAGSystemConfigOption) error

参数#

参数名参数类型参数解释
knowledgeBaseNamestring
documentNamestring
opts...rag.RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1error

DeleteKnowledgeBase#

详细描述#

_deleteKnowledgeBase 删除指定的知识库及其关联的 RAG 内容

包括: RAG 向量库、RAG 集合综述库、知识库条目库、知识库集合、问题索引库等

Example:


    err = rag.DeleteKnowledgeBase("my_knowledge_base")

定义#

DeleteKnowledgeBase(name string) error

参数#

参数名参数类型参数解释
namestring

返回值#

返回值(顺序)返回值类型返回值解释
r1error

DeleteRAG#

详细描述#

_deleteRAG 删除指定的 RAG 系统

Example:


    err = rag.DeleteRAG("my_rag")

定义#

DeleteRAG(name string) error

参数#

参数名参数类型参数解释
namestring

返回值#

返回值(顺序)返回值类型返回值解释
r1error

Embedding#

详细描述#

_embedding 生成文本的嵌入向量

使用默认的嵌入服务生成文本的向量表示(优先使用在线服务,回退到本地服务)

Example:


    result, err = rag.Embedding("你好")    if err != nil {        // handle error    }    // result is []float32

定义#

Embedding(text string) ([]float32, error)

参数#

参数名参数类型参数解释
textstring

返回值#

返回值(顺序)返回值类型返回值解释
r1[]float32
r2error

EnableMockMode#

详细描述#

定义#

EnableMockMode()

Export#

详细描述#

定义#

Export(collectionName string, fileName string, opts ...RAGSystemConfigOption) error

参数#

参数名参数类型参数解释
collectionNamestring
fileNamestring
opts...RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1error

Get#

详细描述#

定义#

Get(name string, opts ...RAGSystemConfigOption) (*RAGSystem, error)

参数#

参数名参数类型参数解释
namestring
opts...RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1*RAGSystem
r2error

GetCollection#

详细描述#

定义#

GetCollection(name string, opts ...RAGSystemConfigOption) (*RAGSystem, error)

参数#

参数名参数类型参数解释
namestring
opts...RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1*RAGSystem
r2error

GetCollectionInfo#

详细描述#

_getCollectionInfo 获取指定集合的详细信息

Example:


    info, err = rag.GetCollectionInfo("my_collection")

定义#

GetCollectionInfo(name string) (*vectorstore.CollectionInfo, error)

参数#

参数名参数类型参数解释
namestring

返回值#

返回值(顺序)返回值类型返回值解释
r1*vectorstore.CollectionInfo
r2error

HasCollection#

详细描述#

_hasCollection 检查指定集合是否存在

Example:


    exists = rag.HasCollection("my_collection")

定义#

HasCollection(name string) bool

参数#

参数名参数类型参数解释
namestring

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

Import#

详细描述#

定义#

Import(inputPath string, optFuncs ...RAGSystemConfigOption) error

参数#

参数名参数类型参数解释
inputPathstring
optFuncs...RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1error

ListCollection#

详细描述#

_listCollection 获取所有 RAG 集合列表

Example:


    collections = rag.ListCollection()

定义#

ListCollection() []string

返回值#

返回值(顺序)返回值类型返回值解释
r1[]string

ListRAG#

详细描述#

_listRAG 列出所有 RAG 系统列表

Example:


    ragSystems = rag.ListRAG()

定义#

ListRAG() []string

返回值#

返回值(顺序)返回值类型返回值解释
r1[]string

LocalEmbedding#

详细描述#

_localEmbedding 使用本地嵌入服务生成文本的向量表示

本地服务需要安装本地模型(如 Qwen3-Embedding-0.6B-Q4_K_M)

Example:


    result, err = rag.LocalEmbedding("你好")    if err != nil {        // handle error - 本地服务不可用    }    // result is []float32, dimension: 1024

定义#

LocalEmbedding(text string) ([]float32, error)

参数#

参数名参数类型参数解释
textstring

返回值#

返回值(顺序)返回值类型返回值解释
r1[]float32
r2error

NewRagDatabase#

详细描述#

定义#

NewRagDatabase(path string) (*gorm.DB, error)

参数#

参数名参数类型参数解释
pathstring

返回值#

返回值(顺序)返回值类型返回值解释
r1*gorm.DB
r2error

NewTempRagDatabase#

详细描述#

_newTempRagDatabase 创建临时 RAG 数据库

Example:


    db, err = rag.NewTempRagDatabase()

定义#

NewTempRagDatabase() (*gorm.DB, error)

返回值#

返回值(顺序)返回值类型返回值解释
r1*gorm.DB
r2error

OnlineEmbedding#

详细描述#

_onlineEmbedding 使用在线嵌入服务生成文本的向量表示

使用 AIBalance 免费在线服务,无需安装本地模型

Example:


    result, err = rag.OnlineEmbedding("你好")    if err != nil {        // handle error - 在线服务不可用    }    // result is []float32, dimension: 1024

定义#

OnlineEmbedding(text string) ([]float32, error)

参数#

参数名参数类型参数解释
textstring

返回值#

返回值(顺序)返回值类型返回值解释
r1[]float32
r2error

Query#

详细描述#

定义#

Query(query string, opts ...RAGSystemConfigOption) (<-chan *RAGSearchResult, error)

参数#

参数名参数类型参数解释
querystring
opts...RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1<-chan *RAGSearchResult
r2error

QueryDocuments#

详细描述#

_queryDocuments 在指定集合中查询文档

Example:


    results, err = rag.QueryDocuments("my_collection", "query", 10)

定义#

QueryDocuments(knowledgeBaseName string, query string, limit int, opts ...rag.RAGSystemConfigOption) ([]*rag.SearchResult, error)

参数#

参数名参数类型参数解释
knowledgeBaseNamestring
querystring
limitint
opts...rag.RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1[]*rag.SearchResult
r2error

aiService#

详细描述#

定义#

aiService(aiService aicommon.AICallbackType) RAGSystemConfigOption

参数#

参数名参数类型参数解释
aiServiceaicommon.AICallbackType

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

aiServiceType#

详细描述#

定义#

aiServiceType(aiServiceName string, aiServiceConfig ...aispec.AIConfigOption) RAGSystemConfigOption

参数#

参数名参数类型参数解释
aiServiceNamestring
aiServiceConfig...aispec.AIConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

buildFilter#

详细描述#

定义#

buildFilter(filter *ypb.EntityFilter) RAGSystemConfigOption

参数#

参数名参数类型参数解释
filter*ypb.EntityFilter

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

buildQuery#

详细描述#

定义#

buildQuery(query string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
querystring

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

chunkSize#

详细描述#

定义#

chunkSize(size int64) Option

参数#

参数名参数类型参数解释
sizeint64

返回值#

返回值(顺序)返回值类型返回值解释
r1Option

ctx#

详细描述#

定义#

ctx(ctx context.Context) AnalysisOption

参数#

参数名参数类型参数解释
ctxcontext.Context

返回值#

返回值(顺序)返回值类型返回值解释
r1AnalysisOption

db#

详细描述#

定义#

db(db *gorm.DB) RAGSystemConfigOption

参数#

参数名参数类型参数解释
db*gorm.DB

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

docMetadata#

详细描述#

WithDocumentMetadataKeyValue sets document metadata key-value pairs

定义#

docMetadata(key string, value any) RAGSystemConfigOption

参数#

参数名参数类型参数解释
keystring
valueany

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

docRawMetadata#

详细描述#

WithDocumentRawMetadata sets raw document metadata

定义#

docRawMetadata(metadata map[string]any) RAGSystemConfigOption

参数#

参数名参数类型参数解释
metadatamap[string]any

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

documentHandler#

详细描述#

定义#

documentHandler(documentHandler func(doc schema.VectorStoreDocument) (schema.VectorStoreDocument, error)) RAGSystemConfigOption

参数#

参数名参数类型参数解释
documentHandlerfunc(doc schema.VectorStoreDocument) (schema.VectorStoreDocument, error)

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

embeddingHandle#

详细描述#

_embeddingHandle 创建自定义嵌入处理器

Example:


    embeddingOpt = rag.embeddingHandle((text) => {        return [0.1, 0.2, 0.3] // 返回嵌入向量    })

定义#

embeddingHandle(handle func(text string) any) rag.RAGSystemConfigOption

参数#

参数名参数类型参数解释
handlefunc(text string) any

返回值#

返回值(顺序)返回值类型返回值解释
r1rag.RAGSystemConfigOption

entryLength#

详细描述#

定义#

entryLength(length int) RefineOption

参数#

参数名参数类型参数解释
lengthint

返回值#

返回值(顺序)返回值类型返回值解释
r1RefineOption

extraPrompt#

详细描述#

定义#

extraPrompt(prompt string) AnalysisOption

参数#

参数名参数类型参数解释
promptstring

返回值#

返回值(顺序)返回值类型返回值解释
r1AnalysisOption

getEntityFilter#

详细描述#

定义#

getEntityFilter(reposName string, entityTypes []string, names []string, HiddenIndex []string, keywords []string) *ypb.EntityFilter

参数#

参数名参数类型参数解释
reposNamestring
entityTypes[]string
names[]string
HiddenIndex[]string
keywords[]string

返回值#

返回值(顺序)返回值类型返回值解释
r1*ypb.EntityFilter

importName#

详细描述#

WithRAGCollectionName sets the specific collection name to query

定义#

importName(collectionName string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
collectionNamestring

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

importOverwrite#

详细描述#

定义#

importOverwrite(overwriteExisting bool) RAGSystemConfigOption

参数#

参数名参数类型参数解释
overwriteExistingbool

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

importRebuildGraph#

详细描述#

定义#

importRebuildGraph(rebuildHNSWIndex bool) RAGSystemConfigOption

参数#

参数名参数类型参数解释
rebuildHNSWIndexbool

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

khopLimit#

详细描述#

定义#

khopLimit(k int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
kint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

khopk#

详细描述#

WithKHopK 设置k-hop的跳数,k>=2时返回k-hop路径,k=0返回所有路径

定义#

khopk(k int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
kint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

khopkMax#

详细描述#

WithKHopKMax 设置最大路径长度,最小值为2

定义#

khopkMax(kMax int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
kMaxint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

khopkMin#

详细描述#

WithKHopKMin 设置最小路径长度,最小值为2

定义#

khopkMin(kMin int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
kMinint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

log#

详细描述#

定义#

log(handler func(format string, args ...any)) AnalysisOption

参数#

参数名参数类型参数解释
handlerfunc(format string, args ...any)

返回值#

返回值(顺序)返回值类型返回值解释
r1AnalysisOption

noEntityRepository#

详细描述#

_noEntityRepository 禁用实体仓库

Example:


    rag.noEntityRepository()

定义#

noEntityRepository() rag.RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1rag.RAGSystemConfigOption

noHNSWGraph#

详细描述#

定义#

noHNSWGraph(noHNSWGraph bool) RAGSystemConfigOption

参数#

参数名参数类型参数解释
noHNSWGraphbool

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

noKnowledgeBase#

详细描述#

_noKnowledgeBase 禁用知识库

Example:


    rag.noKnowledgeBase()

定义#

noKnowledgeBase() rag.RAGSystemConfigOption

返回值#

返回值(顺序)返回值类型返回值解释
r1rag.RAGSystemConfigOption

noMetadata#

详细描述#

定义#

noMetadata(noMetadata bool) RAGSystemConfigOption

参数#

参数名参数类型参数解释
noMetadatabool

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

noOriginInput#

详细描述#

定义#

noOriginInput(noOriginInput bool) RAGSystemConfigOption

参数#

参数名参数类型参数解释
noOriginInputbool

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

onlyPQCode#

详细描述#

定义#

onlyPQCode(onlyPQCode bool) RAGSystemConfigOption

参数#

参数名参数类型参数解释
onlyPQCodebool

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

pathDepth#

详细描述#

定义#

pathDepth(deep int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
deepint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

progressHandler#

详细描述#

定义#

progressHandler(progressHandler func(percent float64, message string, messageType string)) RAGSystemConfigOption

参数#

参数名参数类型参数解释
progressHandlerfunc(percent float64, message string, messageType string)

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryCollection#

详细描述#

WithRAGCollectionName sets the specific collection name to query

定义#

queryCollection(collectionName string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
collectionNamestring

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryConcurrent#

详细描述#

WithRAGConcurrent sets the concurrency level for query operations

定义#

queryConcurrent(concurrent int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
concurrentint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryCtx#

详细描述#

WithRAGCtx sets the context for RAG query operations

定义#

queryCtx(ctx context.Context) RAGSystemConfigOption

参数#

参数名参数类型参数解释
ctxcontext.Context

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryEnhance#

详细描述#

WithRAGEnhance sets the enhancement strategies to apply

定义#

queryEnhance(enhance ...string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
enhance...string

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryLimit#

详细描述#

WithRAGLimit sets the maximum number of results to return

定义#

queryLimit(limit int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
limitint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryScoreLimit#

详细描述#

WithRAGCollectionScoreLimit sets the score limit for collection filtering

定义#

queryScoreLimit(scoreLimit float64) RAGSystemConfigOption

参数#

参数名参数类型参数解释
scoreLimitfloat64

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryStatus#

详细描述#

WithRAGQueryStatus sets the query status callback function

定义#

queryStatus(callback func(label string, i any, tags ...string)) RAGSystemConfigOption

参数#

参数名参数类型参数解释
callbackfunc(label string, i any, tags ...string)

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

queryType#

详细描述#

WithRAGDocumentType sets the document type filter

定义#

queryType(documentType ...string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
documentType...string

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

ragCosineDistance#

详细描述#

定义#

ragCosineDistance()

ragDescription#

详细描述#

定义#

ragDescription(description string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
descriptionstring

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

ragEmbeddingModel#

详细描述#

定义#

ragEmbeddingModel(model string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
modelstring

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

ragForceNew#

详细描述#

WithForceNew sets whether to force creation of new collection

定义#

ragForceNew(force bool) RAGSystemConfigOption

参数#

参数名参数类型参数解释
forcebool

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

ragHNSWParameters#

详细描述#

WithHNSWParameters sets HNSW parameters

定义#

ragHNSWParameters(m int, ml float64, efSearch int, efConstruct int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
mint
mlfloat64
efSearchint
efConstructint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

ragImportFile#

详细描述#

定义#

ragImportFile(importFile string) RAGSystemConfigOption

参数#

参数名参数类型参数解释
importFilestring

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

ragModelDimension#

详细描述#

WithModelDimension sets the model dimension

定义#

ragModelDimension(dimension int) RAGSystemConfigOption

参数#

参数名参数类型参数解释
dimensionint

返回值#

返回值(顺序)返回值类型返回值解释
r1RAGSystemConfigOption

statusCard#

详细描述#

定义#

statusCard(handler func(id string, data any, tags ...string)) AnalysisOption

参数#

参数名参数类型参数解释
handlerfunc(id string, data any, tags ...string)

返回值#

返回值(顺序)返回值类型返回值解释
r1AnalysisOption