@ai-sdk/azure 4.0.87 → 4.0.90

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @ai-sdk/azure
2
2
 
3
+ ## 4.0.90
4
+
5
+ ### Patch Changes
6
+
7
+ - 8952233: feat(azure): support MAI-Voice-2.1 and MAI-Voice-2.1-Flash speech generation, and MAI-Transcribe-2-Streaming streaming transcription through the MAI realtime API. Adds the `maiBaseURL` and `webSocket` settings and `providerOptions.azure.api: 'mai'`. Unknown MAI voices or styles now fail with a descriptive, non-retryable error.
8
+
9
+ ## 4.0.89
10
+
11
+ ### Patch Changes
12
+
13
+ - d08102b: Add test coverage for `resourceName` validation edge cases: labels at the 63-character limit, underscores, non-ASCII characters, and invalid `AZURE_RESOURCE_NAME` values for non-language models.
14
+
15
+ ## 4.0.88
16
+
17
+ ### Patch Changes
18
+
19
+ - 560ac0b: Route `mai-transcribe-1.5` to the Azure Speech API by default, like `mai-transcribe-2`. MAI-Transcribe-1.5 requests no longer send the `segment` timestamps default, which the model rejects.
20
+ - 00f2a59: Add MAI-Voice-2-Flash and MAI-Voice-2 speech generation through `azure.speech()` using Azure Speech text to speech (SSML), with voice, output format, speed, and `style`/`styleDegree` provider options. `language` picks a default voice when no voice is set. Select the API with `providerOptions.azure.api` to override model-based routing, and add `azure.speechModel()` as an alias of `azure.speech()`.
21
+
3
22
  ## 4.0.87
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ResponsesProviderMetadata, ResponsesReasoningProviderMetadata, ResponsesSourceDocumentProviderMetadata, ResponsesTextProviderMetadata, codeInterpreter, fileSearch, imageGeneration, webSearch, webSearchPreview } from "@ai-sdk/openai/internal";
2
2
  import { EmbeddingModelV4, ImageModelV4, LanguageModelV4, ProviderV4, SpeechModelV4, TranscriptionModelV4 } from "@ai-sdk/provider";
3
- import { FetchFunction, InferSchema } from "@ai-sdk/provider-utils";
3
+ import { FetchFunction, InferSchema, WebSocketConstructor } from "@ai-sdk/provider-utils";
4
4
  import { DeepSeekLanguageModelChatOptions } from "@ai-sdk/deepseek";
5
5
  import { OpenAILanguageModelChatOptions, OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, OpenAILanguageModelResponsesOptions, OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, OpenAIResponsesSystemMessageOptions } from "@ai-sdk/openai";
6
6
  //#region src/azure-openai-tools.d.ts
