build backend to collect and search using embeddings

This commit is contained in:
2025-01-04 00:15:29 -07:00
parent c4521af5c2
commit 3be1648ee4
16 changed files with 679 additions and 489 deletions

View File

@ -0,0 +1,36 @@
package datastore
import "testing"
func Benchmark_mySerializedEmbeddings(b *testing.B) {
type args struct {
embeddings []float32
}
tests := []struct {
name string
args args
want string
}{
{
name: "Test 1",
args: args{
embeddings: []float32{0.1, 0.2, 0.3},
},
want: "[0.1, 0.2, 0.3]",
},
{
name: "Crazy long test",
args: args{
embeddings: []float32{0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0},
},
want: "[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]",
},
}
for _, tt := range tests {
b.Run(tt.name, func(t *testing.B) {
if got := serializeEmbeddings(tt.args.embeddings); got != tt.want {
t.Errorf("mySerializedEmbeddings() = %v, want %v", got, tt.want)
}
})
}
}