The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
refactor(langchain): clean redundancy ifelse. (#37448)
湛露先生956bdc912f86
diff --git a/libs/langchain_v1/langchain/agents/factory.py b/libs/langchain_v1/langchain/agents/factory.pyindex b66d650f3f..a245a4d4be 100644--- a/libs/langchain_v1/langchain/agents/factory.py+++ b/libs/langchain_v1/langchain/agents/factory.py@@ -867,11 +867,8 @@ def create_agent(initial_response_format: ToolStrategy[Any] | ProviderStrategy[Any] | AutoStrategy[Any] | Noneif response_format is None:initial_response_format = None- elif isinstance(response_format, (ToolStrategy, ProviderStrategy)):- # Preserve explicitly requested strategies- initial_response_format = response_format- elif isinstance(response_format, AutoStrategy):- # AutoStrategy provided - preserve it for later auto-detection+ elif isinstance(response_format, (ToolStrategy, ProviderStrategy, AutoStrategy)):+ # Explicit Tool/Provider strategy, or AutoStrategy for later capability detectioninitial_response_format = response_formatelse:# Raw schema - wrap in AutoStrategy to enable auto-detection