Metadata-Version: 2.4
Name: dsrs-cli
Version: 0.1.0
Summary: An interactive AI chatbot for the command line - DSRS
Home-page: https://github.com/fsaudm/dsrs-cli
Author: Farid Saud
Author-email: gfs3@illinois.edu
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: openai>=1.0
Requires-Dist: python-dotenv
Requires-Dist: rich
Requires-Dist: prompt-toolkit
Requires-Dist: tiktoken
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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 `rich` for beautiful Markdown rendering, including code blocks with syntax highlighting.         
*   **Advanced Input:** Uses `prompt_toolkit` for:                                                                         
  *   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 `.env` file 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:
```bash
pip install dsrs-cli
```



## Configuration                                                                                                           
                                                                                                                         
The script needs your API Key and the Base URL for the AI service.                                                         
                                                                                                                         
*   **Using `.env` file (Recommended):**                                                                                   
  *   Create a file named `.env` in the same directory where you run the script (or where `dsrs_cli.py` is located if    
installing).                                                                                                               
  *   Add the following lines, replacing the placeholders with your actual credentials:                                  
      ```dotenv                                                                                                          
      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 `.env` file 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:

```bash                                                                                                                    
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.                                                                                        
