()
| 122 | } |
| 123 | |
| 124 | func main() { |
| 125 | var model string |
| 126 | var showHelp bool |
| 127 | var tools bool |
| 128 | |
| 129 | flag.StringVar(&model, "model", "gpt-5-mini", "OpenAI model to use") |
| 130 | flag.BoolVar(&showHelp, "help", false, "Show usage information") |
| 131 | flag.BoolVar(&tools, "tools", false, "Enable tools for testing") |
| 132 | flag.Parse() |
| 133 | |
| 134 | if showHelp { |
| 135 | printUsage() |
| 136 | os.Exit(0) |
| 137 | } |
| 138 | |
| 139 | apiKey := os.Getenv("OPENAI_APIKEY") |
| 140 | if apiKey == "" { |
| 141 | fmt.Println("Error: OPENAI_APIKEY environment variable not set") |
| 142 | printUsage() |
| 143 | os.Exit(1) |
| 144 | } |
| 145 | |
| 146 | args := flag.Args() |
| 147 | message := "Stream me a limerick about gophers coding in Go." |
| 148 | if len(args) > 0 { |
| 149 | message = args[0] |
| 150 | } |
| 151 | |
| 152 | ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) |
| 153 | defer cancel() |
| 154 | |
| 155 | fmt.Printf("Testing OpenAI Responses API\n") |
| 156 | fmt.Printf("Model: %s\n", model) |
| 157 | fmt.Printf("Message: %s\n", message) |
| 158 | fmt.Println("===") |
| 159 | |
| 160 | if err := makeOpenAIRequest(ctx, apiKey, model, message, tools); err != nil { |
| 161 | fmt.Printf("Error: %v\n", err) |
| 162 | os.Exit(1) |
| 163 | } |
| 164 | } |
nothing calls this directly
no test coverage detected