()
| 9 | ) |
| 10 | |
| 11 | func ExampleVerify() { |
| 12 | generate := func(_ context.Context, in flow.State) (flow.State, error) { |
| 13 | if strings.Contains(in.String(), "feedback") { |
| 14 | in.Data = []byte(`{"answer":"include a source"}`) |
| 15 | return in, nil |
| 16 | } |
| 17 | in.Data = []byte(`{"answer":"draft"}`) |
| 18 | return in, nil |
| 19 | } |
| 20 | grader := func(_ context.Context, out flow.State) (bool, string, error) { |
| 21 | return strings.Contains(out.String(), "source"), "add a source", nil |
| 22 | } |
| 23 | |
| 24 | out, _ := flow.Verify(generate, grader, flow.VerifyMaxAttempts(2))(context.Background(), flow.State{}) |
| 25 | fmt.Println(strings.Contains(out.String(), `"verification_passed":true`)) |
| 26 | // Output: true |
| 27 | } |
| 28 | |
| 29 | func ExampleAnalyze() { |
| 30 | runs := []flow.Run{{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…