-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
log, won't return on failure to write db (#165)
- Loading branch information
1 parent
4a5df34
commit 0ea0427
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package postgres | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/uuid" | ||
|
||
"github.com/getzep/zep/pkg/models" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDocumentsFromEmbeddingUpdates(t *testing.T) { | ||
uuid1 := uuid.New() | ||
uuid2 := uuid.New() | ||
|
||
updates := []models.DocEmbeddingUpdate{ | ||
{ | ||
UUID: uuid1, | ||
Embedding: []float32{0.1, 0.2, 0.3}, | ||
}, | ||
{ | ||
UUID: uuid2, | ||
Embedding: []float32{0.4, 0.5, 0.6}, | ||
}, | ||
} | ||
|
||
expectedDocs := []models.Document{ | ||
{ | ||
DocumentBase: models.DocumentBase{ | ||
UUID: uuid1, | ||
IsEmbedded: true, | ||
}, | ||
Embedding: []float32{0.1, 0.2, 0.3}, | ||
}, | ||
{ | ||
DocumentBase: models.DocumentBase{ | ||
UUID: uuid2, | ||
IsEmbedded: true, | ||
}, | ||
Embedding: []float32{0.4, 0.5, 0.6}, | ||
}, | ||
} | ||
|
||
docs := documentsFromEmbeddingUpdates(updates) | ||
|
||
assert.Equal(t, expectedDocs, docs) | ||
} |