( apiBase: string, config: z.infer<typeof OpenAIConfigSchema>, )
| 29 | dotenv.config(); |
| 30 | |
| 31 | function openAICompatible( |
| 32 | apiBase: string, |
| 33 | config: z.infer<typeof OpenAIConfigSchema>, |
| 34 | ): OpenAIApi { |
| 35 | return new OpenAIApi({ |
| 36 | ...config, |
| 37 | apiBase: config.apiBase ?? apiBase, |
| 38 | }); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Detects if a HuggingFace API URL is using an OpenAI-compatible router |