classSynthesizerComponent(QueryComponent):"""Synthesizer component."""synthesizer:BaseSynthesizer=Field(...,description="Synthesizer")classConfig:arbitrary_types_allowed=Truedefset_callback_manager(self,callback_manager:CallbackManager)->None:"""Set callback manager."""self.synthesizer.callback_manager=callback_managerdef_validate_component_inputs(self,input:Dict[str,Any])->Dict[str,Any]:"""Validate component inputs during run_component."""# make sure both query_str and nodes are thereif"query_str"notininput:raiseValueError("Input must have key 'query_str'")input["query_str"]=validate_and_convert_stringable(input["query_str"])if"nodes"notininput:raiseValueError("Input must have key 'nodes'")nodes=input["nodes"]ifnotisinstance(nodes,list):raiseValueError("Input nodes must be a list")fornodeinnodes:ifnotisinstance(node,NodeWithScore):raiseValueError("Input nodes must be a list of NodeWithScore")returninputdef_run_component(self,**kwargs:Any)->Dict[str,Any]:"""Run component."""output=self.synthesizer.synthesize(kwargs["query_str"],kwargs["nodes"])return{"output":output}asyncdef_arun_component(self,**kwargs:Any)->Dict[str,Any]:"""Run component."""output=awaitself.synthesizer.asynthesize(kwargs["query_str"],kwargs["nodes"])return{"output":output}@propertydefinput_keys(self)->InputKeys:"""Input keys."""returnInputKeys.from_keys({"query_str","nodes"})@propertydefoutput_keys(self)->OutputKeys:"""Output keys."""returnOutputKeys.from_keys({"output"})