A command line tool for quick concept lookups
Project description
LiteLookup 🔎
LiteLookup is a command-line tool developed in Python that fetches beginner-level information about any concept directly from the command line. This tool is designed for users who want quick, concise, and accessible explanations without leaving their terminal.
Features
- Command-Line Interface (CLI): Uses
argparse
to handle user inputs. - Error Handling: Validates user input to ensure meaningful queries. Catches special characters and raises appropriate errors.
- API Integration: Utilizes the Groq LLM API to generate concise explanations of the concepts provided.
- Caching: Implements Redis for persistent caching of API responses, reducing unnecessary API calls and improving response times.
- Interactive Shell Session: Launches an intractive shell for faster, continuous lookups after the initial connection establishment. This mode is ideal for making multiple queries in a single session without the overhead of reconnecting for each request.
- Verbose Mode: Use the
-v
flag for more detailed explanations, including examples or code snippets when applicable. - HTTP/2 Support: Uses
httpx
with connection pooling and HTTP/2 for efficient API communication. - Expandable: Designed to be easily extended with new features and enhancements.
Installation
Prerequisites
- Python 3.10 or higher
- Redis server installed and running
- Groq LLM API access — You will need to store a valid Groq API Key as a secret. You can generate one for free here.
Setup
-
Install LiteLookup via pip or pipx:
pip install litelookup
orpipx install litelookup
Check if LiteLookup is correctly installed with
lookup --version
-
Configure the environment variables:
Enter the API Key from Groq in the prompt from the first usage:
>>Enter API KEY here: your-api_key here
Replace "your_api_key_here" with the API key to begin interacting with the tool.
-
Ensure Redis is running:
redis-cli ping
You should get
PONG
which indicates redis is up and running.
Usage
Basic Usage
To fetch information about a concept, use the following command:
lookup "concept"
For example, lookup "git rebase"
Verbose Mode
For a more detailed response, including examples or code snippets:
`lookup "git rebase" -v'
Programming Mode
lookup "programming concept" -p
For example, lookup "print() in python" -p
Interactive Shell Mode
Enter the interactive mode for continuous lookups without reconnecting:
lookup -i
If you wish to generate verbose responses while in the interactive mode, use
-
lookup -i -v
orlookup -iv
The responses you get with this will be slightly detailed without overwhelming you. -
lookup -i -p
or `lookup -ip The responses you get with this will be more finetuned for programming. -
lookup -i -d
orlookup -id
This combines interactive mode with direct mode for quick, concise command-related answers.
To exit the interactive mode, type:
quit
orq
Direct Mode
Get concise, direct answers for command-related queries:
lookup -d "command to ..."
orlookup --direct "how to ..."
For example, lookup -d "command to delete a file in Linux" or lookup -d "how to rollback a commit in Git"
This mode provides brief, actionable responses without additional explanations. For best results, start your query with "command to" or "how to".
Flags
- -p or --programming: Programming-focused responses
- -i or --interactive: Interactive shell mode
- -v or --verbose: Relatively detailed responses
- -d or --direct: Concise, command-related answers
Contributing
If you'd like to contribute to LiteLookup, please fork the repository and submit a pull request. For any issues or suggestions, feel free to open an issue on the GitHub repository.
Contact
For any questions or support, please contact Abdulmumin at [lanreywaju97@gmail.com]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file litelookup-0.2.0.tar.gz
.
File metadata
- Download URL: litelookup-0.2.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f1f46e0ac387bde31ac561f6d488acefa1026c840873297852832b9dc137038 |
|
MD5 | 705ed8332a52a645229e43285c4d7f02 |
|
BLAKE2b-256 | 3155b57d999968ab1330e4dc294c47170c1f4da73f6d4f5b715980fa0b92b18f |
File details
Details for the file litelookup-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: litelookup-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0980da21eb4430bbad68fcc4b1e0aa1ddeb8ca2b34141071c7952af831cbf72c |
|
MD5 | 8b6b332deee167a7bb5c40fdd7674aef |
|
BLAKE2b-256 | 42cac4c3aeb5eac668d8ac55be48b6acbf254b5e2d6802662932172bf9260d46 |