{"id":20625340,"url":"https://github.com/nemmusu/gpt-api","last_synced_at":"2026-01-08T07:37:46.326Z","repository":{"id":214914083,"uuid":"737662912","full_name":"nemmusu/gpt-api","owner":"nemmusu","description":"The GPT class in this Python script is designed to utilize OpenAI's GPT language model to generate responses based on the provided questions.","archived":false,"fork":false,"pushed_at":"2024-06-08T19:38:21.000Z","size":52425,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T16:15:15.057Z","etag":null,"topics":["api","command-line","gpt","interface","openai","pyqt5","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nemmusu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-01T01:19:15.000Z","updated_at":"2024-06-08T19:38:23.000Z","dependencies_parsed_at":"2024-01-15T09:15:52.798Z","dependency_job_id":null,"html_url":"https://github.com/nemmusu/gpt-api","commit_stats":{"total_commits":55,"total_committers":1,"mean_commits":55.0,"dds":0.0,"last_synced_commit":"44ce04b6b0821cbefc0f326d7e0280f81d934725"},"previous_names":["nemmusu/gpt-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemmusu%2Fgpt-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemmusu%2Fgpt-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemmusu%2Fgpt-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemmusu%2Fgpt-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemmusu","download_url":"https://codeload.github.com/nemmusu/gpt-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246329390,"owners_count":20759920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","command-line","gpt","interface","openai","pyqt5","python","python3"],"created_at":"2024-11-16T13:09:19.976Z","updated_at":"2026-01-08T07:37:46.291Z","avatar_url":"https://github.com/nemmusu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Readme\n[README: Italiano](./README_IT.md)\n\n[README: English](./README.md)\n\n# GPT Chat Bot\nThis project provides a Python script to interface with the OpenAI GPT language model and a GUI to use it.\n\n## Table of Contents\n\n1. [Readme](#readme)\n    - [README: Italiano](./README_IT.md)\n    - [README: English](./README.md)\n2. [Installation](#installation)\n3. [Usage](#usage)\n   - [Configuration File](#configuration-file)\n   - [Using the GPT Class](#using-the-gpt-class)\n   - [gpt.py Script](#gptpy-script)\n4. [Interface](#interface)\n5. [Creating the Executable](#creating-the-executable)\n   - [PyInstaller](#pyinstaller)\n   - [cx_Freeze](#cxfreeze)\n6. [Screenshots](#screenshots)\n\n## Installation \u003ca name=\"installation\"\u003e\u003c/a\u003e\nTo install the project, follow these steps:\n\n1. Download the project from the GitHub repository. Open the terminal and navigate to the folder where you want to download the project. You can do this using the `cd` command followed by the folder path.\n    ```shell\n    cd /path/to/folder\n    ```\n2. Clone the repository using the `git clone` command followed by the repository URL:\n    ```shell\n    git clone https://github.com/nemmusu/gpt-api.git\n    ```\n3. Access the project folder:\n    ```shell\n    cd gpt-api\n    ```\n4. Install the required `openai` library for this project:\n    ```shell\n    pip install openai\n    ```\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n### Configuration File \u003ca name=\"configuration-file\"\u003e\u003c/a\u003e\nThe `config.ini` file is used to configure various aspects of the chat bot. Here's an example of how it could be configured:\n\n```ini\n[OPENAI]\napi_key = your_api_key\nquestion = What do you recommend doing today?\ntemperature = 0.7\nmodel = gpt-3.5-turbo\nsystem_role_message = You are an expert assistant and will answer my questions in a specific and detailed manner exclusively in markdown format.\n```\n\n### Using the GPT Class \u003ca name=\"using-the-gpt-class\"\u003e\u003c/a\u003e\nTo use the GPT class, instantiate a GPT object and call the `get_chat_response()` method. All parameters are optional and if not specified, will be retrieved from the configuration file.\n\nHere's an example usage without parameters:\n```python\nfrom gpt import GPT\n\nchatbot = GPT() # Uses default values from the configuration file\nresponse = chatbot.get_chat_response()\nprint(response)\n```\n\nAnd an example usage with parameters:\n```python\nfrom gpt import GPT\n\nchatbot = GPT(config_file='/etc/gpt-api/config.ini', api_key='your_api_key', question='What is the meaning of life?', \n              temperature=0.5, model='gpt-4', \n              system_role_message='You are an expert assistant and will answer my questions in a specific and detailed manner exclusively in markdown format.')\nresponse = chatbot.get_chat_response()\nprint(response)\n```\n\nThe available parameters are:\n\n- `config_file`: The path to the configuration file (default: `config.ini`)\n- `api_key`: The OpenAI API key\n- `question`: The question to pass to the GPT model\n- `temperature`: The temperature for the GPT model\n- `model`: The GPT model to use\n- `system_role_message`: The system role message for the GPT model\n\n### gpt.py Script \u003ca name=\"gptpy-script\"\u003e\u003c/a\u003e\nThe `gpt.py` script can be run standalone or imported as a module. All parameters are optional and if not specified, will be retrieved from the configuration file.\n\nYou can run it using the following command:\n```shell\npython gpt.py --question \"What do you recommend doing today?\" --temperature 0.7 --model gpt-3.5-turbo\n```\nThe available parameters are:\n\n- `--config`: The path to the configuration file (default: `config.ini`).\n- `--api_key`: The API key for OpenAI.\n- `--question`: The question to pass to the GPT model.\n- `--temperature`: The temperature for the GPT model.\n- `--model`: The GPT model to use.\n- `--system_role_message`: The system role message for the GPT model.\n\nTo view the command's help, run:\n```shell\npython gpt.py --help\n```\n\n## Interface \u003ca name=\"interface\"\u003e\u003c/a\u003e\nThe interface implemented in `gui.pyw` uses PyQt5 and other modules. To install, run the following command:\n```shell\npip install pyqt5 markdown bleach pygments openai\n```\nTo run the GUI interface, execute the following command:\n```shell\npython gui.pyw\n```\n\n## Creating the Executable \u003ca name=\"creating-the-executable\"\u003e\u003c/a\u003e\n\n### PyInstaller \u003ca name=\"pyinstaller\"\u003e\u003c/a\u003e\nTo create an executable using PyInstaller, you need to install PyInstaller on your system. You can do this using the following command:\n\n```\npip install pyinstaller\n```\n\nOnce PyInstaller is installed, you can create the executable using the following command:\n\n```\npyinstaller --onefile --name \"GUI_ChatGPT\" gui.pyw --hidden-import=gpt --hidden-import=argparse --hidden-import=configparser --hidden-import=openai --hidden-import=PyQt5.QtCore --hidden-import=PyQt5.QtWidgets\n```\n\nThis command creates a single executable file named \"GUI_ChatGPT\" using \"gui.pyw\" as the entry point. Hidden dependencies such as \"gpt\", \"argparse\", \"configparser\", \"openai\", \"PyQt5.QtCore\", and \"PyQt5.QtWidgets\" are also specified to be included in the executable.\n\n### cx_Freeze \u003ca name=\"cxfreeze\"\u003e\u003c/a\u003e\nTo create an executable using cx_Freeze, you need to install cx_Freeze on your system. You can do this using the following command:\n\n```\npip install cx_Freeze\n```\n\nOnce cx_Freeze is installed, you can create the executable using the following command:\n\n```\npython compile_cx_freeze.py build\n```\n\nThis command will create a structured package with folders containing the executable and the necessary libraries.\n\n\n## Screenshots \u003ca name=\"screenshots\"\u003e\u003c/a\u003e\n\n![Screenshot GPT API](https://github.com/nemmusu/gpt-api/blob/main/screenshots/interface-example.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemmusu%2Fgpt-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemmusu%2Fgpt-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemmusu%2Fgpt-api/lists"}