@@ -60,8 +60,9 @@ interface AzureOpenAIProvider extends ProviderV4 {
60
60
  */
61
61
  imageModel(deploymentId: string): ImageModelV4;
62
62
  /**
63
- * Creates an Azure transcription model. MAI-Transcribe-2 uses the Speech API
64
- * by default; other IDs use OpenAI. Override with providerOptions.azure.api.
63
+ * Creates an Azure transcription model. MAI-Transcribe models use the Speech
64
+ * API and MAI-Transcribe-2-Streaming the MAI realtime API by default; other
65
+ * IDs use OpenAI. Override with providerOptions.azure.api.
65
66
  */
66
67
  transcription(deploymentId: string): TranscriptionModelV4;
67
68
  /**
@@ -69,9 +70,14 @@ interface AzureOpenAIProvider extends ProviderV4 {
69
70
  */
70
71
  transcriptionModel(deploymentId: string): TranscriptionModelV4;
71
72
  /**
72
- * Creates an Azure OpenAI model for speech generation.
73
+ * Creates an Azure speech generation model. MAI-Voice models use the Speech
74
+ * API by default; other IDs use OpenAI. Override with providerOptions.azure.api.
73
75
  */
74
76
  speech(deploymentId: string): SpeechModelV4;
77
+ /**
78
+ * Creates an Azure speech generation model. Alias of `speech`.
79
+ */
80
+ speechModel(deploymentId: string): SpeechModelV4;
75
81
  /**
76
82
  * AzureOpenAI-specific tools.
77
83
  */
@@ -125,12 +131,25 @@ interface AzureOpenAIProviderSettings {
125
131
  */
126
132
  useDeploymentBasedUrls?: boolean;
127
133
  /**
128
- * URL prefix for Azure Speech transcription (MAI-Transcribe-2), e.g. a
129
- * regional endpoint like `https://eastus.api.cognitive.microsoft.com`.
134
+ * URL prefix for Azure Speech (MAI-Transcribe transcription and MAI-Voice
135
+ * speech), e.g. a regional endpoint like
136
+ * `https://eastus.api.cognitive.microsoft.com`.
130
137
  * Defaults to `https://{resourceName}.cognitiveservices.azure.com`.
131
138
  * Speech requests do not use `baseURL` or `apiVersion`.
132
139
  */
133
140
  speechBaseURL?: string;
141
+ /**
142
+ * URL prefix for MAI realtime APIs (MAI-Transcribe-2-Streaming).
143
+ * Defaults to `https://{resourceName}.services.ai.azure.com/mai/v1`.
144
+ */
145
+ maiBaseURL?: string;
146
+ /**
147
+ * Custom WebSocket implementation for MAI streaming transcription, e.g.
148
+ * `ws` in Node.js. With a custom implementation the API key is sent as a
149
+ * header; otherwise it is sent as the `api-key` query parameter. Entra ID
150
+ * tokens require a custom implementation; streaming rejects them otherwise.
151
+ */
152
+ webSocket?: WebSocketConstructor;
134
153
  }
135
154
  /**
136
155
  * Create an Azure OpenAI provider instance.
@@ -158,8 +177,17 @@ type AzureResponsesSourceDocumentProviderMetadata = {
158
177
  //#region src/version.d.ts
159
178
  export declare const VERSION: string;
160
179
  //#endregion
180
+ //#region src/azure-speech-model-options.d.ts
181
+ declare const azureSpeechModelOptions: import("@ai-sdk/provider-utils").LazySchema<{
182
+ style?: string | undefined;
183
+ styleDegree?: number | undefined;
184
+ api?: "openai" | "speech" | undefined;
185
+ }>;
186
+ type AzureSpeechModelOptions = InferSchema<typeof azureSpeechModelOptions>;
187
+ //#endregion
161
188
  //#region src/azure-transcription-model-options.d.ts
162
189
  declare const azureTranscriptionModelOptions: import("@ai-sdk/provider-utils").LazySchema<{
190
+ language?: string | undefined;
163
191
  timestamps?: "word" | "segment" | "none" | undefined;
164
192
  transcribeStyle?: "verbatim" | "clean" | undefined;
165
193
  locales?: string[] | undefined;
@@ -169,7 +197,7 @@ declare const azureTranscriptionModelOptions: import("@ai-sdk/provider-utils").L
169
197
  phraseList?: {
170
198
  phrases: string[];
171
199
  } | undefined;
172
- api?: "openai" | "speech" | undefined;
200
+ api?: "openai" | "speech" | "mai" | undefined;
173
201
  }>;
174
202
  type AzureTranscriptionModelOptions = InferSchema<typeof azureTranscriptionModelOptions>;
175
203
  //#endregion
@@ -197,5 +225,5 @@ export type AzureDeepSeekLanguageModelOptions = Omit<DeepSeekLanguageModelChatOp
197
225
  /** @deprecated Use `AzureDeepSeekLanguageModelOptions` instead. */
198
226
  export type AzureDeepSeekChatOptions = AzureDeepSeekLanguageModelOptions;
199
227
  //#endregion
200
- export type { AzureOpenAIProvider, AzureOpenAIProviderSettings, AzureResponsesProviderMetadata, AzureResponsesReasoningProviderMetadata, AzureResponsesSourceDocumentProviderMetadata, AzureResponsesTextProviderMetadata, AzureTranscriptionModelOptions, AzureTranscriptionProviderMetadata, OpenAIChatLanguageModelOptions, OpenAILanguageModelChatOptions, OpenAILanguageModelResponsesOptions, OpenAIResponsesProviderOptions, OpenAIResponsesSystemMessageOptions };
228
+ export type { AzureOpenAIProvider, AzureOpenAIProviderSettings, AzureResponsesProviderMetadata, AzureResponsesReasoningProviderMetadata, AzureResponsesSourceDocumentProviderMetadata, AzureResponsesTextProviderMetadata, AzureSpeechModelOptions, AzureTranscriptionModelOptions, AzureTranscriptionProviderMetadata, OpenAIChatLanguageModelOptions, OpenAILanguageModelChatOptions, OpenAILanguageModelResponsesOptions, OpenAIResponsesProviderOptions, OpenAIResponsesSystemMessageOptions };
201
229
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/azure-openai-tools.ts","../src/azure-openai-provider.ts","../src/azure-openai-provider-metadata.ts","../src/version.ts","../src/azure-transcription-model-options.ts","../src/azure-transcription-provider-metadata.ts","../src/index.ts"],"mappings":";;;;;;cAQa;EACX,wBAAwB;EACxB,mBAAmB;EACnB,wBAAwB;EACxB,kBAAkB;EAClB,yBAAyB;;;;UC4BV,4BAA4B;GAC1C,uBAAuB;;;;EAKxB,cAAc,uBAAuB;;;;EAKrC,KAAK,uBAAuB;;;;EAK5B,SAAS,uBAAuB;;;;EAKhC,UAAU,uBAAuB;;;;EAKjC,WAAW,uBAAuB;;;;EAKlC,UAAU,uBAAuB;;;;EAKjC,eAAe,uBAAuB;;;;EAKtC,cAAc,uBAAuB;;;;EAKrC,mBAAmB,uBAAuB;;;;EAK1C,MAAM,uBAAuB;;;;EAK7B,WAAW,uBAAuB;;;;;EAMlC,cAAc,uBAAuB;;;;EAKrC,mBAAmB,uBAAuB;;;;EAK1C,OAAO,uBAAuB;;;;EAK9B,cAAc;;UAGC;;;;;;;EAOf;;;;;;;;;EAUA;;;;EAKA;;;;;;EAOA,uBAAuB;;;;EAKvB,UAAU;;;;;EAMV,QAAQ;;;;;EAMR;;;;;;EAOA;;;;;;;EAQA;;;;;wBAgCc,YACd,UAAS,8BACR;;;;qBAiOU,OAAK;;;KClbN;EACV,OAAO;;KAGG;EACV,OAAO;;KAGG;EACV,OAAO;;KAGG;EACV,OAAO;;;;qBClBI;;;cCMA,iEAA8B;;;;;;;;;;;;KAY/B,iCAAiC,mBACpC;;;KCrBG;EACV;IACE,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA,QAAQ;QACN;QACA;QACA;;;;;;;YCVI,oCAAoC,KAC9C;;YAIU,2BAA2B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/azure-openai-tools.ts","../src/azure-openai-provider.ts","../src/azure-openai-provider-metadata.ts","../src/version.ts","../src/azure-speech-model-options.ts","../src/azure-transcription-model-options.ts","../src/azure-transcription-provider-metadata.ts","../src/index.ts"],"mappings":";;;;;;cAQa;EACX,wBAAwB;EACxB,mBAAmB;EACnB,wBAAwB;EACxB,kBAAkB;EAClB,yBAAyB;;;;UCqCV,4BAA4B;GAC1C,uBAAuB;;;;EAKxB,cAAc,uBAAuB;;;;EAKrC,KAAK,uBAAuB;;;;EAK5B,SAAS,uBAAuB;;;;EAKhC,UAAU,uBAAuB;;;;EAKjC,WAAW,uBAAuB;;;;EAKlC,UAAU,uBAAuB;;;;EAKjC,eAAe,uBAAuB;;;;EAKtC,cAAc,uBAAuB;;;;EAKrC,mBAAmB,uBAAuB;;;;EAK1C,MAAM,uBAAuB;;;;EAK7B,WAAW,uBAAuB;;;;;;EAOlC,cAAc,uBAAuB;;;;EAKrC,mBAAmB,uBAAuB;;;;;EAM1C,OAAO,uBAAuB;;;;EAK9B,YAAY,uBAAuB;;;;EAKnC,cAAc;;UAGC;;;;;;;EAOf;;;;;;;;;EAUA;;;;EAKA;;;;;;EAOA,uBAAuB;;;;EAKvB,UAAU;;;;;EAMV,QAAQ;;;;;EAMR;;;;;;EAOA;;;;;;;;EASA;;;;;EAMA;;;;;;;EAQA,YAAY;;;;;wBAgCE,YACd,UAAS,8BACR;;;;qBAgQU,OAAK;;;KChfN;EACV,OAAO;;KAGG;EACV,OAAO;;KAGG;EACV,OAAO;;KAGG;EACV,OAAO;;;;qBClBI;;;cCMA,0DAAuB;;;;;KAYxB,0BAA0B,mBAC7B;;;cCZI,iEAA8B;;;;;;;;;;;;;KAc/B,iCAAiC,mBACpC;;;KCxBG;EACV;IACE,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA,QAAQ;QACN;QACA;QACA;;;;;;;YCVI,oCAAoC,KAC9C;;YAIU,2BAA2B"}