diff --git a/docs/docs/api/index.md b/docs/docs/api/index.md new file mode 100644 index 000000000..4ea156459 --- /dev/null +++ b/docs/docs/api/index.md @@ -0,0 +1,3 @@ +# API Reference + +Welcome to the DSPy API reference documentation. This section provides detailed information about DSPy's classes, modules, and functions. \ No newline at end of file diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 4ad6f3060..c189c57f7 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -67,6 +67,7 @@ nav: - Cheatsheet: cheatsheet.md - API Reference: + - API Reference: api/index.md - Adapters: - Adapter: api/adapters/Adapter.md - ChatAdapter: api/adapters/ChatAdapter.md diff --git a/docs/scripts/generate_api_docs.py b/docs/scripts/generate_api_docs.py index d3308e077..39ba45cd4 100644 --- a/docs/scripts/generate_api_docs.py +++ b/docs/scripts/generate_api_docs.py @@ -235,7 +235,10 @@ def remove_empty_dirs(path: Path): if __name__ == "__main__": api_dir = Path("docs/api") if api_dir.exists(): - shutil.rmtree(api_dir) + # Delete only subdirectories + for item in api_dir.iterdir(): + if item.is_dir(): + shutil.rmtree(item) for keys in API_MAPPING.keys(): # Create a directory for each API category @@ -243,6 +246,7 @@ def remove_empty_dirs(path: Path): subpath.mkdir(parents=True, exist_ok=True) excluded_modules = ["dspy.dsp"] + generate_md_docs(api_dir, excluded_modules=excluded_modules) # Clean up empty directories remove_empty_dirs(api_dir) diff --git a/docs/scripts/generate_api_summary.py b/docs/scripts/generate_api_summary.py index e62d82e13..c918e734b 100644 --- a/docs/scripts/generate_api_summary.py +++ b/docs/scripts/generate_api_summary.py @@ -112,6 +112,7 @@ def main(): # Create API section api_section = [" - API Reference:"] + api_section.append(" - API Reference: api/index.md") api_section.extend(format_nav_section(api_nav)) api_section.append("") # Add empty line before theme section