pynamer/memory-bank/techContext.md

41 lines
1.7 KiB
Markdown

# Tech Context: PyNamer
**Language:** Python 3
**Core Libraries:**
- `litellm`: For interacting with various LLM APIs (OpenAI, Anthropic, etc.). Handles model routing, API key management, and standardized response format.
- `PyYAML`: For parsing the `config.yaml` configuration file.
- `Pillow`: For image manipulation (opening, resizing, saving to buffer).
- `argparse`: Standard library for parsing command-line arguments.
- `base64`: Standard library for encoding image data.
- `io`: Standard library for handling in-memory byte streams (used with Pillow).
- `os`, `pathlib`: Standard libraries for file system operations.
- `logging`: Standard library for application logging.
**Dependencies:**
- Listed in `requirements.txt`.
- Key dependencies: `litellm`, `pyyaml`, `Pillow`.
**Setup & Execution:**
1. **Installation:**
```bash
pip install -r requirements.txt
# or potentially: pip install . (if setup.py is configured correctly)
```
2. **Configuration:**
- Create or modify `config.yaml`.
- Set LLM `api_key` in the config or via environment variable (e.g., `OPENAI_API_KEY`).
- Adjust `model`, `max_tokens`, `temperature`, `resize_max_dimension`, `resize_format`, and `prompts` as needed.
3. **Execution:**
```bash
python pynamer.py <image_path_1> [image_path_2 ...] [-c config.yaml] [-d] [-v]
```
- `<image_path>`: Path to the image file(s). Handles paths with spaces.
- `-c`: Specify a different config file path.
- `-d`: Dry run (preview changes).
- `-v`: Verbose logging.
**Environment:**
- Assumes a standard Python environment where dependencies can be installed via pip.
- Relies on network access to reach the configured LLM API endpoint.