chatgpt-cli icon indicating copy to clipboard operation
chatgpt-cli copied to clipboard

Add support for Cohere as model provider

Open daulet opened this issue 1 year ago • 3 comments

Had to do some refactoring to plug in another provider, reviewing individual commits might be easier than the whole thing, but at high level:

  • Factor out OpenAI specific logic to OpenAIProvider type;
  • Factor out stdout writes out of http.Caller - that way other providers don't have to duplicate behavior embedded into http.Caller, which is currently used for making OpenAI calls;
  • Add CohereProvider that could be plugged in based on new provider field in configuration;

I don't know if you are open to supporting other providers at all, so publishing bigger PR than ideal to get initial buy in, can break it down into more consumable chunks if necessary.

If accepted it would probably require adding defaults per provider, such as default model, to make switching easier on user.

daulet avatar Apr 27 '24 03:04 daulet

@daulet wow, this is amazing. I am currently traveling but should have time to dive into this either on Sunday or Monday. Thanks!!

kardolus avatar Apr 27 '24 15:04 kardolus

@kardolus the integration tests are failing due to this addition. To set provider we need to write to config file, so I added creating config directory on demand, but that fails the expectation in the tests. What would you recommend as the right fix here?

daulet avatar Apr 29 '24 16:04 daulet

@daulet thanks for your patience. Had a very busy week. Will look at the PR as a whole before diving into the integration tests. Will have time today.

kardolus avatar May 03 '24 11:05 kardolus