MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / Field

Function Field

tensorrt_llm/llmapi/llm_args.py:68–95  ·  view source on GitHub ↗

Custom Field wrapper that adds status to json_schema_extra. Args: default: The default value for the field status: Optional status indicator that gets added to json_schema_extra. - None: Stable. - "beta": Recommended for use per the latest documentation.

(default: Any = ...,
          *,
          status: Optional[Literal["prototype", "beta", "deprecated"]] = None,
          **kwargs: Any)

Source from the content-addressed store, hash-verified

66
67
68def Field(default: Any = ...,
69 *,
70 status: Optional[Literal["prototype", "beta", "deprecated"]] = None,
71 **kwargs: Any) -> Any:
72 """Custom Field wrapper that adds status to json_schema_extra.
73
74 Args:
75 default: The default value for the field
76 status: Optional status indicator that gets added to json_schema_extra.
77 - None: Stable.
78 - "beta": Recommended for use per the latest documentation.
79 - "prototype": Not yet stable and subject to breaking changes; intended for experimentation only.
80 **kwargs: All other arguments passed to the original Pydantic Field
81
82 Returns:
83 A Pydantic FieldInfo object with the status added to json_schema_extra if provided
84 """
85
86 if status is not None:
87 json_schema_extra = kwargs.get('json_schema_extra', {})
88 if isinstance(json_schema_extra, dict):
89 json_schema_extra['status'] = status
90 else:
91 # If json_schema_extra is not a dict, create a new dict with the status
92 json_schema_extra = {'status': status}
93 kwargs['json_schema_extra'] = json_schema_extra
94
95 return PydanticField(default, **kwargs)
96
97
98class StrictBaseModel(BaseModel):

Callers 15

RecipeClass · 0.85
PromptConfigClass · 0.85
BenchmarkConfigClass · 0.85
ExperimentConfigClass · 0.85
LoraConfigClass · 0.85
BuildConfigClass · 0.85
CudaGraphConfigClass · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected