Skip to content

fix: Add support for a metadata column named id in PGVectorStore #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions langchain_postgres/v2/async_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,14 @@ async def aadd_embeddings(
)
insert_stmt = f'INSERT INTO "{self.schema_name}"."{self.table_name}"("{self.id_column}", "{self.content_column}", "{self.embedding_column}"{hybrid_search_column}{metadata_col_names}'
values = {
"id": id,
"langchain_id": id,
"content": content,
"embedding": str([float(dimension) for dimension in embedding]),
}
values_stmt = "VALUES (:id, :content, :embedding"
values_stmt = "VALUES (:langchain_id, :content, :embedding"

if not embedding and can_inline_embed:
values_stmt = f"VALUES (:id, :content, {self.embedding_service.embed_query_inline(content)}" # type: ignore
values_stmt = f"VALUES (:langchain_id, :content, {self.embedding_service.embed_query_inline(content)}" # type: ignore

if self.hybrid_search_config and self.hybrid_search_config.tsv_column:
lang = (
Expand Down