feat(qa): support synthesis-wide chat context (#63)
This commit is contained in:
@ -3,7 +3,7 @@ package summaryqa
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -18,13 +18,13 @@ func (p *web60ServiceProvider) Answer(_ context.Context, r StatelessRequest) (An
|
||||
return p.result, nil
|
||||
}
|
||||
|
||||
func TestTicket60ServiceProjectsMinimalWebContextAndNormalizesCitations(t *testing.T) {
|
||||
func TestTicket63ServicePreservesFullWebContextAndNormalizesCitations(t *testing.T) {
|
||||
p := &web60ServiceProvider{result: AnswerResult{Answer: "answer", WebSearchPerformed: true, Citations: []Citation{{Title: " source ", URL: "https://EXAMPLE.COM:443/"}, {Title: "duplicate", URL: "https://example.com/"}}}}
|
||||
r := &fixtureRepo{work: Work{Summary: strings.Repeat("PRIVATE_SUMMARY", MaxContextBytes), History: []Exchange{{Answer: strings.Repeat("PRIVATE_HISTORY", MaxContextBytes)}}, Language: "fr", Turn: Turn{ID: "turn"}}}
|
||||
r := &fixtureRepo{work: Work{Summary: "FULL_SYNTHESIS", History: []Exchange{{Answer: "PREVIOUS_ANSWER"}}, Language: "fr", Turn: Turn{ID: "turn"}}}
|
||||
s := New(r, &fixtureResolver{p: p})
|
||||
_, err := s.Ask(context.Background(), "owner", "summary", Question{RequestID: "00000000-0000-0000-0000-000000006001", Passage: "p", Question: "q", UseWebSearch: true})
|
||||
if err != nil || len(p.requests) != 1 || p.requests[0].Summary != "" || len(p.requests[0].History) != 0 || !p.requests[0].UseWebSearch || r.finishes != 1 || len(r.result.Citations) != 1 {
|
||||
t.Fatalf("non-minimal request or invalid result: %v %+v", err, p.requests)
|
||||
if err != nil || len(p.requests) != 1 || p.requests[0].Summary != r.work.Summary || !reflect.DeepEqual(p.requests[0].History, r.work.History) || !p.requests[0].UseWebSearch || r.finishes != 1 || len(r.result.Citations) != 1 {
|
||||
t.Fatalf("incomplete context or invalid result: %v %+v", err, p.requests)
|
||||
}
|
||||
}
|
||||
func TestTicket60UnsupportedSearchNeverAcquiresQuotaAndReplaysSameFailure(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user