Prepare scene extraction and deterministic normalization in core
This commit is contained in:
@@ -85,15 +85,14 @@ func TestExtractReturnsSemanticallyInvalidResponseForDeterministicValidation(t *
|
||||
func TestExtractValidatesRequestsAndSurfacesProviderFailures(t *testing.T) {
|
||||
request := extractionRequest()
|
||||
extractor := newExtractor(t, &fakeSceneDescriptionsLLMClient{response: extractionResponse{Kind: dnd.SceneKindMeta, Title: "Table talk", Summary: "The group discusses rules."}})
|
||||
var nilExtractor *Extractor
|
||||
var nilExtractor *extractionFixture
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
extractor *Extractor
|
||||
extractor *extractionFixture
|
||||
req contracts.TypedExtractionRequest[dnd.SceneDescriptionList]
|
||||
want string
|
||||
}{
|
||||
{name: "nil extractor", extractor: nilExtractor, req: request, want: "extractor"},
|
||||
{name: "nil LLM client", extractor: &Extractor{}, req: request, want: "native engine"},
|
||||
{name: "wrapped preflight failure", extractor: extractor, req: mismatchedSourceInputRequest(request), want: "must match chunk"},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
@@ -102,8 +101,9 @@ func TestExtractValidatesRequestsAndSurfacesProviderFailures(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
_, err := newExtractor(t, &fakeSceneDescriptionsLLMClient{err: errors.New("provider unavailable")}).Extract(context.Background(), request)
|
||||
if err == nil || !strings.Contains(err.Error(), "dnd scene descriptions") || !strings.Contains(err.Error(), "provider unavailable") {
|
||||
failure := errors.New("provider unavailable")
|
||||
_, err := newExtractor(t, &fakeSceneDescriptionsLLMClient{err: failure}).Extract(context.Background(), request)
|
||||
if !errors.Is(err, failure) {
|
||||
t.Fatalf("provider Extract() error = %v, want contextual provider error", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user