Skip to content

Rishang/heygpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

55 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

heygpt ๐Ÿ”ฎ

Downloads

A simple command line tool to generate text using OpenAI GPT or Palm based on ready made templated prompts.

Purpose

  • To provide a simple command line tool to generate text using GPT or Palm based on ready made templated prompts, in both cli as well as web-ui interface.

  • CLI demo

  • UI demo

Installation

  • There is an optional dependency of fzf for interactive prompt selection. You can install it using your package manager.
  • refer: fzf README for more info on steps to install fzf.
pip install heygptcli

help page:

heygpt --help

For debug logs use: export LOG_LEVEL=DEBUG or set LOG_LEVEL=DEBUG on windows.

Configuration

You will need openai API credentials to use heygpt. You can get them from here.

# gpt custom prompts (optional)
GPT_PROMPT_URL=<url-to-your-prompt-file>

# openai
OPENAI_API_KEY=<your-openai-api-key>
OPENAI_ORG=<org-*****> # optional openai organization id
OPENAI_MODEL=gpt-4 # optional openai model name

# palm (optional)
# ref: https://github.com/dsdanielpark/palm-API
PALM_API_KEY=<your-palm-api-key>

In order to configure them you can use heygpt config command:

โฏ heygpt config --help

 Usage: heygpt config [OPTIONS]

 Configure heygpt.

โ•ญโ”€ Options -------------------------------------------------+
โ”‚ --prompt-file         TEXT  Prompt file path.             |
โ”‚ --prompt-url          TEXT  Prompt file url.              |
โ”‚ --openai-key          TEXT  OpenAI API key.               |
โ”‚ --openai-org          TEXT  OpenAI organization id.       |
โ”‚ --openai-model        TEXT  OpenAI model name.            |
โ”‚ --palm-key            TEXT  palm API key.                 |
|                                                           |
โ”‚ --help                      Show this message and exit.   |
------------------------------------------------------------+
heygpt config --openai-key <your-openai-api-key>

Using local/remote prompts

Prompt csv formate

Title,Command
<Your title for promot>,<your command for promopt>

Here, --prompt-url and --prompt-file is optional. If you want to use own custom prompts.

For providing a URL of csv file containing your prompts.

# remote csv file
heygpt config --prompt-url <url-to-your-prompt-file.csv>

Note: This is the default csv used for prompts: default-prompts.csv, for using your own prompts, you need to follow the same format as in this file.

For your own prompts by providing a URL to a csv file containing your prompts. You can also use local csv file by providing a relative path to it.

# local csv file
heygpt config --prompt-file ~/path/to/prompts.csv

Usage Examples

Asking heygpt to perform a cretain task based on prompt template:

heygpt ask
  • heygpt will ask you to choose a prompt from a list of available templates.

  • After that, it will ask you to enter your query/task and will provide you with the result based on type of prompt you selected.

  • If you want to see output from palm instead of openai gpt, you can pass --palm flag to ask command.

heygpt ask --palm
  • For asking queries without any prompt templates you can use --no-prompt flag.
heygpt ask --no-prompt

Convert audio to text using heygpt:

heygpt wisper ../path/to/audio.mp3
  • You can provide standard output as well to heygpt ask

    echo "why sky is blue" | heygpt ask --no-prompt

    An other way to use it can be providing wisper audio 2 text, output to heygpt ask:

    heygpt wisper ../path/to/audio.mp3 | heygpt ask

Using heygpt in Web-UI mode:

heygpt stream

This will start a streamlit server on localhost:

Using heygpt as an API:

heygpt api

This will start a fastapi server on localhost: