Open rstropek opened 2 months ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @ralph-msft @trrwilson.
FYI - this is my workaround. Is this the intended way to go?
var azureClient = new AzureOpenAIClient(
new Uri(options.Endpoint),
new AzureKeyCredential(options.ApiKey ?? configuration["AZURE_OPENAI_KEY"]!),
new AzureOpenAIClientOptions() {
Transport = new ApiVersionSelectorTransport("2024-08-01-preview")
});
// ...
class ApiVersionSelectorTransport(string apiVersion) : HttpClientPipelineTransport
{
protected override void OnSendingRequest(PipelineMessage message, HttpRequestMessage httpRequest)
{
var uriBuilder = new UriBuilder(httpRequest.RequestUri!);
var query = HttpUtility.ParseQueryString(uriBuilder.Query);
query["api-version"] = apiVersion;
uriBuilder.Query = query.ToString();
httpRequest.RequestUri = uriBuilder.Uri;
base.OnSendingRequest(message, httpRequest);
}
}
Library name and version
Azure.AI.OpenAI 2.0.0-beta.5
Query/Question
It is a common scenario to switch between API versions (e.g. testing the structured outputs feature which requires API version
2024-08-01-preview
). How can I switch the API version withAzure.AI.OpenAI
? Other SDKs (e.g. Python) have an easy-to-use parameter for that.Environment
.NET 8, C#