@core-ai/azure-openai 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@core-ai/azure-openai.svg)](https://www.npmjs.com/package/@core-ai/azure-openai)
4
4
 
5
- Azure OpenAI provider package for `@core-ai/core-ai`. It uses the Azure OpenAI v1 Chat Completions API by default and can opt into the classic API.
5
+ Azure OpenAI provider package for `@core-ai/core-ai`. Azure v1 uses the
6
+ Responses API by default and also exposes strict Chat Completions.
6
7
 
7
8
  ## Installation
8
9
 
@@ -32,6 +33,12 @@ const result = await generate({
32
33
  console.log(result.content);
33
34
  ```
34
35
 
36
+ Use Chat Completions explicitly when needed:
37
+
38
+ ```ts
39
+ const model = azure.chat.chatModel('gpt-5-mini-deployment');
40
+ ```
41
+
35
42
  ## Authentication
36
43
 
37
44
  Use an Azure OpenAI API key with the v1 API:
@@ -58,10 +65,12 @@ Classic mode also accepts an Entra ID token provider via `azureADTokenProvider`.
58
65
 
59
66
  ## Model IDs
60
67
 
61
- Pass your Azure OpenAI deployment name to `chatModel()`. The provider sends it as the Chat Completions `model` field.
68
+ Pass your Azure OpenAI deployment name to either model factory.
62
69
 
63
70
  ```ts
64
71
  const model = azure.chatModel('customer-support-gpt-5-mini');
65
72
  ```
66
73
 
67
- This package supports chat models only. Use `@core-ai/openai` for OpenAI Responses API, embeddings, and image generation.
74
+ Classic mode supports Chat Completions only, so its root `chatModel()` and
75
+ `chat.chatModel()` methods are equivalent. This package does not expose
76
+ embeddings or image generation.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
+ import OpenAI from 'openai';
1
2
  import { ChatModel } from '@core-ai/core-ai';
2
- import { OpenAIChatClient } from '@core-ai/openai/compat';
3
+ import { OpenAIChatClient } from '@core-ai/openai';
3
4
 
4
5
  type AzureOpenAIV1Options = {
5
6
  api?: 'v1';
6
7
  apiKey?: string;
7
8
  endpoint?: string;
8
- client?: OpenAIChatClient;
9
+ client?: OpenAI;
9
10
  };
10
11
  type AzureOpenAIClassicOptions = {
11
12
  api: 'classic';
@@ -19,6 +20,9 @@ type AzureOpenAIClassicOptions = {
19
20
  type AzureOpenAIProviderOptions = AzureOpenAIV1Options | AzureOpenAIClassicOptions;
20
21
  type AzureOpenAIProvider = {
21
22
  chatModel(modelId: string): ChatModel;
23
+ chat: {
24
+ chatModel(modelId: string): ChatModel;
25
+ };
22
26
  };
23
27
  declare function createAzureOpenAI(options?: AzureOpenAIProviderOptions): AzureOpenAIProvider;
24
28
 
package/dist/index.js CHANGED
@@ -1,27 +1,43 @@
1
1
  // src/provider.ts
2
2
  import OpenAI, { AzureOpenAI } from "openai";
3
3
  import {
4
- createOpenAICompatChatProvider
5
- } from "@core-ai/openai/compat";
4
+ createOpenAIChatCompletionsModel,
5
+ createOpenAIProvider
6
+ } from "@core-ai/openai";
6
7
  var PROVIDER_ID = "azure-openai";
7
8
  function createAzureOpenAI(options = {}) {
8
- const client = options.client ?? createAzureOpenAIClient(options);
9
- return createOpenAICompatChatProvider({ client }, PROVIDER_ID);
10
- }
11
- function createAzureOpenAIClient(options) {
12
9
  if (options.api === "classic") {
13
- return new AzureOpenAI({
10
+ const client2 = options.client ?? new AzureOpenAI({
14
11
  apiKey: options.apiKey,
15
12
  endpoint: options.endpoint,
16
13
  apiVersion: options.apiVersion,
17
14
  deployment: options.deployment,
18
15
  azureADTokenProvider: options.azureADTokenProvider
19
16
  });
17
+ const chat = {
18
+ chatModel: (modelId) => createOpenAIChatCompletionsModel(client2, modelId, {
19
+ providerId: PROVIDER_ID
20
+ })
21
+ };
22
+ return {
23
+ chatModel: chat.chatModel,
24
+ chat
25
+ };
20
26
  }
21
- return new OpenAI({
27
+ const client = options.client ?? new OpenAI({
22
28
  apiKey: options.apiKey,
23
29
  baseURL: getAzureOpenAIV1BaseURL(options.endpoint)
24
30
  });
31
+ const provider = createOpenAIProvider(
32
+ { client },
33
+ {
34
+ providerId: PROVIDER_ID
35
+ }
36
+ );
37
+ return {
38
+ chatModel: provider.chatModel,
39
+ chat: provider.chat
40
+ };
25
41
  }
26
42
  function getAzureOpenAIV1BaseURL(endpoint) {
27
43
  if (!endpoint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core-ai/azure-openai",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Azure OpenAI provider package for @core-ai/core-ai",
5
5
  "license": "MIT",
6
6
  "author": "Omnifact (https://omnifact.ai)",
@@ -46,8 +46,8 @@
46
46
  "test:watch": "vitest"
47
47
  },
48
48
  "dependencies": {
49
- "@core-ai/core-ai": "^0.14.0",
50
- "@core-ai/openai": "^0.14.0",
49
+ "@core-ai/core-ai": "^0.16.0",
50
+ "@core-ai/openai": "^0.16.0",
51
51
  "openai": "^6.46.0"
52
52
  },
53
53
  "peerDependencies": {