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: add Cohere API support (Command-R+) #1246

Merged
merged 4 commits into from
Apr 13, 2024
Merged

feat: add Cohere API support (Command-R+) #1246

merged 4 commits into from
Apr 13, 2024

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Apr 12, 2024

Example usage:

% memgpt configure
Loading config from /Users/loaner/.memgpt/config
? Select LLM inference provider: cohere
? Enter your Cohere API key (see https://dashboard.cohere.com/api-keys): ****************************************
? Override default endpoint: https://api.cohere.ai/v1
? Select default model: command-r-plus
Got context window 116000 for model command-r-plus
? Select your model's context window (see https://docs.cohere.com/docs/command-r): 116000
? Select embedding provider: openai
? Select default preset: memgpt_chat
? Select default persona: sam_pov
? Select default human: basic
? Select storage backend for archival data: chroma
? Select chroma backend: persistent
? Select storage backend for recall data: sqlite
📖 Saving config to /Users/loaner/.memgpt/config
% memgpt run
Loading config from /Users/loaner/.memgpt/config

? Would you like to select an existing agent? No

🧬 Creating new agent...
->  🤖 Using persona profile: 'sam_pov'
->  🧑 Using human profile: 'basic'
🎉 Created new agent 'LoyalPumpkin' (id=ab53ba74-6d44-49c4-8d17-4779a2b14f81)

Hit enter to begin (will request first MemGPT message)

💭 I wonder what Chad needs help with. I'm curious to see what kind of conversations we'll have.
🤖 Hello Chad. I'm Sam. How can I help you today?
> Enter your message: my name is brad, not chad
💭 Oops, my mistake. I'll remember that from now on.
⚡🧠 [function] updating memory with core_memory_replace
         First name: Chad
        → First name: Brad
> Enter your message: is anyone there?
💭 I should be more careful with names in the future.
🤖 Yes, I'm here. How can I help you today, Brad?

Please describe the purpose of this pull request.

Adds support for the Cohere API. Notes:

  • Because the Cohere /chat API only supports back-and-forth text messages between CHATBOT and USER, we use the SYSTEM role to interleave function calls and function responses into the conversation history
  • The preamble param is used in the payload instead of a SYSTEM role message as chat_history[0]

@cpacker cpacker mentioned this pull request Apr 12, 2024
32 tasks
Copy link
Collaborator

@sarahwooders sarahwooders left a comment

Choose a reason for hiding this comment

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

lgtm!

@sarahwooders sarahwooders merged commit 7c7b55f into main Apr 13, 2024
4 checks passed
@cpacker cpacker deleted the cohere branch April 15, 2024 19:26
mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
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