Giter VIP home page Giter VIP logo

conscious-gpt's Introduction

conscious-gpt

ChatGPT

ChatGPT is a Python script that uses OpenAI's GPT-3 natural language processing model to create a chatbot that can answer questions and generate new questions based on a summary of previous questions. The chatbot stores conversation history in a local SQLite database, allowing it to learn and improve over time.

Prerequisites

To run ChatGPT, you will need:

  • Python 3.x
  • An OpenAI API key
  • The openai, sqlite3, nltk, and gensim Python packages

Getting Started

  1. Clone the repository or download the chatgpt.py file.

  2. Install the required packages using pip:

    pip install openai sqlite3 nltk gensim
    
  3. Set your OpenAI API key as the value of the openai.api_key variable at the top of the chatgpt.py file.

  4. Run the script using the following command:

    python chatgpt.py
    
  5. The script will prompt you to enter questions or responses. ChatGPT will respond with a generated question or a response based on the input and the summary of previous questions stored in the database.

How it Works

When you run ChatGPT, it connects to a local SQLite database (chat_history.db) that stores the conversation history. If the database does not exist, the script creates it and creates a table to store the conversation history.

The script then enters a loop, prompting the user to enter a question or response. The script retrieves all previous questions from the database and concatenates them into a single text string. It then uses the summarize_text function to generate a summary of the previous questions.

The generate_question function uses the summary text to prompt the user to generate a new question. The user's input is then passed to the ask_gpt function, which generates a response using the GPT-3 model.

The response is printed to the console, and the conversation is inserted into the database. If the user enters "exit", the script terminates and the database connection is closed.

Contributing

Contributions to ChatGPT are welcome! If you find a bug or have a suggestion for an improvement, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

conscious-gpt's People

Contributors

ali60 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.