service

package
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SplitByDesign   string = "split_by_design"
	SplitByDefault  string = "split_by_default"
	SplitTypeCommon string = "common"
	SplitTypeParent string = "parent_child"

	RagCommunityReport string = "community_report"
)

Variables

This section is empty.

Functions

func BatchRagDocMeta added in v0.2.3

func BatchRagDocMeta(ctx context.Context, batchRagDocTagParams *BatchRagDocMetaParams) error

BatchRagDocMeta 更新文档元数据

func CopyFile

func CopyFile(ctx context.Context, srcFilePath string, destObjectNamePre string) (string, string, int64, error)

func DeleteFile

func DeleteFile(ctx context.Context, minioFilePath string) error

func DownloadFile

func DownloadFile(ctx context.Context, minioFilePath string) ([]byte, error)

func DownloadFileObject added in v0.2.1

func DownloadFileObject(ctx context.Context, minioFilePath string) (*minio.Object, error)

func DownloadFileToLocal

func DownloadFileToLocal(ctx context.Context, minioFilePath string, localPath string) error

func RagAddReport added in v0.2.7

func RagAddReport(ctx context.Context, ragAddReportParams *RagAddReportParams) error

RagAddReport rag更新社区报告

func RagBatchDeleteMeta added in v0.2.3

func RagBatchDeleteMeta(ctx context.Context, ragDeleteParams *RagBatchDeleteMetaParams) error

func RagBatchUpdateMeta added in v0.2.3

func RagBatchUpdateMeta(ctx context.Context, ragUpdateParams *RagBatchUpdateMetaKeyParams) error

func RagBuildKnowledgeGraph added in v0.2.7

func RagBuildKnowledgeGraph(ctx context.Context, ragImportDocParams *RagImportDocParams) error

RagBuildKnowledgeGraph 构建知识库图谱

func RagCreateDocChildSegment added in v0.2.4

func RagCreateDocChildSegment(ctx context.Context, ragCreateDocChildSegmentParams *RagCreateDocChildSegmentParams) error

RagCreateDocChildSegment 新增文档子切片

func RagCreateDocSegment added in v0.2.0

func RagCreateDocSegment(ctx context.Context, ragCreateDocSegmentParams *RagCreateDocSegmentParams) error

RagCreateDocSegment 新增文档切片

func RagCreateKnowledgeReport added in v0.2.7

func RagCreateKnowledgeReport(ctx context.Context, ragImportDocParams *RagImportDocParams) error

RagCreateKnowledgeReport 创建知识库社区报告

func RagDeleteDoc

func RagDeleteDoc(ctx context.Context, ragDeleteDocParams *RagDeleteDocParams) error

RagDeleteDoc 删除具体文档

func RagDeleteDocChildSegment added in v0.2.4

func RagDeleteDocChildSegment(ctx context.Context, ragDeleteDocChildSegmentParams *RagDeleteDocChildSegmentParams) error

RagDeleteDocChildSegment 删除文档子切片

func RagDeleteDocSegment added in v0.2.1

func RagDeleteDocSegment(ctx context.Context, ragDeleteDocSegmentParams *RagDeleteDocSegmentParams) error

RagDeleteDocSegment 删除文档切片

func RagDeleteReport added in v0.2.7

func RagDeleteReport(ctx context.Context, ragDeleteReportParams *RagDeleteReportParams) error

RagDeleteReport rag删除社区报告

func RagDocSegmentLabels added in v0.1.8

func RagDocSegmentLabels(ctx context.Context, ragDocSegLabelsParams *RagDocSegmentLabelsParams) error

RagDocSegmentLabels 更新文档切片标签

func RagDocUpdateDocSegmentStatus

func RagDocUpdateDocSegmentStatus(ctx context.Context, docSegmentStatusUpdateParams interface{}) error

RagDocUpdateDocSegmentStatus 更新文档切片状态

func RagImportDoc

func RagImportDoc(ctx context.Context, ragImportDocParams *RagImportDocParams) error

RagImportDoc 导入具体文档

func RagImportUrlDoc

func RagImportUrlDoc(ctx context.Context, ragImportDocParams *RagImportUrlDocParams) error

