Giter Club home page Giter Club logo

chatgpt-from-bash's Introduction

ChatGPT from Bash

This is a Bash script that can be sourced in your .bashrc to query the OpenAI GPT model from the command line. It tracks the conversation history in a file /tmp/gpt_cli_conversation.

Prerequisites

Before you can use this script, you need to set the OPENAI_API_KEY environment variable. You can do this by setting it manually like this: export OPENAI_API_KEY=[your_api_key] Alternatively, you can use a password manager like pass to get the key: export OPENAI_API_KEY=$(pass openaiapikey) If the script can't find the API key, it will try to receive it from pass. You can change this behavior in line 16 of the script.

Usage

To use the script, source it in your .bashrc: source /path/to/ChatGPTfromBash.sh

Then, you can use it like this: gpt Hello, who are you? This will query the model with the given text and print the response to the console.

You can also reset the conversation by using the --reset flag: gpt --reset This will clear the conversation history and start a new conversation. Currently only one conversation can be tracked at a time.

Flags

The following flags are supported:

-h, --help: Show help --reset: Reset the conversation

Acknowledgements

This script was co-authored by ChatGPT - just for good measure...

License

MIT Do as you please.

chatgpt-from-bash's People

Contributors

vvhg1 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.