https://github.com/caiodallaqua/vectoria
  
  
    Vectoria is an embedded vector database. 
    https://github.com/caiodallaqua/vectoria
  
artificial-intelligence go golang golang-library information-retrieval large-language-models machine-learning open-source vector-database vector-search
        Last synced: 4 months ago 
        JSON representation
    
Vectoria is an embedded vector database.
- Host: GitHub
- URL: https://github.com/caiodallaqua/vectoria
- Owner: caiodallaqua
- License: apache-2.0
- Created: 2023-09-04T21:48:14.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-24T20:48:46.000Z (8 months ago)
- Last Synced: 2025-06-10T10:08:20.140Z (5 months ago)
- Topics: artificial-intelligence, go, golang, golang-library, information-retrieval, large-language-models, machine-learning, open-source, vector-database, vector-search
- Language: Go
- Homepage:
- Size: 1.09 MB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 3
- 
            Metadata Files:
            - Readme: README.md
- License: LICENSE
 
Awesome Lists containing this project
README
          # Vectoria
Vectoria is an embedded vector database for simple use cases. It implements LSH (Locality-Sensitive Hashing).
Here’s a complete example:
```go
package main
import (
	"log"
	"github.com/caiodallaqua/vectoria"
)
func main() {
	var (
		indexName = "hello-world"
		// Vector to be stored.
		vec = []float64{1.1, 0.2}
		// Key to be retrieved.
		key = "my-key"
		// Let's add a small deviation to vec,
		// so we can see a match.
		queryVec = []float64{vec[0] + 0.1, vec[1] + 0.1}
		// Only similarities >= thresold.
		threshold = 0.9
		// Upper limit on how many items to retrieve.
		k uint32 = 1
	)
	dbConfig := vectoria.DBConfig{
		Path: "", // In-memory storage.
		LSH: []vectoria.LSHConfig{{
			IndexName:      indexName,
			NumRounds:      5,
			NumHyperPlanes: 2,
			SpaceDim:       2, // Length of your vectors.
		}},
	}
	db, err := vectoria.New(dbConfig)
	if err != nil {
		log.Fatalf("unable to create database: %s", err)
		return
	}
	if err = db.Add(key, vec, indexName); err != nil {
		log.Fatalf("unable to add key: %s", err)
		return
	}
	res, err := db.Get(queryVec, threshold, k, indexName)
	if err != nil {
		log.Fatalf("unable to get key: %s", err)
		return
	}
	log.Println("retrieval results:")
	for index, key := range res {
		log.Printf("\tindex: %v", index)
		log.Printf("\tkeys: %v", key)
	}
}
```
### License
[Apache License 2.0](LICENSE)