RagImportUrlDoc 导入url文档

func RagKnowledgeCreate

func RagKnowledgeCreate(ctx context.Context, ragCreateParams *RagCreateParams) error

RagKnowledgeCreate rag创建知识库

func RagKnowledgeDelete

func RagKnowledgeDelete(ctx context.Context, ragDeleteParams *RagDeleteParams) error

RagKnowledgeDelete rag更新知识库删除

func RagKnowledgeUpdate

func RagKnowledgeUpdate(ctx context.Context, ragUpdateParams *RagUpdateParams) error

RagKnowledgeUpdate rag更新知识库

func RagOperateKeywords added in v0.1.6

func RagOperateKeywords(ctx context.Context, ragOperateKeywordsParams *RagOperateKeywordsParams) error

RagOperateKeywords rag添加关键词

func RagUpdateDocChildSegment added in v0.2.4

func RagUpdateDocChildSegment(ctx context.Context, ragUpdateDocChildSegmentParams *RagUpdateDocChildSegmentParams) error

RagUpdateDocChildSegment 更新文档子切片

func RagUpdateDocSegment added in v0.2.1

func RagUpdateDocSegment(ctx context.Context, ragUpdateDocSegmentParams *RagUpdateDocSegmentParams) error

RagUpdateDocSegment 更新文档切片

func RagUpdateReport added in v0.2.7

func RagUpdateReport(ctx context.Context, ragUpdateReportParams *RagUpdateReportParams) error

RagUpdateReport rag更新社区报告

func RebuildFileName

func RebuildFileName(docId, docType, docName string) string

func RebuildSegmentType

func RebuildSegmentType(segmentType string, segmentMethod string) string

RebuildSegmentType 转换分段类型

func RebuildSplitType added in v0.2.3

func RebuildSplitType(segmentMethod string) string

RebuildSplitType 转换分段方法

func SplitFilePath

func SplitFilePath(filePath string) (bucketName string, objectName string, fileName string)

func UploadFile

func UploadFile(ctx context.Context, dir string, fileName string, reader io.Reader, objectSize int64) (string, int64, error)

func UploadLocalFile

func UploadLocalFile(ctx context.Context, minioDir string, minioFileName string, srcFilePath string) (string, string, int64, error)

UploadLocalFile 根据文件路径上传文件

Types

type BatchRagDocMetaParams added in v0.2.3

type BatchRagDocMetaParams struct {
	UserId        string         `json:"userId"`
	KnowledgeBase string         `json:"knowledgeBase"`
	KnowledgeId   string         `json:"kb_id"`
	MetaList      []*DocMetaInfo `json:"metas"`
}

type ChildChunk added in v0.2.4

type ChildChunk struct {
	ChildContent string `json:"child_content"`           //子分段内容
	ChildChunkNo int32  `json:"child_chunk_current_num"` // 子分段序列号
}

type ChildChunkConfig added in v0.2.4

type ChildChunkConfig struct {
	Separators []string `json:"separators"` // 分隔符
	ChunkSize  int32    `json:"chunk_size"` // 子分段大小
}

func RebuildChildChunkConfig added in v0.2.4

func RebuildChildChunkConfig(segmentMethod string, subMaxSplitter int, subSplitter []string) *ChildChunkConfig

type ChildContent added in v0.2.3

type ChildContent struct {
	ChildSnippet string  `json:"child_snippet"`
	Score        float64 `json:"score"`
}

type ChildContentListResp added in v0.2.3

type ChildContentListResp struct {
	ParentChunkId      string                  `json:"parent_chunk_id"`
	ChildChunkTotalNum int                     `json:"child_chunk_total_num"` // 以这个字段为准
	ChildContentList   []ChildFileSplitContent `json:"child_content_list"`
}

func RagGetDocChildSegmentList added in v0.2.3

func RagGetDocChildSegmentList(ctx context.Context, ragGetDocChildSegmentParams *RagGetDocChildSegmentParams) (*ChildContentListResp, error)

type ChildContentMeta added in v0.2.3

