[PR #106] [feat]allow user to specify collection & embedding table names #168

Open
opened 2026-02-16 05:16:49 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langchain-postgres/pull/106
Author: @liunux4odoo
Created: 8/10/2024
Status: 🔄 Open

Base: mainHead: feat3


📝 Commits (1)

  • 156e933 allow user to specify collection & embedding table names, so user can

📊 Changes

1 file changed (+115 additions, -39 deletions)

View changed files

📝 langchain_postgres/vectorstores.py (+115 -39)

📄 Description

allow user to specify collection & embedding table names, so user can create multiple vector store pairs for different usage.
also some small fix:

  • remove type annotaion for EmbeddingStore.embedding
  • give default values for connection_string_from_db_params
  • fix bug in _results_to_docs_and_scores and other similar methods

example code:

# running environment:
# python = 3.10.12
# pgvector = 0.2.5
# sqlalchemy = 2.0.31


from langchain_postgres import PGVector
from langchain_openai import OpenAIEmbeddings


embedding = OpenAIEmbeddings(base_url="http://xxx/v1",
                     api_key="sk-", model="xx")
con = PGVector.connection_string_from_db_params("langchain")
vs = PGVector.from_texts(['hello world'], embedding , collection_name="test", connection=con,
                         collection_table_name="collection", embedding_table_name="embedding")
docs = vs.similarity_search("hello there")
print(docs)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langchain-postgres/pull/106 **Author:** [@liunux4odoo](https://github.com/liunux4odoo) **Created:** 8/10/2024 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat3` --- ### 📝 Commits (1) - [`156e933`](https://github.com/langchain-ai/langchain-postgres/commit/156e933744ff263275d3143973fac96d49f40a6f) allow user to specify collection & embedding table names, so user can ### 📊 Changes **1 file changed** (+115 additions, -39 deletions) <details> <summary>View changed files</summary> 📝 `langchain_postgres/vectorstores.py` (+115 -39) </details> ### 📄 Description allow user to specify collection & embedding table names, so user can create multiple vector store pairs for different usage. also some small fix: - remove type annotaion for `EmbeddingStore.embedding` - give default values for `connection_string_from_db_params` - fix bug in `_results_to_docs_and_scores` and other similar methods example code: ```python3 # running environment: # python = 3.10.12 # pgvector = 0.2.5 # sqlalchemy = 2.0.31 from langchain_postgres import PGVector from langchain_openai import OpenAIEmbeddings embedding = OpenAIEmbeddings(base_url="http://xxx/v1", api_key="sk-", model="xx") con = PGVector.connection_string_from_db_params("langchain") vs = PGVector.from_texts(['hello world'], embedding , collection_name="test", connection=con, collection_table_name="collection", embedding_table_name="embedding") docs = vs.similarity_search("hello there") print(docs) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 05:16:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langchain-postgres#168