GithubHelp home page GithubHelp logo

atomic14 / command_line_chatgpt Goto Github PK

View Code? Open in Web Editor NEW
128.0 9.0 92.0 11 KB

A command line chat bot using the ChatGPT API from OpenAI

License: The Unlicense

Python 100.00%
chatbot chatgpt chatgpt-api python

command_line_chatgpt's Introduction

Big News!

There's now an official ChatGPT API!!!

Watch the walk-through video for this repo here:

ChatGPT API Walkthrough

If you want to look at the old code for this project Simply clone the repo and checkout the davinci-version branch.

git checkout davinci-version

Otherwise, just use the default main branch and you'll be plugged into the official ChatGPT API!

Command Line ChatGPT Bot

This is a simple chat-bot that uses the OpenAI ChatGPT API.

You can watch the original video walkthrough that uses the davinci-model here. There will be a new video coming shortly to match the new code.

Setup

Make sure you have python3 installed:

python3 --version

Create a virtual environment and install the dependencies:

Linux/Mac:

python3 -m venv venv
. ./venv/bin/activate
pip install -r requirements.txt

Windows:

python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements.txt

Configuration

Copy env.sample to .env and add your OpenAI API key to the file.

OPENAI_API_KEY=<<YOUR_API_KEY>>

Edit main.py and replace <<PUT THE PROMPT HERE>> with your prompt:

e.g. Create a simple AI cocktail assistant

INSTRUCTIONS = """You are an AI assistant that is an expert in alcoholic beverages.
You know about cocktails, wines, spirits and beers.
You can provide advice on drink menus, cocktail ingredients, how to make cocktails, and anything else related to alcoholic drinks.
If you are unable to provide an answer to a question, please respond with the phrase "I'm just a simple barman, I can't help with that."
Please aim to be as helpful, creative, and friendly as possible in all of your responses.
Do not use any external URLs in your answers. Do not refer to any blogs in your answers.
Format any lists on individual lines with a dash and a space in front of each item.
"""

Running

To run just do the following:

Linux/Mac:

. ./venv/bin/activate
python main.py

Windows:

venv\Scripts\activate.bat
python main.py

command_line_chatgpt's People

Contributors

cgreening avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

command_line_chatgpt's Issues

GPT answering out of context

Hello,

I have cloned the exact code and instructions, input my API, ran the code, and it worked. However, I am having a problem where GPT is answering questions of context, please see the attached image, any thoughts?

Screenshot 2023-06-06 163233

Script stop

It is worth considering the possibility of stopping the script.

streamlit_chat

Can you provide me with some guidance as to how to integrate your code with streamlit_chat?

I can't seem to make it work :(

Thank you

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.