type ChildContentMeta struct {
	FileName             string         `json:"file_name"`
	ChildChunkCurrentNum int            `json:"child_chunk_current_num"`
	ChildChunkTotalNum   int            `json:"child_chunk_total_num"`
	DownloadLink         string         `json:"download_link"`
	BucketName           string         `json:"bucket_name"`
	ObjectName           string         `json:"object_name"`
	DocMeta              []*DocMetaData `json:"doc_meta"`
}

type ChildFileSplitContent added in v0.2.3

type ChildFileSplitContent struct {
	Content         string           `json:"content"`
	ChunkId         string           `json:"chunk_id"` // 尽量不用
	FileName        string           `json:"file_name"`
	OssPath         string           `json:"oss_path"`
	MetaData        ChildContentMeta `json:"meta_data"`
	Status          bool             `json:"status"`
	ContentId       string           `json:"content_id"`
	ParentContentId string           `json:"parent_content_id"`
	KnowledgeName   string           `json:"kb_name"`
	IsParent        bool             `json:"is_parent"` // false是子分段
}

type ChunkSearchList added in v0.1.3

type ChunkSearchList struct {
	Title            string          `json:"title"`
	Snippet          string          `json:"snippet"`
	KbName           string          `json:"kb_name"`
	MetaData         interface{}     `json:"meta_data"`
	ChildContentList []*ChildContent `json:"child_content_list"`
	ChildScore       []float64       `json:"child_score"`
	ContentType      string          `json:"content_type"` // graph:知识图谱(文本), text:文档分段(文本), community_report:社区报告(markdown)
}

type ContentListResp

type ContentListResp struct {
	List          []FileSplitContent `json:"content_list"`
	ChunkTotalNum int                `json:"chunk_total_num"`
}

func RagGetDocSegmentList

func RagGetDocSegmentList(ctx context.Context, ragGetDocSegmentParams *RagGetDocSegmentParams) (*ContentListResp, error)

RagGetDocSegmentList rag获取知识库文档分片

type ContentMetaData

type ContentMetaData struct {
	FileName        string         `json:"file_name"`
	ChunkCurrentNum int            `json:"chunk_current_num"`
	ChunkTotalNum   int            `json:"chunk_total_num"`
	DownloadLink    string         `json:"download_link"`
	BucketName      string         `json:"bucket_name"`
	ObjectName      string         `json:"object_name"`
	DocMeta         []*DocMetaData `json:"doc_meta"`
}

type DocMetaData added in v0.2.3

type DocMetaData struct {
	ValueType   string `json:"value_type"`
	StringValue string `json:"string_value"`
	Key         string `json:"key"`
}

type DocMetaInfo added in v0.2.3

type DocMetaInfo struct {
	FileName     string      `json:"file_name"`
	MetaDataList []*MetaData `json:"metadata_list"`
}

type DocSegmentStatusUpdateAllParams

type DocSegmentStatusUpdateAllParams struct {
	DocSegmentStatusUpdateParams
	All bool `json:"on_off_switch"`
}

type DocSegmentStatusUpdateParams

type DocSegmentStatusUpdateParams struct {
	UserId        string `json:"userId"`
	KnowledgeName string `json:"knowledgeBase"`
	FileName      string `json:"fileName"`
	ContentId     string `json:"content_id"`
	Status        bool   `json:"status"`
}

type DocUrlParams

type DocUrlParams struct {
	Url string `json:"url"`
}

type DocUrlResp

type DocUrlResp struct {
	Url          string        `json:"url"`
	OldName      string        `json:"old_name"`
	FileName     string        `json:"file_name"`
	FileSize     float64       `json:"file_size"`
	ResponseInfo RagCommonResp `json:"response_info"`
}

func BatchRagDocUrlAnalysis

func BatchRagDocUrlAnalysis(ctx context.Context, urlList []string) ([]*DocUrlResp, error)

func RagDocUrlAnalysis

func RagDocUrlAnalysis(ctx context.Context, docUrlParams *DocUrlParams) (*DocUrlResp, error)

RagDocUrlAnalysis 文档url解析

type DocUrlRespSafeArray

type DocUrlRespSafeArray struct {
	// contains filtered or unexported fields
}

