Skip to content

Commit 55c947d

Browse files
committed
feat: add native support for Azure OpenAI embeddings
1 parent e7fbcc1 commit 55c947d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/embedder.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,14 @@ export class Embedder {
302302
this._autoChunk = config.chunking !== false;
303303

304304
// Create a client pool — one OpenAI client per key
305+
const isAzure = config.baseURL?.includes('.openai.azure.com');
305306
this.clients = resolvedKeys.map(key => new OpenAI({
306307
apiKey: key,
307308
...(config.baseURL ? { baseURL: config.baseURL } : {}),
309+
...(isAzure ? {
310+
defaultHeaders: { 'api-key': key },
311+
defaultQuery: { 'api-version': '2024-02-01' }
312+
} : {})
308313
}));
309314

310315
if (this.clients.length > 1) {

0 commit comments

Comments
 (0)