Skip to main content

A CLI tool for getting quick answers to programming questions

Project description

Asker

As someone who is relatively new to programming, I always forget certain commands that I need in my projects. That's why I built Asker.

Asker is the best way to get command related questions, straight in your terminal/command line.

Currently, you have to set this up with your own API keys, and the only model provider that is supported is OpenAI (save the API key as an environment variable called OPENAI_API_KEY on your machine, see [https://platform.openai.com/docs/quickstart#:~:text=Create%20an%20API%20key%20in,environment%20variable%20in%20your%20terminal]). However it is very easy to add more. Just clone this repository, and add the new model provider clients/classes to the llm.py file, following what I have done with the OpenAI client. These should show up in the config, but you'll have to double check this.

However, this means that this tool unfortunately costs money, but it is still useful and you'll only be charged a small fraction of a cent per question (depending on the model you use).

How to use

Asker is super simple to use, just invoke it from the command line and ask a question as follows:

>>> ask how to create a python virtual environment
Asker using OpenAI
1. python3 -m venv myenv - Creates a new virtual environment named 'myenv'.
2. source myenv/bin/activate - Activates the virtual environment.
3. deactivate - Deactivates the virtual environment.

Here are a couple more examples:

>>> ask how to convert video to audio using ffmpeg
Asker using OpenAI
1. ffmpeg -i input.mp4 output.mp3 - Converts video file to audio file.
>>> ask How do I convert image size in ffmpeg
Asker using OpenAI
1. ffmpeg -i input.jpg -filter:v scale=h=1024 output.jpg - Resizes the image to a height of 1024 pixels.
2. ffmpeg -i input.jpg -filter:v scale=w:h=1:1 output.jpg - Resizes image to width and height that are equal
3. ffmpeg -i input.jpg -filter:v scale=force_original output.jpg - Preserving original aspect ratio.

Commands

Built in commands

  • prev: Shows the results from the previous question.
  • --clear: Clears the history
  • --version: Shows Asker version
  • --model: Shows the model being used (for now always OpenAI)
  • --help: Shows this help message

Running commands

Commands can be run by entering the number of the command you want to run. For example:

>>> ask How do I convert image size in ffmpeg
Asker using OpenAI
1. ffmpeg -i input.jpg -filter:v scale=h=1024 output.jpg - Resizes the image to a height of 1024 pixels.
2. ffmpeg -i input.jpg -filter:v scale=w:h=1:1 output.jpg - Resizes image to width and height that are equal
3. ffmpeg -i input.jpg -filter:v scale=force_original output.jpg - Preserving original aspect ratio.

>>> ask 2
Running command: ffmpeg -i input.jpg -filter:v scale=w:h=1:1 output.jpg
<result shows up here if there is one>

Things I may add in the future

  • Add more model providers (you could do this yourself)
  • Add favourites - saved commands you'd want to use and can invoke, similar to running commands regularly.

I also think that the next evolution of something like this is a way to get LLMs to control your computer and automate much of this stuff for you based on prompts. For example, you could ask a sytsem: "can you convert the word documents in my writing folder into pdfs?" Obviously this is very different to what asker is, but it would be something cool to look into in the future. For now Asker is just fine.

The closest thing I have found to what I described is this: https://github.com/OpenInterpreter/open-interpreter

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asker_cli-0.2.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asker_cli-0.2.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file asker_cli-0.2.0.tar.gz.

File metadata

  • Download URL: asker_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for asker_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 aae946d509561d163e531f1ae1e6b475de73636930347dd0a2cd1157005a0da1
MD5 49d9cb2f1414848d54fca476afcf007a
BLAKE2b-256 321f31e66611ac93f66160d9726d3cec2a42dddb780698d565c2ad4ea7f82b51

See more details on using hashes here.

File details

Details for the file asker_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: asker_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for asker_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93a16a8967cca03b62f7e149c7d941b644e7aaa69a52fb10ef136bfd320f7a47
MD5 5606d24f710f5ccd99251960d059645e
BLAKE2b-256 22d98b83aa912b3471f7597890bc028f0df83356b14cc62db02aa7fb7b59fd5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page