-
Notifications
You must be signed in to change notification settings - Fork 2k
[None][doc] add status labels to LLM class's api reference #6899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[None][doc] add status labels to LLM class's api reference #6899
Conversation
📝 WalkthroughWalkthroughAdds injection of :tag: Changes
Sequence Diagram(s)sequenceDiagram
participant Test
participant Utils as generate_api_docs_as_docstring
participant Tagger as ApiParamTagger
participant Model as PydanticModel (LlmArgs)
Test->>Utils: generate_api_docs_as_docstring(Model)
Utils->>Tagger: Tagger(Model) / __call__
Tagger->>Tagger: _process_pydantic_model(Model)
loop per field
Tagger->>Model: read json_schema_extra.status
alt status present
Tagger->>Tagger: _amend_pydantic_field_description_with_tags(field, tag)
end
end
Tagger-->>Utils: modified model/descriptions
Utils-->>Test: docstring with :tag:`<status>` entries
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
tensorrt_llm/llmapi/utils.py (1)
581-586: Make tag injection idempotent and handle None descriptionsCurrently, this will prepend ":tag:
{tag}None" when the description is None, and re-running it will stack tags. Normalize the description and avoid re-tagging if a tag is already present.Apply this diff:
- for field_name in field_names: - field = cls.model_fields[field_name] - cls.model_fields[ - field_name].description = f":tag:`{tag}` {field.description}" - cls.model_rebuild(force=True) + for field_name in field_names: + field = cls.model_fields[field_name] + # Avoid double-tagging and handle None descriptions + desc = (field.description or "").strip() + if not desc.startswith(":tag:`"): + desc = f":tag:`{tag}` {desc}".strip() + cls.model_fields[field_name].description = desc + cls.model_rebuild(force=True)
🧹 Nitpick comments (2)
tensorrt_llm/llmapi/utils.py (1)
562-565: Fix D200: one-line docstring should fit on one lineRuff indicates D200 for this docstring. Collapse it to a single line.
Apply this diff:
- def _process_pydantic_model(self, cls: Type[BaseModel]) -> None: - """Process the Pydantic model to add tags to the fields. - """ + def _process_pydantic_model(self, cls: Type[BaseModel]) -> None: + """Process the Pydantic model to add tags to the fields."""tests/unittest/llmapi/test_utils.py (1)
31-35: Remove noisy print from test; keep the assertionPrinting the generated doc in tests creates noisy output and can hide failures in CI logs. The assertion is sufficient.
Apply this diff:
def test_generate_api_docs_as_docstring(): doc = generate_api_docs_as_docstring(LlmArgs) assert ":tag:`beta`" in doc, "the label is not generated" - print(doc)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (2)
tensorrt_llm/llmapi/utils.py(2 hunks)tests/unittest/llmapi/test_utils.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else
Files:
tensorrt_llm/llmapi/utils.pytests/unittest/llmapi/test_utils.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
Prepend NVIDIA copyright header (current year) to all source files
Files:
tensorrt_llm/llmapi/utils.pytests/unittest/llmapi/test_utils.py
🪛 Ruff (0.12.2)
tensorrt_llm/llmapi/utils.py
560-561: One-line docstring should fit on one line
Reformat to one line
(D200)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (2)
tensorrt_llm/llmapi/utils.py (1)
559-561: Good entry point and structureMaking call delegate to a single processing method keeps the API clean and testable. No issues here.
tests/unittest/llmapi/test_utils.py (1)
1-3: Imports look correctImports align with the new public surface (LlmArgs from tensorrt_llm.llmapi) and direct utility import for doc generation. No issues.
|
/bot run |
|
PR_Github #15285 [ run ] triggered by Bot |
|
PR_Github #15285 [ run ] completed with state |
ca2a3ac to
8389f06
Compare
|
/bot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
tensorrt_llm/llmapi/utils.py (2)
518-521: Avoid duplicate status tags and drop walrus for 3.8 clarityIf ApiParamTagger already prepends a tag in the field description, this will double-tag the arg line. Also prefer explicit assignment over walrus here for readability and consistency.
- if status := field_info.get("status", None): - arg_line += f":tag:`{status}` " + status = field_info.get("status") + if status and not (field_description or "").lstrip().startswith(":tag:`"): + arg_line += f":tag:`{status}` "
571-573: Python 3.8 compatibility: use List[str] instead of list[str]list[str] requires Python 3.9+. Switch to typing.List[str]. List is already imported.
- def _amend_pydantic_field_description_with_tags(self, cls: Type[BaseModel], - field_names: list[str], - tag: str) -> None: + def _amend_pydantic_field_description_with_tags(self, cls: Type[BaseModel], + field_names: List[str], + tag: str) -> None:Additionally, to prevent "None" showing up in descriptions and to avoid double-tagging when this method is called repeatedly, update the assignment inside this method (outside the selected range) as follows:
# Inside _amend_pydantic_field_description_with_tags(...) desc = (field.description or "").lstrip() if not desc.startswith(":tag:`"): desc = f":tag:`{tag}` {desc}".strip() cls.model_fields[field_name].description = desc or f":tag:`{tag}`"
🧹 Nitpick comments (1)
tensorrt_llm/llmapi/utils.py (1)
559-559: Fix one-line docstring style (Ruff D200)Remove the leading space and tighten wording.
- """ The main entry point to tag the api doc. """ + """Main entry point to tag the API doc."""
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (2)
tensorrt_llm/llmapi/utils.py(2 hunks)tests/unittest/llmapi/test_utils.py(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/unittest/llmapi/test_utils.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else
Files:
tensorrt_llm/llmapi/utils.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
Prepend NVIDIA copyright header (current year) to all source files
Files:
tensorrt_llm/llmapi/utils.py
🪛 Ruff (0.12.2)
tensorrt_llm/llmapi/utils.py
560-561: One-line docstring should fit on one line
Reformat to one line
(D200)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tensorrt_llm/llmapi/utils.py (1)
562-570: Privatization and call-site update LGTMRenaming the processing method to a private variant and updating the call site improves encapsulation without changing behavior.
|
PR_Github #15313 [ run ] triggered by Bot |
|
PR_Github #15313 [ run ] completed with state |
8389f06 to
2927f81
Compare
|
/bot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
tensorrt_llm/llmapi/utils.py (1)
571-580: Python 3.8 compatibility: use List[str] and tidy docstring (D205)list[str] requires Python 3.9+. Our target is 3.8+, so use typing.List[str]. Also add a blank line between summary and description.
Apply this diff:
- def _amend_pydantic_field_description_with_tags(self, cls: Type[BaseModel], - field_names: list[str], - tag: str) -> None: - """Amend the description of the fields with tags. - e.g. :tag:`beta` or :tag:`prototype` + def _amend_pydantic_field_description_with_tags(self, cls: Type[BaseModel], + field_names: List[str], + tag: str) -> None: + """Amend the description of the fields with tags. + + e.g. :tag:`beta` or :tag:`prototype`
♻️ Duplicate comments (1)
tensorrt_llm/llmapi/utils.py (1)
518-521: Guard against double-tagging and avoid the walrus for clarityIf ApiParamTagger already prepends a tag in the field description, this will add a second tag. Also, per our style, prefer a simple assignment over the walrus here.
Apply this diff:
- if status := field_info.get("status", None): - arg_line += f":tag:`{status}` " + status = field_info.get("status") + if status and not (field_description or "").lstrip().startswith(":tag:`"): + arg_line += f":tag:`{status}` "
🧹 Nitpick comments (2)
tensorrt_llm/llmapi/utils.py (2)
559-561: Fix one-line docstring style (D200)The one-line docstring should fit on a single line without extra leading/trailing spaces.
Apply this diff:
- """ The main entry point to tag the api doc. """ + """The main entry point to tag the API doc."""
585-586: Make tag amendment idempotent and handle None descriptionsIf description is None, this will render "None" in docs. Also, calling this twice will duplicate tags. Make it robust and idempotent.
Apply this diff:
- cls.model_fields[ - field_name].description = f":tag:`{tag}` {field.description}" + old_desc = field.description or "" + # Avoid double-tagging if a tag already exists + if old_desc.lstrip().startswith(":tag:`"): + new_desc = old_desc + else: + new_desc = f":tag:`{tag}` {old_desc}".strip() + cls.model_fields[field_name].description = new_desc
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
tensorrt_llm/llmapi/utils.py(2 hunks)tests/unittest/llmapi/test_utils.py(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/unittest/llmapi/test_utils.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else
Files:
tensorrt_llm/llmapi/utils.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
Prepend NVIDIA copyright header (current year) to all source files
Files:
tensorrt_llm/llmapi/utils.py
🪛 Ruff (0.12.2)
tensorrt_llm/llmapi/utils.py
560-561: One-line docstring should fit on one line
Reformat to one line
(D200)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tensorrt_llm/llmapi/utils.py (1)
562-570: Approve rename: no external callers detectedRan ripgrep across the codebase and found no occurrences of
process_pydantic_model(oramend_pydantic_field_description_with_tags(. The private‐method refactor is safe to merge.
|
PR_Github #15577 [ run ] triggered by Bot |
|
PR_Github #15577 [ run ] completed with state |
|
/bot run |
|
PR_Github #15682 [ run ] triggered by Bot |
|
PR_Github #15682 [ run ] completed with state |
Signed-off-by: Superjomn <[email protected]>
2927f81 to
0f06d51
Compare
|
/bot run |
|
PR_Github #15794 [ run ] triggered by Bot |
|
PR_Github #15794 [ run ] completed with state |
Signed-off-by: Superjomn <[email protected]>
Signed-off-by: Superjomn <[email protected]> Signed-off-by: Wangshanshan <[email protected]>
Signed-off-by: Superjomn <[email protected]> Signed-off-by: Wangshanshan <[email protected]>
Signed-off-by: Superjomn <[email protected]> Signed-off-by: Wangshanshan <[email protected]>
Signed-off-by: Superjomn <[email protected]> Signed-off-by: Wangshanshan <[email protected]>
Signed-off-by: Superjomn <[email protected]> Signed-off-by: Wangshanshan <[email protected]>
Summary by CodeRabbit
New Features
Documentation
beta) to clarify parameter stability.Tests
Description
Currently, the LLM class has no API status tag. And the status tags only exist in LlmArgs's field API references, e.g., TorchLlmArgs.
This PR adds the status tags to LLM class's docstring:

Test Coverage
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.