feat (provider/azure): add OpenAI responses API support#5461
feat (provider/azure): add OpenAI responses API support#5461lgrammel merged 9 commits intovercel:mainfrom
Conversation
|
@AVtheking have you tested this end-to-end with an Azure setup? |
|
no actually I don't have subscription at azure 😞 , Let me see If I can make some arrangements |
|
Hi @lgrammel I have tested now with azure setup and it is working fine , also added an example for the responses api. PTAL |
|
@lgrammel could you please take a look and let me know any changes required whenever you are free. |
|
How would this integrate with the tools provided within the |
|
Yeah I want to discuss that thing (but don't know how and where I could discuss this with maintainers) , one way could be directly importing the tools from the open ai module to this |
|
@lgrammel Is this already in the works, or planned, by maintainers? Personally, I would rather be able to use the openai provider directly by configuring it for AzureOpenAI. Similarly as I'd do it when using the the OpenAI package directly. IE: import { AzureOpenAI } from "openai";
const deployment = "deployment name";
const apiVersion = "2024-10-21";
const client = new AzureOpenAI({ azureADTokenProvider, deployment, apiVersion });When using Azure OpenAI Services, it would be fantastic to simply create the OpenAI provider with some additional configurations: import { createAzureOpenAI } from '@ai-sdk/openai';
const deployment = "deployment name";
const apiVersion = "2024-10-21";
const openai = createAzureOpenAI({
azureADTokenProvider,
deployment,
apiVersion
});Perhaps that would be easier to work with in the long run? |
|
@AVtheking looks pretty good, docs would need updating. Can you add the responses api section from the openai provider docs page to the azure provider docs page (and tweak if necessary)? |
|
@lgrammel I have updated the doc , PTAL, thanks. |
|
Seeing test & type check errors. |
|
Fixed those |
|
Can you also add tests to |
| model: azure.responses('your-deployment-name'), | ||
| prompt: 'What happened in San Francisco last week?', | ||
| tools: { | ||
| web_search_preview: azure.tools.webSearchPreview({ |
There was a problem hiding this comment.
The provided docs example will result in a null pointer, as the azure provider object does not export a tool property.
const azure = createAzure({
resourceName: AZURE_OAI_RESOURCE,
apiKey: AZURE_OAI_KEY
})
const model = azure.responses('insert-deployment-here')
const result = await generateText({
model,
prompt: input,
tools: {
web_search_preview: azure.tools.webSearchPreview({
searchContextSize: 'high',
userLocation: {
type: 'approximate',
city: 'San Francisco',
region: 'California',
},
})
}
})
Results in: TypeError: Cannot read properties of undefined (reading 'webSearchPreview')
@AVtheking can you judge whether my usage example is correct? If yes, I suppose this is an issue with the provider.
There was a problem hiding this comment.
yes you are correct, it doesn't exports tool now.
There was a problem hiding this comment.
Thanks for your response! Do you know any workaround to still enable such tools while using the azure provider?
There was a problem hiding this comment.
I would raise a PR for this to fix this, if I still has azure creds, or you can do it buddy, I can also help you
There was a problem hiding this comment.
havent tested it yet, but I think its resolved 😄 #8238
Fixes #5346 & #5454