An interactive AI chatbot for the command line - DSRS
Project description
DSRS CLI Chat 🚀
A lightweight, feature-rich, interactive AI chatbot for your command line, powered by OpenAI-compatible APIs.
Features
- Interactive Chat: Engage in conversations with an AI model directly from your terminal.
- OpenAI Compatible: Connects to any OpenAI-compatible API endpoint.
- Streaming Responses: Watch the AI's response appear in real-time.
- Rich Output: Uses
richfor beautiful Markdown rendering, including code blocks with syntax highlighting. - Advanced Input: Uses
prompt_toolkitfor: - Multi-line input (easy pasting).
- Persistent command history (Up/Down arrows).
- Input clearing (
Ctrl+U). - Tab completion for model selection.
- Interruptible Generation: Stop the AI mid-response with
Ctrl+X. - Model Selection: Choose from available models provided by the API endpoint.
- Custom System Prompt: View and modify the system prompt guiding the AI's behavior.
- Credential Management: Load API Key and Base URL securely from a
.envfile or enter them manually. - Useful Commands:
clear,restart,model,system,instructions,exit/quit. - Exit Summary: Displays the final context sent to the AI and its last response upon quitting.
- Cross-Platform: Designed to work on Linux, macOS, and Windows.
Requirements
- Python 3.7+
- Pip (Python package installer)
- An API Key and Base URL for an OpenAI-compatible API endpoint.
Installation
To install, just run:
pip install dsrs-cli
Configuration
The script needs your API Key and the Base URL for the AI service.
-
Using
.envfile (Recommended): -
Create a file named
.envin the same directory where you run the script (or wheredsrs_cli.pyis located if
installing). -
Add the following lines, replacing the placeholders with your actual credentials:
OPENAI_API_KEY=... BASE_URL=...
-
When you run the script, choose 'y' when asked "Load API Key and Base URL from .env file?".
-
Manual Input:
-
If you don't use a
.envfile or it's missing credentials, the script will prompt you to enter the API Key
(hidden) and Base URL securely when it starts.
Usage
After installing, run:
dsrs-chat
Interacting with the Chat:
- Type your message. For multi-line input, press Esc then Enter (or your terminal's default for submitting multi-line).
- Commands:
- instructions: Show the welcome message and commands again.
- model: Select a different AI model from the available list.
- system: View the current system prompt and optionally change it.
- clear: Clear the terminal screen.
- restart: Restart the chat application.
- exit or quit: Exit the chat application.
- Shortcuts:
- Ctrl+X: Interrupt the AI while it's generating a response.
- Ctrl+U: Clear the current input line.
- Up/Down Arrows (on empty line): Navigate through input history.
- Ctrl+C: Exit the application immediately.
- Ctrl+D (EOF): Exit the application gracefully.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dsrs_cli-0.1.1.tar.gz.
File metadata
- Download URL: dsrs_cli-0.1.1.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
225c48276f73d54325278a4dafb81e40a5f6efa23c950cd0cfff9354b13cddf8
|
|
| MD5 |
68da2862cc99014975b38c5c104c09ec
|
|
| BLAKE2b-256 |
3506cee91267ae8df06f7ab2306dfccb523edd76921dd3fab0a63e726fe16b99
|
File details
Details for the file dsrs_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dsrs_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee8a7bdbc1d2e1844ce21aa3f6fdc95580be5da3c1426b7c24f4a90a75eee2ad
|
|
| MD5 |
b80c522f7fa7f40424758aa92b35d154
|
|
| BLAKE2b-256 |
c717d073be8364cbc67fe0124e4ae0b778a4a4a45204677d0b461fd812058f8e
|