Skip to content

Commit 11a3664

Browse files
authored
Merge branch 'main' into renovate/migrate-config
2 parents 551fec4 + 14098ca commit 11a3664

23 files changed

Lines changed: 1148 additions & 2283 deletions

‎.github/workflows/docs.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
13+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
1414
- name: Setup Python
1515
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
1616
with:
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
29+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
3030
- name: Setup Python
3131
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
3232
with:

‎.github/workflows/lint.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
steps:
3333
- name: Checkout Repository
34-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
34+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
3535

3636
- name: Setup Python
3737
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0

‎.github/workflows/schedule_reporter.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
issues: 'write'
2525
checks: 'read'
2626
contents: 'read'
27-
uses: googleapis/langchain-google-alloydb-pg-python/.github/workflows/cloud_build_failure_reporter.yml@6fbd4b557d0784569dd246e386acd01a264d7de4
27+
uses: googleapis/langchain-google-alloydb-pg-python/.github/workflows/cloud_build_failure_reporter.yml@3423e9aea159d63dee57d11d2667358ae233c081
2828
with:
2929
trigger_names: "pg-integration-test-nightly,pg-continuous-test-on-merge"

‎README.rst‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,26 @@ Use a Vector Store to store embedded data and perform vector search.
111111
embeddings=embedding_service
112112
)
113113
114+
Hybrid search
115+
~~~~~~~~~~~~~
116+
117+
The `PostgresVectorStore` supports hybrid search (dense vectors + full text) for more comprehensive and relevant search results.
118+
119+
.. code-block:: python
120+
121+
from langchain_google_cloud_sql_pg import HybridSearchConfig, reciprocal_rank_fusion
122+
123+
vs = PostgresVectorStore.create_sync(
124+
engine=engine,
125+
table_name=TABLE_NAME,
126+
embedding_service=embedding,
127+
hybrid_search_config=HybridSearchConfig(
128+
fusion_function=reciprocal_rank_fusion
129+
),
130+
)
131+
hybrid_docs = vector_store.similarity_search("products", k=5)
132+
133+
114134
See the full `Vector Store`_ tutorial.
115135

116136
.. _`Vector Store`: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/docs/vector_store.ipynb

‎docs/vector_store.ipynb‎

Lines changed: 392 additions & 2 deletions
Large diffs are not rendered by default.

‎pyproject.toml‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ authors = [
1111

1212
dependencies = [
1313
"cloud-sql-python-connector[asyncpg] >= 1.10.0, <2.0.0",
14-
"langchain-core>=0.2.36, <1.0.0 ",
1514
"numpy>=1.24.4, <3.0.0; python_version >= '3.11'",
1615
"numpy>=1.24.4, <=2.2.6; python_version == '3.10'",
1716
"numpy>=1.24.4, <=2.0.2; python_version <= '3.9'",
18-
"pgvector>=0.2.5, <1.0.0",
19-
"SQLAlchemy[asyncio]>=2.0.25, <3.0.0"
17+
"langchain-postgres>=0.0.15",
2018
]
2119

2220
classifiers = [
@@ -46,12 +44,12 @@ langgraph = [
4644
test = [
4745
"black[jupyter]==25.1.0",
4846
"isort==6.0.1",
49-
"mypy==1.15.0",
47+
"mypy==1.17.1",
5048
"pytest-asyncio==0.26.0",
5149
"pytest==8.4.1",
5250
"pytest-cov==6.2.1",
5351
"langchain-tests==0.3.20",
54-
"langgraph==0.5.2"
52+
"langgraph==0.6.5"
5553
]
5654

5755
[build-system]

‎requirements.txt‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
cloud-sql-python-connector[asyncpg]==1.18.2
2-
langchain-core==0.3.68
3-
numpy==2.3.1; python_version >= "3.11"
1+
cloud-sql-python-connector[asyncpg]==1.18.4
2+
numpy==2.3.2; python_version >= "3.11"
43
numpy==2.2.6; python_version == "3.10"
54
numpy==2.0.2; python_version <= "3.9"
6-
pgvector==0.4.1
7-
SQLAlchemy[asyncio]==2.0.41
8-
langgraph==0.5.2
5+
langgraph==0.6.5
6+
langchain-postgres==0.0.15

‎src/langchain_google_cloud_sql_pg/__init__.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from langchain_postgres import Column
16+
from langchain_postgres.v2.hybrid_search_config import (
17+
HybridSearchConfig,
18+
reciprocal_rank_fusion,
19+
weighted_sum_ranking,
20+
)
21+
1522
from . import indexes
1623
from .chat_message_history import PostgresChatMessageHistory
1724
from .checkpoint import PostgresSaver
18-
from .engine import Column, PostgresEngine
25+
from .engine import PostgresEngine
1926
from .loader import PostgresDocumentSaver, PostgresLoader
2027
from .vectorstore import PostgresVectorStore
2128
from .version import __version__
@@ -29,5 +36,8 @@
2936
"PostgresLoader",
3037
"PostgresDocumentSaver",
3138
"PostgresSaver",
39+
"HybridSearchConfig",
40+
"reciprocal_rank_fusion",
41+
"weighted_sum_ranking",
3242
"__version__",
3343
]

0 commit comments

Comments
 (0)