Skip to content
Domenic Datti edited this page Apr 10, 2023 · 9 revisions

GPT Console Application

This console application allows you to use OpenAI's GPT API for text generation or editing. It provides a convenient command-line interface with a variety of options to customize the text generation process.

Table of Contents

Command Line Parameters

Here is a list of the command-line options you can use with this application:

  • --api-key: Your OpenAI API key.
  • --base-domain: The base URL for the OpenAI API.
  • --prompt: The prompt for text generation (required for normal operation).
  • --config: The path to the appSettings.json config file. Defaults to "appSettings.json".
  • --model: The model ID to use. Defaults to gpt-3.5-turbo.
  • --max-tokens: The maximum number of tokens to generate in the completion. Defaults to 50.
  • --temperature: The sampling temperature to use, between 0 and 2.
  • --top-p: The value for nucleus sampling.
  • --n: The number of completions to generate for each prompt. Defaults to 1.
  • --stream: Whether to stream back partial progress.
  • --stop: Up to 4 sequences where the API will stop generating further tokens.
  • --presence-penalty: Penalty for new tokens based on their presence in the text so far.
  • --frequency-penalty: Penalty for new tokens based on their frequency in the text so far.
  • --logit-bias: Modify the likelihood of specified tokens appearing in the completion.
  • --user: A unique identifier representing your end-user.
  • --file: One or many files that were saved as embeddings via the embed command. Use this to add context before prompts or chat.

Commands:

  • chat: Starts listening in chat mode. (use stdin to apply contextual information)
  • embed: Create an embedding from stdin (coming soon)
  • default: Use the --prompt command to generate a single completion/edit. Use STDIN for edits (e.g. gpt --prompt "translate this to c#" < script.py)

Using the appSettings.json File

You can use the appSettings.json file to specify default values for the command-line parameters. Here's an example of the file's structure:

{
  "OpenAI": {
    "api-key": "your-api-key",
    "base-domain": "https://api.openai.com"
  },
  "GPT": {
    "model": "gpt-3.5-turbo",
    "max-tokens": 4096,
    "temperature": 1.0,
    "top-p": 0.9,
    "n": 1,
    "stream": false,
    "stop": null,
    "presence-penalty": null,
    "frequency-penalty": null,
    "logit-bias": null
  }
}

The application will use the values specified in this file as defaults. You can override them by providing the corresponding command-line parameters.

GPT-CLI can also enable chat on any command line

This feature is a work in progress. Currently it's limited to the max-token size for the full chat, and the way it handles chat messages is not the same as the real ChatGPT. Your mileage may vary, but I intend to continue improving it.

Here's an example session:

C:\projects\GPT-CLI>gpt chat true

 #####                       #####  ######  #######     #####  #       ###
#     # #    #   ##   ##### #     # #     #    #       #     # #        #
#       #    #  #  #    #   #       #     #    #       #       #        #
#       ###### #    #   #   #  #### ######     #       #       #        #
#       #    # ######   #   #     # #          #       #       #        #
#     # #    # #    #   #   #     # #          #       #     # #        #
 #####  #    # #    #   #    #####  #          #        #####  ####### ###

? Hi there! I am chatting with you via the command line in a tool I wrote called ChatGPT CLI. Can you give me an example page explaining how ChatGPT on the command line might improve people's workflows? I'll b
e sharing this on github, so give it to me in markdown format, please.
Sure, here's an example page in markdown format:

# How ChatGPT CLI Can Improve Your Workflow

ChatGPT CLI is a powerful tool that can help you streamline your workflow and increase your productivity. Here are some examples of how ChatGPT CLI can be used to improve your workflow:

## 1. Automating Repetitive Tasks

ChatGPT CLI can be used to automate repetitive tasks, such as sending emails or updating spreadsheets. By creating custom scripts, you can save time and reduce the risk of errors. For example, you could create a script that automatically sends a daily report to your team, or a script that updates your CRM with new leads.

## 2. Getting Quick Answers

ChatGPT CLI can be used to quickly get answers to questions without having to leave your command line interface. For example, you could ask ChatGPT CLI for the weather forecast, or for the definition of a word. This can save you time and help you stay focused on your work.

## 3. Collaborating with Team Members

ChatGPT CLI can be used to collaborate with team members in real-time. For example, you could use ChatGPT CLI to share code snippets or to discuss project ideas. This can help you work more efficiently and stay on top of your tasks.

## 4. Managing Your Schedule

ChatGPT CLI can be used to manage your schedule and stay organized. For example, you could create a script that reminds you of upcoming meetings or deadlines. This can help you stay on track and avoid missing important events.

Overall, ChatGPT CLI is a versatile tool that can be used in many different ways to improve your workflow. Whether you're automating tasks, getting quick answers, collaborating with team members, or managing your schedule, ChatGPT CLI can help you work more efficiently and effectively.

? Thanks! Now write a rap about that.
Sure thing, here's a rap about ChatGPT CLI:

Verse 1:
Yo, listen up, I got a tool to share
It's called ChatGPT CLI, and it's beyond compare
It can automate tasks, save you time and stress
And help you stay on top of your workflow, no less

Chorus:
ChatGPT CLI, it's the way to go
Streamline your work, and let it flow
Get quick answers, collaborate with your team
Manage your schedule, and live your dream

Verse 2:
You can ask for the weather, or the definition of a word
And get the answer in seconds, it's absurd
You can share code snippets, and discuss project ideas
And work more efficiently, without any fears

Chorus:
ChatGPT CLI, it's the way to go
Streamline your work, and let it flow
Get quick answers, collaborate with your team
Manage your schedule, and live your dream

Verse 3:
You can create custom scripts, and automate tasks
Like sending emails, or updating spreadsheets, it's a blast
You can set reminders, and never miss a beat
And stay on top of your game, and never face defeat

Chorus:
ChatGPT CLI, it's the way to go
Streamline your work, and let it flow
Get quick answers, collaborate with your team
Manage your schedule, and live your dream

Outro:
So if you want to improve your workflow, and be the best
Just give ChatGPT CLI a try, and put it to the test
It's a powerful tool, that can help you achieve
Your goals and dreams, and make you believe.