MCPcopy
hub / github.com/wavetermdev/waveterm / main

Function main

cmd/testai/main-testai.go:465–548  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

463}
464
465func main() {
466 var anthropic, openaicomp, openrouter, nanogpt, gemini, tools, help, t1, t2, t3, t4 bool
467 var model string
468 flag.BoolVar(&anthropic, "anthropic", false, "Use Anthropic API instead of OpenAI")
469 flag.BoolVar(&openaicomp, "openaicomp", false, "Use OpenAI Completions API")
470 flag.BoolVar(&openrouter, "openrouter", false, "Use OpenRouter API")
471 flag.BoolVar(&nanogpt, "nanogpt", false, "Use NanoGPT API")
472 flag.BoolVar(&gemini, "gemini", false, "Use Google Gemini API")
473 flag.BoolVar(&tools, "tools", false, "Enable GitHub Actions Monitor tools for testing")
474 flag.StringVar(&model, "model", "", fmt.Sprintf("AI model to use (defaults: %s for OpenAI, %s for Anthropic, %s for OpenRouter, %s for NanoGPT, %s for Gemini)", DefaultOpenAIModel, DefaultAnthropicModel, DefaultOpenRouterModel, DefaultNanoGPTModel, DefaultGeminiModel))
475 flag.BoolVar(&help, "help", false, "Show usage information")
476 flag.BoolVar(&t1, "t1", false, fmt.Sprintf("Run preset T1 test (%s with 'what is 2+2')", DefaultAnthropicModel))
477 flag.BoolVar(&t2, "t2", false, fmt.Sprintf("Run preset T2 test (%s with 'what is 2+2')", DefaultOpenAIModel))
478 flag.BoolVar(&t3, "t3", false, "Run preset T3 test (OpenAI Completions API with gpt-5.1)")
479 flag.BoolVar(&t4, "t4", false, "Run preset T4 test (OpenAI Completions API with gemini-3-pro-preview)")
480 flag.Parse()
481
482 if help {
483 printUsage()
484 os.Exit(0)
485 }
486
487 ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
488 defer cancel()
489
490 if t1 {
491 testT1(ctx)
492 return
493 }
494 if t2 {
495 testT2(ctx)
496 return
497 }
498 if t3 {
499 testT3(ctx)
500 return
501 }
502 if t4 {
503 testT4(ctx)
504 return
505 }
506
507 // Set default model based on API type if not provided
508 if model == "" {
509 if anthropic {
510 model = DefaultAnthropicModel
511 } else if openaicomp {
512 model = "gpt-4o"
513 } else if openrouter {
514 model = DefaultOpenRouterModel
515 } else if nanogpt {
516 model = DefaultNanoGPTModel
517 } else if gemini {
518 model = DefaultGeminiModel
519 } else {
520 model = DefaultOpenAIModel
521 }
522 }

Callers

nothing calls this directly

Calls 13

testT1Function · 0.85
testT2Function · 0.85
testT3Function · 0.85
testT4Function · 0.85
getToolDefinitionsFunction · 0.85
testAnthropicFunction · 0.85
testOpenAICompFunction · 0.85
testOpenRouterFunction · 0.85
testNanoGPTFunction · 0.85
testGeminiFunction · 0.85
testOpenAIFunction · 0.85
ParseMethod · 0.80

Tested by

no test coverage detected