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
10 changes: 3 additions & 7 deletions src/python/library/tritonclient/grpc/_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

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

if parameters:
for key, value in parameters.items():
if (
key == "sequence_id"
or key == "sequence_start"
or key == "sequence_end"
or key == "priority"
or key == "binary_data_output"
if key in TRITON_RESERVED_REQUEST_PARAMS or key.startswith(
TRITON_RESERVED_REQUEST_PARAMS_PREFIX
):
raise_error(
f'Parameter "{key}" is a reserved parameter and cannot be specified.'
Expand Down
15 changes: 8 additions & 7 deletions src/python/library/tritonclient/http/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
from urllib.parse import quote_plus

import rapidjson as json
from tritonclient.utils import InferenceServerException, raise_error
from tritonclient.utils import (
TRITON_RESERVED_REQUEST_PARAMS,
TRITON_RESERVED_REQUEST_PARAMS_PREFIX,
InferenceServerException,
raise_error,
)


def _get_error(response):
Expand Down Expand Up @@ -118,12 +123,8 @@ def _get_inference_request(

if custom_parameters:
for key, value in custom_parameters.items():
if (
key == "sequence_id"
or key == "sequence_start"
or key == "sequence_end"
or key == "priority"
or key == "binary_data_output"
if key in TRITON_RESERVED_REQUEST_PARAMS or key.startswith(
TRITON_RESERVED_REQUEST_PARAMS_PREFIX
):
raise_error(
f'Parameter "{key}" is a reserved parameter and cannot be specified.'
Expand Down
17 changes: 16 additions & 1 deletion src/python/library/tritonclient/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

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

from ._shared_memory_tensor import SharedMemoryTensor

# Reserved request parameters for Triton's usage.
# Other locations:
# - server/src/common.h
# - server/docs/protocol/extension_parameters.md
TRITON_RESERVED_REQUEST_PARAMS = [
"sequence_id",
"sequence_start",
"sequence_end",
"priority",
"timeout",
"headers",
"binary_data_output",
]
TRITON_RESERVED_REQUEST_PARAMS_PREFIX = "triton_"


def raise_error(msg):
"""
Expand Down
Loading