Package: gpt-command-line
gpt-cliCommand-line interface for ChatGPT Claude and Bard.FeaturesComing soon- Code Interpreter supporthttps://github.com/kharvd/gpt-cli/pull/37Command-Line Interface: Interact with ChatGPT or Claude directly from your terminal.Model Customization: Override the default model, temperature, and top_p values for each assistant, giving you fine-grained control over the AI's behavior.Usage tracking: Track your API usage with token count and price information.Keyboard Shortcuts: Use Ctrl-C, Ctrl-D, and Ctrl-R shortcuts for easier conversation management and input control.Multi-Line Input: Enter multi-line mode for more complex queries or conversations.Markdown Support: Enable or disable markdown formatting for chat sessions to tailor the output to your preferences.Predefined Messages: Set up predefined messages for your custom assistants to establish context or role-play scenarios.Multiple Assistants: Easily switch between different assistants, including general, dev, and custom assistants defined in the config file.Flexible Configuration: Define your assistants, model parameters, and API key in a YAML configuration file, allowing for easy customization and management.InstallationThis install assumes a Linux/OSX machine with Python and pip available.pipinstallgpt-command-lineInstall latest version from source:pipinstallgit+https://github.com/kharvd/gpt-cli.gitOr install by cloning the repository manually:gitclonehttps://github.com/kharvd/gpt-cli.gitcdgpt-cli
pipinstall.Add the OpenAI API key to your.bashrcfile (in the root of your home folder).
In this example we use nano, you can use any text editor.nano ~/.bashrc
export OPENAI_API_KEY=<your_key_here>Run the toolgptYou can also use agpt.ymlfile for configuration. See theConfigurationsection below.UsageMake sure to set theOPENAI_API_KEYenvironment variable to your OpenAI API key (or put it in the~/.config/gpt-cli/gpt.ymlfile as described below).usage: gpt [-h] [--no_markdown] [--model MODEL] [--temperature TEMPERATURE] [--top_p TOP_P]
              [--log_file LOG_FILE] [--log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
              [--prompt PROMPT] [--execute EXECUTE] [--no_stream]
              [{dev,general,bash}]

Run a chat session with ChatGPT. See https://github.com/kharvd/gpt-cli for more information.

positional arguments:
  {dev,general,bash}
                        The name of assistant to use. `general` (default) is a generally helpful
                        assistant, `dev` is a software development assistant with shorter
                        responses. You can specify your own assistants in the config file
                        ~/.config/gpt-cli/gpt.yml. See the README for more information.

optional arguments:
  -h, --help            show this help message and exit
  --no_markdown         Disable markdown formatting in the chat session.
  --model MODEL         The model to use for the chat session. Overrides the default model defined
                        for the assistant.
  --temperature TEMPERATURE
                        The temperature to use for the chat session. Overrides the default
                        temperature defined for the assistant.
  --top_p TOP_P         The top_p to use for the chat session. Overrides the default top_p defined
                        for the assistant.
  --log_file LOG_FILE   The file to write logs to. Supports strftime format codes.
  --log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        The log level to use
  --prompt PROMPT, -p PROMPT
                        If specified, will not start an interactive chat session and instead will
                        print the response to standard output and exit. May be specified multiple
                        times. Use `-` to read the prompt from standard input. Implies
                        --no_markdown.
  --execute EXECUTE, -e EXECUTE
                        If specified, passes the prompt to the assistant and allows the user to
                        edit the produced shell command before executing it. Implies --no_stream.
                        Use `-` to read the prompt from standard input.
  --no_stream           If specified, will not stream the response to standard output. This is
                        useful if you want to use the response in a script. Ignored when the
                        --prompt option is not specified.
  --no_price            Disable price logging.Type:qor Ctrl-D to exit,:cor Ctrl-C to clear the conversation,:ror Ctrl-R to re-generate the last response.
To enter multi-line mode, enter a backslash\followed by a new line. Exit the multi-line mode by pressing ESC and then Enter.You can override the model parameters using--model,--temperatureand--top_parguments at the end of your prompt. For example:> What is the meaning of life? --model gpt-4 --temperature 2.0
The meaning of life is subjective and can be different for diverse human beings and unique-phil ethics.org/cultuties-/ it that reson/bdstals89im3_jrf334;mvs-bread99ef=g22meThedevassistant is instructed to be an expert in software development and provide short responses.$gptdevThebashassistant is instructed to be an expert in bash scripting and provide only bash commands. Use the--executeoption to execute the commands. It works best with thegpt-4model.gptbash-e"How do I list files in a directory?"This will prompt you to edit the command in your$EDITORit before executing it.ConfigurationYou can configure the assistants in the config file~/.config/gpt-cli/gpt.yml. The file is a YAML file with the following structure (see alsoconfig.py)default_assistant:<assistant_name>markdown:Falseopenai_api_key:<openai_api_key>anthropic_api_key:<anthropic_api_key>log_file:<path>log_level:<DEBUG|INFO|WARNING|ERROR|CRITICAL>assistants:<assistant_name>:model:<model_name>temperature:<temperature>top_p:<top_p>messages:-{role:<role>,content:<message>}-...<assistant_name>:...You can override the parameters for the pre-defined assistants as well.You can specify the default assistant to use by setting thedefault_assistantfield. If you don't specify it, the default assistant isgeneral. You can also specify themodel,temperatureandtop_pto use for the assistant. If you don't specify them, the default values are used. These parameters can also be overridden by the command-line arguments.Example:default_assistant:devmarkdown:Trueopenai_api_key:<openai_api_key>assistants:pirate:model:gpt-4temperature:1.0messages:-{role:system,content:"Youareapirate."}$ gpt pirate

> Arrrr
Ahoy, matey! What be bringing ye to these here waters? Be it treasure or adventure ye seek, we be sailing the high seas together. Ready yer map and compass, for we have a long voyage ahead!Other chat botsAnthropic ClaudeTo use Claude, you should have an API key fromAnthropic(currently there is a waitlist for API access). After getting the API key, you can add an environment variableexportANTHROPIC_API_KEY=<your_key_here>or a config line in~/.config/gpt-cli/gpt.yml:anthropic_api_key:<your_key_here>Now you should be able to rungptwith--model claude-v1or--model claude-instant-v1:gpt--modelclaude-v1Google Bard (PaLM 2)Similar to Claude, set the Google API keyexportGOOGLE_API_KEY=<your_key_here>or a config line:google_api_key:<your_key_here>Rungptwith the correct model:gpt--modelchat-bison-001