func (*DocUrlRespSafeArray) Append

func (sa *DocUrlRespSafeArray) Append(value *DocUrlResp)

func (*DocUrlRespSafeArray) Get

func (sa *DocUrlRespSafeArray) Get(index int) interface{}

func (*DocUrlRespSafeArray) Len

func (sa *DocUrlRespSafeArray) Len() int

type FileSplitContent

type FileSplitContent struct {
	Content            string          `json:"content"`
	Order              int             `json:"order"`
	Status             bool            `json:"status"`
	MetaData           ContentMetaData `json:"meta_data"`
	ContentId          string          `json:"content_id"`
	UserId             string          `json:"userId"`
	KbName             string          `json:"kb_name"`
	FileName           string          `json:"file_name"`
	Labels             []string        `json:"labels"`
	ChunkId            string          `json:"chunk_id"`
	OssPath            string          `json:"oss_path"`
	IsParent           bool            `json:"is_parent"`             // 区分是否是父分段,true是父分段,false是子分段,不存在这个key时说明文档分段模式不是父子分段
	ChildChunkTotalNum int             `json:"child_chunk_total_num"` // 父分段对应子分段数量
}

type KnowledgeHitData added in v0.1.3

type KnowledgeHitData struct {
	Prompt     string             `json:"prompt"`
	SearchList []*ChunkSearchList `json:"searchList"`
	Score      []float64          `json:"score"`
	UseGraph   bool               `json:"use_graph"`
}

type KnowledgeHitParams added in v0.1.3

type KnowledgeHitParams struct {
	UserId               string                `json:"userId"`
	Question             string                `json:"question" validate:"required"`
	KnowledgeBase        []string              `json:"knowledgeBase" validate:"required"`
	KnowledgeIdList      []string              `json:"knowledgeIdList" validate:"required"`
	Threshold            float64               `json:"threshold"`
	TopK                 int32                 `json:"topK"`
	RerankModelId        string                `json:"rerank_model_id"`               // rerankId
	RerankMod            string                `json:"rerank_mod"`                    // rerank_model:重排序模式,weighted_score:权重搜索
	RetrieveMethod       string                `json:"retrieve_method"`               // hybrid_search:混合搜索, semantic_search:向量搜索, full_text_search:文本搜索
	Weight               *WeightParams         `json:"weights"`                       // 权重搜索下的权重配置
	TermWeight           float32               `json:"term_weight_coefficient"`       // 关键词系数
	MetaFilter           bool                  `json:"metadata_filtering"`            // 元数据过滤开关
	MetaFilterConditions []*MetadataFilterItem `json:"metadata_filtering_conditions"` // 元数据过滤条件
	UseGraph             bool                  `json:"use_graph"`                     // 是否使用知识图谱
}

type MetaData added in v0.1.7

type MetaData struct {
	Key       string      `json:"key"`
	Value     interface{} `json:"value"`
	ValueType string      `json:"value_type"`
}

type MetaItem added in v0.2.2

type MetaItem struct {
	MetaName           string      `json:"meta_name"`           // 元数据名称
	MetaType           string      `json:"meta_type"`           // 元数据类型
	ComparisonOperator string      `json:"comparison_operator"` // 比较运算符
	Value              interface{} `json:"value,omitempty"`     // 用于过滤的条件值
}

type MetadataFilterItem added in v0.2.2

type MetadataFilterItem struct {
	FilterKnowledgeName string      `json:"filtering_kb_name"`
	LogicalOperator     string      `json:"logical_operator"`
	Conditions          []*MetaItem `json:"conditions"`
}

type NewChunkItem added in v0.2.1

type NewChunkItem struct {
	Content string   `json:"content"`
	Labels  []string `json:"labels"`
}

type RagAddReportItem added in v0.2.7

type RagAddReportItem struct {
	Content string `json:"content"`
	Title   string `json:"title"`
}

type RagAddReportParams added in v0.2.7

type RagAddReportParams struct {
	UserId            string              `json:"userId"`
	KnowledgeBaseName string              `json:"knowledgeBase"`
	KnowledgeId       string              `json:"kb_id"`
	ReportItem        []*RagAddReportItem `json:"reports"`
}

