autogen
autogen copied to clipboard
[.Net][Feature Request]: Agent as openai-compatible chat service
Is your feature request related to a problem? Please describe.
Starting an openai-chat-compatible rest service from an arbitrary agent
Describe the solution you'd like
// Server side
IAgent agent;
app.UseAgentAsOpenAIChatCompletionEndpoint(agent) // this will start an OpenAI API at /v1/chat/completions
app.StartAsync();
// client side
// Suppose the service is running at localhost:8080
// We can use `OpenAIChatAgent` to consume that backend
var openaiClient = CreateOpenAIClient(client); // check Example 16 on how to connect to a third-party OpenAI API backend
var openAIAgent = new OpenAIChatAgent(openaiClient, "test", "test")
.RegisterMessageConnector();
await openAIAgent.SendAsync("Hello");
Additional context
Also cc @ekzhu and @luisquintanilla No response
### Tasks
@LittleLittleCloud Great idea!
Would you be able to configure the backend? i.e. OpenAI, Ollama, LMStudio, etc...
@LittleLittleCloud Great idea!
Would you be able to configure the backend? i.e. OpenAI, Ollama, LMStudio, etc...
Should be? It will work for all ‘IAgent’