ai_document_set

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: Apache-2.0, BSD-2-Clause, MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk added in v1.2.0

type Chunk struct {
	Text     string `json:"text"`
	StartPos uint64 `json:"startPos"`
	EndPos   uint64 `json:"endPos"`
}

type Credentials

type Credentials struct {
	TmpSecretID  string `json:"TmpSecretId"`
	TmpSecretKey string `json:"TmpSecretKey"`
	SessionToken string `json:"Token"`
	Expiration   string `json:"Expiration,omitempty"`
	ExpiredTime  int    `json:"ExpiredTime,omitempty"`
}

type DeleteQueryCond

type DeleteQueryCond struct {
	DocumentSetId   []string `json:"documentSetId"`
	DocumentSetName []string `json:"documentSetName"`
	Filter          string   `json:"filter"`
}

type DeleteReq

type DeleteReq struct {
	api.Meta       `path:"/ai/documentSet/delete" tags:"Document" method:"Post"`
	Database       string           `json:"database"`
	CollectionView string           `json:"collectionView"`
	Query          *DeleteQueryCond `json:"query"`
}

DeleteReq delete document request

type DeleteRes

type DeleteRes struct {
	api.CommonRes
	AffectedCount uint64 `json:"affectedCount"`
}

DeleteRes delete document request

type DocumentSetInfo

type DocumentSetInfo struct {
	TextLength      *uint64 `json:"textLength,omitempty"`
	ByteLength      *uint64 `json:"byteLength,omitempty"`
	IndexedProgress *uint64 `json:"indexedProgress,omitempty"`
	IndexedStatus   *string `json:"indexedStatus,omitempty"` // Ready | New | Loading | Failure
	CreateTime      *string `json:"createTime,omitempty"`
	LastUpdateTime  *string `json:"lastUpdateTime,omitempty"`
	IndexedErrorMsg *string `json:"indexedErrorMsg,omitempty"`
	Keywords        *string `json:"keywords,omitempty"`
}

type DocumentSplitterPreprocess added in v1.2.0

type DocumentSplitterPreprocess struct {
	AppendTitleToChunk    *bool   `json:"appendTitleToChunk,omitempty"`
	AppendKeywordsToChunk *bool   `json:"appendKeywordsToChunk,omitempty"`
	ChunkSplitter         *string `json:"chunkSplitter,omitempty"`
}

DocumentSplitterPreprocess holds the parameters for splitting document chunks.

Fields:

  • AppendTitleToChunk: (Optional) Whether to append the title to the splitting chunks (default to false).
  • AppendKeywordsToChunk: (Optional) Whether to append the keywords to the splitting chunks, which are extracted from the full text (default to true).
  • ChunkSplitter: The regular expression used to configure the document splitting method. For example, "\n{2,}" can be used in QA contents.

type GetChunksReq added in v1.2.0

type GetChunksReq struct {
	api.Meta        `path:"/ai/documentSet/getChunks" tags:"Document" method:"Post""`
	Database        string `json:"database"`
	CollectionView  string `json:"collectionView"`
	DocumentSetName string `json:"documentSetName"`
	DocumentSetId   string `json:"documentSetId"`
	Limit           *int64 `json:"limit"`
	Offset          int64  `json:"offset"`
}

type GetChunksRes added in v1.2.0

type GetChunksRes struct {
	api.CommonRes
	DocumentSetId   string  `json:"documentSetId"`
	DocumentSetName string  `json:"documentSetName"`
	Count           uint64  `json:"count"`
	Chunks          []Chunk `json:"chunks"`
}

type GetReq

type GetReq struct {
	api.Meta        `path:"/ai/documentSet/get" tags:"Document" method:"Post""`
	Database        string `json:"database"`
	CollectionView  string `json:"collectionView"`
	DocumentSetName string `json:"documentSetName"`
	DocumentSetId   string `json:"documentSetId"`
}

type GetRes

type GetRes struct {
	api.CommonRes
	Count        uint64           `json:"count"`
	DocumentSets QueryDocumentSet `json:"documentSet"`
}

type QueryCond

type QueryCond struct {
	DocumentSetId   []string `json:"documentSetId"`
	DocumentSetName []string `json:"documentSetName"`
	Filter          string   `json:"filter,omitempty"`
	Limit           int64    `json:"limit,omitempty"`
	Offset          int64    `json:"offset,omitempty"`
	OutputFields    []string `json:"outputFields,omitempty"`
}

type QueryDocumentSet

type QueryDocumentSet struct {
	DocumentSetId      string                      `json:"documentSetId"`
	DocumentSetName    string                      `json:"documentSetName"`
	Text               *string                     `json:"text,omitempty"`
	TextPrefix         *string                     `json:"textPrefix,omitempty"`
	DocumentSetInfo    *DocumentSetInfo            `json:"documentSetInfo,omitempty"`
	ScalarFields       map[string]interface{}      `json:"-"`
	SplitterPreprocess *DocumentSplitterPreprocess `json:"splitterPreprocess,omitempty"`
	ParsingProcess     *api.ParsingProcess         `json:"parsingProcess,omitempty"`
}

Document document struct for document api

func (QueryDocumentSet) MarshalJSON

func (d QueryDocumentSet) MarshalJSON() ([]byte, error)

func (*QueryDocumentSet) UnmarshalJSON

func (d *QueryDocumentSet) UnmarshalJSON(data []byte) error

type QueryReq

type QueryReq struct {
	api.Meta       `path:"/ai/documentSet/query" tags:"Document" method:"Post"`
	Database       string     `json:"database"`
	CollectionView string     `json:"collectionView"`
	Query          *QueryCond `json:"query"`
}

