MVP
Overhaul of the entire codebase.
Currently supports:
- Main feature, chat session
- Validates provider, api_key and model
- Supports history saving and loading
- Supports budget (budget display, saving and loading)
- Supports OpenAI and Anthropic
- Other providers can be simply added by updating the routing method https://github.com/TiansuYu/chatgpt-cli/blob/MVP/src/chatgpt_cli/config.py#L115 (no need to manually update models and providers one by one).
During the refactoring, I was being extremely lazy by using hydra for introducing CLI arguments, ideally this should be implemented via click or typer. So this part is not intended to be ship for the final product.
@marcolardera @tadeasf Let me know what do you think of the updates. (I would recommend look at the branch directly, instead of diff, because of the overhaul.)
Open to any suggestions (style, saving methods on history and cost, etc.)
@marcolardera Let me know if this is something that you would consider merge into this project. (We can certainly discuss dev config and release strategy later, no need to dive into it right now. And hopefully we wont have to cause any breaking change because of the update).
Yep. I got laid off so I have shit to do with job hunting but next weekend I'll get to you :)
@tadeasf Sorry to hear that. Take care. Let us sync on this once your schedule is free. 😄
@TiansuYu pushed a few more changes in https://share.cleanshot.com/YgTYQ2qS at styling branch -> new system prompt -> highly!! recommend. the output is something else and makes gpt-4o usable again compared to claude. i finded tuned it via system prompts found in other repos -> new commands /m and /s to switch between multiline and single line prompts on the fly -> new command /h which saves the session into md and lets you browse the whole history. found this to work better and improve performance compared to tracking code blocks
@TiansuYu i'd recommend either starting a new fork or something where we can both work on it at the same time, @marcolardera seems to have abbandoned this mostly
-> i have checked other projects as ai chat and this still makes massive sense thanks to great features (history, history into $editor, budget tracking etc which are lacking in ai chat) -> i already incorporated typer, i think you got an older base :D
this is the latest branch with typer etc https://github.com/tadeasf/chatgpt-cli/blob/styling/src/chatgpt_cli/chatgpt_cli.py
@TiansuYu i have my personal mattermost (slack clone) deployment i created a channel for purpose on syncing on this more dynamically: https://mattermost.tadeasfort.com/signup_user_complete/?id=m71qne1f5br7zedt1izxayum6h&md=link&sbr=fa
feel free to join :)
I will create a new repo to add we have made progress so far. Would say chatgpt-cli2 or something like that.
Hi all, sorry for not having responded! I have not abandoned the project, I was just very busy in this months (I also started a new job). I'm very impressed by this refactoring and I would definitely consider to merge it to the main branch.
I promise I will check everything in the next 3-4 days and then most likely merge it :) @tadeasf @TiansuYu
Awesome! I already started working on pushing it further. Feel free to join the mattermost.com channel mentioned above to get updates. I also renamed it (for now it's sti very much WIP) to chat_llm_cli + a lot of other stuff. Atm I'm working on autosaving and auto budget saving and such haven't pushed it yet but will hopefully some time today, then I'll merge it onto the fork branch and open new fresh pr here @marcolardera Also sorry if I overwhelmed the project or accused you from abbandoning it! Nothing personal meant here. And the project velocity is mainly due to myself wanting to use this tool for my own work :D as I haven't found anything better (Ai chat or aider being a different projects or lacking features like history editing and Obsidian integration)
@tadeasf I appreciate a lot the work you have done. I think the refactoring is awsome :)
The project started as a very simple script and then many features were added on top of it without a proper architecture (At the start I liked the idea of having everything contained in a single file, but then it became too big). Thus, a refactoring was necessary but in the last months I never managed to find the time to work on it.
I think the structure is very good and I also like the idea of using LiteLLM (which I did not know)...
Great to hear that :) I think that typer + litellm is the way to go. I am working on ollama integration as well. As I mentioned, give me a week or so and I prepare fully ready PR where I'll clean up all the changes
@marcolardera in general I am a big tiangolo fan boy so that might bias me a bit but I believe that rn it's built on top of the most modern python tooling available
I also prepared it to work with rye which I believe is the best project manager available rn
Hello @tadeasf ,
I have played around this version a bit. Overall is very good, just found a couple of issues, such as:
- in config.py the "error" and "success" styles does not exists and that cause some crashes.
- When history is saved it does that using a "dummy" model. It should instead use the correct model in use during the saved conversation.
Those are easy fix. Should I push them on this branch? You mentioned before that you are working on a more advanced version, so maybe you already addressed that...
Regarding the save/restore feature, I have not found a way to restore the previous conversation without typing the json file name (for example chatgpt-cli history.load_from=history-2024-09-14-09-42-39.json). In my previous version there was the special chatgpt-cli --restore last command that does that. I think it should be nice to keep that feature but I'm not sure if this is achievable with Hydra of if we should switch to Click/Typer.
Oh, and I tried to join Mattermost using the link above but it seems the website is not available at the moment...
in config.py the "error" and "success" styles does not exists and that cause some crashes. When history is saved it does that using a "dummy" model. It should instead use the correct model in use during the saved conversation.
Yes, it is not fully tested, so expected to have some hiccups here and there (I have renamed success, error etc. to be just their color names, so if you use the right name, it should reflect that).
Regarding the save/restore feature, I have not found a way to restore the previous conversation without typing the json file name (for example chatgpt-cli history.load_from=history-2024-09-14-09-42-39.json). In my previous version there was the special chatgpt-cli --restore last command that does that. I think it should be nice to keep that feature but I'm not sure if this is achievable with Hydra of if we should switch to Click/Typer.
This can be added easily.
Fee feel to add things into this branch.
@marcolardera @TiansuYu i accidentally got picked up as senior dev so atm i am absolutely flooded and can't really push this anymore 😿 writing me an email at [email protected] is 100% sure way to prompt me if you'll get stuck somewhere but i don't really have capacity to lead this and push it into finish product with nice pypi package and one file executable that I wished to make... also since i got 32 gigs of ram finally i am mostly using ollama nowadays for which i created separate cli tool which is nvim workflow optimized here: https://github.com/tadeasf/ollama-nvim-cli
the principle is the same. and it's free tadaa
if either of you will tell me "do this" i am gonna do it for this project cuz i still use it from time to time when I wanna leverage claude but that's about it :)