Giter Club home page Giter Club logo

ask's Introduction

ASK

"ask" is a simple command line tool for asking questions and getting answers. It is designed to be used in terminal for quick and easy access to information. The backend is powered by OpenAI's GPT-4, which is a powerful language model that can answer a wide range of questions. That means you need to provide an API key to use this tool.

Installation

You can install "ask" using pip:

pip install -r requirements.txt

Set OPENAI_API_KEY environment variable to your API key:

export OPENAI_API_KEY="YOUR_API_KEY"

Or you can set it in the .env file located in the root directory of the project:

echo "ASK_GLOBAL_MODEL=\"gpt-4-0125-preview\"
OPENAI_API_KEY=\"YOUR_OPENAI_API_KEY\"" > .env

(Optional) You can also add the "ask" script to your PATH:

modify the ask.sh file to point to the main.py file in the root directory of the project:

#!/bin/bash
cd /path/to/ask/ && python3 /path/to/ask/main.py $@

Then make the script executable:

chmod +x /path/to/ask/ask.sh

Then make a symbolic link to the script in /usr/local/bin:

sudo ln -s /path/to/ask/ask.sh /usr/local/bin/ask

Usage

To use "ask", you need to provide an API key. You can get one from OpenAI's website. Once you have the API key, you can use it like this:

ask ANY_THING

The default model is "gpt-4" and the default temperature is 0.7. You can change these settings using command line options:

ask --model gpt-4 --temperature 0.7 ANY_THING

The default token limit is 128000. You can change this using the --tokens option:

ask -l 16000 ANY_THING

Use the --stream option to keep the chat completion open and wait for more input:

ask -s

for more information, you can use the --help option:

ask --help
usage: main.py [-h] [--token TOKEN] [--model MODEL] [--version] [--tokenCount]
               [--stream] [--temperture TEMPERTURE] [--tokenLimit TOKENLIMIT]
               [string ...]

OpenAI Chatbot

positional arguments:
  string                Questions

options:
  -h, --help            show this help message and exit
  --token TOKEN, -t TOKEN
                        Set the token for the chatbot
  --model MODEL, -m MODEL
                        Set the model for the chatbot
  --version, -v         Show the version of the chatbot
  --tokenCount          Set the token for the chatbot
  --stream, -s          Don't close chat completion and wait for more input
  --temperture TEMPERTURE, -T TEMPERTURE
                        Set the temperture for the chatbot
  --tokenLimit TOKENLIMIT, -l TOKENLIMIT
                        Set the token limit for the chatbot

Note

The ANY_THING is the question you want to ask the chatbot and should not using period or question mark at the end of the question.

ask What is the capital of France
The capital of France is Paris.

If you want to use the symbol, you have to pass the question in the double quote.

ask "What is the capital of France?"
The capital of France is Paris.

The ask command will not render the question for markdown, so the display is plain text. if you want to use the markdown, you will have to do it manually.

ask "What is the capital of France?" > README.md
open README.md

Contributing

Any

ask's People

Contributors

stevenli-phoenix 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.