MCPcopy Index your code
hub / github.com/coder/coder / mustAdvisorRuntime

Function mustAdvisorRuntime

coderd/x/chatd/chatadvisor/tool_test.go:389–410  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

387}
388
389func mustAdvisorRuntime(t *testing.T) *chatadvisor.Runtime {
390 t.Helper()
391
392 runtime, err := chatadvisor.NewRuntime(chatadvisor.RuntimeConfig{
393 Model: &chattest.FakeModel{
394 ProviderName: "test-provider",
395 ModelName: "test-model",
396 StreamFn: func(_ context.Context, _ fantasy.Call) (fantasy.StreamResponse, error) {
397 return streamFromParts([]fantasy.StreamPart{
398 {Type: fantasy.StreamPartTypeTextStart, ID: "text-1"},
399 {Type: fantasy.StreamPartTypeTextDelta, ID: "text-1", Delta: "fallback advice"},
400 {Type: fantasy.StreamPartTypeTextEnd, ID: "text-1"},
401 {Type: fantasy.StreamPartTypeFinish, FinishReason: fantasy.FinishReasonStop},
402 }), nil
403 },
404 },
405 MaxUsesPerRun: 2,
406 MaxOutputTokens: 64,
407 })
408 require.NoError(t, err)
409 return runtime
410}
411
412func advisorToolCapturingQuestion(t *testing.T, capturedQuestion *string) fantasy.AgentTool {
413 t.Helper()

Calls 3

NewRuntimeFunction · 0.92
streamFromPartsFunction · 0.70
HelperMethod · 0.65

Tested by

no test coverage detected