22 lines
655 B
Go
22 lines
655 B
Go
package workbench
|
|||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestStructuredGenerationRequestsProviderJSONMode(t *testing.T) {
|
||
|
|
s, ctx, _, model := generationHarness(t)
|
||
|
|
model.output = `{"days":[]}`
|
||
|
|
if _, err := s.completeJSON(ctx, "agent", "Return JSON", "course plan"); err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
if string(model.options.Format) != `{"type":"object"}` {
|
||
|
|
t.Fatal("structured operation omitted provider JSON mode")
|
||
|
|
}
|
||
|
|
model.output = "Accepted manuscript"
|
||
|
|
if _, err := s.complete(ctx, "agent", "Return prose", "content"); err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
if len(model.options.Format) != 0 {
|
||
|
|
t.Fatal("manuscript generation must retain its prose output format")
|
||
|
|
}
|
||
|
|
}
|