Add Asynchronous Connection Pooling Support to PostgresChatMessageHistory#130
Open
The Wandering Algorithm (shamspias) wants to merge 9 commits intolangchain-ai:mainfrom
Open
Conversation
|
Erick Friis (@efriis) - Could you help review and merge this PR? I am building something that needs this fix ASAP, please. Thanks. |
|
Hi - any updates so far for this fix? |
|
Hi - any updates so far for this fix? |
Seems like, It haven't fixed yet, I was implementing the streaming in my application, but stuck with the async issue of postgres ChatMessageHistory. Do I have to modify the lib. installed locally? using the provided solution??? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for asynchronous connection pooling in the
PostgresChatMessageHistoryclass, addressing issues #122 and #129Changes Made:
PostgresChatMessageHistory:conn_poolparameter to accept anAsyncConnectionPoolinstance.__init__method to includeconn_pooland reordered parameters for improved usability.session_idandtable_namecan be passed as keyword arguments.aget_messagesandaadd_messagesto utilize the connection pool when provided.async_connectionto ensure backward compatibility.test_async_chat_history_with_poolintests/unit_tests/test_chat_histories.pyto verify the new functionality.PostgresChatMessageHistorywith an asynchronous connection pool.conn_poolparameter.Example Usage:
Testing:
Added a new test
test_async_chat_history_with_poolintests/unit_tests/test_chat_histories.py:Ensured all existing tests pass, maintaining backward compatibility.
Documentation:
__init__method.Notes:
sync_connectionorasync_connectioncontinues to work without modifications.Related Issues:
PostgresChatMessageHistorywith async connections when usingRunnableWithMessageHistory? #122