GithubHelp home page GithubHelp logo

jameswylde / openai-chatgpt-terminal Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 63 KB

Python implementation of OpenAI's ChatGPT integrated into your shell, interactively or passing questions to it from the terminal - with support for custom prompts for honed responses, switching of API model and changing of model temperature.

License: MIT License

Python 100.00%
chatgpt chatgpt-api openai openai-api python shell terminal

openai-chatgpt-terminal's Introduction

ChatGPT in your terminal

OpenAI's ChatGPT integrated into your shell.

Description

Python implementation of OpenAI's ChatGPT intergrated into your shell - interaction can be either calling genie from shell for one off questions, or entering into an interactive chat with genie. There are some chat prompts to use for more honed responses - these can be added or amended in prompts.py

Dependencies

  • Install module dependencies using pip: pip install -r requirements.txt

  • OpenAI API key - you can get one here - Dashboard - Settings - View API Keys - Generate

Installing

  • Clone the repo and copy the folder to a permanent location (including the /src/ folder).

  • Open the script and amend openai.api_key = "API_KEY" with your aforementioned API key and save.

  • Create an alias pointing at the script's location, either in your bash profile ~/.bash_profile or ~/.bashrc or ~/.zshrc - i.e: alias genie='python3 /path/to/genie.py'

Usage

Using your chosen alias you can call it from shell and pass your question as an argument for one off questions:

$ genie "Recommend a python module for LP and link documentation?"

genie

Or by calling the alias without argument to enter an interactive chat with ChatGPT:

$ genie

genie-interactive

The default model used is gpt-3.5-turbo for a more fluent experience as its replies are much faster and API pricing is significantly cheaper.

You can switch API model using the --model argument (run without --model to use the default model) if you'd like to to use gpt-4:

$ genie --model gpt-4

--model will also accept code-davinci-002 & text-davinci-003 - other API models can be seen here OpenAI ChatGPT API Models and added as required to the script.

The temperature used is 0.7 - which appears to be a good balance between creativity and focused responses.

You can switch temperature using the --temp argument (run without --temp to use the default value).

To end the interactive chat, use either bye,quit,q or ctrl+c.

openai-chatgpt-terminal's People

Contributors

jameswylde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

openai-chatgpt-terminal's Issues

You got forked!

Hi James,

Sorry to abuse the issues system like this, but I figured it was less "pushy" than a PR. I recently forked your project as I was looking for an openAI client at the command line that had some form of baked in prompts to choose from. What I've ended up with is a bit more complicated than Genie, but it serves as a jumping off point for some context management experiments I want to do.

Just wanted to say thanks! At this point there isn't much of Genie left in my project, but it was a helpful place to start.

Take a look if you're interested, https://github.com/grobertson/openai-terminal-client

Cheers,
-Grant

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.