How to store text embeddings in custom table in PGVector? #17223
-
Checked other resources
Commit to Help
Example CodeCOLLECTION_NAME = "state_of_the_union_test"
db = PGVector.from_documents(
embedding=embeddings,
documents=docs,
collection_name=COLLECTION_NAME,
connection_string=CONNECTION_STRING,
) DescriptionWe're trying to store the text vector embeddings in PGVector and noticed that PGVector has created two tables.
As per this PGVector class, I see these tables are hard coded. Is there any way to store the embeddings in custom tables? Thanks in advance. System InfoPlatform: Windows |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
🤖 Hey there, @vinayak-shanawad! Good to see you back with another intriguing question. Hope you're doing well! Based on the current implementation of the LangChain framework, there is no built-in way to store text vector embeddings in custom tables with PGVector. The table names 'langchain_pg_collection' and 'langchain_pg_embedding' are hardcoded in the class CollectionStore(BaseModel):
"""Collection store."""
__tablename__ = "langchain_pg_collection"
...
class EmbeddingStore(BaseModel):
"""Embedding store."""
__tablename__ = "langchain_pg_embedding"
... These classes are used throughout the If you need to use custom table names, you might need to create a custom implementation of the You can find more details about the I hope this answers your question. If you have any further queries, feel free to ask. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
I would like to create these tables in a custom schema (my_schema.langchain_pg_collection) by passing in a configuration object. Would be great if this was a feature. |
Beta Was this translation helpful? Give feedback.
🤖
Hey there, @vinayak-shanawad! Good to see you back with another intriguing question. Hope you're doing well!
Based on the current implementation of the LangChain framework, there is no built-in way to store text vector embeddings in custom tables with PGVector. The table names 'langchain_pg_collection' and 'langchain_pg_embedding' are hardcoded in the
CollectionStore
andEmbeddingStore
classes respectively, as shown below:These classes are used throughout the
P…