Repository: langchain
Issue: Non Descriptive Assertion Error while using AzureChatOpenAI model with Agents
Labels: Ɑ: agent,🤖:bug,stale,🔌: openai

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code

Hi Team,

I am trying to use the AzureChatOpenAI as LLM in the inside the ReACT Agent  Here is my code 

```
def search_function(query: str) -> str:
    """use to search results corresponding to given query"""
    return "Hello World"

search = StructuredTool.from_function(
    func=search_function,
    name="Search",
    description="useful for when you need to answer questions about current events",
    # coroutine= ... <- you can specify an async method if desired as well
)

tools = [search]
prompt = hub.pull("hwchase17/react")
prompt

appkey = "APP_KEY" ##Please assume I am using the correct key here

llm = AzureChatOpenAI(
    openai_api_version=os.getenv('OPENAI_API_VERSION'),
    azure_deployment="gpt-35-turbo",
    model_kwargs=dict(
        user=f'{{"appkey": "{appkey}"}}'
  )
)



agent = create_react_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
agent_executor.invoke({"input": "hi"})


```

Below is the AssertionError that I am getting. 

### Error Message and Stack Trace (if applicable)

```
> Entering new AgentExecutor chain...
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[17], [line 1](vscode-notebook-cell:?execution_count=17&line=1)
----> [1](vscode-notebook-cell:?execution_count=17&line=1) agent_executor.invoke({"input": "hi"})

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:162](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:162), in Chain.invoke(self, input, config, **kwargs)
    [160](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:160) except BaseException as e:
    [161](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:161)     run_manager.on_chain_error(e)
--> [162](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:162)     raise e
    [163](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:163) run_manager.on_chain_end(outputs)
    [164](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:164) final_outputs: Dict[str, Any] = self.prep_outputs(
    [165](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:165)     inputs, outputs, return_only_outputs
    [166](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:166) )

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:156](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:156), in Chain.invoke(self, input, config, **kwargs)
    [149](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:149) run_manager = callback_manager.on_chain_start(
    [150](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:150)     dumpd(self),
    [151](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:151)     inputs,
    [152](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:152)     name=run_name,
    [153](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:153) )
    [154](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:154) try:
    [155](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:155)     outputs = (
--> [156](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:156)         self._call(inputs, run_manager=run_manager)
    [157](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:157)         if new_arg_supported
    [158](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:158)         else self._call(inputs)
    [159](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:159)     )
    [160](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:160) except BaseException as e:
    [161](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/chains/base.py:161)     run_manager.on_chain_error(e)

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1391](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1391), in AgentExecutor._call(self, inputs, run_manager)
   [1389](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1389) # We now enter the agent loop (until it returns something).
   [1390](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1390) while self._should_continue(iterations, time_elapsed):
-> [1391](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1391)     next_step_output = self._take_next_step(
   [1392](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1392)         name_to_tool_map,
   [1393](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1393)         color_mapping,
   [1394](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1394)         inputs,
   [1395](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1395)         intermediate_steps,
   [1396](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1396)         run_manager=run_manager,
   [1397](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1397)     )
   [1398](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1398)     if isinstance(next_step_output, AgentFinish):
   [1399](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1399)         return self._return(
   [1400](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1400)             next_step_output, intermediate_steps, run_manager=run_manager
   [1401](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1401)         )

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1097](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1097), in AgentExecutor._take_next_step(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager)
   [1088](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1088) def _take_next_step(
   [1089](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1089)     self,
   [1090](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1090)     name_to_tool_map: Dict[str, BaseTool],
   (...)
   [1094](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1094)     run_manager: Optional[CallbackManagerForChainRun] = None,
   [1095](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1095) ) -> Union[AgentFinish, List[Tuple[AgentAction, str]]]:
   [1096](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1096)     return self._consume_next_step(
-> [1097](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1097)         [
   [1098](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1098)             a
   [1099](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1099)             for a in self._iter_next_step(
   [1100](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1100)                 name_to_tool_map,
   [1101](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1101)                 color_mapping,
   [1102](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1102)                 inputs,
   [1103](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1103)                 intermediate_steps,
   [1104](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1104)                 run_manager,
   [1105](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1105)             )
   [1106](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1106)         ]
   [1107](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1107)     )

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1097](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1097), in <listcomp>(.0)
   [1088](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1088) def _take_next_step(
   [1089](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1089)     self,
   [1090](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1090)     name_to_tool_map: Dict[str, BaseTool],
   (...)
   [1094](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1094)     run_manager: Optional[CallbackManagerForChainRun] = None,
   [1095](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1095) ) -> Union[AgentFinish, List[Tuple[AgentAction, str]]]:
   [1096](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1096)     return self._consume_next_step(
-> [1097](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1097)         [
   [1098](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1098)             a
   [1099](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1099)             for a in self._iter_next_step(
   [1100](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1100)                 name_to_tool_map,
   [1101](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1101)                 color_mapping,
   [1102](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1102)                 inputs,
   [1103](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1103)                 intermediate_steps,
   [1104](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1104)                 run_manager,
   [1105](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1105)             )
   [1106](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1106)         ]
   [1107](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1107)     )

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1125](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1125), in AgentExecutor._iter_next_step(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager)
   [1122](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1122)     intermediate_steps = self._prepare_intermediate_steps(intermediate_steps)
   [1124](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1124)     # Call the LLM to see what to do.
-> [1125](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1125)     output = self.agent.plan(
   [1126](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1126)         intermediate_steps,
   [1127](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1127)         callbacks=run_manager.get_child() if run_manager else None,
   [1128](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1128)         **inputs,
   [1129](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1129)     )
   [1130](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1130) except OutputParserException as e:
   [1131](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:1131)     if isinstance(self.handle_parsing_errors, bool):

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:387](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:387), in RunnableAgent.plan(self, intermediate_steps, callbacks, **kwargs)
    [381](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:381) # Use streaming to make sure that the underlying LLM is invoked in a streaming
    [382](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:382) # fashion to make it possible to get access to the individual LLM tokens
    [383](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:383) # when using stream_log with the Agent Executor.
    [384](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:384) # Because the response from the plan is not a generator, we need to
    [385](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:385) # accumulate the output into final output and return that.
    [386](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:386) final_output: Any = None
--> [387](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:387) for chunk in self.runnable.stream(inputs, config={"callbacks": callbacks}):
    [388](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:388)     if final_output is None:
    [389](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain/agents/agent.py:389)         final_output = chunk

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2424](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2424), in RunnableSequence.stream(self, input, config, **kwargs)
   [2418](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2418) def stream(
   [2419](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2419)     self,
   [2420](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2420)     input: Input,
   [2421](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2421)     config: Optional[RunnableConfig] = None,
   [2422](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2422)     **kwargs: Optional[Any],
   [2423](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2423) ) -> Iterator[Output]:
-> [2424](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2424)     yield from self.transform(iter([input]), config, **kwargs)

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2411](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2411), in RunnableSequence.transform(self, input, config, **kwargs)
   [2405](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2405) def transform(
   [2406](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2406)     self,
   [2407](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2407)     input: Iterator[Input],
   [2408](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2408)     config: Optional[RunnableConfig] = None,
   [2409](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2409)     **kwargs: Optional[Any],
   [2410](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2410) ) -> Iterator[Output]:
-> [2411](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2411)     yield from self._transform_stream_with_config(
   [2412](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2412)         input,
   [2413](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2413)         self._transform,
   [2414](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2414)         patch_config(config, run_name=(config or {}).get("run_name") or self.name),
   [2415](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2415)         **kwargs,
   [2416](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2416)     )

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1497](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1497), in Runnable._transform_stream_with_config(self, input, transformer, config, run_type, **kwargs)
   [1495](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1495) try:
   [1496](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1496)     while True:
-> [1497](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1497)         chunk: Output = context.run(next, iterator)  # type: ignore
   [1498](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1498)         yield chunk
   [1499](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1499)         if final_output_supported:

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2375](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2375), in RunnableSequence._transform(self, input, run_manager, config)
   [2366](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2366) for step in steps:
   [2367](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2367)     final_pipeline = step.transform(
   [2368](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2368)         final_pipeline,
   [2369](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2369)         patch_config(
   (...)
   [2372](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2372)         ),
   [2373](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2373)     )
-> [2375](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2375) for output in final_pipeline:
   [2376](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:2376)     yield output

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1035](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1035), in Runnable.transform(self, input, config, **kwargs)
   [1032](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1032) final: Input
   [1033](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1033) got_first_val = False
-> [1035](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1035) for chunk in input:
   [1036](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1036)     if not got_first_val:
   [1037](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1037)         final = chunk

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4168](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4168), in RunnableBindingBase.transform(self, input, config, **kwargs)
   [4162](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4162) def transform(
   [4163](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4163)     self,
   [4164](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4164)     input: Iterator[Input],
   [4165](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4165)     config: Optional[RunnableConfig] = None,
   [4166](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4166)     **kwargs: Any,
   [4167](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4167) ) -> Iterator[Output]:
-> [4168](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4168)     yield from self.bound.transform(
   [4169](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4169)         input,
   [4170](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4170)         self._merge_configs(config),
   [4171](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4171)         **{**self.kwargs, **kwargs},
   [4172](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:4172)     )

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1045](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1045), in Runnable.transform(self, input, config, **kwargs)
   [1042](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1042)         final = final + chunk  # type: ignore[operator]
   [1044](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1044) if got_first_val:
-> [1045](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/runnables/base.py:1045)     yield from self.stream(final, config, **kwargs)

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:250](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:250), in BaseChatModel.stream(self, input, config, stop, **kwargs)
    [243](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:243) except BaseException as e:
    [244](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:244)     run_manager.on_llm_error(
    [245](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:245)         e,
    [246](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:246)         response=LLMResult(
    [247](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:247)             generations=[[generation]] if generation else []
    [248](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:248)         ),
    [249](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:249)     )
--> [250](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:250)     raise e
    [251](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:251) else:
    [252](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:252)     run_manager.on_llm_end(LLMResult(generations=[[generation]]))

File [~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:242](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:242), in BaseChatModel.stream(self, input, config, stop, **kwargs)
    [240](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:240)         else:
    [241](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:241)             generation += chunk
--> [242](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:242)     assert generation is not None
    [243](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:243) except BaseException as e:
    [244](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:244)     run_manager.on_llm_error(
    [245](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:245)         e,
    [246](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:246)         response=LLMResult(
    [247](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:247)             generations=[[generation]] if generation else []
    [248](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:248)         ),
    [249](https://file+.vscode-resource.vscode-cdn.net/Users/sagarsingh/Desktop/Work/RAG_Fusion_poc/~/Desktop/Work/RAG_Fusion_poc/.venv/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py:249)     )

AssertionError:
```

### Description

Hi Team,

I am trying to use the AzureChatOpenAI as LLM in the inside the ReACT Agent  

AzureChatOpenAI model is working when I run it independently But When I use that in agent as LLM. It is throwing me the Assertion Error (Also Assertion Error is not descriptive)

Please help me how can I run this code, where and what I have missing 

### System Info

langchain==0.1.5
langchain-community==0.0.18
langchain-core==0.1.19
langchain-openai==0.0.6
langchainhub==0.1.14