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

Initial work to add support for Cohere Provider #743

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

humphd
Copy link
Collaborator

@humphd humphd commented Nov 19, 2024

I tried to implement #610, and was able to get to the point of sending a chat completion. However, Cohere's API is different enough from OpenAI that I can't use the OpenAI client.

To properly fix this, I think we need to extend Chat Providers with a way to override the client and API calls that get made with it. This would allow us to use Anthropic directly too, and others that differ significantly.

Or we could switch to a wrapper client like https://sdk.vercel.ai/docs/introduction to help smooth out the differences.

@tarasglek
Copy link
Owner

I would rather do this through a fetch proxy or similar middleware.

@tarasglek
Copy link
Owner

Eg vercel sdk decided on some common format and then have translators to/from it https://github.com/vercel/ai/blob/main/packages/cohere/src/convert-to-cohere-chat-prompt.ts#L7

I think doing this to/from openai would be a more reasonable option.

@@ -183,7 +183,8 @@ ${func.name}(${JSON.stringify(data, null, 2)})\n\`\`\`\n`;
functionName: string,
functionArgs: string
) => {
if (content.length > 0) {
// TODO: need to deal with Cohere returning different data for tokens...
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vercel link was re this TODO

@tarasglek
Copy link
Owner

excited to get cohere support, i love their web search tool

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

Successfully merging this pull request may close these issues.

2 participants