Closed jamesmcroft closed 3 weeks ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @glharper.
Attempting to hijack the requests with a custom HttpClient
implementation from the @azure/core-rest-pipeline library also does not work as expected.
I can assume that the OPTIONS request is part of a downstream function called by the default HTTP client provided by the core-rest-pipeline SDK.
@jamesmcroft this is odd, I don't think we should be making OPTIONS
requests in Node. I'd expect this to only happen in a browser due to CORS. Can you confirm the environment you're executing your code in is Node 20?
Hi @jamesmcroft. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
We strongly recommend that you migrate to using the AzureOpenAI
client exported by the official OpenAI client library for JavaScript. Please checkout the migration guide for information on how to do so.
Hi @jamesmcroft, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!
Describe the bug A clear and concise description of what the bug is.
When calling the
getChatCompletions
function of anOpenAIClient
, an OPTIONS call to the API is made before the POST call is successfully processed.For most scenarios calling Azure OpenAI directly, this works fine. However, scenarios that implement proxies to multiple Azure OpenAI backend instances do not. This is because the OPTIONS request is not defined in the OpenAPI specification for the Azure OpenAI APIs. Those implementing the spec will not handle OPTIONS requests as is not expected.
Exploring the JS SDK, I cannot find where this request is being made as it is not clear in the OpenAI specific source that this is the case.
To confirm functionality across Azure OpenAI SDKs, the .NET SDK will only perform the POST request resulting in a successful response via a proxy.
To Reproduce Steps to reproduce the behavior:
OpenAIClient
with default Azure OpenAI configurationOpenAIClient
using thegetChatCompletions
function.Notice that there are two requests made. The initial OPTIONS request, and the subsequent POST request.
Expected behavior A clear and concise description of what you expected to happen.
Only the POST request should be made.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.