Documentation
¶
Index ¶
- Constants
- type RagChunk
- type RagMetadata
- type TransportFile
- func (instance *TransportFile) GetContent() (response []byte, err error)
- func (instance *TransportFile) GetPath() string
- func (instance *TransportFile) GetSlug() (response string)
- func (instance *TransportFile) GetUid() string
- func (instance *TransportFile) Hash() (response string, err error)
- func (instance *TransportFile) LoadContent(root ...string) (err error)
- func (instance *TransportFile) Map() map[string]interface{}
- func (instance *TransportFile) MapLite(exclude ...string) (response map[string]interface{})
- func (instance *TransportFile) SetContent(value []byte)
- func (instance *TransportFile) SetPath(filePath string) *TransportFile
- func (instance *TransportFile) String() string
- func (instance *TransportFile) StringLite(exclude ...string) (response string)
- type TransportOptions
- func (instance *TransportOptions) IsModeKnowledge() bool
- func (instance *TransportOptions) IsModeNotebook() bool
- func (instance *TransportOptions) IsModeSession() bool
- func (instance *TransportOptions) Map() map[string]interface{}
- func (instance *TransportOptions) SessionId() string
- func (instance *TransportOptions) String() string
Constants ¶
const AIUploadDataActionLink = "link"
const AIUploadDataActionPersist = "persist"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RagChunk ¶
type RagChunk struct {
ID string `json:"id"`
Metadata *RagMetadata `json:"metadata"` // Metadata map[string]string
Embedding []float32 `json:"embedding"`
Content string `json:"content"`
}
func NewRagChunk ¶
func NewRagChunk() (response *RagChunk)
func NewRagChunkFrom ¶ added in v0.3.71
func NewRagChunkFromDBObject ¶
func NewRagChunkFromRAGMap ¶
type RagMetadata ¶
type RagMetadata struct {
Uid string `json:"uid"`
DbId string `json:"db-id,omitempty"`
DbRev string `json:"db-rev,omitempty"`
Hash string `json:"hash,omitempty"`
FileId string `json:"file-id,omitempty"`
File string `json:"file,omitempty"`
Lang string `json:"lang,omitempty"`
Category string `json:"category,omitempty"`
SourceName string `json:"source-name,omitempty"`
SourceHash string `json:"source-hash,omitempty"`
}
func (*RagMetadata) GetCategory ¶
func (instance *RagMetadata) GetCategory() string
func (*RagMetadata) GetFileId ¶ added in v0.3.56
func (instance *RagMetadata) GetFileId() string
func (*RagMetadata) GetUid ¶
func (instance *RagMetadata) GetUid() string
func (*RagMetadata) Map ¶
func (instance *RagMetadata) Map() map[string]interface{}
func (*RagMetadata) String ¶
func (instance *RagMetadata) String() string
type TransportFile ¶
type TransportFile struct {
Name string `json:"name,omitempty"` // name of the file
Extension string `json:"extension,omitempty"` // extension
Schema string `json:"schema,omitempty"` // file:// ftp:// ...
Source string `json:"source,omitempty"` // VFS, email, etc... x_commons.DocSourceVFS
FsOptions string `json:"fs-options,omitempty"` // JSON data to create a new VFS driver
IndexKey string `json:"index-key,omitempty"` // if index of indexer module
Path string `json:"path,omitempty"` // full path of the file
Base64 string `json:"base64,omitempty"` // base64 content of the file
Text string `json:"text,omitempty"` // converted text
Size int `json:"size,omitempty"` // file size
}
func NewTransportFileFromBase64 ¶
func NewTransportFileFromBase64(ext string, base64 string) (instance *TransportFile)
func NewTransportFileFromBytes ¶
func NewTransportFileFromBytes(ext string, bytes []byte) (instance *TransportFile)
func NewTransportFileFromFilename ¶
func NewTransportFileFromFilename(filename string) (instance *TransportFile)
func (*TransportFile) GetContent ¶
func (instance *TransportFile) GetContent() (response []byte, err error)
GetContent retrieves the decoded content of the file as a byte slice, loading it first if not already set. This method sets also Base64 field using LoadContent().
func (*TransportFile) GetPath ¶
func (instance *TransportFile) GetPath() string
func (*TransportFile) GetSlug ¶
func (instance *TransportFile) GetSlug() (response string)
func (*TransportFile) GetUid ¶
func (instance *TransportFile) GetUid() string
GetUid generates and returns a unique identifier for the TransportFile instance based on its attributes or content. id Path is assigned
func (*TransportFile) Hash ¶
func (instance *TransportFile) Hash() (response string, err error)
Hash computes and returns the hash of the file content. It returns an error if the content cannot be retrieved or hashed. This method sets also Base64 field
func (*TransportFile) LoadContent ¶
func (instance *TransportFile) LoadContent(root ...string) (err error)
LoadContent reads the file at the specified path and encodes its content in Base64 format, storing it in the Base64 field. It returns an error if the file cannot be read.
func (*TransportFile) Map ¶
func (instance *TransportFile) Map() map[string]interface{}
func (*TransportFile) MapLite ¶
func (instance *TransportFile) MapLite(exclude ...string) (response map[string]interface{})
func (*TransportFile) SetContent ¶
func (instance *TransportFile) SetContent(value []byte)
SetContent sets the Base64 encoded content of the file using the provided byte slice if it's not nil or empty.
func (*TransportFile) SetPath ¶
func (instance *TransportFile) SetPath(filePath string) *TransportFile
SetPath sets the file path, name, and extension fields of the instance if the input is valid.
func (*TransportFile) String ¶
func (instance *TransportFile) String() string
func (*TransportFile) StringLite ¶
func (instance *TransportFile) StringLite(exclude ...string) (response string)
type TransportOptions ¶
type TransportOptions struct {
Model string `json:"model"` // the model to use to process the document
Lang string `json:"lang"` // lang of the user
SkillName string `json:"skill-name"` // name of the skill to use to process the document
KnowledgeGroups []string `json:"knowledge-groups"` // name of the .jsonl file or of the current session
KnowledgeLang string `json:"knowledge-lang"` // lang of the document
KnowledgeCategory string `json:"knowledge-category"` // metadata for RAG
KnowledgeWriteMode string `json:"knowledge-write-mode"` // insert, update, reset, only_greater
KnowledgeMode x_commons.KnowledgeModeType `json:"knowledge-mode"` // knowledge or notebook, session
Action string `json:"action"` // persist (default), link. persist=file is saved as BASE64, link=file link is saved
Metadata map[string]interface{} `json:"metadata"`
}
func NewTransportOptions ¶
func NewTransportOptions(params map[string]interface{}) (instance *TransportOptions)
func (*TransportOptions) IsModeKnowledge ¶
func (instance *TransportOptions) IsModeKnowledge() bool
func (*TransportOptions) IsModeNotebook ¶
func (instance *TransportOptions) IsModeNotebook() bool
func (*TransportOptions) IsModeSession ¶
func (instance *TransportOptions) IsModeSession() bool
func (*TransportOptions) Map ¶
func (instance *TransportOptions) Map() map[string]interface{}
func (*TransportOptions) SessionId ¶
func (instance *TransportOptions) SessionId() string
SessionId and KnowledgeName are the same when uploading a file for session usage.
func (*TransportOptions) String ¶
func (instance *TransportOptions) String() string