Skip to content

Commit b940ebf

Browse files
authored
[None][doc] Enhance api reference doc by labeling stable APIs (#7751)
Signed-off-by: Yan Chunwei <[email protected]>
1 parent 14aa34f commit b940ebf

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
@@ -517,6 +517,9 @@ def generate_api_docs_as_docstring(model: Type[BaseModel],
517517
arg_line = f"{indent} {field_name} ({type_str}): "
518518
if status := field_info.get("status", None):
519519
arg_line += f":tag:`{status}` "
520+
elif LABEL_STABLE_APIS:
521+
arg_line += f":tag:`stable` "
522+
520523
if field_description:
521524
arg_line += field_description.split('\n')[0] # First line with type
522525

@@ -550,6 +553,10 @@ def get_type_repr(cls):
550553
return f"{module_name}.{cls.__qualname__}"
551554

552555

556+
LABEL_STABLE_APIS: bool = True
557+
""" Whether to label the stable APIs with `stable` tags. """
558+
559+
553560
class ApiParamTagger:
554561
''' A helper to tag the api doc according to the status of the fields.
555562
The status is set in the json_schema_extra of the field.

0 commit comments

Comments
 (0)