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

feat: Client Versioning (+ Provider Trait and ClientBuilder) #149

Open
1 task done
0xMochan opened this issue Dec 13, 2024 · 1 comment
Open
1 task done

feat: Client Versioning (+ Provider Trait and ClientBuilder) #149

0xMochan opened this issue Dec 13, 2024 · 1 comment

Comments

@0xMochan
Copy link
Contributor

0xMochan commented Dec 13, 2024

  • I have looked for existing issues (including closed) about this

Feature Request

As model providers start getting more competitive, the provider API routes might adjust and evolve over time. We should consider specifying a standardized versioning with clients (maybe via a builder or something) that helps in specifying how requests should be made to the API.

Motivation

Cohere recently released a v2 of it's chat endpoint.

Proposal

  • A generic ClientBuilder can be defined to build out specific clients. That way, we can make the ClientBuilder as the singular interface for building all clients and agents.
  • A Provider trait that helps simplify current and future provider implementation (specifically for top-level clients).
    • This should make it much easier for having different versioned clients since they'd share the same set of methods to make agents, extractors, etc.
impl Provider<V> for Client<V> {
    ...
}

impl Client<1> {
    pub fn completion ...
}

impl Client<2> {
    pub fn completion ...
}

Alternatives

Only support the latest version. Against this suggestion primarily because LLM and their providers are moving so quickly that many people might be building agents that could become dated in only a month. The providers leave older version endpoints operational so it would be a shame if someone's Agent stopped working due to a breaking change.

The only positive with supporting a latest version is that it simplifies the number of clients per providers but making a provider generic over a Version might be suitable for this.

@0xMochan 0xMochan changed the title feat: client versioning feat: Client Versioning (+ Provider Trait and ClientBuilder) Dec 13, 2024
@milancermak
Copy link

When I was looking through the source code, I've noticed that the way a completion request is created for Anthropic is not correct. It's modeled after the OpenAI API not the Anthropic one.

IIUC tackling this issue would resolve that, right? If so, could you provide a little bit more detail on how you envision the refactor? I could work on it if that's ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants