Documentation
¶
Index ¶
- Constants
- type ChatLog
- type ChatLogBasic
- type ChatLogSet
- type ChatLogs
- type DocMatch
- type DocMatches
- type DocVector
- type DocVectorBasic
- type DocVectorSet
- type DocVectors
- type Document
- func (z *Document) Creating() error
- func (z *Document) GetFullText() string
- func (z *Document) GetSubject() string
- func (_ *Document) IdentityAlias() string
- func (_ *Document) IdentityLabel() string
- func (_ *Document) IdentityModel() string
- func (_ *Document) IdentityTable() string
- func (z *Document) SetWith(o DocumentSet)
- type DocumentBasic
- type DocumentSet
- type Documents
- type Pair
- type Pairs
- type Vector
Constants ¶
View Source
const ( VectorLen = 1024 PrefixQ = "Q:" PrefixA = "A:" )
View Source
const ( DocumentTable = "corpus_document" DocumentAlias = "cd" DocumentLabel = "document" DocumentTypID = "corpusDocument" )
consts of Document 文档
View Source
const ( DocVectorTable = "corpus_vector_400" DocVectorAlias = "cv" DocVectorLabel = "docVector" DocVectorTypID = "corpusDocVector" )
consts of DocVector 文档向量
View Source
const ( DocMatchLabel = "docMatch" DocMatchTypID = "corpusDocMatch" )
consts of DocMatch 提示匹配结果
View Source
const ( ChatLogTable = "qa_chat_log" ChatLogAlias = "cl" ChatLogLabel = "chatLog" ChatLogTypID = "corpusChatLog" )
consts of ChatLog 聊天日志
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatLog ¶
type ChatLog struct {
comm.BaseModel `bun:"table:qa_chat_log,alias:cl" json:"-"`
comm.DefaultModel
ChatLogBasic
comm.MetaField
} // @name corpusChatLog
ChatLog 聊天日志 Deprecated
func NewChatLogWithBasic ¶
func NewChatLogWithBasic(in ChatLogBasic) *ChatLog
func NewChatLogWithID ¶
func (*ChatLog) IdentityAlias ¶
func (*ChatLog) IdentityLabel ¶
func (*ChatLog) IdentityModel ¶
func (*ChatLog) IdentityTable ¶
func (*ChatLog) SetWith ¶
func (z *ChatLog) SetWith(o ChatLogSet)
type ChatLogBasic ¶
type ChatLogBasic struct {
// 会话ID
ChatID oid.OID `bun:"csid,notnull" extensions:"x-order=A" json:"csid" pg:"csid,notnull" swaggertype:"string"`
// 提问
Question string `bun:",notnull,type:text" extensions:"x-order=B" form:"prompt" json:"prompt" pg:",notnull,type:text"`
// 回答
Answer string `bun:",notnull,type:text" extensions:"x-order=C" form:"response" json:"response" pg:",notnull,type:text"`
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name corpusChatLogBasic
func (*ChatLogBasic) MetaAddKVs ¶
func (in *ChatLogBasic) MetaAddKVs(args ...any) *ChatLogBasic
type ChatLogSet ¶
type ChatLogSet struct {
// 提问
Question *string `extensions:"x-order=A" json:"prompt"`
// 回答
Answer *string `extensions:"x-order=B" json:"response"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name corpusChatLogSet
func (*ChatLogSet) MetaAddKVs ¶
func (in *ChatLogSet) MetaAddKVs(args ...any) *ChatLogSet
type DocMatch ¶
type DocMatch struct {
// 文档编号
DocID oid.OID `bun:"doc_id" extensions:"x-order=A" json:"docID" swaggertype:"string"`
// 提示
Subject string `bun:"subject" extensions:"x-order=B" form:"subject" json:"subject"`
// 相似度
Similarity float32 `bun:"similarity" extensions:"x-order=C" json:"similarity,omitempty"`
} // @name corpusDocMatch
DocMatch 提示匹配结果
type DocMatches ¶
type DocMatches []DocMatch
func (DocMatches) DocumentIDs ¶
func (z DocMatches) DocumentIDs() (out oid.OIDs)
DocumentIDs returns deduplicated document IDs from the document match list
func (DocMatches) Subjects ¶
func (z DocMatches) Subjects(n int) (out []string)
Subjects returns all document subjects from the document match list
type DocVector ¶
type DocVector struct {
comm.BaseModel `bun:"table:corpus_vector_400,alias:cv" json:"-"`
comm.DefaultModel
DocVectorBasic
// 相似度 仅用于查询结果
Similarity float32 `bun:"-" extensions:"x-order=D" json:"similarity,omitempty" pg:"-"`
comm.MetaField
} // @name corpusDocVector
DocVector 文档向量 400=1024, 600=1536
func NewDocVectorWithBasic ¶
func NewDocVectorWithBasic(in DocVectorBasic) *DocVector
func NewDocVectorWithID ¶
func (*DocVector) IdentityAlias ¶
func (*DocVector) IdentityLabel ¶
func (*DocVector) IdentityModel ¶
func (*DocVector) IdentityTable ¶
func (*DocVector) SetWith ¶
func (z *DocVector) SetWith(o DocVectorSet)
type DocVectorBasic ¶
type DocVectorBasic struct {
// 文档编号
DocID oid.OID `bun:"doc_id,notnull" extensions:"x-order=A" json:"docID" pg:"doc_id,notnull" swaggertype:"string"`
// 主题 由名称+属性组成
Subject string `bun:"subject,notnull,type:text" extensions:"x-order=B" form:"subject" json:"subject" pg:"subject,notnull,type:text"`
// 向量值 长为1024的浮点数集
Vector Vector `bun:"embedding,type:vector(1024)" extensions:"x-order=C" json:"vector,omitempty" pg:"embedding,type:vector(1024)"`
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name corpusDocVectorBasic
func (*DocVectorBasic) MetaAddKVs ¶
func (in *DocVectorBasic) MetaAddKVs(args ...any) *DocVectorBasic
type DocVectorSet ¶
type DocVectorSet struct {
// 主题 由名称+属性组成
Subject *string `extensions:"x-order=A" json:"subject"`
// 向量值 长为1024的浮点数集
Vector *Vector `extensions:"x-order=B" json:"vector,omitempty"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name corpusDocVectorSet
func (*DocVectorSet) MetaAddKVs ¶
func (in *DocVectorSet) MetaAddKVs(args ...any) *DocVectorSet
type DocVectors ¶
type DocVectors []DocVector
type Document ¶
type Document struct {
comm.BaseModel `bun:"table:corpus_document,alias:cd" json:"-"`
comm.DefaultModel
DocumentBasic
comm.MetaField
} // @name corpusDocument
Document 文档 语料库
func NewDocumentWithBasic ¶
func NewDocumentWithBasic(in DocumentBasic) *Document
func NewDocumentWithID ¶
func (*Document) GetFullText ¶ added in v0.2.3
func (*Document) GetSubject ¶
GetSubject returns the document subject (title + heading)
func (*Document) IdentityAlias ¶
func (*Document) IdentityLabel ¶
func (*Document) IdentityModel ¶
func (*Document) IdentityTable ¶
func (*Document) SetWith ¶
func (z *Document) SetWith(o DocumentSet)
type DocumentBasic ¶
type DocumentBasic struct {
// 主标题 名称
Title string `` /* 161-byte string literal not displayed */
// 小节标题 属性 类别
Heading string `` /* 165-byte string literal not displayed */
// 内容 值
Content string `bun:",notnull,type:text" extensions:"x-order=C" form:"content" json:"content" pg:",notnull,type:text"`
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name corpusDocumentBasic
func (*DocumentBasic) MetaAddKVs ¶
func (in *DocumentBasic) MetaAddKVs(args ...any) *DocumentBasic
type DocumentSet ¶
type DocumentSet struct {
// 主标题 名称
Title *string `extensions:"x-order=A" json:"title"`
// 小节标题 属性 类别
Heading *string `extensions:"x-order=B" json:"heading"`
// 内容 值
Content *string `extensions:"x-order=C" json:"content"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name corpusDocumentSet
func (*DocumentSet) MetaAddKVs ¶
func (in *DocumentSet) MetaAddKVs(args ...any) *DocumentSet
type Documents ¶
type Documents []Document
func (Documents) MarkdownText ¶
MarkdownText converts document list to Markdown format text for LLM context
Click to show internal directories.
Click to hide internal directories.