fix: adjust invoke agent to work sync (#3789)

♻️ (agent.py): refactor the code to remove unnecessary 'await' keyword before agent.invoke() method to improve code readability and maintainability
This commit is contained in:
Cristhian Zanforlin Lousa 2024-09-12 16:58:41 -03:00 committed by GitHub
commit 5b51fe892b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -98,7 +98,7 @@ class LCAgentComponent(Component):
self.chat_history = self.get_chat_history_data()
if self.chat_history:
input_dict["chat_history"] = data_to_messages(self.chat_history)
result = await agent.ainvoke(
result = agent.invoke(
input_dict, config={"callbacks": [AgentAsyncHandler(self.log)] + self.get_langchain_callbacks()}
)
self.status = result