encoding

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidVector = errors.New("invalid vector")

ErrInvalidVector is returned when a vector is invalid

Functions

func DecodeMetadata

func DecodeMetadata(jsonStr string) (map[string]string, error)

decodeMetadata converts JSON string back to metadata map DecodeMetadata decodes JSON string to metadata

func DecodeVector

func DecodeVector(data []byte) ([]float32, error)

decodeVector converts bytes back to a float32 slice using little-endian encoding DecodeVector decodes bytes to a float32 vector

func EncodeMetadata

func EncodeMetadata(metadata map[string]string) (string, error)

encodeMetadata converts metadata map to JSON string EncodeMetadata encodes metadata to JSON string

func EncodeVector

func EncodeVector(vector []float32) ([]byte, error)

encodeVector converts a float32 slice to bytes using little-endian encoding EncodeVector encodes a float32 vector to bytes

func ValidateEmbedding

func ValidateEmbedding(emb interface{}, expectedDim int) error

ValidateEmbedding validates an embedding

func ValidateVector

func ValidateVector(vector []float32) error

ValidateVector validates a vector

Types

This section is empty.

Jump to

Keyboard shortcuts

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