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

Anthropic support #48

Closed
wants to merge 10 commits into from
Closed

Anthropic support #48

wants to merge 10 commits into from

Conversation

cfortuner
Copy link

Adds support for Anthropic for Chat.

@cfortuner cfortuner marked this pull request as draft September 7, 2024 16:23
@cfortuner cfortuner marked this pull request as ready for review September 7, 2024 17:20
@rileytomasek
Copy link
Collaborator

This is awesome! I'll take a look on the plane tomorrow.

I also added @transitive-bullshit as a reviewer because he likely has valuable insights.

@rileytomasek
Copy link
Collaborator

@cfortuner I was thinking more about this and it seems odd to add Anthropic-specific stuff into this very simple package called openai-fetch. What do you think of exporting the public interface from this package and making anthropic-fetch that provides a dedicated library that implements the same interface as openai-fetch? Then in Dexter we could use them interchangeably because they would have the same public interface from openai-fetch that Dexter expects. Would also allow us to keep expanding the *-fetch packages in a clear and simple way.

@cfortuner
Copy link
Author

@rileytomasek yeah that sounds good

probably would simplify things if we just brought both of these into dexter rather than trying to support these packages separately, but your call.

i'll start a new repo for anthropic-fetch?

@cfortuner
Copy link
Author

@rileytomasek

I was thinking, maybe we should just create anthropic fetch, and then handle any of the translation between openai-client + anthropic client in dexter?

@cfortuner
Copy link
Author

@transitive-bullshit

@rileytomasek and I wanted to loop you in on this to get your advice on how we could support anthropic (or other providers) in dexter.

What do you think about this?

  1. Create an new AI Provider interface for Dexter to rely on with types like ChatParams and ChatMessage, matching OpenAI's structure. This would reduce dexter's coupling with the openai-fetch package.
  2. Build provider adapters to connect OpenAI and Anthropic to this interface. (openai-fetch -> dexa interface, anthropic -> dexa interface)
  3. Decide whether to keep the interface within Dexter or as a separate package, balancing simplicity with flexibility.

@rileytomasek
Copy link
Collaborator

@transitive-bullshit

@rileytomasek and I wanted to loop you in on this to get your advice on how we could support anthropic (or other providers) in dexter.

What do you think about this?

  1. Create an new AI Provider interface for Dexter to rely on with types like ChatParams and ChatMessage, matching OpenAI's structure. This would reduce dexter's coupling with the openai-fetch package.
  2. Build provider adapters to connect OpenAI and Anthropic to this interface. (openai-fetch -> dexa interface, anthropic -> dexa interface)
  3. Decide whether to keep the interface within Dexter or as a separate package, balancing simplicity with flexibility.

I think this is roughly the correct direction, but can be even simpler.

Dexter (and probably most other libs) would prefer to just work with OpenAI types (like openai-fetch) so I'd prefer we don't abstract to far from them.

What do you think of this:

  1. Create an ai-fetch package just exports the same interface openai-fetch already implements (eg: AIClient)
  2. Make it so that the openai-fetch OpenAIClient implements AIClient
  3. Create anthropic-fetch that also implements AIClient
  4. Change Dexter to expect AIClient instead of OpenAIClient for the ChatModel

This way Dexter and openai-fetch don't have any breaking changes, and using anthropic-fetch with Dexter is as simple as passing an instance of it's client instead of an openai-fetch client.

@cfortuner
Copy link
Author

@rileytomasek 👍 yeah that's exactly what I had in mind

@cfortuner cfortuner closed this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants