microsoft / microsoft/aspire

Aspire.OpenAI's AddChatClient API should have a way to indicate whether to use the responses endpoint

Open
#8,464 5 comments 1 reaction 0 assignees View on GitHub
ai area-integrations
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

OpenAI has two major different API variants: [chat and responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions). Chat has been around forever and is the same HTTP schema also supported by many non-OpenAI services; responses is a newer design not supported by anyone outside OpenAI.

Right now, `Aspire.OpenAI`'s `AddChatClient` is built on `Microsoft.Extensions.AI.OpenAI`'s chat-endpoint-based `IChatClient` implementation. It doesn't currently offer any way to set up a responses-endpoint-based `IChatClient` implementation, even though `Microsoft.Extensions.AI.OpenAI` can do that.

The MEAI team discussed this and we think that there'll have to be some way for app developers to control which endpoint is used:

* We can't hardcode it always to use chat, because responses is the future for OpenAI.
* And we can't hardcode it always to use responses, because chat is so universal and is the only thing supported by many non-OpenAI services.

Possible design:

```cs
// Old
builder.AddOpenAIClient(serviceName).AddChatClient();

// New
builder.AddOpenAIClient(serviceName).Chat.AddChatClient();
builder.AddOpenAIClient(serviceName).Responses.AddChatClient();

// Alternative
builder.AddOpenAIClient(serviceName).AddChatClient(endpoint: AspireOpenAIEndpoint.Responses);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.