QueryReq query document request

type QueryRes

type QueryRes struct {
	api.CommonRes
	Count        uint64             `json:"count"`
	DocumentSets []QueryDocumentSet `json:"documentSets"`
}

QueryRes query document response

type RerankOption

type RerankOption struct {
	Enable                *bool   `json:"enable,omitempty"`
	ExpectRecallMultiples float32 `json:"expectRecallMultiples,omitempty"`
}

RerankOption holds the parameters for reranking.

Fields:

  • Enable: (Optional) Whether to enable word vector reranking (default to false).
  • ExpectRecallMultiples: (Optional) The recall amplification factor for word vector reordering (default to 5). The maximum number of elements to be recalled is 256.

type SearchCond

type SearchCond struct {
	Content         string       `json:"content"`
	DocumentSetName []string     `json:"documentSetName"`
	Options         SearchOption `json:"options"`
	Filter          string       `json:"filter"`
	Limit           int64        `json:"limit,omitempty"` // 结果数量
}

SearchCond search filter condition

type SearchData

type SearchData struct {
	Text                     string   `json:"text"`
	StartPos                 int      `json:"startPos"`
	EndPos                   int      `json:"endPos"`
	Pre                      []string `json:"pre"`
	Next                     []string `json:"next"`
	ParagraphTitle           string   `json:"paragraphTitle"`
	AllParentParagraphTitles []string `json:"allParentParagraphTitles"`
}

type SearchDocument

type SearchDocument struct {
	Score       float64           `json:"score"`
	Data        SearchData        `json:"data"`
	DocumentSet SearchDocumentSet `json:"documentSet"`
}

type SearchDocumentSet

type SearchDocumentSet struct {
	DocumentSetId   string                 `json:"documentSetId"`
	DocumentSetName string                 `json:"documentSetName"`
	ScalarFields    map[string]interface{} `json:"-"`
}

func (SearchDocumentSet) MarshalJSON

func (s SearchDocumentSet) MarshalJSON() ([]byte, error)

func (*SearchDocumentSet) UnmarshalJSON

func (s *SearchDocumentSet) UnmarshalJSON(data []byte) error

type SearchOption

type SearchOption struct {
	// ResultType  string `json:"resultType"`  // chunks|paragraphs|file
	ChunkExpand  []int         `json:"chunkExpand"`      // 搜索结果中,向前、向后补齐几个chunk的上下文
	RerankOption *RerankOption `json:"rerank,omitempty"` // 多路召回

}

type SearchOptionWeight

type SearchOptionWeight struct {
	ChunkSimilarity float64 `json:"chunkSimilarity"`
	WordSimilarity  float64 `json:"wordSimilarity"`
	WordBm25        float64 `json:"wordBm25"`
}

type SearchParams

type SearchParams struct {
	Nprobe uint32  `protobuf:"varint,1,opt,name=nprobe,proto3" json:"nprobe"`  // 搜索时查找的聚类数量,使用索引默认值即可
	Ef     uint32  `protobuf:"varint,2,opt,name=ef,proto3" json:"ef"`          // HNSW
	Radius float32 `protobuf:"fixed32,3,opt,name=radius,proto3" json:"radius"` // 距离阈值,范围搜索时有效
}

type SearchReq

type SearchReq struct {
	api.Meta        `path:"/ai/documentSet/search" tags:"Document" method:"Post"`
	Database        string      `json:"database"`
	CollectionView  string      `json:"collectionView"`
	ReadConsistency string      `json:"readConsistency"`
	Search          *SearchCond `json:"search"`
}

SearchReq search documents request

type SearchRes

type SearchRes struct {
	api.CommonRes
	Documents []SearchDocument `json:"documents"`
}

SearchRes search documents response

type UpdateQueryCond

type UpdateQueryCond struct {
	DocumentSetId   []string `json:"documentSetId"`
	DocumentSetName []string `json:"documentSetName"`
	Filter          string   `json:"filter"`
}

type UpdateReq

type UpdateReq struct {
	api.Meta       `path:"/ai/documentSet/update" tags:"Document" method:"Post""`
	Database       string                 `json:"database"`
	CollectionView string                 `json:"collectionView"`
	Query          UpdateQueryCond        `json:"query"`
	Update         map[string]interface{} `json:"update"`
}

type UpdateRes

type UpdateRes struct {
	api.CommonRes
	AffectedCount uint64 `json:"affectedCount"`
}

type UploadCondition

type UploadCondition struct {
	MaxSupportContentLength int64 `json:"maxSupportContentLength"`
}

type UploadUrlReq

type UploadUrlReq struct {
	api.Meta        `path:"/ai/documentSet/uploadUrl" tags:"Document" method:"Post" summary:"获取cos上传签名"`
	Database        string              `json:"database"`
	CollectionView  string              `json:"collectionView"`
	DocumentSetName string              `json:"documentSetName"`
	ByteLength      *uint64             `json:"byteLength,omitempty"`
	ParsingProcess  *api.ParsingProcess `json:"parsingProcess,omitempty"`
}

type UploadUrlRes

type UploadUrlRes struct {
	api.CommonRes
	DocumentSetId   string           `json:"documentSetId"`
	CosEndpoint     string           `json:"cosEndpoint"`
	CosRegion       string           `json:"cosRegion"`
	CosBucket       string           `json:"cosBucket"`
	UploadPath      string           `json:"uploadPath"`
	Credentials     *Credentials     `json:"credentials"`
	UploadCondition *UploadCondition `json:"uploadCondition"`
}

Jump to

Keyboard shortcuts

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