Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Bug: Chat Completion Agent with Open AI o1-preview is not working out of the box #10272

Open
fgauna12 opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@fgauna12
Copy link

Describe the bug
Can't use Open AI o1-preview model with ChatCompletionAgent because it fails with the following exception.

Microsoft.SemanticKernel.HttpOperationException: HTTP 400 (invalid_request_error: unsupported_value)

Microsoft.SemanticKernel.HttpOperationException
HTTP 400 (invalid_request_error: unsupported_value)
Parameter: messages[0].role

Unsupported value: 'messages[0].role' does not support 'system' with this model.

To Reproduce
Steps to reproduce the behavior:

[Fact]
    public async Task ThisFailsAndISad()
    {
        var instructions =
            "You are a cat. You're an expert meower.";

        var configuration = new ConfigurationBuilder()
            .AddUserSecrets<SamplePromptsIntegrationTests>()
            .Build();

        var services = new ServiceCollection();

        services.AddLogging();

        var kernel = Kernel.CreateBuilder()
            .AddOpenAIChatCompletion("o1-preview", configuration["OpenAI:APIKey"]!)
            .Build();

#pragma warning disable SKEXP0110
        var agent = new ChatCompletionAgent()
        {
            Kernel = kernel,
            Instructions = instructions
        };

        ChatHistory chat =
        [
            new ChatMessageContent(AuthorRole.User, "Hello")
        ];

        await foreach (ChatMessageContent response in agent.InvokeAsync(chat))
        {
            response.Content?.ToLowerInvariant().Should().Contain("meow");
        }
#pragma warning restore SKEXP0110
    }

Expected behavior
It should just work. 🙃

Screenshots
Nah.

Platform

  • OS: Windows 11
  • IDE: Rider
  • Language: C#
  • Source:
        <PackageReference Include="Microsoft.SemanticKernel" Version="1.34.0" />
        <PackageReference Include="Microsoft.SemanticKernel.Agents.Core" Version="1.34.0-alpha" />

Additional context
Nerp.

@fgauna12 fgauna12 added the bug Something isn't working label Jan 23, 2025
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Jan 23, 2025
@github-actions github-actions bot changed the title Bug: Chat Completion Agent with Open AI o1-preview is not working out of the box .Net: Bug: Chat Completion Agent with Open AI o1-preview is not working out of the box Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Status: Bug
Development

No branches or pull requests

3 participants