Skip to content

Commit

Permalink
Add landing page for api reference (#2034)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmoneygithub authored Jan 10, 2025
1 parent fea2d38 commit d4e1931
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/docs/api/index.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion docs/scripts/generate_api_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,18 @@ 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
subpath = api_dir / keys
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)
1 change: 1 addition & 0 deletions docs/scripts/generate_api_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d4e1931

Please sign in to comment.