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][Feature Request]: Use Azure.AI.OpenAI v2.0 in AutoGen.OpenAI package #3193

Closed
2 tasks done
LittleLittleCloud opened this issue Jul 23, 2024 · 0 comments
Closed
2 tasks done
Labels
api-break-change Will break existing api and needs an migration for previous code to work dotnet issues related to AutoGen.Net roadmap Issues related to roadmap of AutoGen

Comments

@LittleLittleCloud
Copy link
Collaborator

LittleLittleCloud commented Jul 23, 2024

Is your feature request related to a problem? Please describe.

Use the new OpenAI SDK in AutoGen.OpenAI

In the meantime, the old AutoGen.OpenAI will be renamed to AutoGen.OpenAI.V1 for those who don't want to migrate to Azure.AI.OpenAI v2 package in their project.

Additional context

This will introduce api-break-change to previous version, because Azure.AI.OpenAI v2.0 is not compatible with v1.17.0

migration guide

For those who want to keep on the old AutoGen.OpenAI package which depends on Azure.AI.OpenAI v1 package, simply replace AutoGen.OpenAI with AutoGen.OpenAI.V1 package instead. You would need to update the namespace from using AutoGen.OpenAI to using AutoGen.OpenAI.V1.

For those who want to use the new AutoGen.OpenAI package which depends on OpenAI V2 package, you would need to pass a ChatClient instead of OpenAIClient to OpenAIChatAgent.

var openAIClient = new OpenAIClient(apiKey);

// previous way of creating OpenAIChatAgent
var openAIClientAgent = new OpenAIChatAgent(
            openAIClient: openAIClient,
            model: "gpt-4o-mini",
            name: "assistant",
            systemMessage: "You are a helpful assistant designed to output JSON.",
            seed: 0, // explicitly set a seed to enable deterministic output
            responseFormat: ChatResponseFormat.JsonObject) // set response format to JSON object to enable JSON mode
            .RegisterMessageConnector()
            .RegisterPrintMessage();

// new way of creating OpenAIChatAgent
var openAIClientAgent = new OpenAIChatAgent(
            openAIClient: openAIClient.GetChatClient("gpt-4o-mini"),
            name: "assistant",
            systemMessage: "You are a helpful assistant designed to output JSON.",
            seed: 0, // explicitly set a seed to enable deterministic output
            responseFormat: ChatResponseFormat.JsonObject) // set response format to JSON object to enable JSON mode
            .RegisterMessageConnector()
            .RegisterPrintMessage();

In the meantime, the following agent is deprecated

  • GPTAgent: this agent is replaced by OpenAIChatClient.

No response

Tasks

Preview Give feedback
@LittleLittleCloud LittleLittleCloud added this to the AutoGen.Net 0.1.0 milestone Jul 23, 2024
@LittleLittleCloud LittleLittleCloud added the api-break-change Will break existing api and needs an migration for previous code to work label Jul 23, 2024
@LittleLittleCloud LittleLittleCloud added roadmap Issues related to roadmap of AutoGen dotnet issues related to AutoGen.Net labels Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-break-change Will break existing api and needs an migration for previous code to work dotnet issues related to AutoGen.Net roadmap Issues related to roadmap of AutoGen
Projects
None yet
Development

No branches or pull requests

1 participant