sync: migrate ai-operator to Gitea (2026-08-10)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package embedding
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFakeProviderDeterministic(t *testing.T) {
|
||||
p := NewFakeProvider(1536, "fake")
|
||||
a, err := p.Embed(context.Background(), []string{"hello", "world"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, _ := p.Embed(context.Background(), []string{"hello"})
|
||||
if len(a) != 2 || len(a[0]) != 1536 || len(b[0]) != 1536 {
|
||||
t.Fatalf("bad dims")
|
||||
}
|
||||
if a[0][0] != b[0][0] {
|
||||
t.Fatalf("not deterministic")
|
||||
}
|
||||
if a[0][0] == a[1][0] && a[0][1] == a[1][1] {
|
||||
t.Fatalf("different inputs too similar")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user