@@ -187,10 +187,10 @@ async def aadd_texts(
187187 self ,
188188 texts : Iterable [str ],
189189 metadatas : Optional [List [dict ]] = None ,
190- ids : Optional [List [ str ] ] = None ,
190+ ids : Optional [List ] = None ,
191191 ** kwargs : Any ,
192192 ) -> List [str ]:
193- """Embed texts and add to the table."""
193+ """Embed texts and add to the table. Throws an error if Id column data type doesn't match with the ids. """
194194 return await self ._engine ._run_as_async (
195195 self .__vs .aadd_texts (texts , metadatas , ids , ** kwargs )
196196 )
@@ -199,50 +199,50 @@ def add_texts(
199199 self ,
200200 texts : Iterable [str ],
201201 metadatas : Optional [List [dict ]] = None ,
202- ids : Optional [List [ str ] ] = None ,
202+ ids : Optional [List ] = None ,
203203 ** kwargs : Any ,
204204 ) -> List [str ]:
205- """Embed texts and add to the table."""
205+ """Embed texts and add to the table. Throws an error if Id column data type doesn't match with the ids. """
206206 return self ._engine ._run_as_sync (
207207 self .__vs .aadd_texts (texts , metadatas , ids , ** kwargs )
208208 )
209209
210210 async def aadd_documents (
211211 self ,
212212 documents : List [Document ],
213- ids : Optional [List [ str ] ] = None ,
213+ ids : Optional [List ] = None ,
214214 ** kwargs : Any ,
215215 ) -> List [str ]:
216- """Embed documents and add to the table"""
216+ """Embed documents and add to the table. Throws an error if Id column data type doesn't match with the ids. """
217217 return await self ._engine ._run_as_async (
218218 self .__vs .aadd_documents (documents , ids , ** kwargs )
219219 )
220220
221221 def add_documents (
222222 self ,
223223 documents : List [Document ],
224- ids : Optional [List [ str ] ] = None ,
224+ ids : Optional [List ] = None ,
225225 ** kwargs : Any ,
226226 ) -> List [str ]:
227- """Embed documents and add to the table."""
227+ """Embed documents and add to the table. Throws an error if Id column data type doesn't match with the ids. """
228228 return self ._engine ._run_as_sync (
229229 self .__vs .aadd_documents (documents , ids , ** kwargs )
230230 )
231231
232232 async def adelete (
233233 self ,
234- ids : Optional [List [ str ] ] = None ,
234+ ids : Optional [List ] = None ,
235235 ** kwargs : Any ,
236236 ) -> Optional [bool ]:
237- """Delete records from the table."""
237+ """Delete records from the table. Throws an error if Id column data type doesn't match with the ids. """
238238 return await self ._engine ._run_as_async (self .__vs .adelete (ids , ** kwargs ))
239239
240240 def delete (
241241 self ,
242- ids : Optional [List [ str ] ] = None ,
242+ ids : Optional [List ] = None ,
243243 ** kwargs : Any ,
244244 ) -> Optional [bool ]:
245- """Delete records from the table."""
245+ """Delete records from the table. Throws an error if Id column data type doesn't match with the ids. """
246246 return self ._engine ._run_as_sync (self .__vs .adelete (ids , ** kwargs ))
247247
248248 @classmethod
@@ -254,7 +254,7 @@ async def afrom_texts( # type: ignore[override]
254254 table_name : str ,
255255 schema_name : str = "public" ,
256256 metadatas : Optional [List [dict ]] = None ,
257- ids : Optional [List [ str ] ] = None ,
257+ ids : Optional [List ] = None ,
258258 content_column : str = "content" ,
259259 embedding_column : str = "embedding" ,
260260 metadata_columns : List [str ] = [],
@@ -268,14 +268,16 @@ async def afrom_texts( # type: ignore[override]
268268 index_query_options : Optional [QueryOptions ] = None ,
269269 ) -> PostgresVectorStore :
270270 """Create an PostgresVectorStore instance from texts.
271+ Throws an error if Id column data type doesn't match with the ids.
272+
271273 Args:
272274 texts (List[str]): Texts to add to the vector store.
273275 embedding (Embeddings): Text embedding model to use.
274276 engine (PostgresEngine): Connection pool engine for managing connections to Postgres database.
275277 table_name (str): Name of the existing table or the table to be created.
276278 schema_name (str, optional): Database schema name of the table. Defaults to "public".
277279 metadatas (Optional[List[dict]]): List of metadatas to add to table records.
278- ids: (Optional[List[str] ]): List of IDs to add to table records.
280+ ids: (Optional[List]): List of IDs to add to table records.
279281 content_column (str): Column that represent a Document’s page_content. Defaults to "content".
280282 embedding_column (str): Column for embedding vectors. The embedding is generated from the document value. Defaults to "embedding".
281283 metadata_columns (List[str]): Column(s) that represent a document's metadata.
@@ -319,7 +321,7 @@ async def afrom_documents( # type: ignore[override]
319321 engine : PostgresEngine ,
320322 table_name : str ,
321323 schema_name : str = "public" ,
322- ids : Optional [List [ str ] ] = None ,
324+ ids : Optional [List ] = None ,
323325 content_column : str = "content" ,
324326 embedding_column : str = "embedding" ,
325327 metadata_columns : List [str ] = [],
@@ -333,6 +335,7 @@ async def afrom_documents( # type: ignore[override]
333335 index_query_options : Optional [QueryOptions ] = None ,
334336 ) -> PostgresVectorStore :
335337 """Create an PostgresVectorStore instance from documents.
338+ Throws an error if Id column data type doesn't match with the ids.
336339
337340 Args:
338341 documents (List[Document]): Documents to add to the vector store.
@@ -341,7 +344,7 @@ async def afrom_documents( # type: ignore[override]
341344 table_name (str): Name of the existing table or the table to be created.
342345 schema_name (str, optional): Database schema name of the table. Defaults to "public".
343346 metadatas (Optional[List[dict]]): List of metadatas to add to table records.
344- ids: (Optional[List[str] ]): List of IDs to add to table records.
347+ ids: (Optional[List]): List of IDs to add to table records.
345348 content_column (str): Column that represent a Document’s page_content. Defaults to "content".
346349 embedding_column (str): Column for embedding vectors. The embedding is generated from the document value. Defaults to "embedding".
347350 metadata_columns (List[str]): Column(s) that represent a document's metadata.
@@ -386,7 +389,7 @@ def from_texts( # type: ignore[override]
386389 table_name : str ,
387390 schema_name : str = "public" ,
388391 metadatas : Optional [List [dict ]] = None ,
389- ids : Optional [List [ str ] ] = None ,
392+ ids : Optional [List ] = None ,
390393 content_column : str = "content" ,
391394 embedding_column : str = "embedding" ,
392395 metadata_columns : List [str ] = [],
@@ -400,14 +403,16 @@ def from_texts( # type: ignore[override]
400403 index_query_options : Optional [QueryOptions ] = None ,
401404 ) -> PostgresVectorStore :
402405 """Create an PostgresVectorStore instance from texts.
406+ Throws an error if Id column data type doesn't match with the ids.
407+
403408 Args:
404409 texts (List[str]): Texts to add to the vector store.
405410 embedding (Embeddings): Text embedding model to use.
406411 engine (PostgresEngine): Connection pool engine for managing connections to Postgres database.
407412 table_name (str): Name of the existing table or the table to be created.
408413 schema_name (str, optional): Database schema name of the table. Defaults to "public".
409414 metadatas (Optional[List[dict]]): List of metadatas to add to table records.
410- ids: (Optional[List[str] ]): List of IDs to add to table records.
415+ ids: (Optional[List]): List of IDs to add to table records.
411416 content_column (str): Column that represent a Document’s page_content. Defaults to "content".
412417 embedding_column (str): Column for embedding vectors. The embedding is generated from the document value. Defaults to "embedding".
413418 metadata_columns (List[str]): Column(s) that represent a document's metadata.
@@ -451,7 +456,7 @@ def from_documents( # type: ignore[override]
451456 engine : PostgresEngine ,
452457 table_name : str ,
453458 schema_name : str = "public" ,
454- ids : Optional [List [ str ] ] = None ,
459+ ids : Optional [List ] = None ,
455460 content_column : str = "content" ,
456461 embedding_column : str = "embedding" ,
457462 metadata_columns : List [str ] = [],
@@ -465,6 +470,7 @@ def from_documents( # type: ignore[override]
465470 index_query_options : Optional [QueryOptions ] = None ,
466471 ) -> PostgresVectorStore :
467472 """Create an PostgresVectorStore instance from documents.
473+ Throws an error if Id column data type doesn't match with the ids.
468474
469475 Args:
470476 documents (List[Document]): Documents to add to the vector store.
@@ -473,7 +479,7 @@ def from_documents( # type: ignore[override]
473479 table_name (str): Name of the existing table or the table to be created.
474480 schema_name (str, optional): Database schema name of the table. Defaults to "public".
475481 metadatas (Optional[List[dict]]): List of metadatas to add to table records.
476- ids: (Optional[List[str] ]): List of IDs to add to table records.
482+ ids: (Optional[List]): List of IDs to add to table records.
477483 content_column (str): Column that represent a Document’s page_content. Defaults to "content".
478484 embedding_column (str): Column for embedding vectors. The embedding is generated from the document value. Defaults to "embedding".
479485 metadata_columns (List[str]): Column(s) that represent a document's metadata.
0 commit comments