Documentation
¶
Index ¶
- Constants
- Variables
- func BatchGenChunkIDs(count int) []string
- func BatchGenDocIDs(count int) []string
- func ExtractCollectionIDFromDocID(docID string) (string, string)
- func ExtractCollectionIDFromGraphName(graphName string) string
- func ExtractCollectionIDFromStoreName(storeName string) string
- func ExtractCollectionIDFromVectorName(vectorName string) string
- func ExtractionPrompt(userPrompt string) string
- func ExtractionPromptWithJSONFormat(userPrompt string) string
- func GenChunkID() string
- func GenCollectionID(prefix string) string
- func GenDocID() string
- func GenDocIDWithCollectionID(graphName string) string
- func GenShortID() string
- func GetCollectionIDs(name string) (types.CollectionIDs, error)
- func GetExtractionToolcall() []map[string]interface{}
- func GetSemanticToolcall() []map[string]interface{}
- func IsDocIDWithCollectionID(docID string) bool
- func IsValidUUID(id string) bool
- func ParseJSONOptions(optionsStr string) (map[string]interface{}, error)
- func PostLLM(ctx context.Context, conn connector.Connector, endpoint string, ...) (interface{}, error)
- func PostLLMFile(ctx context.Context, conn connector.Connector, endpoint string, ...) (interface{}, error)
- func SemanticPrompt(userPrompt string, size int) string
- func StreamLLM(ctx context.Context, conn connector.Connector, endpoint string, ...) error
- func ValidateName(name string) error
- type FileReader
- type Parser
- func (parser *Parser) ParseExtractionEntities(chunkData []byte) ([]types.Node, []types.Relationship, error)
- func (parser *Parser) ParseExtractionRegular(finalContent string) ([]types.Node, []types.Relationship, error)
- func (parser *Parser) ParseExtractionToolcall(finalArguments string) ([]types.Node, []types.Relationship, error)
- func (parser *Parser) ParseSemanticPositions(chunkData []byte) ([]types.Position, error)
- func (parser *Parser) ParseSemanticRegular(finalContent string) ([]types.Position, error)
- func (parser *Parser) ParseSemanticToolcall(finalArguments string) ([]types.Position, error)
- func (parser *Parser) SetToolcall(isToolcall bool)
Constants ¶
const ExtractionToolcallRaw = `` /* 5266-byte string literal not displayed */
ExtractionToolcallRaw is the optimized toolcall for entity and relationship extraction
const SemanticToolcallRaw = `` /* 1825-byte string literal not displayed */
SemanticToolcallRaw is the toolcall semantic segmentation
Variables ¶
var ExtractionToolcall = GetExtractionToolcall()
ExtractionToolcall is the extraction toolcall
var SemanticToolcall = GetSemanticToolcall()
SemanticToolcall is the semantic toolcall
Functions ¶
func BatchGenChunkIDs ¶
BatchGenChunkIDs generates multiple chunk IDs at once
func BatchGenDocIDs ¶
BatchGenDocIDs generates multiple document IDs at once
func ExtractCollectionIDFromDocID ¶
ExtractCollectionIDFromDocID extracts the GraphName from a prefixed docID Returns the GraphName and the plain UUID part
func ExtractCollectionIDFromGraphName ¶
ExtractCollectionIDFromGraphName extracts the original collection ID from a graph collection name
func ExtractCollectionIDFromStoreName ¶
ExtractCollectionIDFromStoreName extracts the original collection ID from a store collection name
func ExtractCollectionIDFromVectorName ¶
ExtractCollectionIDFromVectorName extracts the original collection ID from a vector collection name This is the reverse operation of GetCollectionIDs
func ExtractionPrompt ¶
ExtractionPrompt returns the extraction prompt, with JSON format instructions for non-toolcall mode
func ExtractionPromptWithJSONFormat ¶
ExtractionPromptWithJSONFormat returns the extraction prompt with JSON format instructions for non-toolcall mode
func GenCollectionID ¶
GenCollectionID generates a unique collection ID with prefix + timestamp
func GenDocID ¶
func GenDocID() string
GenDocID generates a UUID for document identification (without dashes)
func GenDocIDWithCollectionID ¶
GenDocIDWithCollectionID generates a UUID for document identification with GraphName prefix Format: graphname__uuid (without dashes)
func GenShortID ¶
func GenShortID() string
GenShortID generates a shorter ID using timestamp and random bytes Useful for cases where shorter IDs are preferred
func GetCollectionIDs ¶
func GetCollectionIDs(name string) (types.CollectionIDs, error)
GetCollectionIDs generates simple collection IDs: name_vector, name_graph, name_store
func GetExtractionToolcall ¶
func GetExtractionToolcall() []map[string]interface{}
GetExtractionToolcall returns the extraction toolcall
func GetSemanticToolcall ¶
func GetSemanticToolcall() []map[string]interface{}
GetSemanticToolcall returns the semantic toolcall
func IsDocIDWithCollectionID ¶
IsDocIDWithCollectionID checks if a docID contains a GraphName prefix
func IsValidUUID ¶
IsValidUUID checks if a string is a valid UUID format
func ParseJSONOptions ¶
ParseJSONOptions parses JSON options string and returns a map
func PostLLM ¶
func PostLLM(ctx context.Context, conn connector.Connector, endpoint string, payload map[string]interface{}) (interface{}, error)
PostLLM sends a POST request to LLM API using connector
func PostLLMFile ¶
func PostLLMFile(ctx context.Context, conn connector.Connector, endpoint string, filePath string, formData map[string]interface{}) (interface{}, error)
PostLLMFile sends a POST request to LLM API with file upload using multipart/form-data
func SemanticPrompt ¶
SemanticPrompt returns the semantic prompt
func StreamLLM ¶
func StreamLLM(ctx context.Context, conn connector.Connector, endpoint string, payload map[string]interface{}, callback func(data []byte) error) error
StreamLLM sends a streaming request to LLM service with real-time callback
func ValidateName ¶
ValidateName validates collection name format Only allows a-z, A-Z, 0-9, and underscore characters
Types ¶
type FileReader ¶
FileReader wraps os.File to implement io.ReadSeeker with Close method
func OpenFileAsReader ¶
func OpenFileAsReader(filename string) (*FileReader, error)
OpenFileAsReader opens a file and returns a ReadSeeker with Close method
type Parser ¶
type Parser struct {
Content string
Arguments string
Toolcall bool
// contains filtered or unexported fields
}
Parser handles streaming LLM responses and accumulates data
func NewExtractionParser ¶
func NewExtractionParser() *Parser
NewExtractionParser creates a new extraction parser for tool call parsing
func NewSemanticParser ¶
NewSemanticParser creates a new semantic parser
func (*Parser) ParseExtractionEntities ¶
func (parser *Parser) ParseExtractionEntities(chunkData []byte) ([]types.Node, []types.Relationship, error)
ParseExtractionEntities parses a single streaming chunk for extraction and returns extraction progress
func (*Parser) ParseExtractionRegular ¶
func (parser *Parser) ParseExtractionRegular(finalContent string) ([]types.Node, []types.Relationship, error)
ParseExtractionRegular parses entities and relationships from regular LLM content
func (*Parser) ParseExtractionToolcall ¶
func (parser *Parser) ParseExtractionToolcall(finalArguments string) ([]types.Node, []types.Relationship, error)
ParseExtractionToolcall parses the final arguments of the extraction toolcall
func (*Parser) ParseSemanticPositions ¶
ParseSemanticPositions parses a single streaming chunk returns a semantic chunk
func (*Parser) ParseSemanticRegular ¶
ParseSemanticRegular parses the final content of the regular
func (*Parser) ParseSemanticToolcall ¶
ParseSemanticToolcall parses the final arguments of the toolcall
func (*Parser) SetToolcall ¶
SetToolcall sets the toolcall mode for the parser