Documentation
¶
Index ¶
- func ApplyManagedEmbedding(node *storage.Node, embeddings [][]float32, model string, dimensions int, ...)
- func BuildText(properties map[string]interface{}, labels []string, opts *EmbedTextOptions) string
- func ChunkCount(meta map[string]any) int
- func InvalidateManagedEmbeddings(node *storage.Node)
- func IsMetadataPropertyKey(key string) bool
- func RecordChunkSpans(node *storage.Node, source EmbedText, chunks []string)
- func TextPolicy(opts *EmbedTextOptions) storage.EmbeddingTextPolicy
- type ChunkSpan
- type EmbedText
- type EmbedTextOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyManagedEmbedding ¶
func ApplyManagedEmbedding(node *storage.Node, embeddings [][]float32, model string, dimensions int, embeddedAt time.Time)
ApplyManagedEmbedding writes worker-compatible embedding payload to node fields.
func BuildText ¶
func BuildText(properties map[string]interface{}, labels []string, opts *EmbedTextOptions) string
BuildText creates canonical embedding text from node properties and labels.
func ChunkCount ¶
ChunkCount is the number of chunks meta's embedding has, whichever integer type the stored form decoded into; -1 when meta records none.
func InvalidateManagedEmbeddings ¶
InvalidateManagedEmbeddings clears worker-managed embedding state on a node.
func IsMetadataPropertyKey ¶
IsMetadataPropertyKey reports whether a property key is internal embedding metadata.
func RecordChunkSpans ¶
RecordChunkSpans stores where each of node's chunks lies in its string properties, from the text the chunks were cut from. It replaces any spans of an earlier embedding, and stores none when the chunks don't match the node's chunk embeddings one to one (a multimodal document's single vector).
func TextPolicy ¶
func TextPolicy(opts *EmbedTextOptions) storage.EmbeddingTextPolicy
TextPolicy is opts as storage's embedding text policy.
Types ¶
type ChunkSpan ¶
ChunkSpan is where a chunk of a node's embedding text lies in one of its string properties: [Start, End) in Unicode code points of the value, as Cypher's substring() counts. A chunk that runs across two properties has one span in each.
func StoredChunkSpans ¶
StoredChunkSpans returns the chunk spans RecordChunkSpans stored in meta, whichever integer types the stored form decoded into; ok is false when meta holds none (an embedding made before spans were recorded).
type EmbedText ¶
type EmbedText struct {
Text string
// contains filtered or unexported fields
}
EmbedText is a node's embedding text, with where each string property's value lies in it, so a chunk of the text can be traced to its properties.
func BuildEmbedText ¶
func BuildEmbedText(properties map[string]interface{}, labels []string, opts *EmbedTextOptions) EmbedText
BuildEmbedText creates canonical embedding text from node properties and labels, as BuildText, and records where each string property's value lies.
func (EmbedText) ChunkSpans ¶
ChunkSpans finds each chunk in the text (textchunk.Align) and returns the parts of the string property values it covers, with leading and trailing whitespace left out. A chunk not found in the text, or one covering only labels, keys or non-string values, has no span.
type EmbedTextOptions ¶
EmbedTextOptions controls which properties and labels are used when building embedding text.
func EmbedTextOptionsFromConfig ¶
func EmbedTextOptionsFromConfig(cfg *config.Config) *EmbedTextOptions
EmbedTextOptionsFromConfig maps runtime embedding worker config to text builder options.
func EmbedTextOptionsFromFields ¶
func EmbedTextOptionsFromFields(include []string, exclude []string, includeLabels bool) *EmbedTextOptions
EmbedTextOptionsFromFields builds text options from raw include/exclude settings.