Skip to content

Commit fe70b95

Browse files
committed
lint
1 parent 735b24f commit fe70b95

5 files changed

+24
-13
lines changed

examples/migrate_pgvector_to_pgvectorstore.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@
280280
"outputs": [],
281281
"source": [
282282
"from langchain_core.embeddings import FakeEmbeddings\n",
283+
"\n",
283284
"from langchain_postgres import PGVectorStore\n",
284285
"from langchain_postgres.utils.pgvector_migrator import amigrate_pgvector_collection\n",
285286
"\n",

examples/pg_vectorstore.ipynb

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@
136136
},
137137
"outputs": [],
138138
"source": [
139-
"from langchain_postgres import Column\n",
140139
"from sqlalchemy.exc import ProgrammingError\n",
141140
"\n",
141+
"from langchain_postgres import Column\n",
142+
"\n",
142143
"try:\n",
143144
" await pg_engine.ainit_vectorstore_table(\n",
144145
" table_name=TABLE_NAME,\n",
@@ -149,7 +150,7 @@
149150
" Column(\"topic\", \"TEXT\"),\n",
150151
" ],\n",
151152
" )\n",
152-
"except ProgrammingError as e:\n",
153+
"except ProgrammingError:\n",
153154
" # Catching the exception here\n",
154155
" print(\"Table already exists. Skipping creation.\")"
155156
]
@@ -191,7 +192,7 @@
191192
"source": [
192193
"from langchain_openai import OpenAIEmbeddings\n",
193194
"\n",
194-
"embedding = OpenAIEmbeddings(model=\"text-embedding-3-small\")"
195+
"embedding = OpenAIEmbeddings(model=\"text-embedding-3-small\")"
195196
]
196197
},
197198
{
@@ -226,7 +227,7 @@
226227
" engine=pg_engine,\n",
227228
" table_name=TABLE_NAME,\n",
228229
" embedding_service=embedding,\n",
229-
" metadata_columns=[\"location\", \"topic\"]\n",
230+
" metadata_columns=[\"location\", \"topic\"],\n",
230231
")"
231232
]
232233
},
@@ -252,8 +253,8 @@
252253
"outputs": [],
253254
"source": [
254255
"import uuid\n",
255-
"from langchain_core.documents import Document\n",
256256
"\n",
257+
"from langchain_core.documents import Document\n",
257258
"\n",
258259
"docs = [\n",
259260
" Document(\n",
@@ -388,7 +389,9 @@
388389
},
389390
"outputs": [],
390391
"source": [
391-
"await vectorstore.asimilarity_search(\"birds\", filter={\"$or\": [{\"topic\": \"animals\"}, {\"location\": \"market\"}]})"
392+
"await vectorstore.asimilarity_search(\n",
393+
" \"birds\", filter={\"$or\": [{\"topic\": \"animals\"}, {\"location\": \"market\"}]}\n",
394+
")"
392395
]
393396
},
394397
{
@@ -410,7 +413,9 @@
410413
},
411414
"outputs": [],
412415
"source": [
413-
"await vectorstore.asimilarity_search(\"apple\", filter={\"topic\": {\"$in\": [\"food\", \"animals\"]}})"
416+
"await vectorstore.asimilarity_search(\n",
417+
" \"apple\", filter={\"topic\": {\"$in\": [\"food\", \"animals\"]}}\n",
418+
")"
414419
]
415420
},
416421
{
@@ -421,7 +426,9 @@
421426
},
422427
"outputs": [],
423428
"source": [
424-
"await vectorstore.asimilarity_search(\"sales of fruit\", filter={\"topic\": {\"$ne\": \"animals\"}})"
429+
"await vectorstore.asimilarity_search(\n",
430+
" \"sales of fruit\", filter={\"topic\": {\"$ne\": \"animals\"}}\n",
431+
")"
425432
]
426433
},
427434
{
@@ -450,7 +457,7 @@
450457
"source": [
451458
"from langchain_postgres.v2.indexes import IVFFlatIndex\n",
452459
"\n",
453-
"index = IVFFlatIndex() # Add an index using a default index name\n",
460+
"index = IVFFlatIndex() # Add an index using a default index name\n",
454461
"await vectorstore.aapply_vector_index(index)"
455462
]
456463
},

examples/pg_vectorstore_how_to.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,10 @@
278278
"metadata": {},
279279
"outputs": [],
280280
"source": [
281-
"from langchain_core.documents import Document\n",
282281
"import uuid\n",
283282
"\n",
283+
"from langchain_core.documents import Document\n",
284+
"\n",
284285
"docs = [\n",
285286
" Document(\n",
286287
" id=str(uuid.uuid4()),\n",
@@ -400,7 +401,7 @@
400401
"metadata": {},
401402
"outputs": [],
402403
"source": [
403-
"from langchain_postgres.v2.indexes import IVFFlatIndex, HNSWIndex\n",
404+
"from langchain_postgres.v2.indexes import HNSWIndex, IVFFlatIndex\n",
404405
"\n",
405406
"index = IVFFlatIndex()\n",
406407
"await store.aapply_vector_index(index)\n",
@@ -461,7 +462,7 @@
461462
"outputs": [],
462463
"source": [
463464
"await store.adrop_vector_index() # Delete index using the default name\n",
464-
"await store.adrop_vector_index(\"my-hnsw-index\") # Delete index using the index name"
465+
"await store.adrop_vector_index(\"my-hnsw-index\") # Delete index using the index name"
465466
]
466467
},
467468
{

examples/vectorstore.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@
6868
"outputs": [],
6969
"source": [
7070
"from langchain_cohere import CohereEmbeddings\n",
71-
"from langchain_postgres.vectorstores import PGVector\n",
7271
"from langchain_core.documents import Document\n",
7372
"\n",
73+
"from langchain_postgres.vectorstores import PGVector\n",
74+
"\n",
7475
"# See docker command above to launch a postgres instance with pgvector enabled.\n",
7576
"connection = \"postgresql+psycopg://langchain:langchain@localhost:6024/langchain\"\n",
7677
"collection_name = \"my_docs\"\n",

langchain_postgres/chat_message_histories.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
This client provides support for both sync and async via psycopg 3.
44
"""
5+
56
from __future__ import annotations
67

78
import json

0 commit comments

Comments
 (0)