You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if we can migrate to aprep_inputs in astream.
Motivation
I'm exploring the PostgresChatMessageHistory and want to utilize asynchronous connections. To do so, I maintained an async posgres connection pool and pass an async connection each time I create an instance of PostgresChatMessageHistory
However, when I wrap the history into a memory and pass that memory to an agent executor, then astream that agent executor, I encounter an error:
Please initialize the PostgresChatMessageHistory with a sync connection or use the async aget_messages method instead.
After some digging, I find that the prep_inputs was called instead of the aprep_inputs, causing PostgresChatMessageHistory to fetch messages synchronously without a sync connection provided.
This can be resolved by passing a sync_connection to PostgresChatMessageHistory during instantiating. However, this requires maintaining a separate synchronize connection pool, which is less than ideal.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
In current implementation,
AgentExecutorIterator
invokesAgentExecutor
‘sprep_inputs
instead ofaprep_inputs
:It would be great if we can migrate to
aprep_inputs
inastream
.Motivation
I'm exploring the
PostgresChatMessageHistory
and want to utilize asynchronous connections. To do so, I maintained an async posgres connection pool and pass an async connection each time I create an instance ofPostgresChatMessageHistory
However, when I wrap the history into a memory and pass that memory to an agent executor, then astream that agent executor, I encounter an error:
Please initialize the PostgresChatMessageHistory with a sync connection or use the async aget_messages method instead.
After some digging, I find that the
prep_inputs
was called instead of theaprep_inputs
, causingPostgresChatMessageHistory
to fetch messages synchronously without a sync connection provided.This can be resolved by passing a sync_connection to
PostgresChatMessageHistory
during instantiating. However, this requires maintaining a separate synchronize connection pool, which is less than ideal.Proposal (If applicable)
No response
Beta Was this translation helpful? Give feedback.
All reactions