Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/source/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from pathlib import Path
from typing import Optional

import pygit2


def underline(title: str, character: str = "=") -> str:
return f"{title}\n{character * len(title)}"
Expand Down Expand Up @@ -82,14 +84,16 @@ def collect_script_paths(examples_subdir: str) -> list[Path]:
llmapi_doc_paths = [
doc_dir / f"{path.stem}.rst" for path in llmapi_script_paths
]
llmapi_script_base_url = "https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/llm-api"
repo = pygit2.Repository('.')
commit_hash = str(repo.head.target)
llmapi_script_base_url = f"https://github.com/NVIDIA/TensorRT-LLM/blob/{commit_hash}/examples/llm-api"

# Collect source paths for trtllm-serve examples
serve_script_paths = collect_script_paths("serve")
serve_doc_paths = [
doc_dir / f"{path.stem}.rst" for path in serve_script_paths
]
serve_script_base_url = "https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/serve"
serve_script_base_url = f"https://github.com/NVIDIA/TensorRT-LLM/blob/{commit_hash}/examples/serve"

def _get_lines_without_metadata(filename: str) -> str:
"""Get line ranges that exclude metadata lines.
Expand Down Expand Up @@ -147,7 +151,6 @@ def write_scripts(base_url: str,
logging.warning(f"Ignoring file: {script_path.name}")
continue
script_url = f"{base_url}/{script_path.name}"

# Determine language based on file extension
language = "python" if script_path.suffix == ".py" else "bash"

Expand Down