Versions in this module Expand all Collapse all v1 v1.0.4 Mar 1, 2026 Changes in this version + func Compact(model *SimpleInt8Model512, text string, maxTokens int, query string) (string, error) + func CompactBatchInt8Cosine(embeddings []*Int8Result512, refVec *simd.Vec512, refScale float32, ...) []int + func CompactSentences(model *SimpleInt8Model512, sentences []string, maxTokens int, query string) ([]string, error) + func CompactSentencesWithConfig(model *SimpleInt8Model512, sentences []string, cfg CompactConfig) ([]string, error) + func CompactWithConfig(model *SimpleInt8Model512, text string, cfg CompactConfig) (string, error) + func EstimateTokens(text string) int + func EstimateTokensSlice(sentences []string) []int + func SentenceSplit(text string) []string + func Vec512FromInt8(emb *Int8Result512) *simd.Vec512 + type CompactConfig struct + MaxTokens int + PreserveOrder bool + Query string v1.0.3 Feb 11, 2026 v1.0.2 Feb 11, 2026 v1.0.1 Feb 11, 2026 v1.0.0 Feb 11, 2026 Changes in this version + const DefaultBatchSize + const DefaultTimeout + const Int8EmbeddingDim + const Int8VocabSize + const MaxErrorTextLength + func BuildCAGRACachePath(namespace string, vectorDim, graphDegree, count int) string + func CosineSimilarity(a, b []float32) float32 + func CosineSimilarityFloat64(a, b []float64) float64 + func CosineSimilarityInt8(a, b []uint8) float32 + func CosineSimilarityInt8Fallback(a, b []uint8) float32 + func DebugLoggingEnabled() bool + func Debugf(format string, args ...interface{}) + func Debugln(args ...interface{}) + func DisableDebugLogging() + func EnableDebugLogging() + func ExampleVectorSearch() + func FastQuantize(input []float32) ([]int8, float32) + func FusedCAGRAAvailable() bool + func GetCUDADeviceCount() int + func GetCUDAVersion() string + func GetEmbedBuffer() []float32 + func GetInt8Buffer() []int8 + func GetOptimalBatchSize() int + func GetOptimalGPUBatchSize() int + func GetSearchConfig(preset SearchPreset, estimatedSize int) search.Config + func GetTokenBuffer() []int + func IsCUDAAvailable() bool + func LoadModelUnified(config *UnifiedModelConfig) (interface{}, error) + func PutEmbedBuffer(buf []float32) + func PutInt8Buffer(buf []int8) + func PutTokenBuffer(buf []int) + func SetDebugOutput(w io.Writer) + func SetSimpleInt8Verbose(verbose bool) + func ZeroCopyInt32ToFloat32(src []int32) []float32 + type BatchConfig struct + GPUMemoryLimit uint64 + MaxBatchSize int + MinBatch int + OptimalBatch int + type BatchEmbeddingResult struct + BatchSize int + Duration time.Duration + Embeddings [][]float32 + ItemsPerSec float64 + type BatchProcessor struct + func NewBatchProcessor(batchSize, workers int) *BatchProcessor + func (bp *BatchProcessor) ProcessBatch(texts []string, model *EmbeddingModel) ([]simd.Vec512, []float32, error) + type BatchResult struct + Embeddings [][]float32 + Time time.Duration + type BufferPool struct + type CAGRAConfig struct + CachePath string + GraphDegree int + MaxIterations int + MaxVectors int + TargetLatencyUs int + TargetRecall float32 + VectorDim int + func DefaultCAGRAConfig() CAGRAConfig + func FastCAGRAConfig() CAGRAConfig + func QualityCAGRAConfig() CAGRAConfig + type CPUBulkIndexer struct + func NewCPUBulkIndexer(index *VectorIndex, batchSize int) *CPUBulkIndexer + func (idx *CPUBulkIndexer) IndexBatch(docs []Document) error + func (idx *CPUBulkIndexer) Stats() CPUBulkIndexerStats + type CPUBulkIndexerStats struct + BatchSize int + NumWorkers int + Throughput float64 + TotalIndexed int64 + TotalTime time.Duration + func (stats CPUBulkIndexerStats) LogStats() + type CachedEmbedding struct + LastUsed int64 + Scale float32 + UseCount uint32 + Vector []float32 + VectorI8 []int8 + type Document struct + ID int + Text string + type EmbedInt8Result struct + Scale float32 + Vector []int8 + type EmbeddingModel struct + EmbedDim int + VocabSize int + func LoadModel() (*EmbeddingModel, error) + func (m *EmbeddingModel) EmbedInt8(text string) (*EmbedInt8Result, error) + func (m *EmbeddingModel) Encode(text string) ([]float32, error) + func (m *EmbeddingModel) FindMostSimilar(query string, candidates []string, limit int) ([]SimilarityResult, error) + func (m *EmbeddingModel) GetAvailableTexts() []string + func (m *EmbeddingModel) OptimizedEmbedding(text string, cache *TokenPatternCache) ([]float32, error) + func (m *EmbeddingModel) Similarity(text1, text2 string) (float32, error) + type EmbeddingModelInt8 struct + EmbedDim int + VocabSize int + func LoadModelInt8(useInt8 bool) (*EmbeddingModelInt8, error) + func (m *EmbeddingModelInt8) ComputeEmbeddingFromTokens(tokenIDs []int) ([]uint8, error) + func (m *EmbeddingModelInt8) Encode(text string) ([]uint8, error) + type FusedCAGRAConfig struct + EmbedDim int + GraphDegree int + MaxVectors int + TopK int + VocabSize int + func DefaultFusedCAGRAConfig() FusedCAGRAConfig + type FusedCAGRAEngine struct + func NewFusedCAGRAEngine(config FusedCAGRAConfig) (*FusedCAGRAEngine, error) + func (engine *FusedCAGRAEngine) BuildIndex(embedWeights []int8, embedScales []float32, database []simd.Vec512, ...) error + func (engine *FusedCAGRAEngine) Close() + func (engine *FusedCAGRAEngine) GetStats() FusedCAGRAStats + func (engine *FusedCAGRAEngine) Search(tokens []uint16) ([]SearchResult, error) + func (engine *FusedCAGRAEngine) SearchBatch(tokenBatch [][]uint16, maxTokens int) ([][]SearchResult, error) + type FusedCAGRAStats struct + AvgSearchTimeMs float64 + EmbedDim int + IsBuilt bool + NumVectors int + SearchCount int64 + TopK int + VocabSize int + type GPUBatchProcessor struct + func NewGPUBatchProcessor(model *EmbeddingModel, cache *TokenPatternCache) *GPUBatchProcessor + func (p *GPUBatchProcessor) GetMetrics() map[string]interface{} + func (p *GPUBatchProcessor) GetStats() map[string]interface{} + func (p *GPUBatchProcessor) ProcessBatch(texts []string) ([]*EmbedInt8Result, error) + func (p *GPUBatchProcessor) Shutdown() + type GPUBlockPool struct + type GPUCagraConfig struct + Degree int + NList int + NProbe int + VectorDim int + type GPUEmbeddingModel struct + func NewGPUEmbeddingModel(batchSize int, useGPU bool) (*GPUEmbeddingModel, error) + func (g *GPUEmbeddingModel) EncodeBatch(texts []string) (*BatchEmbeddingResult, error) + func (g *GPUEmbeddingModel) MemoryOptimizedEncodeBatch(texts []string, maxMemoryMB int) (*BatchEmbeddingResult, error) + func (g *GPUEmbeddingModel) OptimalBatchSize() int + type GPUIndexer struct + func NewGPUIndexer(config IndexConfig) (*GPUIndexer, error) + func (g *GPUIndexer) AddVectors(vectors [][]int8) error + func (g *GPUIndexer) BatchSearch(queries [][]int8, k int) ([][]SearchResult, error) + func (g *GPUIndexer) Close() error + func (g *GPUIndexer) GetMemoryUsage() uint64 + func (g *GPUIndexer) GetStats() IndexStats + func (g *GPUIndexer) IndexVectors(vectors []simd.Vec512, scales []float32) error + func (g *GPUIndexer) Initialize() error + func (g *GPUIndexer) IsReady() bool + func (g *GPUIndexer) Search(query simd.Vec512, scale float32, k int) ([]int, []float32, error) + func (g *GPUIndexer) TrainIndex(vectors [][]int8) error + type GPUMemoryConfig struct + DeviceID int + MaxMemoryUsagePercent float64 + MaxQueryBlocks int + MaxResultBlocks int + MaxVectorBlocks int + QueryPoolBlockSize uint64 + ReserveMemoryMB uint64 + ResultPoolBlockSize uint64 + VectorPoolBlockSize uint64 + func DefaultGPUMemoryConfig() GPUMemoryConfig + type GPUMemoryManager struct + func NewGPUMemoryManager(config GPUMemoryConfig) (*GPUMemoryManager, error) + func (m *GPUMemoryManager) AllocateQueryMemory() (unsafe.Pointer, error) + func (m *GPUMemoryManager) AllocateResultMemory() (unsafe.Pointer, error) + func (m *GPUMemoryManager) AllocateVectorMemory() (unsafe.Pointer, error) + func (m *GPUMemoryManager) Close() error + func (m *GPUMemoryManager) ForceGarbageCollection() + func (m *GPUMemoryManager) FreeQueryMemory(ptr unsafe.Pointer) + func (m *GPUMemoryManager) FreeResultMemory(ptr unsafe.Pointer) + func (m *GPUMemoryManager) FreeVectorMemory(ptr unsafe.Pointer) + func (m *GPUMemoryManager) GetMemoryStats() GPUMemoryStats + func (m *GPUMemoryManager) StartMemoryMonitor(interval time.Duration) + type GPUMemoryStats struct + AllocatedGB float64 + AllocationCount uint64 + FreeMemoryGB float64 + MaxUsageGB float64 + PeakUsageGB float64 + QueryPoolStats PoolStats + ResultPoolStats PoolStats + TotalMemoryGB float64 + VectorPoolStats PoolStats + type GPUSearchServer struct + func NewGPUSearchServer(model *EmbeddingModel, config GPUServerConfig) (*GPUSearchServer, error) + func (s *GPUSearchServer) Start() error + func (s *GPUSearchServer) Stop() error + type GPUServerConfig struct + EnableGPUFallback bool + EnableMetrics bool + EnableProfiling bool + GPUBatchSize int + GPUDeviceID int + GPUMemoryLimitMB int + IndexingBatchSize int + MaxConcurrency int + MaxVectors int + Port int + PreloadEmbeddings bool + ReadOnly bool + SharedIndexPath string + WorkerThreads int + func DefaultGPUServerConfig() GPUServerConfig + type GPUStats struct + DeviceID int + MemoryTotal int64 + MemoryUsed int64 + Temperature float32 + Utilization float32 + type IndexComparison struct + AsyncError error + AsyncSpeedup float64 + AsyncTime time.Duration + GPUError error + GPUSpeedup float64 + GPUTime time.Duration + NumDocuments int + ParallelError error + ParallelSpeedup float64 + ParallelTime time.Duration + SequentialError error + SequentialTime time.Duration + type IndexConfig struct + CodebookSize int + DeviceID int + IVFClusters int + NumSubquantizers int + ProbeLists int + RerankK int + VectorDim int + func DefaultGPUConfig() IndexConfig + type IndexData struct + IDs []int + IndexType string + MemoryUsageMB float64 + Trained bool + Vectors [][]float32 + VectorsBinary []byte + type IndexProgress struct + Current int + DocsPerSec float64 + Percentage float64 + TimeLeft time.Duration + Total int + type IndexRequest struct + Context context.Context + IDs []int + Response chan IndexResponse + Texts []string + type IndexResponse struct + Error error + IDs []int + Stats IndexingStats + type IndexSnapshot struct + Config SearchConfig + CreatedAt time.Time + Documents map[int]string + IndexData *IndexData + Metadata map[string]interface{} + NumDocuments int + Version string + type IndexStats struct + GPUMemoryMB float32 + IVFClusters int + IndexBuilt bool + IsTrained bool + NumVectors int + PQSubquantizers int + VectorDim int + type IndexingStats struct + DocumentsProcessed int + EmbeddingTime time.Duration + IndexingTime time.Duration + ProcessingTime time.Duration + type Int8EmbeddingModel512 struct + func LoadFastModel() (*Int8EmbeddingModel512, error) + func LoadInt8Model512() (*Int8EmbeddingModel512, error) + func (m *Int8EmbeddingModel512) Embed(text string) ([]float32, error) + func (m *Int8EmbeddingModel512) EmbedInt8(text string) (*Int8Result512, error) + func (m *Int8EmbeddingModel512) EmbedTokens(tokens []int16) ([]float32, error) + func (m *Int8EmbeddingModel512) GetInt8Weights() ([]int8, []float32) + func (m *Int8EmbeddingModel512) GetMemoryUsage() string + func (m *Int8EmbeddingModel512) Similarity(text1, text2 string) (float32, error) + func (m *Int8EmbeddingModel512) Tokenize(text string) ([]int16, error) + type Int8Result512 struct + Scale float32 + Vector []int8 + type MemoryOptimizedCache struct + func NewMemoryOptimizedCache(maxSize int) *MemoryOptimizedCache + func (c *MemoryOptimizedCache) Clear() + func (c *MemoryOptimizedCache) Get(text string) (*EmbedInt8Result, bool) + func (c *MemoryOptimizedCache) Put(text string, embedding *EmbedInt8Result) + func (c *MemoryOptimizedCache) Size() int + type ModelCompatibilityWrapper struct + func LoadCompatibleModel() (*ModelCompatibilityWrapper, error) + func (w *ModelCompatibilityWrapper) Encode(text string) ([]float32, error) + func (w *ModelCompatibilityWrapper) EncodeInt8(text string) ([]int8, error) + type ObjectPool struct + func NewObjectPool() *ObjectPool + func (p *ObjectPool) GetEmbedding() *EmbedInt8Result + func (p *ObjectPool) GetSlice() *[]float32 + func (p *ObjectPool) GetVector() *simd.Vec512 + func (p *ObjectPool) PutEmbedding(emb *EmbedInt8Result) + func (p *ObjectPool) PutSlice(slice *[]float32) + func (p *ObjectPool) PutVector(vec *simd.Vec512) + type OptimizedEmbeddingModel struct + func LoadOptimizedModel() (*OptimizedEmbeddingModel, error) + func (m *OptimizedEmbeddingModel) BatchEmbed(texts []string) ([]*EmbedInt8Result, error) + func (m *OptimizedEmbeddingModel) EmbedInt8Optimized(text string) (*EmbedInt8Result, error) + func (m *OptimizedEmbeddingModel) EmbedOptimized(text string) ([]float32, error) + func (m *OptimizedEmbeddingModel) FastSearch(query string, limit int) ([]float32, error) + func (m *OptimizedEmbeddingModel) GetStats() map[string]interface{} + func (m *OptimizedEmbeddingModel) OptimizeForProduction(maxCacheSize int, gpuEnabled bool) + func (m *OptimizedEmbeddingModel) PrecomputePatterns(patterns []string) + func (m *OptimizedEmbeddingModel) WarmupCache() + type ParallelIndexConfig struct + BatchSize int + EnableCache bool + NumWorkers int + QueueSize int + func DefaultParallelIndexConfig() ParallelIndexConfig + type ParallelIndexStats struct + BatchSize int + DocsPerSec float64 + Errors uint32 + NumWorkers int + TotalIndexed uint64 + TotalTime time.Duration + type ParallelIndexer struct + func NewParallelIndexer(engine *SearchEngine, config ParallelIndexConfig) *ParallelIndexer + func (p *ParallelIndexer) IndexDocumentsParallel(texts []string) ([]int, error) + func (p *ParallelIndexer) IndexWithProgress(texts []string) (<-chan IndexProgress, error) + func (p *ParallelIndexer) OptimizeWorkers(testDocs []string) (int, error) + func (p *ParallelIndexer) Stats() ParallelIndexStats + type ParallelProcessor struct + func NewParallelProcessor() *ParallelProcessor + func (p *ParallelProcessor) Close() + func (p *ParallelProcessor) ProcessBatch(items []func()) + type ParallelSearchEngine struct + func NewParallelSearchEngine(model *EmbeddingModel, config SearchConfig) *ParallelSearchEngine + func (e *ParallelSearchEngine) IndexBatchParallel(texts []string) ([]int, error) + func (e *ParallelSearchEngine) IndexBatchWithComparison(texts []string) (*IndexComparison, error) + type PersistenceFormat string + const FormatBinary + const FormatJSON + type PersistenceStats struct + LastLoadTime time.Duration + LastSaveTime time.Duration + LastSaved time.Time + LoadCount int + SaveCount int + func GetPersistenceStats() PersistenceStats + type PoolStats struct + AllocBlocks int + AllocCount uint64 + BlockSizeMB float64 + FreeBlocks int + FreeCount uint64 + MaxBlocks int + Name string + TotalAllocGB float64 + type PrecomputedEmbeddings struct + Bigram map[string][]float32 + Fourgram map[string][]float32 + Single map[string][]float32 + Trigram map[string][]float32 + type PresetConfig struct + DatasetSize int + Preset SearchPreset + type SaveOptions struct + Compress bool + Format PersistenceFormat + IncludeTexts bool + Metadata map[string]interface{} + func DefaultSaveOptions() SaveOptions + type SearchConfig struct + AsyncQueueSize int + AsyncWorkers int + AutoMode bool + CandidatesToRerank int + EnableAsync bool + EnableGPU bool + GPUBatchSize int + GPUDeviceID int + MaxConcurrency int + MaxExactSearchSize int + NumClusters int + Preset SearchPreset + SearchClusters int + UseCompression bool + UseGraphRouting bool + UseInt8 bool + func AsyncSearchConfig() SearchConfig + func AutoOptimizedSearchConfig() SearchConfig + func DefaultSearchConfig() SearchConfig + func GPUSearchConfig() SearchConfig + type SearchEngine struct + func FastSearchEngine(model *EmbeddingModel) *SearchEngine + func NewAsyncSearchEngine(model *EmbeddingModel) *SearchEngine + func NewAutoSearchEngine(model *EmbeddingModel) *SearchEngine + func NewCAGRASearchEngine(model *EmbeddingModel) *SearchEngine + func NewGPUSearchEngine(model *EmbeddingModel) *SearchEngine + func NewSearchEngine(model *EmbeddingModel) *SearchEngine + func NewSearchEngineWithConfig(model *EmbeddingModel, config SearchConfig) *SearchEngine + func NewSearchEngineWithPreset(model *EmbeddingModel, preset SearchPreset) (*SearchEngine, error) + func (se *SearchEngine) AutoSave(dir string, interval time.Duration) + func (se *SearchEngine) Checkpoint(dir string) error + func (se *SearchEngine) Clear() + func (se *SearchEngine) Close() error + func (se *SearchEngine) FindSimilar(documentID int, k int) ([]SearchResult, error) + func (se *SearchEngine) Flush() error + func (se *SearchEngine) GetAllDocuments() map[int]string + func (se *SearchEngine) GetDocument(id int) (string, bool) + func (se *SearchEngine) Index(text string) (int, error) + func (se *SearchEngine) IndexBatch(texts []string) ([]int, error) + func (se *SearchEngine) IndexBatchAsync(texts []string) <-chan IndexResponse + func (se *SearchEngine) IndexBatchAsyncWithIDs(ids []int, texts []string) <-chan IndexResponse + func (se *SearchEngine) IndexBatchWithIDs(ids []int, texts []string) error + func (se *SearchEngine) IndexWithID(id int, text string) error + func (se *SearchEngine) Load(path string) error + func (se *SearchEngine) LoadFromDirectory(dir string) error + func (se *SearchEngine) Optimize() error + func (se *SearchEngine) QuickSave(path string) error + func (se *SearchEngine) Save(path string, options SaveOptions) error + func (se *SearchEngine) SaveToDirectory(dir string, options SaveOptions) error + func (se *SearchEngine) Search(query string, k int) ([]SearchResult, error) + func (se *SearchEngine) SearchWithOptions(query string, opts SearchOptions) ([]SearchResult, error) + func (se *SearchEngine) Size() int + func (se *SearchEngine) Stats() SearchEngineStats + type SearchEngineStats struct + IndexDetails map[string]interface{} + IndexType string + Initialized bool + MemoryUsageMB float64 + NumDocuments int + type SearchOptions struct + IncludeVectors bool + MaxDistance float32 + MinSimilarity float32 + TopK int + type SearchPreset int + const AccuratePreset + const BalancedPreset + const CAGRAPreset + const CustomPreset + const FastPreset + type SearchRequest struct + K int + Queries []string + Query string + RequestID string + Timeout int + type SearchResponse struct + Batch [][]SearchResult + Error string + Latency int64 + RequestID string + Results []SearchResult + type SearchResult struct + Distance float32 + ID int + Similarity float32 + Text string + type SearchServer struct + func NewSearchServer(model *EmbeddingModel, config ServerConfig) (*SearchServer, error) + func (s *SearchServer) Start() error + func (s *SearchServer) Stop() error + type ServerConfig struct + EnableMetrics bool + EnableProfiling bool + MaxConcurrency int + MaxVectors int + Port int + PreloadEmbeddings bool + ReadOnly bool + SharedIndexPath string + WorkerThreads int + func DefaultServerConfig() ServerConfig + type ServerDocument struct + ID int + Text string + type ServerIndexRequest struct + Async bool + Documents []ServerDocument + RequestID string + type ServerIndexResponse struct + Error string + Indexed int + Latency int64 + RequestID string + type SharedIndexHeader struct + IDsOffset uint64 + IndexType uint32 + MaxVectors uint32 + MetaOffset uint64 + NumVectors uint64 + ScalesOffset uint64 + TotalReads uint64 + TotalSearches uint64 + VectorDim uint32 + VectorOffset uint64 + Version uint32 + WriteSeqNum uint64 + WriterPID int32 + type SharedIndexStats struct + CacheSize int + MaxVectors uint64 + MemoryUsageMB float64 + NumVectors uint64 + TotalReads uint64 + TotalSearches uint64 + WriteSeqNum uint64 + type SharedMemoryConfig struct + BasePath string + CacheSize int + CreateIfNew bool + MaxVectors int + ReadOnly bool + UseLockFree bool + type SharedMemoryIndex struct + func NewSharedMemoryIndex(config SharedMemoryConfig) (*SharedMemoryIndex, error) + func (idx *SharedMemoryIndex) AddVector(vec *simd.Vec512, scale float32, id int) error + func (idx *SharedMemoryIndex) BatchSearch(queries []*simd.Vec512, k int) [][]SearchResult + func (idx *SharedMemoryIndex) Close() error + func (idx *SharedMemoryIndex) GetVector(index int) (*simd.Vec512, error) + func (idx *SharedMemoryIndex) ReleaseWriter() + func (idx *SharedMemoryIndex) SearchTopK(query *simd.Vec512, k int) []SearchResult + func (idx *SharedMemoryIndex) Stats() SharedIndexStats + func (idx *SharedMemoryIndex) Sync() error + func (idx *SharedMemoryIndex) TryAcquireWriter() bool + func (idx *SharedMemoryIndex) WaitForWrites(targetSeq uint64) + type SimilarityResult struct + Similarity float32 + Text1 string + Text2 string + type SimpleInt8Model512 struct + func LoadSimpleInt8Model512() (*SimpleInt8Model512, error) + func (m *SimpleInt8Model512) Close() error + func (m *SimpleInt8Model512) Embed(text string) ([]float32, error) + func (m *SimpleInt8Model512) EmbedBatchInt8(texts []string) ([]*Int8Result512, error) + func (m *SimpleInt8Model512) EmbedBatchInt8Optimized(texts []string, progressCallback func(processed, total int)) ([]*Int8Result512, error) + func (m *SimpleInt8Model512) EmbedDim() int + func (m *SimpleInt8Model512) EmbedFast(text string) ([]float32, func()) + func (m *SimpleInt8Model512) EmbedInt8(text string) (*Int8Result512, error) + func (m *SimpleInt8Model512) EmbedTokens(tokens []int16) ([]float32, error) + func (m *SimpleInt8Model512) EmbedTokensInt8(tokens []int16) (*Int8Result512, error) + func (m *SimpleInt8Model512) EmbedTokensInto(tokens []int16, result []float32) int + func (m *SimpleInt8Model512) EmbedTokensIntoSIMD(tokens []int16, result []float32) int + func (m *SimpleInt8Model512) EmbeddingTable() [][]int8 + func (m *SimpleInt8Model512) ScaleTable() []float32 + func (m *SimpleInt8Model512) Similarity(text1, text2 string) (float32, error) + func (m *SimpleInt8Model512) SimpleTokenize(text string) []int16 + func (m *SimpleInt8Model512) VocabSize() int + type SimplifiedSearchConfig struct + CustomConfig *SearchConfig + DatasetSize int + Preset SearchPreset + type TensorInfo struct + DataOffsets [2]int64 + Dtype string + Shape []int + type TokenData struct + Length int + TokenIDs []int + type TokenFrequencyData struct + Bigrams TokenPatternSection + Fourgrams TokenPatternSection + SingleTokens TokenFrequencySection + Stats map[string]int + Stopwords []int + TokenizerName string + Trigrams TokenPatternSection + VocabSize int + type TokenFrequencySection struct + Counts []int + IDs []int + type TokenPatternCache struct + func NewTokenPatternCache(freqFile, embeddingFile string) (*TokenPatternCache, error) + func (c *TokenPatternCache) BatchGetEmbeddings(tokenBatches [][]int) ([]*CachedEmbedding, []bool) + func (c *TokenPatternCache) ComputeEmbeddingWithCache(tokens []int, computeFn func([]int) ([]float32, error)) ([]float32, error) + func (c *TokenPatternCache) FilterStopwords(tokens []int, textLength int) []int + func (c *TokenPatternCache) GetCachedEmbedding(tokens []int) (*CachedEmbedding, bool) + func (c *TokenPatternCache) GetStats() map[string]interface{} + func (c *TokenPatternCache) PrecomputeCommonPatterns(model *EmbeddingModel, patterns [][]int) + type TokenPatternSection struct + Counts []int + Patterns [][]int + type TokenizerOptimizations struct + func NewTokenizerOptimizations(maxCacheSize int) *TokenizerOptimizations + func (t *TokenizerOptimizations) ClearCache() + func (t *TokenizerOptimizations) TokenizeCached(text string, tokenizeFn func(string) ([]uint32, error)) ([]int, error) + type UnifiedModelConfig struct + ForceFloat32 bool + ModelDir string + UseInt8 bool + func DefaultFastConfig() *UnifiedModelConfig + type VectorBuffer struct + func NewVectorBuffer(capacity int) *VectorBuffer + func (vb *VectorBuffer) Add(vec simd.Vec512, scale float32) + func (vb *VectorBuffer) GetVectors() ([]simd.Vec512, []float32) + func (vb *VectorBuffer) IsFull() bool + func (vb *VectorBuffer) Len() int + func (vb *VectorBuffer) Reset() + type VectorIndex struct + func NewVectorIndex(model *EmbeddingModel, config VectorIndexConfig) *VectorIndex + func (idx *VectorIndex) AddDocument(doc Document) error + func (idx *VectorIndex) AddDocuments(docs []Document) error + func (idx *VectorIndex) AddDocumentsBulkGPU(docs []Document) error + func (idx *VectorIndex) AddDocumentsWithMonitoring(docs []Document) (<-chan interface{}, error) + func (idx *VectorIndex) Search(query string, k int) ([]SearchResult, error) + func (idx *VectorIndex) Size() int + func (idx *VectorIndex) Stats() VectorIndexStats + func (idx *VectorIndex) Train(texts []string) error + type VectorIndexConfig struct + BulkBatchSize int + EnableBulkGPU bool + MaxFlatSize int + NList int + NProbe int + RerankSize int + UseHNSW bool + UsePQ bool + UseParallel bool + func DefaultVectorIndexConfig() VectorIndexConfig + type VectorIndexStats struct + HNSWEnabled bool + IndexType string + MemoryUsage int64 + NLists int + PQEnabled bool + Size int v0 v0.1.5 Aug 24, 2025 v0.1.4 Aug 20, 2025 v0.1.3 Aug 19, 2025 v0.1.0 Aug 16, 2025 v0.0.1 Aug 14, 2025