type RagBatchDeleteMetaParams added in v0.2.3

type RagBatchDeleteMetaParams struct {
	UserId        string   `json:"userId"`        // 用户id
	KnowledgeBase string   `json:"knowledgeBase"` // 知识库名称
	KnowledgeId   string   `json:"kb_id"`         // 知识库id
	Keys          []string `json:"keys"`          // 删除的元数据key列表
}

type RagBatchReportCount added in v0.2.7

type RagBatchReportCount struct {
	SuccessCount int `json:"success_count"` // 成功的社区报告数量
}

type RagBatchReportResp added in v0.2.7

type RagBatchReportResp struct {
	RagCommonResp
	Data *RagBatchReportCount `json:"data"`
}

type RagBatchUpdateMetaKeyParams added in v0.2.3

type RagBatchUpdateMetaKeyParams struct {
	UserId        string            `json:"userId"`        // 用户id
	KnowledgeBase string            `json:"knowledgeBase"` // 知识库名称
	KnowledgeId   string            `json:"kb_id"`         // 知识库id
	Mappings      []*RagMetaMapKeys `json:"mappings"`      // 元数据key映射列表
}

type RagChunkConfig added in v0.2.3

type RagChunkConfig struct {
	SegmentSize int      `json:"chunk_size"`
	Separators  []string `json:"separators"`
}

type RagCommonResp

type RagCommonResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type RagCreateDocChildSegmentParams added in v0.2.4

type RagCreateDocChildSegmentParams struct {
	UserId        string   `json:"userId"`         // 发起请求的用户ID
	KnowledgeBase string   `json:"knowledgeBase"`  // 知识库的名称
	KnowledgeId   string   `json:"kb_id"`          // 知识库的唯一ID
	FileName      string   `json:"fileName"`       // 与chunk关联的文件名
	ChunkId       string   `json:"chunk_id"`       // 父分段id
	ChildContents []string `json:"child_contents"` // 子分段内容
}

type RagCreateDocSegmentParams added in v0.2.0

type RagCreateDocSegmentParams struct {
	UserId           string            `json:"userId"`             // 发起请求的用户ID
	KnowledgeBase    string            `json:"knowledgeBase"`      // 知识库的名称
	KnowledgeId      string            `json:"kb_id"`              // 知识库的唯一ID
	FileName         string            `json:"fileName"`           // 与chunk关联的文件名
	MaxSentenceSize  int               `json:"max_sentence_size"`  // 最大分段长度限制
	Chunks           []*NewChunkItem   `json:"chunks"`             // 分段数据列表
	SplitType        string            `json:"split_type"`         // 分段类型 //parent_child|common
	ChildChunkConfig *ChildChunkConfig `json:"child_chunk_config"` //子分段配置
}

type RagCreateParams

type RagCreateParams struct {
	UserId               string `json:"userId"`
	Name                 string `json:"knowledgeBase"`
	KnowledgeBaseId      string `json:"kb_id"`
	EmbeddingModelId     string `json:"embedding_model_id"`
	EnableKnowledgeGraph bool   `json:"enable_knowledge_graph"`
}

type RagDeleteDocChildSegmentParams added in v0.2.4

type RagDeleteDocChildSegmentParams struct {
	UserId                string  `json:"userId"`                   // 发起请求的用户ID
	KnowledgeBase         string  `json:"knowledgeBase"`            // 知识库的名称
	KnowledgeId           string  `json:"kb_id"`                    // 知识库的唯一ID
	FileName              string  `json:"fileName"`                 // 与chunk关联的文件名
	ChunkId               string  `json:"chunk_id"`                 // 父分段id
	ChunkCurrentNum       int32   `json:"chunk_current_num"`        // 父分段序列号
	ChildChunkCurrentNums []int32 `json:"child_chunk_current_nums"` // 子分段序列号列表
}

type RagDeleteDocParams

type RagDeleteDocParams struct {
	UserId        string `json:"userId"`
	KnowledgeBase string `json:"knowledgeBase"`
	FileName      string `json:"fileName"`
}

type RagDeleteDocSegmentParams added in v0.2.1

