97e91a83f3
Ruff / Ruff (push) Has been cancelled
Test / Core Tests (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.10) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.11) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.12) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.13) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.9) (push) Has been cancelled
Test / Full Coverage (Python 3.11) (push) Has been cancelled
Test / Core Provider Tests (OpenAI) (push) Has been cancelled
Test / Core Provider Tests (Anthropic) (push) Has been cancelled
Test / Core Provider Tests (Google) (push) Has been cancelled
Test / Core Provider Tests (Other) (push) Has been cancelled
Test / Anthropic Tests (push) Has been cancelled
Test / Gemini Tests (push) Has been cancelled
Test / Google GenAI Tests (push) Has been cancelled
Test / Vertex AI Tests (push) Has been cancelled
Test / OpenAI Tests (push) Has been cancelled
Test / Writer Tests (push) Has been cancelled
Test / Auto Client Tests (push) Has been cancelled
ty / type-check (push) Has been cancelled
80 lines
1.5 KiB
Python
80 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
import glob
|
|
import os
|
|
from collections.abc import Iterable
|
|
|
|
from pytest_examples import find_examples
|
|
|
|
CORE = {
|
|
"alias.md",
|
|
"dictionary_operations.md",
|
|
"distillation.md",
|
|
"enums.md",
|
|
"fastapi.md",
|
|
"fields.md",
|
|
"index.md",
|
|
"iterable.md",
|
|
"lists.md",
|
|
"logging.md",
|
|
"maybe.md",
|
|
"models.md",
|
|
"parallel.md",
|
|
"partial.md",
|
|
"philosophy.md",
|
|
"prompting.md",
|
|
"typeadapter.md",
|
|
"typeddicts.md",
|
|
"types.md",
|
|
"union.md",
|
|
"unions.md",
|
|
"validation.md",
|
|
}
|
|
|
|
OPERATIONS = {
|
|
"caching.md",
|
|
"prompt_caching.md",
|
|
"raw_response.md",
|
|
"retrying.md",
|
|
"error_handling.md",
|
|
}
|
|
|
|
PROVIDERS = {
|
|
"from_provider.md",
|
|
"migration.md",
|
|
"mode-migration.md",
|
|
"patching.md",
|
|
"usage.md",
|
|
}
|
|
|
|
ADVANCED = {
|
|
"batch.md",
|
|
"hooks.md",
|
|
"multimodal.md",
|
|
"reask_validation.md",
|
|
"semantic_validation.md",
|
|
"templating.md",
|
|
}
|
|
|
|
|
|
def concept_paths(names: Iterable[str]) -> list[str]:
|
|
return [os.path.join("docs", "concepts", name) for name in names]
|
|
|
|
|
|
def all_concept_files() -> list[str]:
|
|
return sorted(glob.glob("docs/concepts/*.md"))
|
|
|
|
|
|
def core_concept_files() -> list[str]:
|
|
excluded = OPERATIONS | PROVIDERS | ADVANCED
|
|
return [
|
|
path for path in all_concept_files() if os.path.basename(path) not in excluded
|
|
]
|
|
|
|
|
|
def collect_examples(files: Iterable[str]):
|
|
examples = []
|
|
for markdown_file in files:
|
|
examples.extend(find_examples(markdown_file))
|
|
return examples
|