Skip to content

Commit ce89628

Browse files
authored
fix: azure openai config validation fix (#125)
1 parent 2987d80 commit ce89628

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/fast-ways-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hai-build-code-generator": patch
3+
---
4+
5+
Fixing LLM configuration validation

src/api/providers/openai.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class OpenAiHandler implements ApiHandler {
1515
constructor(options: ApiHandlerOptions) {
1616
this.options = options
1717
// Azure API shape slightly differs from the core API shape: https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai
18-
if (this.options.openAiBaseUrl?.toLowerCase().includes("azure.com")) {
18+
if (this.options.openAiBaseUrl?.toLowerCase().includes("azure")) {
1919
this.client = new AzureOpenAI({
2020
endpoint: this.options.openAiBaseUrl,
2121
deployment: this.options.openAiModelId,
@@ -107,7 +107,7 @@ export class OpenAiHandler implements ApiHandler {
107107

108108
async validateAPIKey(): Promise<boolean> {
109109
try {
110-
if (this.options.openAiBaseUrl?.toLowerCase().includes("azure.com") && !this.options.openAiModelId) {
110+
if (this.options.openAiBaseUrl?.toLowerCase().includes("azure") && !this.options.openAiModelId) {
111111
return false
112112
}
113113

0 commit comments

Comments
 (0)