Describe the bug
AzureOpenAIChatCompletionWithDataService does not use correct form of request URI for API versions post 2023-12-01 (e.g. 2024-02-15)
To Reproduce
Steps to reproduce the behavior:
- Run
ai CLI (in development branch) using ai dev new sk-chat-streaming-with-data --csharp
- Examine source code produced is valid sample following same pattern as
dotnet\samples\Concepts\ChatCompletion\AzureOpenAIWithData_ChatCompletion.cs
var dataConfig = new AzureOpenAIChatCompletionWithDataConfig
{
CompletionModelId = AZURE_OPENAI_CHAT_DEPLOYMENT!,
CompletionEndpoint = AZURE_OPENAI_ENDPOINT!,
CompletionApiKey = AZURE_OPENAI_API_KEY!,
CompletionApiVersion = AZURE_OPENAI_API_VERSION!,
DataSourceEndpoint = AZURE_AI_SEARCH_ENDPOINT!,
DataSourceApiKey = AZURE_AI_SEARCH_KEY!,
DataSourceIndex = AZURE_AI_SEARCH_INDEX_NAME!
};
// Create a kernel with the Azure OpenAI chat completion service
var builder = Kernel.CreateBuilder();
builder.AddAzureOpenAIChatCompletion(dataConfig);
builder.AddAzureOpenAITextEmbeddingGeneration(
AZURE_OPENAI_EMBEDDING_DEPLOYMENT,
AZURE_OPENAI_EMBEDDING_ENDPOINT,
AZURE_OPENAI_API_KEY!);
var kernel = builder.Build();
- Try running sample once all environment variables are set
Expected behavior
It should function as expected, and do an "on your data" look up from the appropriate data via AI Search
Screenshots
Instead, it throws an exception:
Unhandled exception. Microsoft.SemanticKernel.HttpOperationException: Response status code does not indicate success: 404 (Resource Not Found).
---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Resource Not Found).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.SemanticKernel.Http.HttpClientExtensions.SendWithSuccessCheckAsync(HttpClient client, HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.SemanticKernel.Http.HttpClientExtensions.SendWithSuccessCheckAsync(HttpClient client, HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Microsoft.SemanticKernel.Http.HttpClientExtensions.SendWithSuccessCheckAsync(HttpClient client, HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.SemanticKernel.Connectors.OpenAI.AzureOpenAIChatCompletionWithDataService.SendRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.SemanticKernel.Connectors.OpenAI.AzureOpenAIChatCompletionWithDataService.InternalGetChatStreamingContentsAsync(ChatHistory chatHistory, PromptExecutionSettings executionSettings, Kernel kernel, CancellationToken cancellationToken)+MoveNext()
at Microsoft.SemanticKernel.Connectors.OpenAI.AzureOpenAIChatCompletionWithDataService.InternalGetChatStreamingContentsAsync(ChatHistory chatHistory, PromptExecutionSettings executionSettings, Kernel kernel, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
Platform
- OS: Windows
- IDE: VS Code (although, that's irrelevant for this)
- Language: C#
- Source: NuGet package 1.13.0
Additional context
Contact robch@microsoft.com for further information if needed.
Describe the bug
AzureOpenAIChatCompletionWithDataService does not use correct form of request URI for API versions post 2023-12-01 (e.g. 2024-02-15)
To Reproduce
Steps to reproduce the behavior:
aiCLI (in development branch) usingai dev new sk-chat-streaming-with-data --csharpdotnet\samples\Concepts\ChatCompletion\AzureOpenAIWithData_ChatCompletion.csExpected behavior
It should function as expected, and do an "on your data" look up from the appropriate data via AI Search
Screenshots
Instead, it throws an exception:
Platform
Additional context
Contact robch@microsoft.com for further information if needed.