Skip to content

Commit

Permalink
feat (provider/azure): update Azure API version to 2024-06-01 (vercel…
Browse files Browse the repository at this point in the history
…#2542)

Co-authored-by: Bhanu Nexus <[email protected]>
  • Loading branch information
lgrammel and BhanuNexus authored Aug 5, 2024
1 parent b3f49a8 commit b99180b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-olives-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ai-sdk/azure': patch
---

feat (provider/azure): update Azure API version to 2024-06-01
2 changes: 1 addition & 1 deletion content/providers/01-ai-sdk-providers/02-azure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ OpenAI language models can also be used in the `streamText`, `generateObject`, `

<Note>
The URL for calling Azure chat models will be constructed as follows:
`https://RESOURCE_NAME.openai.azure.com/openai/deployments/DEPLOYMENT_NAME/chat/completions?api-version=2024-05-01-preview`
`https://RESOURCE_NAME.openai.azure.com/openai/deployments/DEPLOYMENT_NAME/chat/completions?api-version=2024-06-01`
</Note>

Azure OpenAI chat models support also some model specific settings that are not part of the [standard call settings](/docs/ai-sdk-core/settings).
Expand Down
14 changes: 4 additions & 10 deletions packages/azure/src/azure-openai-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ describe('chat', () => {
});

const searchParams = await server.getRequestUrlSearchParams();
expect(searchParams.get('api-version')).toStrictEqual(
'2024-05-01-preview',
);
expect(searchParams.get('api-version')).toStrictEqual('2024-06-01');
});

it('should pass headers', async () => {
Expand Down Expand Up @@ -108,7 +106,7 @@ describe('chat', () => {

const requestUrl = await server.getRequestUrl();
expect(requestUrl).toStrictEqual(
'https://test-resource.openai.azure.com/openai/deployments/test-deployment/chat/completions?api-version=2024-05-01-preview',
'https://test-resource.openai.azure.com/openai/deployments/test-deployment/chat/completions?api-version=2024-06-01',
);
});
});
Expand Down Expand Up @@ -172,9 +170,7 @@ describe('completion', () => {
});

const searchParams = await server.getRequestUrlSearchParams();
expect(searchParams.get('api-version')).toStrictEqual(
'2024-05-01-preview',
);
expect(searchParams.get('api-version')).toStrictEqual('2024-06-01');
});

it('should pass headers', async () => {
Expand Down Expand Up @@ -250,9 +246,7 @@ describe('embedding', () => {
});

const searchParams = await server.getRequestUrlSearchParams();
expect(searchParams.get('api-version')).toStrictEqual(
'2024-05-01-preview',
);
expect(searchParams.get('api-version')).toStrictEqual('2024-06-01');
});

it('should pass headers', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/azure/src/azure-openai-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export function createAzure(

const url = ({ path, modelId }: { path: string; modelId: string }) =>
options.baseURL
? `${options.baseURL}/${modelId}${path}?api-version=2024-05-01-preview`
: `https://${getResourceName()}.openai.azure.com/openai/deployments/${modelId}${path}?api-version=2024-05-01-preview`;
? `${options.baseURL}/${modelId}${path}?api-version=2024-06-01`
: `https://${getResourceName()}.openai.azure.com/openai/deployments/${modelId}${path}?api-version=2024-06-01`;

const createChatModel = (
deploymentName: string,
Expand Down

0 comments on commit b99180b

Please sign in to comment.