Skip to content

Commit 833e86c

Browse files
Superjomndominicshanshan
authored andcommitted
[None][doc] Enhance api reference doc by labeling stable APIs (NVIDIA#7751)
Signed-off-by: Yan Chunwei <[email protected]>
1 parent 2b37972 commit 833e86c

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

docs/source/_static/custom.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.tag {
2-
padding: 2px 5px;
3-
border-radius: 4px;
2+
padding: 2px 3px;
3+
border-radius: 3px;
44
font-size: 0.8em;
55
margin-right: 5px;
66
color: #000;
@@ -9,7 +9,7 @@
99
code.beta {
1010
display: inline-block;
1111
background-color: #6c757d;
12-
color: #999;
12+
color: #fff;
1313
}
1414

1515
code.prototype {
@@ -23,3 +23,9 @@ code.deprecated {
2323
background-color: red;
2424
color: #fff;
2525
}
26+
27+
code.stable {
28+
display: inline-block;
29+
background-color: #28a745;
30+
color: #fff;
31+
}

docs/source/helper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ def generate_llmapi():
312312
content = underline("API Reference", "-") + "\n\n"
313313
content += ".. note::\n"
314314
content += " Since version 1.0, we have attached a status label to `LLM`, `LlmArgs` and `TorchLlmArgs` Classes.\n\n"
315-
content += ' 1. :tag:`prototype` - The item is a prototype and is subject to change.\n'
316-
content += ' 2. :tag:`beta` - The item is in beta and approaching stability.\n'
317-
content += ' 3. :tag:`deprecated` - The item is deprecated and will be removed in a future release.\n'
318-
content += " 4. For the remaining items without a status label, they are considered **stable**.\n"
315+
content += " 1. :tag:`stable` - The item is stable and will keep consistent.\n"
316+
content += ' 2. :tag:`prototype` - The item is a prototype and is subject to change.\n'
317+
content += ' 3. :tag:`beta` - The item is in beta and approaching stability.\n'
318+
content += ' 4. :tag:`deprecated` - The item is deprecated and will be removed in a future release.\n'
319319
content += "\n"
320320

321321
for cls_name in public_classes_names:

tensorrt_llm/llmapi/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@ def generate_api_docs_as_docstring(model: Type[BaseModel],
520520
arg_line = f"{indent} {field_name} ({type_str}): "
521521
if status := field_info.get("status", None):
522522
arg_line += f":tag:`{status}` "
523+
elif LABEL_STABLE_APIS:
524+
arg_line += f":tag:`stable` "
525+
523526
if field_description:
524527
arg_line += field_description.split('\n')[0] # First line with type
525528

@@ -553,6 +556,10 @@ def get_type_repr(cls):
553556
return f"{module_name}.{cls.__qualname__}"
554557

555558

559+
LABEL_STABLE_APIS: bool = True
560+
""" Whether to label the stable APIs with `stable` tags. """
561+
562+
556563
class ApiParamTagger:
557564
''' A helper to tag the api doc according to the status of the fields.
558565
The status is set in the json_schema_extra of the field.

0 commit comments

Comments
 (0)