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.
- Interact with OpenAI API using CLI
- Support for predefined templates
- Adjustable model, temperature, and streaming options
go install github.com/chrispangg/prompter@latest
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
--api-key
orOPENAI_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
).
prompter ask "Explain the theory of relativity" --template=templates/write_essay.tmpl
Templates are used to format the input query. Example templates are provided in the templates
directory.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.
This project uses the following libraries: