This project provides a flexible client for interacting with Large Language Models (LLM), designed to facilitate information extraction, response generation, and comprehensive testing.
- 🚀 Configurable LLM client
- 🧪 Complete unit test suite
- 🔒 Secure credential management
- 📊 Model performance analysis
- 🌐 Multilingual support
- Python 3.8+
- Account with an LLM API provider (OpenAI, Anthropic, etc.)
- Clone the repository:
git clone https://github.com/seseWho/llm-interaction-client.git
cd llm-interaction-client- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory:
LLM_API_KEY=your_api_key_here
LLM_BASE_URL=https://api.example.com/v1
LLM_MODEL=model_name
from llm_client import LLMClient
from config import API_KEY, BASE_URL, MODEL_NAME
# Create LLM client
client = LLMClient(API_KEY, BASE_URL, MODEL_NAME)
# Generate response
response = client.generate_response("Hello, how are you?")
print(response)python test_suite.pyThe test suite includes:
- Initial connection test
- Response generation
- Response time measurement
- Context length limit
- Multilingual support
- Temperature variation
- JSON generation
- Code generation
- Logical reasoning tests
llm_interaction/
│
├── src/
│ ├── llm_client.py # Main LLM client
│ ├── test_suite.py # Test battery
│ └── config.py # Configurations and constants
│
├── tests/ # Additional tests
│ └── test_llm_client.py
│
├── main.py # Program entry point
└── requirements.txt # Project dependencies
- Modify
config.pyto change configurations - Adjust
llm_client.pyto adapt to different APIs - Extend
test_suite.pywith specific use case tests
- Never commit your API credentials
- Use environment variables
- Limit access to configuration files
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Your Name - sergio.sesena@gmail.com
Project Link: https://github.com/seseWho/llm-interaction-client
Note: This project is under continuous development. Contributions and suggestions are welcome.