type RagDeleteDocSegmentParams struct {
	UserId        string   `json:"userId"`        // 发起请求的用户ID
	KnowledgeBase string   `json:"knowledgeBase"` // 知识库的名称
	KnowledgeId   string   `json:"kb_id"`         // 知识库的唯一ID
	FileName      string   `json:"fileName"`      // 与chunk关联的文件名
	ChunkIds      []string `json:"chunk_ids"`     // 分段数据列表
}

type RagDeleteParams

type RagDeleteParams struct {
	UserId            string `json:"userId"`
	KnowledgeBaseName string `json:"knowledgeBase"`
	KnowledgeId       string `json:"kb_id"`
}

type RagDeleteReportParams added in v0.2.7

type RagDeleteReportParams struct {
	UserId            string   `json:"userId"`
	KnowledgeBaseName string   `json:"knowledgeBase"`
	KnowledgeId       string   `json:"kb_id"`
	ReportIds         []string `json:"report_ids"`
}

type RagDocMetaParams added in v0.1.6

type RagDocMetaParams struct {
	UserId        string      `json:"userId"`
	KnowledgeBase string      `json:"knowledgeBase"`
	FileName      string      `json:"fileName"`
	MetaList      []*MetaData `json:"tags"`
}

type RagDocSegmentLabelsParams added in v0.1.8

type RagDocSegmentLabelsParams struct {
	UserId        string   `json:"userId"`        // 发起请求的用户ID
	KnowledgeBase string   `json:"knowledgeBase"` // 知识库的名称
	KnowledgeId   string   `json:"kb_id"`         // 知识库的唯一ID
	FileName      string   `json:"fileName"`      // 与chunk关联的文件名
	ContentId     string   `json:"chunk_id"`      // 要更新标签的chunk的唯一ID
	Labels        []string `json:"labels"`        // 需要为该chunk关联的标签列表
}

type RagDocSegmentResp added in v0.2.1

type RagDocSegmentResp struct {
	Code    int           `json:"code"`
	Message string        `json:"message"`
	Data    SegmentResult `json:"data"`
}

type RagGetDocChildSegmentParams added in v0.2.3

type RagGetDocChildSegmentParams struct {
	UserId            string `json:"userId"`        // 用户id
	KnowledgeBaseName string `json:"knowledgeBase"` // 知识库名称
	KnowledgeId       string `json:"kb_id"`         // 知识库id
	FileName          string `json:"file_name"`     // 文件名
	ChunkId           string `json:"chunk_id"`      // 使用父分段的contentId
}

type RagGetDocChildSegmentResp added in v0.2.3

type RagGetDocChildSegmentResp struct {
	RagCommonResp
	Data *ChildContentListResp `json:"data"`
}

type RagGetDocSegmentParams

type RagGetDocSegmentParams struct {
	UserId            string `json:"userId"`
	KnowledgeBaseName string `json:"knowledgeBase"`
	FileName          string `json:"fileName"`
	PageSize          int32  `json:"page_size"`
	SearchAfter       int32  `json:"search_after"`
}

type RagGetDocSegmentResp

type RagGetDocSegmentResp struct {
	RagCommonResp
	Data *ContentListResp `json:"data"`
}

type RagGetReportParams added in v0.2.7

type RagGetReportParams struct {
	UserId            string `json:"userId"`
	KnowledgeBaseName string `json:"knowledgeBase"`
	KnowledgeId       string `json:"kb_id"`
	PageSize          int32  `json:"page_size"`
	SearchAfter       int32  `json:"search_after"`
}

type RagGetReportResp added in v0.2.7

type RagGetReportResp struct {
	RagCommonResp
	Data *RagReportListResp `json:"data"`
}

type RagImportDocParams

