refactor(langchain): clean redundancy ifelse. (#37448)

Signed-off-by: zhanluxianshen <yanggangtony@163.com>
This commit is contained in:
湛露先生
2026-05-19 05:26:09 +08:00
committed by GitHub
parent c7daed8c0f
commit 956bdc912f

View File

@@ -867,11 +867,8 @@ def create_agent(
initial_response_format: ToolStrategy[Any] | ProviderStrategy[Any] | AutoStrategy[Any] | None initial_response_format: ToolStrategy[Any] | ProviderStrategy[Any] | AutoStrategy[Any] | None
if response_format is None: if response_format is None:
initial_response_format = None initial_response_format = None
elif isinstance(response_format, (ToolStrategy, ProviderStrategy)): elif isinstance(response_format, (ToolStrategy, ProviderStrategy, AutoStrategy)):
# Preserve explicitly requested strategies # Explicit Tool/Provider strategy, or AutoStrategy for later capability detection
initial_response_format = response_format
elif isinstance(response_format, AutoStrategy):
# AutoStrategy provided - preserve it for later auto-detection
initial_response_format = response_format initial_response_format = response_format
else: else:
# Raw schema - wrap in AutoStrategy to enable auto-detection # Raw schema - wrap in AutoStrategy to enable auto-detection