5353_DISABLED_JUDGE_DEFAULT = AIJudgeConfigDefault .disabled ()
5454
5555
56- def _parse_tools (tools_data : Optional [Dict [str , Any ]]) -> Optional [Dict [str , LDTool ]]:
56+ def _parse_tools (tools_data : Optional [Dict [str , Any ]], * , warn : bool = True ) -> Optional [Dict [str , LDTool ]]:
5757 """Parse the root-level tools map from a flag variation dict."""
5858 if not isinstance (tools_data , dict ):
5959 return None
60- result = {}
60+ result : Dict [ str , LDTool ] = {}
6161 for tool_name , tool_dict in tools_data .items ():
6262 if not isinstance (tool_dict , dict ):
63- log .warning ('Skipping tool "%s": expected a dict, got %s' , tool_name , type (tool_dict ).__name__ )
63+ if warn :
64+ log .warning ('Skipping tool "%s": expected a dict, got %s' , tool_name , type (tool_dict ).__name__ )
6465 continue
6566 result [tool_name ] = LDTool (
6667 name = tool_dict .get ('name' , tool_name ),
@@ -86,18 +87,7 @@ def _resolve_tools(variation: Dict[str, Any]) -> Optional[Dict[str, LDTool]]:
8687 if not isinstance (tools_data , dict ):
8788 return None
8889
89- result = {}
90- for tool_name , tool_dict in tools_data .items ():
91- if not isinstance (tool_dict , dict ):
92- continue
93- result [tool_name ] = LDTool (
94- name = tool_dict .get ('name' , tool_name ),
95- description = tool_dict .get ('description' ),
96- type = tool_dict .get ('type' ),
97- parameters = tool_dict .get ('parameters' ),
98- custom_parameters = tool_dict .get ('customParameters' ),
99- )
100- return result or None
90+ return _parse_tools (tools_data , warn = False )
10191
10292
10393class LDAIClient :
0 commit comments