From ba46e42c3ee6b25e0e3b5cb3377fc95e51e740f0 Mon Sep 17 00:00:00 2001 From: "@k33g" Date: Fri, 29 Nov 2024 08:14:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=9F=20Updated:=20vector=20type=20refac?= =?UTF-8?q?toring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- embeddings/daphnia-store.go | 64 +++++++++---------- examples/25-rag-with-regex/main.go | 4 +- .../create-embeddings/main.go | 2 +- .../32-rag-with-redis/use-embeddings/main.go | 2 +- .../create-embeddings/main.go | 2 +- .../34-rag-with-bbolt/use-embeddings/main.go | 2 +- .../create-embeddings/go.mod | 2 + .../create-embeddings/main.go | 2 +- .../35-rag-with-bbolt/use-embeddings/go.mod | 4 +- .../35-rag-with-bbolt/use-embeddings/go.sum | 5 ++ .../35-rag-with-bbolt/use-embeddings/main.go | 2 +- .../create-embeddings/main.go | 2 +- .../use-embeddings/main.go | 2 +- .../create-embeddings/main.go | 2 +- .../37-rag-with-html/use-embeddings/main.go | 2 +- .../create-embeddings/main.go | 2 +- .../go.mod | 1 + .../go.sum | 2 + go.work.sum | 30 +-------- llm/types.go | 8 +-- 20 files changed, 63 insertions(+), 79 deletions(-) diff --git a/embeddings/daphnia-store.go b/embeddings/daphnia-store.go index 158c0a7..1fca2d5 100644 --- a/embeddings/daphnia-store.go +++ b/embeddings/daphnia-store.go @@ -20,29 +20,29 @@ func (dvs *DaphniaVectoreStore) Initialize(dbPath string) error { } func (dvs *DaphniaVectoreStore) Get(id string) (llm.VectorRecord, error) { - daphniaRecord, err:= dvs.store.Get(id) + daphniaRecord, err := dvs.store.Get(id) if err != nil { return llm.VectorRecord{}, err } vectorRecord := llm.VectorRecord{ - Id: id, + Id: id, Embedding: daphniaRecord.Embedding, - Prompt: daphniaRecord.Prompt, + Prompt: daphniaRecord.Prompt, } return vectorRecord, nil } func (dvs *DaphniaVectoreStore) GetAll() ([]llm.VectorRecord, error) { - daphniaRecords, err:= dvs.store.GetAll() + daphniaRecords, err := dvs.store.GetAll() if err != nil { return nil, err } var vectorRecords []llm.VectorRecord for _, daphniaRecord := range daphniaRecords { vectorRecord := llm.VectorRecord{ - Id: daphniaRecord.Id, + Id: daphniaRecord.Id, Embedding: daphniaRecord.Embedding, - Prompt: daphniaRecord.Prompt, + Prompt: daphniaRecord.Prompt, } vectorRecords = append(vectorRecords, vectorRecord) } @@ -51,10 +51,10 @@ func (dvs *DaphniaVectoreStore) GetAll() ([]llm.VectorRecord, error) { func (dvs *DaphniaVectoreStore) Save(vectorRecord llm.VectorRecord) (llm.VectorRecord, error) { daphniaRecord := daphnia.VectorRecord{ - Id: vectorRecord.Id, + Id: vectorRecord.Id, Embedding: vectorRecord.Embedding, - Prompt: vectorRecord.Prompt, - Metadata: vectorRecord.ComplexMetadata, + Prompt: vectorRecord.Prompt, + Metadata: vectorRecord.Metadata, } daphniaRecord, err := dvs.store.Save(daphniaRecord) if err != nil { @@ -65,22 +65,22 @@ func (dvs *DaphniaVectoreStore) Save(vectorRecord llm.VectorRecord) (llm.VectorR } func (dvs *DaphniaVectoreStore) SearchMaxSimilarity(embeddingFromQuestion llm.VectorRecord) (llm.VectorRecord, error) { - records, err := dvs.SearchTopNSimilarities(embeddingFromQuestion, 1.0, 1) - if err != nil { - return llm.VectorRecord{}, err - } - if len(records) == 0 { - return llm.VectorRecord{}, nil - } - return records[0], nil + records, err := dvs.SearchTopNSimilarities(embeddingFromQuestion, 1.0, 1) + if err != nil { + return llm.VectorRecord{}, err + } + if len(records) == 0 { + return llm.VectorRecord{}, nil + } + return records[0], nil } func (dvs *DaphniaVectoreStore) SearchTopNSimilarities(vectorRecord llm.VectorRecord, threshold float64, topN int) ([]llm.VectorRecord, error) { daphniaRecord := daphnia.VectorRecord{ - Id: vectorRecord.Id, + Id: vectorRecord.Id, Embedding: vectorRecord.Embedding, - Prompt: vectorRecord.Prompt, - Metadata: vectorRecord.ComplexMetadata, + Prompt: vectorRecord.Prompt, + Metadata: vectorRecord.Metadata, } daphniaRecords, err := dvs.store.SearchTopNSimilarities(daphniaRecord, threshold, topN) if err != nil { @@ -89,10 +89,10 @@ func (dvs *DaphniaVectoreStore) SearchTopNSimilarities(vectorRecord llm.VectorRe var vectorRecords []llm.VectorRecord for _, daphniaRecord := range daphniaRecords { vectorRecord := llm.VectorRecord{ - Id: daphniaRecord.Id, - Embedding: daphniaRecord.Embedding, - Prompt: daphniaRecord.Prompt, - ComplexMetadata: daphniaRecord.Metadata, + Id: daphniaRecord.Id, + Embedding: daphniaRecord.Embedding, + Prompt: daphniaRecord.Prompt, + Metadata: daphniaRecord.Metadata, CosineDistance: daphniaRecord.CosineDistance, } vectorRecords = append(vectorRecords, vectorRecord) @@ -102,10 +102,10 @@ func (dvs *DaphniaVectoreStore) SearchTopNSimilarities(vectorRecord llm.VectorRe func (dvs *DaphniaVectoreStore) SearchSimilarities(embeddingFromQuestion llm.VectorRecord, limit float64) ([]llm.VectorRecord, error) { daphniaRecord := daphnia.VectorRecord{ - Id: embeddingFromQuestion.Id, + Id: embeddingFromQuestion.Id, Embedding: embeddingFromQuestion.Embedding, - Prompt: embeddingFromQuestion.Prompt, - Metadata: embeddingFromQuestion.ComplexMetadata, + Prompt: embeddingFromQuestion.Prompt, + Metadata: embeddingFromQuestion.Metadata, } daphniaRecords, err := dvs.store.SearchSimilarities(daphniaRecord, limit) if err != nil { @@ -114,13 +114,13 @@ func (dvs *DaphniaVectoreStore) SearchSimilarities(embeddingFromQuestion llm.Vec var vectorRecords []llm.VectorRecord for _, daphniaRecord := range daphniaRecords { vectorRecord := llm.VectorRecord{ - Id: daphniaRecord.Id, - Embedding: daphniaRecord.Embedding, - Prompt: daphniaRecord.Prompt, - ComplexMetadata: daphniaRecord.Metadata, + Id: daphniaRecord.Id, + Embedding: daphniaRecord.Embedding, + Prompt: daphniaRecord.Prompt, + Metadata: daphniaRecord.Metadata, CosineDistance: daphniaRecord.CosineDistance, } vectorRecords = append(vectorRecords, vectorRecord) } return vectorRecords, nil -} \ No newline at end of file +} diff --git a/examples/25-rag-with-regex/main.go b/examples/25-rag-with-regex/main.go index 75efafa..1a0d653 100644 --- a/examples/25-rag-with-regex/main.go +++ b/examples/25-rag-with-regex/main.go @@ -58,7 +58,7 @@ func createEmbeddingsFromDocument(pathDocument, ollamaUrl, embeddingsModel strin if err != nil { fmt.Println("😡:", err) } else { - embedding.MetaData = "📝 chunk num: " + strconv.Itoa(idx) + embedding.SimpleMetaData = "📝 chunk num: " + strconv.Itoa(idx) store.Save(embedding) } } @@ -86,7 +86,7 @@ func getContentFromSimilarities(userContent, ollamaUrl, embeddingsModel string, for _, similarity := range similarities { // Do something with the similarity - fmt.Println("Similarity:", similarity.MetaData) + fmt.Println("Similarity:", similarity.SimpleMetaData) } fmt.Println("🎉 number of similarities:", len(similarities)) diff --git a/examples/32-rag-with-redis/create-embeddings/main.go b/examples/32-rag-with-redis/create-embeddings/main.go index 5905a66..7d1bcb8 100644 --- a/examples/32-rag-with-redis/create-embeddings/main.go +++ b/examples/32-rag-with-redis/create-embeddings/main.go @@ -44,7 +44,7 @@ func main() { if err != nil { fmt.Println("😡:", err) } else { - embedding.MetaData = "📝 chunk num: " + strconv.Itoa(idx) + embedding.SimpleMetaData = "📝 chunk num: " + strconv.Itoa(idx) redisStore.Save(embedding) } } diff --git a/examples/32-rag-with-redis/use-embeddings/main.go b/examples/32-rag-with-redis/use-embeddings/main.go index 6b433a1..e34aeb5 100644 --- a/examples/32-rag-with-redis/use-embeddings/main.go +++ b/examples/32-rag-with-redis/use-embeddings/main.go @@ -49,7 +49,7 @@ func main() { for _, similarity := range similarities { // Do something with the similarity - fmt.Println("Similarity:", similarity.MetaData) + fmt.Println("Similarity:", similarity.SimpleMetaData) } fmt.Println("🎉 number of similarities:", len(similarities)) diff --git a/examples/34-rag-with-bbolt/create-embeddings/main.go b/examples/34-rag-with-bbolt/create-embeddings/main.go index 74e9403..9f0e3e5 100644 --- a/examples/34-rag-with-bbolt/create-embeddings/main.go +++ b/examples/34-rag-with-bbolt/create-embeddings/main.go @@ -44,7 +44,7 @@ func main() { if err != nil { fmt.Println("😡:", err) } else { - embedding.MetaData = "📝 chunk num: " + strconv.Itoa(idx) + embedding.SimpleMetaData = "📝 chunk num: " + strconv.Itoa(idx) store.Save(embedding) } } diff --git a/examples/34-rag-with-bbolt/use-embeddings/main.go b/examples/34-rag-with-bbolt/use-embeddings/main.go index a76f11b..5dec66c 100644 --- a/examples/34-rag-with-bbolt/use-embeddings/main.go +++ b/examples/34-rag-with-bbolt/use-embeddings/main.go @@ -51,7 +51,7 @@ func main() { for _, similarity := range similarities { // Do something with the similarity - fmt.Println("Similarity:", similarity.MetaData) + fmt.Println("Similarity:", similarity.SimpleMetaData) } fmt.Println("🎉 number of similarities:", len(similarities)) diff --git a/examples/35-rag-with-bbolt/create-embeddings/go.mod b/examples/35-rag-with-bbolt/create-embeddings/go.mod index dfb131c..4842fec 100644 --- a/examples/35-rag-with-bbolt/create-embeddings/go.mod +++ b/examples/35-rag-with-bbolt/create-embeddings/go.mod @@ -20,6 +20,8 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.23.0 // indirect + github.com/sea-monkeys/artemia v0.0.0 // indirect + github.com/sea-monkeys/daphnia v0.0.0 // indirect ) replace github.com/parakeet-nest/parakeet => ../../.. diff --git a/examples/35-rag-with-bbolt/create-embeddings/main.go b/examples/35-rag-with-bbolt/create-embeddings/main.go index 46bc39b..db54688 100644 --- a/examples/35-rag-with-bbolt/create-embeddings/main.go +++ b/examples/35-rag-with-bbolt/create-embeddings/main.go @@ -43,7 +43,7 @@ func main() { if err != nil { fmt.Println("😡:", err) } else { - embedding.MetaData = "📝 chunk num: " + strconv.Itoa(idx) + embedding.SimpleMetaData = "📝 chunk num: " + strconv.Itoa(idx) _, err := store.Save(embedding) if err != nil { fmt.Println("😡:", err) diff --git a/examples/35-rag-with-bbolt/use-embeddings/go.mod b/examples/35-rag-with-bbolt/use-embeddings/go.mod index ac55378..55221f1 100644 --- a/examples/35-rag-with-bbolt/use-embeddings/go.mod +++ b/examples/35-rag-with-bbolt/use-embeddings/go.mod @@ -13,11 +13,13 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-redis/redis/v8 v8.11.5 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/sea-monkeys/artemia v0.0.0 // indirect + github.com/sea-monkeys/daphnia v0.0.2 // indirect go.etcd.io/bbolt v1.3.11 // indirect go.opentelemetry.io/otel v1.24.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.24.0 // indirect ) replace github.com/parakeet-nest/parakeet => ../../.. diff --git a/examples/35-rag-with-bbolt/use-embeddings/go.sum b/examples/35-rag-with-bbolt/use-embeddings/go.sum index 09d3d9c..2b07786 100644 --- a/examples/35-rag-with-bbolt/use-embeddings/go.sum +++ b/examples/35-rag-with-bbolt/use-embeddings/go.sum @@ -27,6 +27,10 @@ github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sea-monkeys/artemia v0.0.0 h1:RyRCq33f5nInnN7xsmqZwTPyihdELo81dO8hvTfdYik= +github.com/sea-monkeys/artemia v0.0.0/go.mod h1:BY5pAPG+YwIn1j7sGMOZJyQLIvKKkIipeXOm/Ok2Mx0= +github.com/sea-monkeys/daphnia v0.0.2 h1:HDxWqEgbJTxVW2fql+dg0Pv6dWOq+1hVqfVUCk0Lb5Q= +github.com/sea-monkeys/daphnia v0.0.2/go.mod h1:bc+z4g+EBvEfMH44lG4nYaWYigZReqltf7vGJyz466c= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= @@ -45,6 +49,7 @@ golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= diff --git a/examples/35-rag-with-bbolt/use-embeddings/main.go b/examples/35-rag-with-bbolt/use-embeddings/main.go index 46e793f..789d0e6 100644 --- a/examples/35-rag-with-bbolt/use-embeddings/main.go +++ b/examples/35-rag-with-bbolt/use-embeddings/main.go @@ -50,7 +50,7 @@ func main() { for _, similarity := range similarities { // Do something with the similarity - fmt.Println("Similarity:", similarity.MetaData) + fmt.Println("Similarity:", similarity.SimpleMetaData) } fmt.Println("🎉 number of similarities:", len(similarities)) diff --git a/examples/36-rag-with-asciidoc/create-embeddings/main.go b/examples/36-rag-with-asciidoc/create-embeddings/main.go index e690654..ee44256 100644 --- a/examples/36-rag-with-asciidoc/create-embeddings/main.go +++ b/examples/36-rag-with-asciidoc/create-embeddings/main.go @@ -42,7 +42,7 @@ func main() { if err != nil { fmt.Println("😡:", err) } else { - embedding.MetaData = "📝 chunk num: " + strconv.Itoa(idx) + embedding.SimpleMetaData = "📝 chunk num: " + strconv.Itoa(idx) store.Save(embedding) } } diff --git a/examples/36-rag-with-asciidoc/use-embeddings/main.go b/examples/36-rag-with-asciidoc/use-embeddings/main.go index a76f11b..5dec66c 100644 --- a/examples/36-rag-with-asciidoc/use-embeddings/main.go +++ b/examples/36-rag-with-asciidoc/use-embeddings/main.go @@ -51,7 +51,7 @@ func main() { for _, similarity := range similarities { // Do something with the similarity - fmt.Println("Similarity:", similarity.MetaData) + fmt.Println("Similarity:", similarity.SimpleMetaData) } fmt.Println("🎉 number of similarities:", len(similarities)) diff --git a/examples/37-rag-with-html/create-embeddings/main.go b/examples/37-rag-with-html/create-embeddings/main.go index fea5f77..9e5dd70 100644 --- a/examples/37-rag-with-html/create-embeddings/main.go +++ b/examples/37-rag-with-html/create-embeddings/main.go @@ -42,7 +42,7 @@ func main() { if err != nil { fmt.Println("😡:", err) } else { - embedding.MetaData = "📝 chunk num: " + strconv.Itoa(idx) + embedding.SimpleMetaData = "📝 chunk num: " + strconv.Itoa(idx) store.Save(embedding) } } diff --git a/examples/37-rag-with-html/use-embeddings/main.go b/examples/37-rag-with-html/use-embeddings/main.go index a76f11b..5dec66c 100644 --- a/examples/37-rag-with-html/use-embeddings/main.go +++ b/examples/37-rag-with-html/use-embeddings/main.go @@ -51,7 +51,7 @@ func main() { for _, similarity := range similarities { // Do something with the similarity - fmt.Println("Similarity:", similarity.MetaData) + fmt.Println("Similarity:", similarity.SimpleMetaData) } fmt.Println("🎉 number of similarities:", len(similarities)) diff --git a/examples/40-rag-with-elastic-markdown/create-embeddings/main.go b/examples/40-rag-with-elastic-markdown/create-embeddings/main.go index 3bb9fb1..0271e77 100644 --- a/examples/40-rag-with-elastic-markdown/create-embeddings/main.go +++ b/examples/40-rag-with-elastic-markdown/create-embeddings/main.go @@ -104,7 +104,7 @@ func main() { // You can add metadata to the embedding // It could be useful for debugging and filtering with Elasticsearch // TODO: see how to use this metadata in the search - embedding.MetaData = "👋 hello from Parakeet 🦜🪺" + embedding.SimpleMetaData = "👋 hello from Parakeet 🦜🪺" _, err := elasticStore.Save(embedding) diff --git a/examples/59-jean-luc-picard-contextual-retrieval/go.mod b/examples/59-jean-luc-picard-contextual-retrieval/go.mod index 22619b9..8a4fc3d 100644 --- a/examples/59-jean-luc-picard-contextual-retrieval/go.mod +++ b/examples/59-jean-luc-picard-contextual-retrieval/go.mod @@ -30,6 +30,7 @@ require ( github.com/muesli/termenv v0.15.2 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sea-monkeys/artemia v0.0.0 // indirect + github.com/sea-monkeys/daphnia v0.0.2 // indirect github.com/yuin/goldmark v1.7.4 // indirect go.etcd.io/bbolt v1.3.11 // indirect go.opentelemetry.io/otel v1.24.0 // indirect diff --git a/examples/59-jean-luc-picard-contextual-retrieval/go.sum b/examples/59-jean-luc-picard-contextual-retrieval/go.sum index d2e2a2a..83b9020 100644 --- a/examples/59-jean-luc-picard-contextual-retrieval/go.sum +++ b/examples/59-jean-luc-picard-contextual-retrieval/go.sum @@ -64,6 +64,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/sea-monkeys/artemia v0.0.0 h1:RyRCq33f5nInnN7xsmqZwTPyihdELo81dO8hvTfdYik= github.com/sea-monkeys/artemia v0.0.0/go.mod h1:BY5pAPG+YwIn1j7sGMOZJyQLIvKKkIipeXOm/Ok2Mx0= +github.com/sea-monkeys/daphnia v0.0.2 h1:HDxWqEgbJTxVW2fql+dg0Pv6dWOq+1hVqfVUCk0Lb5Q= +github.com/sea-monkeys/daphnia v0.0.2/go.mod h1:bc+z4g+EBvEfMH44lG4nYaWYigZReqltf7vGJyz466c= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= diff --git a/go.work.sum b/go.work.sum index 8d70c41..d371d63 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,23 +1,9 @@ github.com/DataDog/gostackparse v0.5.0/go.mod h1:lTfqcJKqS9KnXQGnyQMCugq3u1FP6UZMfWR0aitKFMM= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= github.com/alecthomas/repr v0.1.0/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= -github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= -github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= -github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= -github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY= -github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= -github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= -github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= -github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY= -github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= -github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0= -github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -27,26 +13,13 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78 github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mna/pigeon v1.1.0/go.mod h1:rkFeDZ0gc+YbnrXPw0q2RlI0QRuKBBPu67fgYIyGRNg= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= -github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= -github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= -github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= -github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= +github.com/sea-monkeys/daphnia v0.0.0/go.mod h1:lUFhHgyB5hoAMDTAGkL8IFAHR929lkLsLWH986ltrxU= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -56,7 +29,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8= github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= diff --git a/llm/types.go b/llm/types.go index 501d084..38b4940 100644 --- a/llm/types.go +++ b/llm/types.go @@ -202,10 +202,10 @@ type VectorRecord struct { CosineDistance float64 Score float64 // ElasticSearch - Reference string `json:"reference"` - MetaData string `json:"metaData"` - ComplexMetadata map[string]interface{} `json:"metadata"` // additional metadata - Text string `json:"text"` + Reference string `json:"reference"` + SimpleMetaData string `json:"metaData"` + Metadata map[string]interface{} `json:"metadata"` // additional metadata + Text string `json:"text"` } type Query4Embedding struct {