Skip to content

Commit e3932fe

Browse files
committed
asds
1 parent 4d74d55 commit e3932fe

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/python/library/tritonclient/grpc/_utils.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -116,12 +116,8 @@ def _get_inference_request(
116116

117117
if parameters:
118118
for key, value in parameters.items():
119-
if (
120-
key == "sequence_id"
121-
or key == "sequence_start"
122-
or key == "sequence_end"
123-
or key == "priority"
124-
or key == "binary_data_output"
119+
if key in TRITON_RESERVED_REQUEST_PARAMS or key.startswith(
120+
TRITON_RESERVED_REQUEST_PARAMS_PREFIX
125121
):
126122
raise_error(
127123
f'Parameter "{key}" is a reserved parameter and cannot be specified.'

src/python/library/tritonclient/http/_utils.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from urllib.parse import quote_plus
3030

3131
import rapidjson as json
32-
from tritonclient.utils import InferenceServerException, raise_error
32+
from tritonclient.utils import *
3333

3434

3535
def _get_error(response):
@@ -118,12 +118,8 @@ def _get_inference_request(
118118

119119
if custom_parameters:
120120
for key, value in custom_parameters.items():
121-
if (
122-
key == "sequence_id"
123-
or key == "sequence_start"
124-
or key == "sequence_end"
125-
or key == "priority"
126-
or key == "binary_data_output"
121+
if key in TRITON_RESERVED_REQUEST_PARAMS or key.startswith(
122+
TRITON_RESERVED_REQUEST_PARAMS_PREFIX
127123
):
128124
raise_error(
129125
f'Parameter "{key}" is a reserved parameter and cannot be specified.'

src/python/library/tritonclient/utils/__init__.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -32,6 +32,21 @@
3232

3333
from ._shared_memory_tensor import SharedMemoryTensor
3434

35+
# Reserved request parameters for Triton's usage.
36+
# Other locations:
37+
# - server/src/common.h
38+
# - server/docs/protocol/extension_parameters.md
39+
TRITON_RESERVED_REQUEST_PARAMS = [
40+
"sequence_id",
41+
"sequence_start",
42+
"sequence_end",
43+
"priority",
44+
"timeout",
45+
"headers",
46+
"binary_data_output",
47+
]
48+
TRITON_RESERVED_REQUEST_PARAMS_PREFIX = "triton_"
49+
3550

3651
def raise_error(msg):
3752
"""

0 commit comments

Comments
 (0)