A MoA participant must be able to ground its answer in the attached knowledge bases, exactly like a chat turn: the fake asks for a search on round one and only answers once the passages are folded back in.
(t *testing.T)
| 297 | // knowledge bases, exactly like a chat turn: the fake asks for a search on |
| 298 | // round one and only answers once the passages are folded back in. |
| 299 | func TestMoaTurn_NativeKnowledgeLoop(t *testing.T) { |
| 300 | t.Setenv(chatKnowledgeEnvVar, "true") |
| 301 | cli := newKnowledgeTestCLI(t) |
| 302 | plugins.SetKnowledgeAdapter(&knowledgePluginAdapter{cli: cli}) |
| 303 | t.Cleanup(func() { plugins.SetKnowledgeAdapter(nil) }) |
| 304 | |
| 305 | fc := &knowledgeToolFake{} |
| 306 | cli.Provider, cli.Model, cli.Client = "fake", "m", fc |
| 307 | |
| 308 | ts := cli.moaToolsetForRun(nil) |
| 309 | if !ts.knowledge { |
| 310 | t.Fatal("an attached knowledge base must grant the knowledge tool") |
| 311 | } |
| 312 | turn := cli.moaTurn(ts) |
| 313 | out, err := turn(context.Background(), moa.Ref{Provider: "fake", Model: "m"}, "como instalo?", nil) |
| 314 | if err != nil { |
| 315 | t.Fatal(err) |
| 316 | } |
| 317 | if out != "final grounded answer" { |
| 318 | t.Fatalf("out = %q", out) |
| 319 | } |
| 320 | if fc.calls != 2 { |
| 321 | t.Fatalf("expected decision + follow-up calls, got %d", fc.calls) |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | // moaRecallXMLFake drives the XML transport: the instruction must be pinned, |
| 326 | // the call is answered with the full marker form, then prose. |
nothing calls this directly
no test coverage detected