Skip to content

Commit

Permalink
Merge branch 'main' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
GICodeWarrior authored Feb 15, 2025
2 parents c742286 + 7cd9f2a commit 1a743c0
Show file tree
Hide file tree
Showing 48 changed files with 8,674 additions and 473 deletions.
73 changes: 73 additions & 0 deletions docs/docs/community/integrations/vector_stores.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ as the storage backend for `VectorStoreIndex`.
- Epsilla (`EpsillaVectorStore`) [Installation/Quickstart](https://epsilla-inc.gitbook.io/epsilladb/quick-start)
- Faiss (`FaissVectorStore`). [Installation](https://github.com/facebookresearch/faiss/blob/main/INSTALL.md).
- Google AlloyDB for PostgreSQL (`AlloyDBVectorStore`). [QuickStart](https://github.com/googleapis/llama-index-alloydb-pg-python/blob/main/samples/llama_index_vector_store.ipynb).
- Google Cloud SQL for PostgreSQL (`PostgresVectorStore`). [Quickstart](https://github.com/googleapis/llama-index-cloud-sql-pg-python/blob/main/samples/llama_index_vector_store.ipynb)
- Hnswlib (`HnswlibVectorStore`). [Installation](https://github.com/nmslib/hnswlib?tab=readme-ov-file#bindings-installation).
- txtai (`TxtaiVectorStore`). [Installation](https://neuml.github.io/txtai/install/).
- Jaguar (`JaguarVectorStore`). [Installation](http://www.jaguardb.com/docsetup.html).
Expand Down Expand Up @@ -421,6 +422,43 @@ vector_store = FaissVectorStore(faiss_index)
storage_context.persist()
```

**Google Cloud SQL for PostgreSQL**

```bash
pip install llama-index
pip install llama-index-cloud-sql-pg
pip install llama-index-llms-vertex
gcloud services enable aiplatform.googleapis.com
```

```python
from llama_index_cloud_sql_pg import PostgresEngine, PostgresVectorStore
from llama_index.core import Settings
from llama_index.embeddings.vertex import VertexTextEmbedding
from llama_index.llms.vertex import Vertex
import google.auth

# Replace with your own Cloud SQL info
engine = PostgresEngine.from_instance(
project_id=PROJECT_ID,
region=REGION,
instance=INSTANCE,
database=DATABASE,
user=USER,
password=PASSWORD,
)

engine.init_vector_store_table(
table_name=TABLE_NAME,
vector_size=768, # Vector size for VertexAI model(textembedding-gecko@latest)
)

vector_store = PostgresVectorStore.create_sync(
engine=engine,
table_name=TABLE_NAME,
)
```

**txtai**

```python
Expand Down Expand Up @@ -898,6 +936,40 @@ response = query_engine.query("<query_text>")
display(Markdown(f"<b>{response}</b>"))
```

Google Cloud SQL for PostgreSQL stores both document and vectors.
This tutorial demonstrates the synchronous interface. All synchronous methods have corresponding asynchronous methods.
This is an example of how to use Cloud SQL for PostgreSQL:

```bash
pip install llama-index
pip install llama-index-cloud-sql-pg
```

```python
from llama_index.core import SummaryIndex
from llama_index_cloud_sql_pg import PostgresEngine, PostgresReader

engine = PostgresEngine.from_instance(
project_id=PROJECT_ID,
region=REGION,
instance=INSTANCE,
database=DATABASE,
user=USER,
password=PASSWORD,
)
reader = PostgresReader.create_sync(
engine,
table_name=TABLE_NAME,
)
documents = reader.load_data()

index = SummaryIndex.from_documents(documents)

query_engine = index.as_query_engine()
response = query_engine.query("<query_text>")
display(Markdown(f"<b>{response}</b>"))
```

Chroma stores both documents and vectors. This is an example of how to use Chroma:

```python
Expand Down Expand Up @@ -1016,6 +1088,7 @@ documents = reader.load_data(
- [DocArray in-Memory](../../examples/vector_stores/DocArrayInMemoryIndexDemo.ipynb)
- [Espilla](../../examples/vector_stores/EpsillaIndexDemo.ipynb)
- [Google AlloyDB for PostgreSQL](../../examples/vector_stores/AlloyDBVectorStoreDemo.ipynb)
- [Google Cloud SQL for PostgreSQL](../../examples/vector_stores/CloudSQLPgVectorStoreDemo.ipynb)
- [LanceDB](../../examples/vector_stores/LanceDBIndexDemo.ipynb)
- [Lantern](../../examples/vector_stores/LanternIndexDemo.ipynb)
- [Metal](../../examples/vector_stores/MetalIndexDemo.ipynb)
Expand Down
Loading

0 comments on commit 1a743c0

Please sign in to comment.