feat(qa): support synthesis-wide chat context (#63)
This commit is contained in:
@ -18,7 +18,7 @@ const web60Call = `{"type":"web_search_call","status":"completed","action":{"typ
|
||||
func web60Response(body string, status int) *http.Response {
|
||||
return &http.Response{StatusCode: status, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: io.NopCloser(strings.NewReader(body))}
|
||||
}
|
||||
func TestTicket60ResponsesWebSearchIsMinimalStatelessBoundedAndStructured(t *testing.T) {
|
||||
func TestTicket63ResponsesWebSearchIsFullContextStatelessBoundedAndStructured(t *testing.T) {
|
||||
calls := 0
|
||||
p := newOpenAIWebQA("fixture-key", "gpt-6.1-terra")
|
||||
p.client = &http.Client{Transport: ticket31Transport(func(r *http.Request) (*http.Response, error) {
|
||||
@ -48,19 +48,19 @@ func TestTicket60ResponsesWebSearchIsMinimalStatelessBoundedAndStructured(t *tes
|
||||
t.Fatal("unbounded tools", string(body["tools"]))
|
||||
}
|
||||
text := string(body["input"])
|
||||
for _, expected := range []string{"CURRENT_PASSAGE", "CURRENT_QUESTION", "fr"} {
|
||||
for _, expected := range []string{"FULL_SYNTHESIS", "OLD_HISTORY", "CURRENT_PASSAGE", "CURRENT_QUESTION", "fr"} {
|
||||
if !strings.Contains(text, expected) {
|
||||
t.Fatal("missing minimal context", expected)
|
||||
t.Fatal("missing full context", expected)
|
||||
}
|
||||
}
|
||||
for _, private := range []string{"FULL_SYNTHESIS", "OLD_HISTORY", "PRIVATE_ARTICLE"} {
|
||||
for _, private := range []string{"PRIVATE_ARTICLE", "previous_response_id", "citations", "request_id"} {
|
||||
if strings.Contains(text, private) {
|
||||
t.Fatal("private context leaked", private)
|
||||
}
|
||||
}
|
||||
return web60Response(`{"status":"completed","output":[`+web60Call+`,`+web60Message+`]}`, 200), nil
|
||||
})}
|
||||
req := summaryqa.StatelessRequest{UseWebSearch: true, Summary: "FULL_SYNTHESIS PRIVATE_ARTICLE", History: []summaryqa.Exchange{{Answer: "OLD_HISTORY"}}, Passage: "CURRENT_PASSAGE", Question: "CURRENT_QUESTION", Language: "fr"}
|
||||
req := summaryqa.StatelessRequest{UseWebSearch: true, Summary: "FULL_SYNTHESIS", History: []summaryqa.Exchange{{Answer: "OLD_HISTORY"}}, Passage: "CURRENT_PASSAGE", Question: "CURRENT_QUESTION", Language: "fr"}
|
||||
result, err := p.Answer(context.Background(), req)
|
||||
if err != nil || calls != 1 || !result.WebSearchPerformed || len(result.Citations) != 1 || result.Citations[0] != (summaryqa.Citation{Title: "Source title", URL: "https://example.com/report"}) {
|
||||
t.Fatalf("result=%+v err=%v calls=%d", result, err, calls)
|
||||
|
||||
Reference in New Issue
Block a user