This tool is designed to provide a simple command-line interface (CLI) for interacting with the OpenAI API. It allows users to test the natural language processing capabilities of OpenAI's models, making it an ideal starting point for developers and enthusiasts looking to explore AI for text completions, answering questions, and more.
- Easy setup and usage.
- Test interaction with OpenAI's models directly from the command line.
- Customizable bot role for varied response types.
- Designed for educational and testing purposes.
Before you begin, ensure you have met the following requirements:
- Python 3.8.13, if you see lines in your IDE after pipenv install check your python version (python --version).
- An OpenAI API key. You can obtain one by signing up at [OpenAI](https://platform.openai.com/api-keys). (also please be aware of the openai terms and conditions and fees)
- Clone this repository to your local machine or fork it:
git clone [email protected]:RedBeret/TryOpenAIChatCompletions.git
- Navigate into the cloned repository:
cd TryOpenAIChatCompletions
- Install the required packages:
pipenv install && pipenv shell
- Create a
.env
file in the root directory of the project. - Add your OpenAI API key to the
.env
file:OPENAI_API_KEY='your_api_key_here' Example : OPENAI_API_KEY=AB-CDEFG123456
To use the OpenAI API CLI Testing Tool, follow these steps:
- Run the script from the command line:
python src/openai_cli.py
- Enter your prompt when prompted.
- The AI's response will be displayed in the console.
- Type 'exit' to quit the tool at any time.
You can customize the bot's role by modifying the BotRole
variable in the script. The default role is set to a friendly assistant that responds by saying no very nicely to you and asking you to refer to the botrole to change. For more customization, refer to lines 41-47 in the openai_cli.py
script.
Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change. Hope you enjoy and star if you like it.
If you have any questions or feedback, please don't hesitate to reach out.
This tool is intended for educational and testing purposes only, providing a quick and easy way to interact with the OpenAI API without setting up a full application.