(config: JudgeConfig)
| 65 | } |
| 66 | |
| 67 | function getApiKey(config: JudgeConfig): string { |
| 68 | const value = process.env[config.apiKeyEnvVar]; |
| 69 | if (!value) { |
| 70 | throw new Error(`Missing judge API key in environment variable ${config.apiKeyEnvVar}`); |
| 71 | } |
| 72 | return value; |
| 73 | } |
| 74 | |
| 75 | function extractResponseText(payload: OpenAIChatCompletionResponse): string { |
| 76 | const content = payload.choices?.[0]?.message?.content; |