mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-08-24 11:42:51 -04:00
[PR #130] Add Asynchronous Connection Pooling Support to PostgresChatMessageHistory #178
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langchain-ai/langchain-postgres/pull/130
Author: @shamspias
Created: 10/16/2024
Status: 🔄 Open
Base:
main← Head:fix/async-connection-pooling📝 Commits (9)
1065477Add async connection pooling support to PostgresChatMessageHistory084c619Add async connection pooling support with corrected parameter passingcbdc34dAdd tests for async connection pooling in PostgresChatMessageHistoryc9a7b38Update README with async connection pooling usage examplesce04edcMerge branch 'main' into fix/async-connection-pooling6e39bf2Merge branch 'main' into fix/async-connection-pooling6242ce6Merge branch 'main' into fix/async-connection-pooling2c8077aMerge branch 'main' into fix/async-connection-pooling790ea8dMerge branch 'main' into fix/async-connection-pooling📊 Changes
3 files changed (+193 additions, -44 deletions)
View changed files
📝
README.md(+65 -15)📝
langchain_postgres/chat_message_histories.py(+54 -28)📝
tests/unit_tests/test_chat_histories.py(+74 -1)📄 Description
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:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.