(t *testing.T, capturedQuestion *string)
| 410 | } |
| 411 | |
| 412 | func advisorToolCapturingQuestion(t *testing.T, capturedQuestion *string) fantasy.AgentTool { |
| 413 | t.Helper() |
| 414 | |
| 415 | runtime, err := chatadvisor.NewRuntime(chatadvisor.RuntimeConfig{ |
| 416 | Model: &chattest.FakeModel{ |
| 417 | ProviderName: "test-provider", |
| 418 | ModelName: "test-model", |
| 419 | StreamFn: func(_ context.Context, call fantasy.Call) (fantasy.StreamResponse, error) { |
| 420 | require.NotEmpty(t, call.Prompt) |
| 421 | *capturedQuestion = singleText(t, call.Prompt[len(call.Prompt)-1]) |
| 422 | return streamFromParts([]fantasy.StreamPart{ |
| 423 | {Type: fantasy.StreamPartTypeTextStart, ID: "text-1"}, |
| 424 | {Type: fantasy.StreamPartTypeTextDelta, ID: "text-1", Delta: "captured advice"}, |
| 425 | {Type: fantasy.StreamPartTypeTextEnd, ID: "text-1"}, |
| 426 | {Type: fantasy.StreamPartTypeFinish, FinishReason: fantasy.FinishReasonStop}, |
| 427 | }), nil |
| 428 | }, |
| 429 | }, |
| 430 | MaxUsesPerRun: 1, |
| 431 | MaxOutputTokens: 64, |
| 432 | }) |
| 433 | require.NoError(t, err) |
| 434 | |
| 435 | return chatadvisor.Tool(chatadvisor.ToolOptions{ |
| 436 | Runtime: runtime, |
| 437 | GetConversationSnapshot: func() []fantasy.Message { return nil }, |
| 438 | }) |
| 439 | } |
| 440 | |
| 441 | func runAdvisorTool( |
| 442 | t *testing.T, |
no test coverage detected