Open gingters opened 6 months ago
I have a similar error.
I am using RunnableWithMessageHistory and if I run it with sync it says I need to make it async.
then I change it to an async connection and get the same AttributeError.
I even try to async await the connection -
async def get_connection(): return await psycopg.AsyncConnection(POSTGRES_AI)
def create_message_history(session_id: str) -> PostgresChatMessageHistory: return PostgresChatMessageHistory( table_name, session_id, async_connection=get_connection() )
File "/Users/fanli/Library/Caches/pypoetry/virtualenvs/ai-6oX_ziT5-py3.12/lib/python3.12/site-packages/langchain_postgres/chat_message_histories.py", line 336, in aget_messages | async with self._aconnection.cursor() as cursor: | ^^^^^^^^^^^^^^^^^^^^^^^^ | AttributeError: 'coroutine' object has no attribute 'cursor' +------------------------------------
same error, looking forward to fix
Double clicking this again
The community should feel free to open a PR to fix
I moved from langchain_community to langchain_postgres.
With the previous community implementation everything worked, but we need to update as we have other dependencies that need newer versions.
When I use the (sync) Connection, I get this error:
That prompted me to use the AsyncConnection instead, but when using the AsyncConnection, I run into this error when the message history is to be fetched:
I currently use: