A Python library with utility functions for interacting with various LLM providers.
poetry installpoetry install --with devpip install -e .poetry add http://git@github.com/atroo/llm-helpers.git
Convert FastAPI uploaded files to the appropriate format for different LLM providers:
from fastapi import FastAPI, UploadFile
from llm_helpers import file_to_message
app = FastAPI()
@app.post("/upload")
async def upload_file(file: UploadFile, provider: str):
message = await file_to_message(file, provider)
# Use the message with your LLM provider
return {"message": message}Supported providers:
openai- OpenAI formatazure- Azure OpenAI formatgroq- Not yet implemented
poetry install --with devpoetry run pytestpoetry run pytest -k test_get_llm_googlepoetry run black src/ tests/poetry run ruff check src/ tests/poetry run mypy src/poetry add package-namellm-helpers/
├── src/
│ └── llm_helpers/
│ ├── __init__.py
│ └── file_utils.py
├── tests/
│ ├── __init__.py
│ └── test_file_utils.py
├── pyproject.toml
├── README.md
└── .gitignore
You can use Poetry to automatically bump the version:
# Patch version (0.1.1 → 0.1.2)
poetry version patch
# Minor version (0.1.1 → 0.2.0)
poetry version minor
# Major version (0.1.1 → 1.0.0)
poetry version majorOr manually edit the version field in pyproject.toml.
poetry buildThis creates distribution files in the dist/ directory.
# First time: configure PyPI credentials
poetry config pypi-token.pypi your-pypi-token
# Publish (builds automatically if needed)
poetry publish
# Or build and publish separately
poetry build
poetry publishOnce published to PyPI, you can install it in another project using UV:
# Install specific version
uv pip install llm-helpers==0.1.2
# Install latest version
uv pip install llm-helpers
# Or add to your project's pyproject.toml or requirements.txt
# Then run: uv pip install -r requirements.txtAlternative: Install directly from Git (without publishing to PyPI)
If you want to install from Git without publishing to PyPI:
# Install from a specific tag/version
uv pip install git+https://github.com/atroo/llm-helpers.git@v0.1.2
# Install from a branch
uv pip install git+https://github.com/atroo/llm-helpers.git@main
# Install from a private repository (requires SSH key setup)
uv pip install git+ssh://git@github.com/atroo/llm-helpers.git@v0.1.2Note: When installing from Git, make sure to tag your releases:
git tag v0.1.2
git push origin v0.1.2MIT