Skip to content

Commit fbcbef7

Browse files
authored
docs: refactor the readme (#176)
I've decided to keep the Google Cloud Integrations section at the bottom. I will send separate PRs for the migration script and quickstart update.
1 parent 1f1f03f commit fbcbef7

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

README.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Feel free to use the abstraction as provided or else modify them / extend them a
1515

1616
## Requirements
1717

18-
The package currently only supports the [psycogp3](https://www.psycopg.org/psycopg3/) driver.
18+
The package supports the [asyncpg](https://github.com/MagicStack/asyncpg) and [psycogp3](https://www.psycopg.org/psycopg3/) drivers.
1919

2020
## Installation
2121

@@ -27,14 +27,12 @@ pip install -U langchain-postgres
2727

2828
### Vectorstore
2929

30-
> [!NOTE]
31-
> See example for the [PGVector vectorstore here](https://github.com/langchain-ai/langchain-postgres/blob/main/examples/vectorstore.ipynb)
32-
`PGVector` is being deprecated. Please migrate to `PGVectorStore`.
33-
`PGVectorStore` is used for improved performance and manageability.
34-
See the [migration guide](https://github.com/langchain-ai/langchain-postgres/blob/main/examples/migrate_pgvector_to_pgvectorstore.md) for details on how to migrate from `PGVector` to `PGVectorStore`.
30+
> [!WARNING]
31+
> In v0.0.14+, `PGVector` is deprecated. Please migrate to `PGVectorStore`
32+
> for improved performance and manageability.
33+
> See the [migration guide](https://github.com/langchain-ai/langchain-postgres/blob/main/examples/migrate_pgvector_to_pgvectorstore.md) for details on how to migrate from `PGVector` to `PGVectorStore`.
3534
36-
> [!TIP]
37-
> All synchronous functions have corresponding asynchronous functions
35+
For a detailed example on `PGVectorStore` see [here](https://github.com/langchain-ai/langchain-postgres/blob/main/examples/pg_vectorstore.ipynb).
3836

3937
```python
4038
from langchain_postgres import PGEngine, PGVectorStore
@@ -58,11 +56,10 @@ store = PGVectorStore.create_sync(
5856
embedding_service=embedding,
5957
)
6058

61-
all_texts = ["Apples and oranges", "Cars and airplanes", "Pineapple", "Train", "Banana"]
62-
metadatas = [{"len": len(t)} for t in all_texts]
63-
ids = [str(uuid.uuid4()) for _ in all_texts]
6459
docs = [
65-
Document(id=ids[i], page_content=all_texts[i], metadata=metadatas[i]) for i in range(len(all_texts))
60+
Document(page_content="Apples and oranges"),
61+
Document(page_content="Cars and airplanes"),
62+
Document(page_content="Train")
6663
]
6764

6865
store.add_documents(docs)
@@ -72,7 +69,8 @@ docs = store.similarity_search(query)
7269
print(docs)
7370
```
7471

75-
For a detailed example on `PGVectorStore` see [here](https://github.com/langchain-ai/langchain-postgres/blob/main/examples/pg_vectorstore.ipynb).
72+
> [!TIP]
73+
> All synchronous functions have corresponding asynchronous functions
7674
7775
### ChatMessageHistory
7876

@@ -122,10 +120,6 @@ chat_history.add_messages([
122120
print(chat_history.messages)
123121
```
124122

125-
### Vectorstore
126-
127-
See example for the [PGVector vectorstore here](https://github.com/langchain-ai/langchain-postgres/blob/main/examples/vectorstore.ipynb)
128-
129123
## Google Cloud Integrations
130124

131125
[Google Cloud](https://python.langchain.com/docs/integrations/providers/google/) provides Vector Store, Chat Message History, and Data Loader integrations for [AlloyDB](https://cloud.google.com/alloydb) and [Cloud SQL](https://cloud.google.com/sql) for PostgreSQL databases via the following PyPi packages:

langchain_postgres/vectorstores.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,7 @@ class EmbeddingStore(Base):
200200

201201
__tablename__ = "langchain_pg_embedding"
202202

203-
id = sqlalchemy.Column(
204-
sqlalchemy.String, primary_key=True
205-
)
203+
id = sqlalchemy.Column(sqlalchemy.String, primary_key=True)
206204

207205
collection_id = sqlalchemy.Column(
208206
UUID(as_uuid=True),

0 commit comments

Comments
 (0)