type RagImportDocParams struct {
	DocId                 string               `json:"id"`         //文档id
	KnowledgeName         string               `json:"categoryId"` //知识库名称
	CategoryId            string               `json:"kb_id"`      //知识库id
	IsEnhanced            string               `json:"is_enhanced"`
	UserId                string               `json:"userId"`
	Overlap               float32              `json:"overlap" `
	ObjectName            string               `json:"objectName"`
	SegmentSize           int                  `json:"chunk_size"`
	OriginalName          string               `json:"originalName"`
	SegmentType           string               `json:"chunk_type"`
	SplitType             string               `json:"split_type"` //parent_child|common
	Separators            []string             `json:"separators"`
	ParserChoices         []string             `json:"parser_choices"`
	OcrModelId            string               `json:"ocr_model_id"`
	PreProcess            []string             `json:"pre_process"`
	RagMetaDataParams     []*RagMetaDataParams `json:"meta_data"`
	RagChildChunkConfig   *RagChunkConfig      `json:"child_chunk_config"`
	KnowledgeGraphSwitch  bool                 `json:"enable_knowledge_graph"`
	GraphModelId          string               `json:"graph_model_id"`
	GraphSchemaObjectName string               `json:"graph_schema_objectname"`
	GraphSchemaFileName   string               `json:"graph_schema_filename"`
	MessageType           string               `json:"message_type,omitempty"`
}

type RagImportUrlDocParams

type RagImportUrlDocParams struct {
	Url               string               `json:"url"`
	FileName          string               `json:"file_name"`
	Overlap           float32              `json:"overlap_size" `
	SegmentSize       int                  `json:"sentence_size"`
	SegmentType       string               `json:"chunk_type"`
	SplitType         string               `json:"split_type"` //parent_child|common
	UserId            string               `json:"userId"`
	KnowledgeBaseName string               `json:"knowledgeBase"`
	IsEnhanced        bool                 `json:"is_enhanced"`
	Separators        []string             `json:"separators"`
	TaskId            string               `json:"task_id"`
	OcrModelId        string               `json:"ocr_model_id"`
	PreProcess        []string             `json:"pre_process"`
	RagMetaDataParams []*RagMetaDataParams `json:"meta_data"`
}

type RagKnowledgeGraphParams added in v0.2.7

type RagKnowledgeGraphParams struct {
	UserId        string `json:"userId"`        // 用户id
	KnowledgeBase string `json:"knowledgeBase"` // 知识库名称
	KnowledgeId   string `json:"kb_id"`         // 知识库id
}

type RagKnowledgeGraphResp added in v0.2.7

type RagKnowledgeGraphResp struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func RagKnowledgeGraph added in v0.2.7

func RagKnowledgeGraph(ctx context.Context, knowledgeGraphParams *RagKnowledgeGraphParams) (*RagKnowledgeGraphResp, error)

RagKnowledgeGraph rag知识图谱

type RagKnowledgeHitResp added in v0.1.3

type RagKnowledgeHitResp struct {
	Code    int               `json:"code"`
	Message string            `json:"message"`
	Data    *KnowledgeHitData `json:"data"`
}

func RagKnowledgeHit added in v0.1.3

func RagKnowledgeHit(ctx context.Context, knowledgeHitParams *KnowledgeHitParams) (*RagKnowledgeHitResp, error)

RagKnowledgeHit rag命中测试

type RagKnowledgeInfo added in v0.2.5

type RagKnowledgeInfo struct {
	KnowledgeId   string `json:"kb_id"`
	KnowledgeName string `json:"kb_name"`
}

type RagMetaDataParams added in v0.1.7

type RagMetaDataParams struct {
	MetaId    string      `json:"meta_id"`    // 元数据id
	Key       string      `json:"key"`        // key
	Value     interface{} `json:"value"`      // 常量
	ValueType string      `json:"value_type"` // 常量类型
	Rule      string      `json:"rule"`       // 正则表达式
}

type RagMetaMapKeys added in v0.2.3

type RagMetaMapKeys struct {
	OldKey string `json:"old_key"`
	NewKey string `json:"new_key"`
}

type RagOperateKeywordsParams added in v0.1.6

type RagOperateKeywordsParams struct {
	Id               uint32                         `json:"id"`
	UserId           string                         `json:"user_id"`
	Action           string                         `json:"action"`
	Name             string                         `json:"name"`
	Alias            []string                       `json:"alias"`
	KnowledgeBaseIds []string                       `json:"knowledge_base_list"`
	RagKnowledgeInfo map[string][]*RagKnowledgeInfo `json:"knowledge_base_info"`
}

