File tree Expand file tree Collapse file tree 2 files changed +371
-0
lines changed
Expand file tree Collapse file tree 2 files changed +371
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments