1.7 KiB
1.7 KiB
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 theconfig.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:
- Installation:
pip install -r requirements.txt # or potentially: pip install . (if setup.py is configured correctly)
- 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
, andprompts
as needed.
- Create or modify
- Execution:
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.