Skip to content

Figure out chat_openai_compatible() strategy #801

Description

@hadley

From #635 (comment)

My 2¢ is that chat_openai() is too useful of a function for users to deprecate. I think most users will want to just call chat_openai() to start talking to OpenAI models and they won't care at all about the difference in the underlying API.

Personally, I think it's reasonable to push the messiness of the abstractions into the Provider layers, so I really like ProviderOpenAIResponses and an alternate named ProviderOpenAICompletions or ProviderOpenAIApi or ProviderOpenAICompatible (leaning toward the first).

The problem is that there are likely many uses of chat_openai() that currently target the completions endpoint and are taking advantage of an API marketed as "OpenAI-compatible". If it's possible to catch those use-cases at runtime — e.g. by looking for an error message that would occur if chat_openai() tries to use the responses endpoint on a server that doesn't support it — then ellmer could provide migration instructions and point people to a new chat_openai_compatible() or chat_openai_api() that uses the alternate provider.

I suppose that if it's not possible to provide run-time migration advice, my opinion about the chat_openai() name might change. From an educational perspective, I would much rather teach people to use chat_openai() to talk to OpenAI models than to have to teach chat_openai_responses() just to get started. That name is more appropriate for users who are using "off-label" chat_openai(), and those more advanced users are also aware of the fast-moving nature of this space. In general, I think everyone will understand the need for breaking changes in this area, especially if those changes protect the getting started and most common user experiences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions