Skip to content

[Microsoft.Extensions.AI.OpenAI 10.1.1-preview.1.25612.2] CS7069 #7163

@bicijinlian

Description

@bicijinlian

Description

In version 10.1.1-review.1.25612.2 of "Microsoft. Extensions. AI. OpenAI", a compilation error occurs when using "IChatClient. CreateAIAgent()": CS7069! The previous version did not have this error.
Here are code screenshots and project code (very simple)

Image

Reproduction Steps

`
using Microsoft.Extensions.AI;
using Microsoft.Agents.AI;
using OpenAI;

namespace TryCode
{
internal class Program
{
static void Main(string[] args)
{
OpenAIClient openAiClient = new OpenAIClient
(
credential: new System.ClientModel.ApiKeyCredential("nokey"),
options: new OpenAIClientOptions()
{
Endpoint = new Uri("http://localhost:11434/v1"),
NetworkTimeout = TimeSpan.FromMinutes(30)
}
);

        IChatClient chatClient = openAiClient.GetChatClient("").AsIChatClient();
        AIAgent agent = chatClient.CreateAIAgent(instructions: "You are good at telling jokes.", name: "Joker");
    }
}

}
`

Exe net10.0 enable enable

Expected behavior

No compilation errors or running errors

Actual behavior

Compilation error: CS7069

Regression?

This error only occurs in version 10.1.1-view.1.25612.2

Known Workarounds

No response

Configuration

Exe net10.0 enable enable

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-aiMicrosoft.Extensions.AI librariesbugThis issue describes a behavior which is not expected - a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions