This project is an example of how to use the OpenAI API to create a chatbot using the GPT-3.5 Turbo model. The application is written in Python and utilizes the OpenAI, Typer, and Rich libraries. The creator of this code is MoureDev. The following is the link of the tutorial and the author's contacts: https://moure.dev/
Crea una APP con PYTHON y CHATGPT desde cero: https://www.youtube.com/watch?v=b8COygWdvmw
To install the necessary libraries, run the following command:
pip install openai typer[all] rich
- Open the command prompt by typing "cmd" in the search bar and pressing Enter.
- Navigate to the directory where you want to create your virtual environment using the
cd
command. - Type the following command to create a virtual environment with the name "myenv":
python -m venv myenv
- Activate the virtual environment by running the activate script:
myenv\Scripts\activate
You can now install packages and run Python scripts within the virtual environment. To exit the virtual environment, simply type:
deactivate
- Open the Terminal application.
- Navigate to the directory where you want to create your virtual environment using the
cd
command. - Type the following command to create a virtual environment with the name "myenv":
python3 -m venv myenv
- Activate the virtual environment by running the activate script:
source myenv/bin/activate
You can now install packages and run Python scripts within the virtual environment. To exit the virtual environment, simply type:
deactivate
The application will prompt you for input and respond with generated text based on the GPT-3.5 model. Use the exit
command to quit the application or new
to start a new conversation.
- OpenAI module: https://github.com/openai/openai-python
- ChatGPT API documentation: https://platform.openai.com/docs/api-reference/chat
- Typer: https://typer.tiangolo.com
- Rich: https://rich.readthedocs.io/en/stable/