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

Could this tool be extended to include models outside of OpenAI?

Open TiansuYu opened this issue 1 year ago • 4 comments

I am thinking about trying out models from Anthropic and MistralAI on this tool as well. Given how similar the model APIs are between these companies. Could this be easily achieved on this tool?

TiansuYu avatar Jul 01 '24 17:07 TiansuYu

Hello @TiansuYu, the providers supported out-of-the box are OpenAI and Azure. However, it should require only a small code modification to add other providers, given that the the API are the same (with just a different base endpoint)...

I add this suggestion to my "to to list when I find time/motivation" :)

In the meantime, you can try to set the environment variable OPENAI_BASE_ENDPOINT to the base endpoint of Anthropic/Mistral. Also set your API key provided by one of those suppliers. If the API is exactly the same as OpenAI, in theory, it should work. Let me know if it is the case...

marcolardera avatar Jul 03 '24 16:07 marcolardera

I will experiment around it. Open a PR if my time permits. 😄

TiansuYu avatar Jul 06 '24 09:07 TiansuYu

Draft PR https://github.com/marcolardera/chatgpt-cli/pull/71 Seems API KEY loading is not working as intended, needs some further work on this.

TiansuYu avatar Jul 06 '24 10:07 TiansuYu

Some general comments on how to refactor this repo:

  • Set a Config class responsible for resolving config vars from various places. (Currently, it is bit of a mess.)
  • Set an abstract Model class for main method to call Model.prompt, resolve to different Model implementations based on supplier.

TiansuYu avatar Jul 06 '24 10:07 TiansuYu