@@ -80,30 +80,20 @@ def execute(self, state: dict) -> dict:
80
80
81
81
self .logger .info (f"--- Executing { self .node_name } Node ---" )
82
82
83
- # Interpret input keys based on the provided input expression
84
83
input_keys = self .get_input_keys (state )
85
- # Fetching data from the state based on the input keys
84
+
86
85
input_data = [state [key ] for key in input_keys ]
87
86
user_prompt = input_data [0 ]
88
87
doc = input_data [1 ]
89
88
90
- # Initialize the output parser
91
89
if self .node_config .get ("schema" , None ) is not None :
92
- output_parser = JsonOutputParser (pydantic_object = self .node_config ["schema" ])
93
-
94
- # Use built-in structured output for providers that allow it
95
- optional_modules = {"langchain_anthropic" , "langchain_fireworks" , "langchain_groq" , "langchain_google_vertexai" }
96
- if all (key in modules for key in optional_modules ):
97
- if isinstance (self .llm_model , (ChatOpenAI , ChatMistralAI , ChatAnthropic , ChatFireworks , ChatGroq , ChatVertexAI )):
98
- self .llm_model = self .llm_model .with_structured_output (
99
- schema = self .node_config ["schema" ],
100
- method = "json_schema" )
101
- else :
102
- if isinstance (self .llm_model , (ChatOpenAI , ChatMistralAI )):
103
- self .llm_model = self .llm_model .with_structured_output (
104
- schema = self .node_config ["schema" ],
105
- method = "json_schema" )
106
90
91
+ if isinstance (self .llm_model , (ChatOpenAI , ChatMistralAI )):
92
+ self .llm_model = self .llm_model .with_structured_output (
93
+ schema = self .node_config ["schema" ],
94
+ method = "json_schema" )
95
+ else :
96
+ output_parser = JsonOutputParser (pydantic_object = self .node_config ["schema" ])
107
97
108
98
else :
109
99
output_parser = JsonOutputParser ()
0 commit comments