Skip to content

Commit 14098ca

Browse files
authored
docs: Add Hybrid Search documentation (#329)
* docs: Add Hybrid Search documentation * minor changes * minor fixes
1 parent ea4566d commit 14098ca

File tree

2 files changed

+371
-0
lines changed

2 files changed

+371
-0
lines changed

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

0 commit comments

Comments
 (0)