embedding_store

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEmbeddingStoreModel

func NewEmbeddingStoreModel() contracts.IEmbeddingStore

NewEmbeddingStoreModel initializes a new CodeEmbeddingStoreModel.

Types

type EmbeddingStore

type EmbeddingStore struct {
	EmbeddingsStore map[string][]float64
	CodeStore       map[string]string
	// contains filtered or unexported fields
}

EmbeddingStore holds the embeddings and their corresponding code chunks.

func (*EmbeddingStore) CosineSimilarity

func (store *EmbeddingStore) CosineSimilarity(vec1, vec2 []float64) float64

func (*EmbeddingStore) FindRelevantChunks

func (store *EmbeddingStore) FindRelevantChunks(queryEmbedding []float64, topN int, embeddingModel string, threshold float64) []string

FindRelevantChunks retrieves the relevant code chunks from the embedding store based on a similarity threshold.

func (*EmbeddingStore) FindThresholdByModel

func (store *EmbeddingStore) FindThresholdByModel(modelName string) float64

func (*EmbeddingStore) Save

func (store *EmbeddingStore) Save(key string, code string, embeddings []float64)

Save stores the embeddings and corresponding code in the store. If the existing code is different, it updates the entry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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