# Text-Based LLM Interaction System A Python-based system for interacting with an LLM running on LM Studio through a text-based interface. ## Setup Guide For detailed instructions on setting up pyenv and virtual environments, see [setup_guide.md](setup_guide.md). ## Project Structure ``` text_adventure/ ├── main.py # Entry point ├── config.py # Configuration settings ├── llm_client.py # LLM communication ├── interface.py # Text input/output ├── conversation.py # Conversation history management ├── test_interface.py # Test script for interface └── README.md # This file ``` ## Setup ### Option 1: Traditional Setup 1. Ensure you have Python 3.6+ installed 2. Install required dependencies: ```bash pip install -r requirements.txt ``` 3. Make sure LM Studio is running on 10.0.0.200:1234 ### Option 2: Docker Setup (Recommended) 1. Install Docker and Docker Compose 2. Build and run the application: ```bash docker-compose up --build ``` 3. Make sure LM Studio is running on 10.0.0.200:1234 and accessible from the Docker container ### Option 3: Portainer Deployment 1. Ensure you have a Portainer instance running at 10.0.0.199:9000 2. Configure your `.env` file with Portainer credentials (see `.env.example`) 3. Run the deployment script: ```bash python deploy_to_portainer.py ``` 4. Or set environment variables and run: ```bash export PORTAINER_URL=http://10.0.0.199:9000 export PORTAINER_USERNAME=admin export PORTAINER_PASSWORD=yourpassword python deploy_to_portainer.py ``` ## Usage To run the main application: ```bash python main.py ``` ## Testing To test the complete system: ```bash python test_system.py ``` To test just the interface: ```bash python test_interface.py ``` To test connection to LM Studio: ```bash python test_llm_connection.py ``` To test message exchange with LLM: ```bash python test_llm_exchange.py ``` ## Configuration The system is configured to connect to LM Studio at `http://10.0.0.200:1234`. You can modify the `config.py` file to change this setting. ## Components ### Main Application (main.py) The entry point that ties all components together. ### Configuration (config.py) Contains settings for connecting to LM Studio. ### LLM Client (llm_client.py) Handles communication with the LM Studio API. ### Interface (interface.py) Manages text input and output with the user. ### Conversation Manager (conversation.py) Keeps track of the conversation history between user and LLM. ## Testing Run the test_interface.py script to verify the text input/output functionality works correctly.