llm-pycascade 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- llm_pycascade-0.1.0/.github/workflows/python-publish.yml +72 -0
- llm_pycascade-0.1.0/.github/workflows/rtd-publish.yml +18 -0
- llm_pycascade-0.1.0/.gitignore +219 -0
- llm_pycascade-0.1.0/.kilo/plans/1784060424714-mkdocs-rtd-docs-plan.md +240 -0
- llm_pycascade-0.1.0/.readthedocs.yaml +24 -0
- llm_pycascade-0.1.0/LICENSE +21 -0
- llm_pycascade-0.1.0/PKG-INFO +259 -0
- llm_pycascade-0.1.0/README.md +224 -0
- llm_pycascade-0.1.0/config.example.toml +63 -0
- llm_pycascade-0.1.0/docs/changelog.md +29 -0
- llm_pycascade-0.1.0/docs/concepts.md +111 -0
- llm_pycascade-0.1.0/docs/configuration.md +80 -0
- llm_pycascade-0.1.0/docs/error-handling.md +83 -0
- llm_pycascade-0.1.0/docs/index.md +33 -0
- llm_pycascade-0.1.0/docs/installation.md +47 -0
- llm_pycascade-0.1.0/docs/providers.md +118 -0
- llm_pycascade-0.1.0/docs/quickstart.md +87 -0
- llm_pycascade-0.1.0/docs/reference/cascade.md +5 -0
- llm_pycascade-0.1.0/docs/reference/config.md +5 -0
- llm_pycascade-0.1.0/docs/reference/db.md +5 -0
- llm_pycascade-0.1.0/docs/reference/error.md +5 -0
- llm_pycascade-0.1.0/docs/reference/models.md +8 -0
- llm_pycascade-0.1.0/docs/reference/persistence.md +5 -0
- llm_pycascade-0.1.0/docs/reference/providers.md +18 -0
- llm_pycascade-0.1.0/docs/reference/secrets.md +5 -0
- llm_pycascade-0.1.0/docs/requirements.txt +3 -0
- llm_pycascade-0.1.0/docs/secrets.md +83 -0
- llm_pycascade-0.1.0/docs/tools.md +147 -0
- llm_pycascade-0.1.0/mkdocs.yml +105 -0
- llm_pycascade-0.1.0/pyproject.toml +75 -0
- llm_pycascade-0.1.0/src/llm_pycascade/__init__.py +47 -0
- llm_pycascade-0.1.0/src/llm_pycascade/cascade.py +287 -0
- llm_pycascade-0.1.0/src/llm_pycascade/config.py +193 -0
- llm_pycascade-0.1.0/src/llm_pycascade/db.py +123 -0
- llm_pycascade-0.1.0/src/llm_pycascade/error.py +139 -0
- llm_pycascade-0.1.0/src/llm_pycascade/models/__init__.py +14 -0
- llm_pycascade-0.1.0/src/llm_pycascade/models/conversation.py +101 -0
- llm_pycascade-0.1.0/src/llm_pycascade/models/response.py +95 -0
- llm_pycascade-0.1.0/src/llm_pycascade/models/tool.py +19 -0
- llm_pycascade-0.1.0/src/llm_pycascade/persistence.py +49 -0
- llm_pycascade-0.1.0/src/llm_pycascade/providers/__init__.py +21 -0
- llm_pycascade-0.1.0/src/llm_pycascade/providers/anthropic.py +183 -0
- llm_pycascade-0.1.0/src/llm_pycascade/providers/base.py +50 -0
- llm_pycascade-0.1.0/src/llm_pycascade/providers/gemini.py +188 -0
- llm_pycascade-0.1.0/src/llm_pycascade/providers/ollama.py +152 -0
- llm_pycascade-0.1.0/src/llm_pycascade/providers/openai.py +178 -0
- llm_pycascade-0.1.0/src/llm_pycascade/secrets.py +158 -0
- llm_pycascade-0.1.0/tests/conftest.py +1 -0
- llm_pycascade-0.1.0/tests/test_cascade.py +80 -0
- llm_pycascade-0.1.0/tests/test_error.py +94 -0
- llm_pycascade-0.1.0/tests/test_ollama_provider.py +102 -0
- llm_pycascade-0.1.0/tests/test_openai_provider.py +198 -0
- llm_pycascade-0.1.0/uv.lock +841 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Install uv
|
|
26
|
+
uses: astral-sh/setup-uv@v7
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
run: uv python install
|
|
30
|
+
|
|
31
|
+
- name: Install the project
|
|
32
|
+
run: uv sync --locked --all-extras --dev
|
|
33
|
+
|
|
34
|
+
- name: Build
|
|
35
|
+
run: uv build
|
|
36
|
+
|
|
37
|
+
- name: Upload distributions
|
|
38
|
+
uses: actions/upload-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: release-dists
|
|
41
|
+
path: dist/
|
|
42
|
+
|
|
43
|
+
pypi-publish:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
needs:
|
|
46
|
+
- release-build
|
|
47
|
+
permissions:
|
|
48
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
49
|
+
id-token: write
|
|
50
|
+
|
|
51
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
52
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
53
|
+
environment:
|
|
54
|
+
name: pypi
|
|
55
|
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
|
56
|
+
# url: https://pypi.org/p/YOURPROJECT
|
|
57
|
+
#
|
|
58
|
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
59
|
+
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
60
|
+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
|
61
|
+
|
|
62
|
+
steps:
|
|
63
|
+
- name: Retrieve release distributions
|
|
64
|
+
uses: actions/download-artifact@v4
|
|
65
|
+
with:
|
|
66
|
+
name: release-dists
|
|
67
|
+
path: dist/
|
|
68
|
+
|
|
69
|
+
- name: Publish release distributions to PyPI
|
|
70
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
71
|
+
with:
|
|
72
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Publish to ReadTheDocs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
trigger-rtd-build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- name: Trigger ReadTheDocs build
|
|
13
|
+
run: |
|
|
14
|
+
VERSION=${{ github.event.release.tag_name }}
|
|
15
|
+
curl -X POST \
|
|
16
|
+
-H "Authorization: Token ${{ secrets.RTD_TOKEN }}" \
|
|
17
|
+
-H "Content-Type: application/json" \
|
|
18
|
+
https://readthedocs.org/api/v3/projects/llm-pycascade/versions/$VERSION/builds/
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
.docs-venv/
|
|
170
|
+
|
|
171
|
+
# mypy
|
|
172
|
+
.mypy_cache/
|
|
173
|
+
.dmypy.json
|
|
174
|
+
dmypy.json
|
|
175
|
+
|
|
176
|
+
# Pyre type checker
|
|
177
|
+
.pyre/
|
|
178
|
+
|
|
179
|
+
# pytype static type analyzer
|
|
180
|
+
.pytype/
|
|
181
|
+
|
|
182
|
+
# Cython debug symbols
|
|
183
|
+
cython_debug/
|
|
184
|
+
|
|
185
|
+
# PyCharm
|
|
186
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
187
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
188
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
189
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
190
|
+
# .idea/
|
|
191
|
+
|
|
192
|
+
# Abstra
|
|
193
|
+
# Abstra is an AI-powered process automation framework.
|
|
194
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
195
|
+
# Learn more at https://abstra.io/docs
|
|
196
|
+
.abstra/
|
|
197
|
+
|
|
198
|
+
# Visual Studio Code
|
|
199
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
200
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
201
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
202
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
203
|
+
# .vscode/
|
|
204
|
+
# Temporary file for partial code execution
|
|
205
|
+
tempCodeRunnerFile.py
|
|
206
|
+
|
|
207
|
+
# Ruff stuff:
|
|
208
|
+
.ruff_cache/
|
|
209
|
+
|
|
210
|
+
# PyPI configuration file
|
|
211
|
+
.pypirc
|
|
212
|
+
|
|
213
|
+
# Marimo
|
|
214
|
+
marimo/_static/
|
|
215
|
+
marimo/_lsp/
|
|
216
|
+
__marimo__/
|
|
217
|
+
|
|
218
|
+
# Streamlit
|
|
219
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Plan: MkDocs Documentation Site for Read the Docs
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Create a Material-themed MkDocs documentation site for `llm-pycascade` that builds on Read the Docs (RTD), wired to the existing `.readthedocs.yaml` (which already declares `configuration: mkdocs.yml` but the file does not yet exist). API reference is auto-generated from docstrings via `mkdocstrings`.
|
|
5
|
+
|
|
6
|
+
## Confirmed Decisions
|
|
7
|
+
- **API reference**: auto-generated with `mkdocstrings[python]` (Google-style docstrings already present on all public symbols).
|
|
8
|
+
- **Content**: dedicated, structured `docs/` site (README stays as the GitHub landing page).
|
|
9
|
+
- **Theme/output**: `mkdocs-material`, HTML only.
|
|
10
|
+
- **Config location**: `mkdocs.yml` at repo root (matches existing `.readthedocs.yaml`), Markdown pages under `docs/`.
|
|
11
|
+
|
|
12
|
+
## Key Context Found in Code
|
|
13
|
+
- Public API surface (`src/llm_pycascade/__init__.py`): `run_cascade`, `AppConfig`, `CascadeConfig`, `CascadeEntry`, `DatabaseConfig`, `FailureConfig`, `ProviderConfig`, `ProviderType`, `load_config`, `init_db`, `CascadeError`, `ProviderError`, `ContentBlock`, `Conversation`, `LlmResponse`, `Message`, `MessageRole`, `ToolDefinition`, `__version__`.
|
|
14
|
+
- Modules to expose in reference: `cascade`, `config`, `models` (conversation/response/tool), `providers` (base + openai/anthropic/gemini/ollama), `error`, `db`, `persistence`, `secrets`.
|
|
15
|
+
- RTD project slug = `llm-pycascade` (from `.github/workflows/rtd-publish.yml`). Site URL: `https://llm-pycascade.readthedocs.io/`. Repo: `https://github.com/paluigi/llm-pycascade`.
|
|
16
|
+
- Python build target on RTD: `3.13` (per `.readthedocs.yaml`).
|
|
17
|
+
- `config.example.toml` is a complete reference; reuse its content in the configuration page.
|
|
18
|
+
|
|
19
|
+
## Docstring / API Notes (must follow to avoid broken examples)
|
|
20
|
+
- `ContentBlockType` is NOT in `__all__`/`models.__init__`. In the tools guide import it explicitly: `from llm_pycascade.models.response import ContentBlockType`.
|
|
21
|
+
- The README quickstart uses a fragile `config.database.path.replace("~", "/home/user")`. In the docs quickstart use robust expansion instead: `from llm_pycascade.config import expand_tilde` (or `os.path.expanduser`).
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## File Inventory to Create
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
mkdocs.yml # root config (Material theme + mkdocstrings)
|
|
29
|
+
docs/
|
|
30
|
+
├── requirements.txt # docs build deps
|
|
31
|
+
├── index.md # landing/overview
|
|
32
|
+
├── installation.md # pip, uv, [keyring] extra, Python >=3.10
|
|
33
|
+
├── quickstart.md # minimal runnable async example (robust path expansion)
|
|
34
|
+
├── configuration.md # TOML schema: providers, cascades, database, failure_persistence, LLM_PYCASCADE_CONFIG
|
|
35
|
+
├── concepts.md # cascade, failover, cooldown/backoff table, Retry-After, persistence, attempt log
|
|
36
|
+
├── providers.md # built-in providers, base_url override, OpenAI-compatible endpoints
|
|
37
|
+
├── tools.md # tool/function calling guide (correct ContentBlockType import)
|
|
38
|
+
├── secrets.md # keyring integration vs env vars, resolution order, mask_key
|
|
39
|
+
├── error-handling.md # ProviderError variants + properties, CascadeError, failed-prompt JSON
|
|
40
|
+
├── changelog.md # v0.1.0 entry; link to GitHub releases
|
|
41
|
+
└── reference/
|
|
42
|
+
├── cascade.md # ::: llm_pycascade.cascade
|
|
43
|
+
├── config.md # ::: llm_pycascade.config
|
|
44
|
+
├── models.md # ::: llm_pycascade.models (+ conversation, response, tool)
|
|
45
|
+
├── providers.md # ::: llm_pycascade.providers (+ base + each impl)
|
|
46
|
+
├── error.md # ::: llm_pycascade.error
|
|
47
|
+
├── db.md # ::: llm_pycascade.db
|
|
48
|
+
├── persistence.md # ::: llm_pycascade.persistence
|
|
49
|
+
└── secrets.md # ::: llm_pycascade.secrets
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Files to Edit
|
|
53
|
+
- `.readthedocs.yaml` — enable the commented-out `python.install` block so RTD installs docs deps **and** the project (so `mkdocstrings`/griffe can introspect it).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## mkdocs.yml (skeleton to implement)
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
site_name: llm-pycascade
|
|
61
|
+
site_url: https://llm-pycascade.readthedocs.io/
|
|
62
|
+
site_description: Resilient cascading LLM inference with failover, circuit breaking, and retry cooldowns.
|
|
63
|
+
site_author: Luigi
|
|
64
|
+
repo_url: https://github.com/paluigi/llm-pycascade
|
|
65
|
+
repo_name: paluigi/llm-pycascade
|
|
66
|
+
edit_uri: edit/main/docs/
|
|
67
|
+
|
|
68
|
+
docs_dir: docs
|
|
69
|
+
|
|
70
|
+
theme:
|
|
71
|
+
name: material
|
|
72
|
+
features:
|
|
73
|
+
- navigation.tabs
|
|
74
|
+
- navigation.sections
|
|
75
|
+
- navigation.indexes
|
|
76
|
+
- navigation.top
|
|
77
|
+
- content.code.copy
|
|
78
|
+
- content.code.annotate
|
|
79
|
+
- content.tabs.link
|
|
80
|
+
- search.suggest
|
|
81
|
+
- search.highlight
|
|
82
|
+
- toc.follow
|
|
83
|
+
palette:
|
|
84
|
+
- media: "(prefers-color-scheme: light)"
|
|
85
|
+
scheme: default
|
|
86
|
+
toggle:
|
|
87
|
+
icon: material/brightness-7
|
|
88
|
+
name: Switch to dark mode
|
|
89
|
+
- media: "(prefers-color-scheme: dark)"
|
|
90
|
+
scheme: slate
|
|
91
|
+
toggle:
|
|
92
|
+
icon: material/brightness-4
|
|
93
|
+
name: Switch to light mode
|
|
94
|
+
icon:
|
|
95
|
+
repo: fontawesome/brands/github
|
|
96
|
+
|
|
97
|
+
nav:
|
|
98
|
+
- Overview: index.md
|
|
99
|
+
- Installation: installation.md
|
|
100
|
+
- Quickstart: quickstart.md
|
|
101
|
+
- Configuration: configuration.md
|
|
102
|
+
- Concepts:
|
|
103
|
+
- How it works: concepts.md
|
|
104
|
+
- Providers: providers.md
|
|
105
|
+
- Tools & function calling: tools.md
|
|
106
|
+
- Secrets & keyring: secrets.md
|
|
107
|
+
- Error handling: error-handling.md
|
|
108
|
+
- API Reference:
|
|
109
|
+
- cascade: reference/cascade.md
|
|
110
|
+
- config: reference/config.md
|
|
111
|
+
- models: reference/models.md
|
|
112
|
+
- providers: reference/providers.md
|
|
113
|
+
- error: reference/error.md
|
|
114
|
+
- db: reference/db.md
|
|
115
|
+
- persistence: reference/persistence.md
|
|
116
|
+
- secrets: reference/secrets.md
|
|
117
|
+
- Changelog: changelog.md
|
|
118
|
+
|
|
119
|
+
markdown_extensions:
|
|
120
|
+
- admonition
|
|
121
|
+
- attr_list
|
|
122
|
+
- def_list
|
|
123
|
+
- footnotes
|
|
124
|
+
- md_in_html
|
|
125
|
+
- tables
|
|
126
|
+
- toc:
|
|
127
|
+
permalink: true
|
|
128
|
+
- pymdownx.details
|
|
129
|
+
- pymdownx.superfences
|
|
130
|
+
- pymdownx.highlight:
|
|
131
|
+
anchor_linenums: true
|
|
132
|
+
line_spans: __span
|
|
133
|
+
pygments_lang_class: true
|
|
134
|
+
- pymdownx.inlinehilite
|
|
135
|
+
- pymdownx.tabbed:
|
|
136
|
+
alternate_style: true
|
|
137
|
+
- pymdownx.snippets
|
|
138
|
+
|
|
139
|
+
plugins:
|
|
140
|
+
- search
|
|
141
|
+
- mkdocstrings:
|
|
142
|
+
default_handler: python
|
|
143
|
+
handlers:
|
|
144
|
+
python:
|
|
145
|
+
paths: [src]
|
|
146
|
+
options:
|
|
147
|
+
docstring_style: google
|
|
148
|
+
show_source: true
|
|
149
|
+
show_root_heading: true
|
|
150
|
+
show_root_full_path: false
|
|
151
|
+
show_symbol_type_heading: true
|
|
152
|
+
show_symbol_type_toc: true
|
|
153
|
+
show_signature_annotations: true
|
|
154
|
+
separate_signature: true
|
|
155
|
+
merge_init_into_class: true
|
|
156
|
+
heading_level: 2
|
|
157
|
+
|
|
158
|
+
extra:
|
|
159
|
+
social:
|
|
160
|
+
- icon: fontawesome/brands/github
|
|
161
|
+
link: https://github.com/paluigi/llm-pycascade
|
|
162
|
+
version:
|
|
163
|
+
provider: mike
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
> Note: `paths: [src]` lets griffe resolve `llm_pycascade` from source without a runtime import. Installing the package on RTD (via `python.install`) is still done as a safety net.
|
|
167
|
+
|
|
168
|
+
## .readthedocs.yaml change
|
|
169
|
+
|
|
170
|
+
Replace the commented `python:` block with:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
python:
|
|
174
|
+
install:
|
|
175
|
+
- requirements: docs/requirements.txt
|
|
176
|
+
- method: pip
|
|
177
|
+
path: .
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## docs/requirements.txt
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
mkdocs>=1.6
|
|
184
|
+
mkdocs-material>=9.5
|
|
185
|
+
mkdocstrings[python]>=0.26
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
(`mike` is intentionally NOT required; `version.provider: mike` is a no-op on RTD unless configured — drop the `extra.version` block if you prefer zero-unused config.)
|
|
189
|
+
|
|
190
|
+
## Reference page content (each `reference/*.md`)
|
|
191
|
+
Each file is one or more `mkdocstrings` cross-references, e.g. `reference/models.md`:
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
# Models
|
|
195
|
+
|
|
196
|
+
::: llm_pycascade.models
|
|
197
|
+
::: llm_pycascade.models.conversation
|
|
198
|
+
::: llm_pycascade.models.response
|
|
199
|
+
::: llm_pycascade.models.tool
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
- `reference/cascade.md` → `::: llm_pycascade.cascade`
|
|
203
|
+
- `reference/config.md` → `::: llm_pycascade.config`
|
|
204
|
+
- `reference/providers.md` → `::: llm_pycascade.providers` + `::: llm_pycascade.providers.base` + each of openai/anthropic/gemini/ollama
|
|
205
|
+
- `reference/error.md` → `::: llm_pycascade.error`
|
|
206
|
+
- `reference/db.md` → `::: llm_pycascade.db`
|
|
207
|
+
- `reference/persistence.md` → `::: llm_pycascade.persistence`
|
|
208
|
+
- `reference/secrets.md` → `::: llm_pycascade.secrets`
|
|
209
|
+
|
|
210
|
+
## Written-page content guidance
|
|
211
|
+
- **index.md**: 2–3 sentence pitch (from README tagline), feature bullets, badges (CI / RTD / PyPI / license), "next steps" links into Quickstart & Configuration.
|
|
212
|
+
- **installation.md**: `pip install`, `uv add`, the `[keyring]` extra, Python ≥3.10 requirement.
|
|
213
|
+
- **quickstart.md**: copy/adapt README basic example but use robust path expansion; show both a plain prompt and how to read `response.text_only()`.
|
|
214
|
+
- **configuration.md**: explain the search order (`LLM_PYCASCADE_CONFIG` → XDG → legacy), embed `config.example.toml` content with per-section explanation.
|
|
215
|
+
- **concepts.md**: reuse README architecture ASCII diagram + cooldown/backoff table + Retry-After behavior + persistence behavior + SQLite tables (`attempt_log`, `cooldown`).
|
|
216
|
+
- **providers.md**: list built-in providers, default base URLs, `base_url` override for OpenAI-compatible (vLLM/LiteLLM/Together), Ollama needing no key.
|
|
217
|
+
- **tools.md**: tool/function-calling guide; correct `ContentBlockType` import; show iterating `response.content`.
|
|
218
|
+
- **secrets.md**: `resolve_api_key` resolution order (keyring → env), `set_key`/`get_key`/`has_key`/`delete_key`, `mask_key`, qualified service name `llm-pycascade/<provider>`.
|
|
219
|
+
- **error-handling.md**: `ProviderError` variants (http/request/parse/missing_api_key/other), `http_status`/`retry_after_seconds` props, `CascadeError` + failed-prompt path.
|
|
220
|
+
- **changelog.md**: initial "v0.1.0 — initial release" entry; link to GitHub Releases.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Validation (run before finishing)
|
|
225
|
+
1. Create an isolated env and install docs deps + project:
|
|
226
|
+
`uv pip install -r docs/requirements.txt && uv pip install -e .` (or `pip install -r docs/requirements.txt && pip install -e .`).
|
|
227
|
+
2. `mkdocs build --strict` from repo root — must pass with zero warnings (catches broken nav, bad `:::` refs, dead links).
|
|
228
|
+
3. `mkdocs serve` — spot-check nav, code highlighting, API reference rendering, dark/light toggle.
|
|
229
|
+
4. After push: RTD builds automatically on every push to `main`; confirm the build at the RTD dashboard. (The `rtd-publish.yml` release-trigger is an additional versioned-build trigger.)
|
|
230
|
+
|
|
231
|
+
## Risks / Gotchas
|
|
232
|
+
- If `mkdocs build --strict` fails on `:::` refs, confirm the module path is importable from `src` (griffe `paths: [src]`) — installing the package (`pip install -e .`) resolves this.
|
|
233
|
+
- `extra.version.provider: mike` does nothing without `mike` installed; remove it if unused to keep config honest.
|
|
234
|
+
- Keep `mkdocs.yml` at repo root (NOT in `docs/`) — `.readthedocs.yaml` already expects it there.
|
|
235
|
+
|
|
236
|
+
## Out of Scope
|
|
237
|
+
- Versioned docs hosting via `mike` (can be added later).
|
|
238
|
+
- PDF export.
|
|
239
|
+
- i18n / translations.
|
|
240
|
+
- Any source-code logic changes (doc-only, except the `.readthedocs.yaml` config edit).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Read the Docs configuration file
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
# Required
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
# Set the OS, Python version, and other tools you might need
|
|
8
|
+
build:
|
|
9
|
+
os: ubuntu-24.04
|
|
10
|
+
tools:
|
|
11
|
+
python: "3.13"
|
|
12
|
+
|
|
13
|
+
# Build documentation with Mkdocs
|
|
14
|
+
mkdocs:
|
|
15
|
+
configuration: mkdocs.yml
|
|
16
|
+
|
|
17
|
+
# Declare the Python requirements required to build your documentation.
|
|
18
|
+
# The project itself is also installed so mkdocstrings can introspect it.
|
|
19
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
20
|
+
python:
|
|
21
|
+
install:
|
|
22
|
+
- requirements: docs/requirements.txt
|
|
23
|
+
- method: pip
|
|
24
|
+
path: .
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Luigi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|