feat(ml): fuse two embedding models and protect the ML service with a token
This commit is contained in:
1 parent
bc00d6901f
commit
b24e5ff906
63 files changed
+2287
-276
No files matched your search
@@ -17,6 +17,7 @@ type extenderFake struct {
|
||||
err error
|
||||
author domain.PolicyAuthor
|
||||
semantic bool
|
||||
ensemble bool
|
||||
}
|
||||
|
||||
func (extender *extenderFake) EnsureDemoMatchingSection(_ context.Context, author domain.PolicyAuthor) (policy.MatchingResult, error) {
|
||||
@@ -30,6 +31,12 @@ func (extender *extenderFake) EnsureDemoSemanticMatchingSection(_ context.Contex
|
||||
return extender.result, extender.err
|
||||
}
|
||||
|
||||
func (extender *extenderFake) EnsureDemoSemanticEnsembleSection(_ context.Context, author domain.PolicyAuthor) (policy.MatchingResult, error) {
|
||||
extender.author = author
|
||||
extender.ensemble = true
|
||||
return extender.result, extender.err
|
||||
}
|
||||
|
||||
func TestParseRequiresTheMatchingTrackAndAnOperatorHandle(t *testing.T) {
|
||||
command, err := Parse([]string{"matching", "--actor", "operator:night"})
|
||||
if err != nil || command.Author != "operator:night" || command.Track != TrackMatching {
|
||||
@@ -39,6 +46,10 @@ func TestParseRequiresTheMatchingTrackAndAnOperatorHandle(t *testing.T) {
|
||||
if err != nil || semantic.Track != TrackSemantic {
|
||||
t.Fatalf("Parse(semantic) = %+v, %v", semantic, err)
|
||||
}
|
||||
ensemble, err := Parse([]string{"semantic-ensemble", "--actor", "operator:night"})
|
||||
if err != nil || ensemble.Track != TrackSemanticEnsemble {
|
||||
t.Fatalf("Parse(semantic-ensemble) = %+v, %v", ensemble, err)
|
||||
}
|
||||
for _, args := range [][]string{
|
||||
nil, {"list"}, {"matching"}, {"matching", "--actor", "alice"}, {"matching", "--actor", "system:demo-seed"},
|
||||
{"matching", "--actor", "operator:night", "extra"},
|
||||
@@ -84,3 +95,14 @@ func TestExecuteSemanticTrackPublishesTheSemanticSection(t *testing.T) {
|
||||
t.Fatalf("output = %q, semantic called %v", output.String(), extender.semantic)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecuteSemanticEnsembleTrackPublishesTheEnsembleSection(t *testing.T) {
|
||||
var output bytes.Buffer
|
||||
extender := &extenderFake{}
|
||||
if err := Execute(context.Background(), Command{Track: TrackSemanticEnsemble, Author: "operator:night"}, extender, &output); err != nil {
|
||||
t.Fatalf("Execute() error = %v", err)
|
||||
}
|
||||
if !extender.ensemble || extender.semantic || !strings.Contains(output.String(), "semantic ensemble section") {
|
||||
t.Fatalf("output = %q, ensemble called %v", output.String(), extender.ensemble)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user