type RagOperationParams

type RagOperationParams struct {
	Operation string              `json:"operation"`
	Type      string              `json:"type"`
	Doc       *RagImportDocParams `json:"doc"`
}

type RagReportInfo added in v0.2.7

type RagReportInfo struct {
	ReportTitle string      `json:"report_title"` // 社区报告标题
	Content     string      `json:"content"`      // 社区报告内容
	ChunkId     string      `json:"chunk_id"`     // 社区报告id
	MetaData    interface{} `json:"meta_data"`    // 元数据
	Status      bool        `json:"status"`       // 社区报告状态
	ContentId   string      `json:"content_id"`   // 社区报告id
	KbName      string      `json:"kb_name"`      // 知识库名称
	CreateTime  string      `json:"create_time"`  // 生成时间
}

type RagReportListResp added in v0.2.7

type RagReportListResp struct {
	List          []RagReportInfo `json:"content_list"`
	ChunkTotalNum int             `json:"chunk_total_num"` // 社区报告数量
}

func RagGetReport added in v0.2.7

func RagGetReport(ctx context.Context, ragGetReportParams *RagGetReportParams) (*RagReportListResp, error)

RagGetReport rag获取社区报告

type RagUpdateDocChildSegmentParams added in v0.2.4

type RagUpdateDocChildSegmentParams struct {
	UserId          string      `json:"userId"`            // 发起请求的用户ID
	KnowledgeBase   string      `json:"knowledgeBase"`     // 知识库的名称
	KnowledgeId     string      `json:"kb_id"`             // 知识库的唯一ID
	FileName        string      `json:"fileName"`          // 与chunk关联的文件名
	ChunkId         string      `json:"chunk_id"`          // 父分段id
	ChunkCurrentNum int32       `json:"chunk_current_num"` // 父分段序列号
	ChildChunk      *ChildChunk `json:"child_chunk"`       // 子分段内容

}

type RagUpdateDocSegmentParams added in v0.2.1

type RagUpdateDocSegmentParams struct {
	UserId           string            `json:"userId"`             // 发起请求的用户ID
	KnowledgeBase    string            `json:"knowledgeBase"`      // 知识库的名称
	KnowledgeId      string            `json:"kb_id"`              // 知识库的唯一ID
	FileName         string            `json:"fileName"`           // 与chunk关联的文件名
	MaxSentenceSize  int               `json:"max_sentence_size"`  // 最大分段长度限制
	Chunk            *UpdateChunkItem  `json:"chunk"`              // 分段数据列表
	SplitType        string            `json:"split_type"`         // 分段类型 //parent_child|common
	ChildChunkConfig *ChildChunkConfig `json:"child_chunk_config"` //子分段配置
}

type RagUpdateParams

type RagUpdateParams struct {
	UserId          string `json:"userId"`
	KnowledgeBaseId string `json:"kb_id"`
	OldKbName       string `json:"old_kb_name"`
	NewKbName       string `json:"new_kb_name"`
}

type RagUpdateReportItem added in v0.2.7

type RagUpdateReportItem struct {
	ReportId string `json:"report_id"`
	Content  string `json:"content"`
	Title    string `json:"title"`
}

type RagUpdateReportParams added in v0.2.7

type RagUpdateReportParams struct {
	UserId            string               `json:"userId"`
	KnowledgeBaseName string               `json:"knowledgeBase"`
	KnowledgeId       string               `json:"kb_id"`
	ReportItem        *RagUpdateReportItem `json:"reports"`
}

type SegmentResult added in v0.2.0

type SegmentResult struct {
	SuccessCount int `json:"success_count"` // 分段成功导入数量
}

type UpdateChunkItem added in v0.2.1

type UpdateChunkItem struct {
	ChunkId string   `json:"chunk_id"`
	Content string   `json:"content"`
	Labels  []string `json:"labels"`
}

type WeightParams added in v0.1.5

type WeightParams struct {
	VectorWeight float32 `json:"vector_weight"` //语义权重
	TextWeight   float32 `json:"text_weight"`   //关键字权重
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL