Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mahmoudfazeli/finetuned_gpt3_virtual_assistants

"Finetuned GPT-3 Virtual Assistants" is an open-source project that enables the creation of virtual assistants for websites or applications using GPT-3. The project includes a script for fine-tuning GPT-3 on a dataset, as well as a web interface for integrating the finetuned model into applications.
https://github.com/mahmoudfazeli/finetuned_gpt3_virtual_assistants

chatgpt python

Last synced: 2 months ago
JSON representation

"Finetuned GPT-3 Virtual Assistants" is an open-source project that enables the creation of virtual assistants for websites or applications using GPT-3. The project includes a script for fine-tuning GPT-3 on a dataset, as well as a web interface for integrating the finetuned model into applications.

Awesome Lists containing this project

README

        

# Finetuned GPT-3 Virtual Assistants

"Finetuned GPT-3 Virtual Assistants" is an open-source project that enables the creation of virtual assistants for websites or applications using GPT-3. The project includes a script for fine-tuning GPT-3 on a dataset, as well as a web interface for integrating the finetuned model into applications. By using this project, a virtual assistant with the ability to understand and respond to natural language queries can be created.

## Requirements

* Python 3.6 or higher
* OpenAI API key (sign up for one at https://beta.openai.com/)
* The following Python packages:
```bash
- openai
- configargparse
- flask
```

## File Structure

```bash
finetuned_gpt3_virtual_assistants/
├── datasets/
│ └── Mental_Health_FAQ/
│ └── Mental_Health_FAQ.csv
├── templates/
│ └── index.html
├── .gitignore
├── assistant_config.ini
├── config.ini
├── flask_app.py
├── LICENSE
├── pre_process.py
├── README.md
└── requirements.txt
```

## API Key

To use the OpenAI API, you will need an API key. You can sign up for a free API key at https://beta.openai.com/.

## Usage:

1. Clone this repository to your local machine:

```bash
git clone https://github.com/mahmoudfazeli/finetuned_gpt3_virtual_assistants.git
```

2. Navigate to the project directory:

```bash
cd finetuned_gpt3_virtual_assistants
```

3. Install the required dependencies:

```bash
pip install -r requirements.txt
```

4. (Optional) Create a `config.ini` file in the root directory with the following structure:

```bash
[preprocess]
csv-file =
prompt-column =
completion-column =
```

5. If you created the `config.ini` file, you can run:

```bash
python pre_process.py -c config.ini
```

alternatively, you can run:

```bash
python pre_process.py --csv-file --prompt-column --completion-column .json` in the same directory as the CSV file. This JSON file will contain a list of dictionaries, where each dictionary represents a row in the CSV file, with the keys being the column names and the values being the cell values. This JSON file can then be used to fine-tune a GPT model.

6. The following assumes you've already prepared training data following the above instructions.
Start your fine-tuning job using the OpenAI CLI:

```bash
openai api fine_tunes.create -t -m
```

7. Create a config file named `assistant_config.ini` and specify the assistant's name and identity. For example:

```bash
[ASSISTANT]
model_name = davinci:ft-personal-2023-01-11-15-48-39
assistant_name = Dr. Bot
description = Dr. Bot is a friendly and helpful virtual mental health assistant Bot who can always offer support and guidance. Dr. Bot is non-judgmental and patient, providing comfort and understanding to anyone who seeks his help. Dr. Bot is knowledgeable and understanding, and strives to provide the best advice and support possible.
```

8. Run the following script to start the Flask web server:

```bash
python flask_app.py -c assistant_config.ini
```

10. Open a web browser and go to http://localhost:5000 to access the chatbot interface.

## Contributions

We welcome contributions to this project! If you want to contribute, please follow these guidelines:

1. Fork the repository and create a new branch for your changes.

2. Make sure that your code follows the style guidelines of the project (e.g. PEP 8 for Python).

3. Test your changes thoroughly before submitting a pull request.

4. Make sure that your pull request includes detailed descriptions of the changes you made and why you made them.

5. We will review all pull requests and may ask you to make additional changes before merging. Thank you for your contribution!

## Contact

If you have any questions or suggestions about this project, please don't hesitate to send an email to [email protected].

## License

This project is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/mahmoudfazeli/finetuned_gpt3_virtual_assistants/blob/main/LICENSE) file for details.