Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions docs/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.tag {
padding: 2px 5px;
border-radius: 4px;
padding: 2px 3px;
border-radius: 3px;
font-size: 0.8em;
margin-right: 5px;
color: #000;
Expand All @@ -9,7 +9,7 @@
code.beta {
display: inline-block;
background-color: #6c757d;
color: #999;
color: #fff;
}

code.prototype {
Expand All @@ -23,3 +23,9 @@ code.deprecated {
background-color: red;
color: #fff;
}

code.stable {
display: inline-block;
background-color: #28a745;
color: #fff;
}
8 changes: 4 additions & 4 deletions docs/source/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ def generate_llmapi():
content = underline("API Reference", "-") + "\n\n"
content += ".. note::\n"
content += " Since version 1.0, we have attached a status label to `LLM`, `LlmArgs` and `TorchLlmArgs` Classes.\n\n"
content += ' 1. :tag:`prototype` - The item is a prototype and is subject to change.\n'
content += ' 2. :tag:`beta` - The item is in beta and approaching stability.\n'
content += ' 3. :tag:`deprecated` - The item is deprecated and will be removed in a future release.\n'
content += " 4. For the remaining items without a status label, they are considered **stable**.\n"
content += " 1. :tag:`stable` - The item is stable and will keep consistent.\n"
content += ' 2. :tag:`prototype` - The item is a prototype and is subject to change.\n'
content += ' 3. :tag:`beta` - The item is in beta and approaching stability.\n'
content += ' 4. :tag:`deprecated` - The item is deprecated and will be removed in a future release.\n'
content += "\n"

for cls_name in public_classes_names:
Expand Down
7 changes: 7 additions & 0 deletions tensorrt_llm/llmapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ def generate_api_docs_as_docstring(model: Type[BaseModel],
arg_line = f"{indent} {field_name} ({type_str}): "
if status := field_info.get("status", None):
arg_line += f":tag:`{status}` "
elif LABEL_STABLE_APIS:
arg_line += f":tag:`stable` "

if field_description:
arg_line += field_description.split('\n')[0] # First line with type

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


LABEL_STABLE_APIS: bool = True
""" Whether to label the stable APIs with `stable` tags. """


class ApiParamTagger:
''' A helper to tag the api doc according to the status of the fields.
The status is set in the json_schema_extra of the field.
Expand Down