mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
updated provider_models.json to yaml, added that file to our docs for reference
This commit is contained in:
parent
5984e2c594
commit
1d5c8e05ac
13 changed files with 406 additions and 360 deletions
|
|
@ -1,6 +1,9 @@
|
|||
FROM sphinxdoc/sphinx
|
||||
|
||||
WORKDIR /docs
|
||||
ADD requirements.txt /docs
|
||||
ADD docs/requirements.txt /docs
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
RUN pip freeze
|
||||
|
||||
# Copy provider_models.yaml from the repo for documentation
|
||||
COPY crates/hermesllm/src/bin/provider_models.yaml /docs/provider_models.yaml
|
||||
|
|
|
|||
|
|
@ -1,4 +1,19 @@
|
|||
docker build -f Dockerfile . -t sphinx
|
||||
docker run --user $(id -u):$(id -g) --rm -v $(pwd):/docs sphinx make clean
|
||||
docker run --user $(id -u):$(id -g) --rm -v $(pwd):/docs sphinx make html
|
||||
chmod -R 777 build/html
|
||||
docker build -f docs/Dockerfile . -t sphinx
|
||||
|
||||
# Clean build output locally
|
||||
rm -rf docs/build
|
||||
|
||||
# Run make clean/html while keeping provider_models.yaml from the image
|
||||
docker run --user $(id -u):$(id -g) --rm \
|
||||
-v $(pwd)/docs/source:/docs/source \
|
||||
-v $(pwd)/docs/Makefile:/docs/Makefile \
|
||||
-v $(pwd)/docs/build:/docs/build \
|
||||
sphinx make clean
|
||||
|
||||
docker run --user $(id -u):$(id -g) --rm \
|
||||
-v $(pwd)/docs/source:/docs/source \
|
||||
-v $(pwd)/docs/Makefile:/docs/Makefile \
|
||||
-v $(pwd)/docs/build:/docs/build \
|
||||
sphinx make html
|
||||
|
||||
chmod -R 777 docs/build/html
|
||||
|
|
|
|||
44
docs/source/_ext/provider_models.py
Normal file
44
docs/source/_ext/provider_models.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"""Sphinx extension to copy provider_models.yaml to build output."""
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
import shutil
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sphinx.application import Sphinx
|
||||
|
||||
|
||||
def _on_build_finished(app: Sphinx, exception: Exception | None) -> None:
|
||||
"""Copy provider_models.yaml to the build output after build completes."""
|
||||
if exception is not None:
|
||||
return
|
||||
|
||||
# Only generate for HTML-like builders where app.outdir is a website root.
|
||||
if getattr(app.builder, "format", None) != "html":
|
||||
return
|
||||
|
||||
# Source path: provider_models.yaml is copied into the Docker image at /docs/provider_models.yaml
|
||||
# This follows the pattern used for config templates like envoy.template.yaml and arch_config_schema.yaml
|
||||
docs_root = Path(app.srcdir).parent # Goes from source/ to docs/
|
||||
source_path = docs_root / "provider_models.yaml"
|
||||
|
||||
if not source_path.exists():
|
||||
# Silently skip if source file doesn't exist
|
||||
return
|
||||
|
||||
# Per repo convention, place generated artifacts under an `includes/` folder.
|
||||
out_path = Path(app.outdir) / "includes" / "provider_models.yaml"
|
||||
out_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
shutil.copy2(source_path, out_path)
|
||||
|
||||
|
||||
def setup(app: Sphinx) -> dict[str, object]:
|
||||
"""Register the extension with Sphinx."""
|
||||
app.connect("build-finished", _on_build_finished)
|
||||
return {
|
||||
"version": "0.1.0",
|
||||
"parallel_read_safe": True,
|
||||
"parallel_write_safe": True,
|
||||
}
|
||||
|
|
@ -738,6 +738,7 @@ Automatically configure all available models from a provider using wildcard patt
|
|||
- Expands at config load time to all models in Plano's provider registry
|
||||
- Creates entries for both canonical (``openai/gpt-4``) and short names (``gpt-4``)
|
||||
- Enables the ``/v1/models`` endpoint to list all available models
|
||||
- **View complete model list**: `provider_models.yaml <../../includes/provider_models.yaml>`_
|
||||
|
||||
2. **Unknown/Custom Providers** (e.g., ``custom-provider/*``):
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ extensions = [
|
|||
"sphinx_design",
|
||||
# Local extensions
|
||||
"llms_txt",
|
||||
"provider_models",
|
||||
]
|
||||
|
||||
# Paths that contain templates, relative to this directory.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue