Skip to content

.Net: Bug: HTTP 404 - POST /chat/completions #8525

@johnholliday

Description

@johnholliday

Describe the bug
Exception thrown: 'Microsoft.SemanticKernel.HttpOperationException' in mscorlib.dll
Exception thrown: 'System.AggregatException' in mscorlib.dll
HTTP 404 (invalid_request_error: unknown_url)

Unknown request URL: POST /chat/completions. Please check the URL for typos, or see the docs at https://platform.openai.com/docs/api-reference/.
HTTP 404 (invalid_request_error: unknown_url)

To Reproduce

var builder = Kernel.CreateBuilder();
builder.AddOpenAIChatCompletion("gpt-4o", OPENAI_APIKEY);
var _kernel = builder.Build();

var service = _kernel.GetRequiredService<IChatCompletionService>();

var settings = new OpenAIPromptExecutionSettings
{
    Temperature = 1.05F,
    TopP = 1F,
    MaxTokens = 4096,
    ResponseFormat = "json_object"
};

var chat = new ChatHistory();
var ct = new CancellationTokenSource();
chat.AddUserMessage("tell me something good");
var content = await service.GetChatMessageContentsAsync(chat, settings, _kernel, ct.Token);

Expected behavior
'content' variable contains the message result.

Platform

  • OS: Windows 11
  • IDE: Visual Studio 2022
  • Language: C#
  • Source: Microsoft.SemanticKernel v 1.18.2

Additional context
Was working, then suddenly started throwing this exception.

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions