Skip to content

Prompter - A Simple CLI Tool for OpenAI API with Templates

Notifications You must be signed in to change notification settings

chrispangg/prompter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prompter - A Simple CLI Tool for OpenAI API with Templates

Prompter is a command-line tool designed to interact with the OpenAI API using predefined templates. It supports various options to customize the API requests.

Features

  • Interact with OpenAI API using CLI
  • Support for predefined templates
  • Adjustable model, temperature, and streaming options

Installation

go install github.com/chrispangg/prompter@latest

Usage

Ask a question to the OpenAI API. Reads input from stdin if no query is provided.

prompter ask "Explain the theory of relativity"

Use pbpaste to pipe clipboard content:

pbpaste | prompter ask

Override the model and temperature with flags:

pbpaste | prompter ask --api-key your_api_key_here --model "gpt-3.5-turbo" --temperature 0.9 --template templates/example.tmpl

Options

  • --api-key or OPENAI_API_KEY: Set your OpenAI API key.
  • --model or -m: Specify the model to use (default: gpt-3.5-turbo).
  • --temperature or -t: Set the sampling temperature (default: 0.1).
  • --template: Path to the template file to use.
  • --streaming: Enable or disable streaming (default: true).

Example with Template

prompter ask "Explain the theory of relativity" --template=templates/write_essay.tmpl

Templates

Templates are used to format the input query. Example templates are provided in the templates directory.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Acknowledgements

This project uses the following libraries:

About

Prompter - A Simple CLI Tool for OpenAI API with Templates

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages