fix(opencode): @ai-sdk/azure - Set default to Responses instead of Completion API#9036
fix(opencode): @ai-sdk/azure - Set default to Responses instead of Completion API#9036OmarMcAdam wants to merge 1 commit intoanomalyco:devfrom
Responses instead of Completion API#9036Conversation
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
Responses instead of Completion API
| if (!modelLoaders[providerID]) { | ||
| const isAzure = Object.values(provider.models).some((model) => model.api.npm === "@ai-sdk/azure") | ||
| if (isAzure) { | ||
| modelLoaders[providerID] = async (sdk: any, modelID: string, options?: Record<string, any>) => { | ||
| const useCompletionUrls = options?.["useCompletionUrls"] === true | ||
| if (useCompletionUrls) return sdk.chat(modelID) | ||
| return sdk.responses(modelID) | ||
| } | ||
| } |
There was a problem hiding this comment.
im not sure this is correct solution
There was a problem hiding this comment.
any suggestions
tried looking at other patterns but didnt find any established for specific model loaders
| "azure-cognitive-services": async () => { | ||
| const resourceName = Env.get("AZURE_COGNITIVE_SERVICES_RESOURCE_NAME") | ||
| return { | ||
| autoload: false, | ||
| async getModel(sdk: any, modelID: string, options?: Record<string, any>) { | ||
| if (options?.["useCompletionUrls"]) { | ||
| return sdk.chat(modelID) | ||
| } else { | ||
| return sdk.responses(modelID) | ||
| } | ||
| }, | ||
| options: { | ||
| baseURL: resourceName ? `https://${resourceName}.cognitiveservices.azure.com/openai` : undefined, |
There was a problem hiding this comment.
The useCompletionUrls option should already be respected but this raises a good point of, I think this should be auto detected better.
I do not have azure cognitive services setup to test tho
There was a problem hiding this comment.
pinging in discord with some test stuff if needed
There was a problem hiding this comment.
ah this is cognitive services, different system iirc
There was a problem hiding this comment.
scroll up 5 lines, normaal azure does exact same flow, so ditto
|
i am an idiot |
Summary
Issue
Fixes #9035
Testing