Fix chat template cache key order (#41517)

This commit is contained in:
Ke Bao
2026-09-28 15:17:09 +08:00
committed by GitHub
parent f4de6abee6
commit 6405cf2881
@@ -1748,6 +1748,7 @@ class OpenAIServingChat(OpenAIServingBase):
cache_key = None
if use_cache:
try:
# Key order is part of the key: templates render dicts in their given order.
cache_key = orjson.dumps(
(
getattr(
@@ -1760,7 +1761,6 @@ class OpenAIServingChat(OpenAIServingBase):
template_kwargs,
encode_kwargs,
),
option=orjson.OPT_SORT_KEYS,
)
except TypeError:
pass