Skip to content

Commit e4c0447

Browse files
docs: Add README to the repo. (#7)
* docs: Add README to the repo. * Update README.rst * Update README.rst * Update README.rst --------- Co-authored-by: Averi Kitsch <akitsch@google.com>
1 parent a85ec56 commit e4c0447

File tree

1 file changed

+157
-12
lines changed

1 file changed

+157
-12
lines changed

README.rst

Lines changed: 157 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,172 @@
1-
# Cloud SQL Postgres for Llama Index
1+
Cloud SQL for PostgreSQL for LlamaIndex
2+
==================================================
23

3-
[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=GITHUB_URL)
4+
|preview| |pypi| |versions|
45

5-
*Description*
6+
- `Product Documentation`_
67

7-
> **🧪 Preview:** Any notes about stability or launch stage.
8+
The **Cloud SQL for PostgreSQL for LlamaIndex** package provides a first class experience for connecting to
9+
Cloud SQL instances from the LlamaIndex ecosystem while providing the following benefits:
810

9-
## Features
11+
- **Simplified & Secure Connections**: easily and securely create shared connection pools to connect to Google Cloud databases utilizing IAM for authorization and database authentication without needing to manage SSL certificates, configure firewall rules, or enable authorized networks.
12+
- **Improved metadata handling**: store metadata in columns instead of JSON, resulting in significant performance improvements.
13+
- **Clear separation**: clearly separate table and extension creation, allowing for distinct permissions and streamlined workflows.
1014

11-
## Getting Started
15+
.. |preview| image:: https://img.shields.io/badge/support-preview-orange.svg
16+
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
17+
.. |pypi| image:: https://img.shields.io/pypi/v/llama-index-cloud-sql-pg.svg
18+
:target: https://pypi.org/project/llama-index-cloud-sql-pg/
19+
.. |versions| image:: https://img.shields.io/pypi/pyversions/llama-index-cloud-sql-pg.svg
20+
:target: https://pypi.org/project/llama-index-cloud-sql-pg/
21+
.. _Product Documentation: https://cloud.google.com/sql/docs
1222

13-
### Prerequisites
23+
Quick Start
24+
-----------
1425

15-
## Contributing
26+
In order to use this library, you first need to go through the following
27+
steps:
28+
29+
1. `Select or create a Cloud Platform project.`_
30+
2. `Enable billing for your project.`_
31+
3. `Enable the Cloud SQL Admin API.`_
32+
4. `Setup Authentication.`_
33+
34+
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
35+
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
36+
.. _Enable the Cloud SQL Admin API.: https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com
37+
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
38+
39+
Installation
40+
~~~~~~~~~~~~
41+
42+
Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to create isolated Python environments. The basic problem it addresses is
43+
one of dependencies and versions, and indirectly permissions.
44+
45+
With `virtualenv`_, it's
46+
possible to install this library without needing system install
47+
permissions, and without clashing with the installed system
48+
dependencies.
49+
50+
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
51+
52+
Supported Python Versions
53+
^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
Python >= 3.9
56+
57+
Mac/Linux
58+
^^^^^^^^^
59+
60+
.. code-block:: console
61+
62+
pip install virtualenv
63+
virtualenv <your-env>
64+
source <your-env>/bin/activate
65+
<your-env>/bin/pip install llama-index-cloud-sql-pg
66+
67+
Windows
68+
^^^^^^^
69+
70+
.. code-block:: console
71+
72+
pip install virtualenv
73+
virtualenv <your-env>
74+
<your-env>\Scripts\activate
75+
<your-env>\Scripts\pip.exe install llama-index-cloud-sql-pg
76+
77+
Example Usage
78+
-------------
79+
80+
Code samples and snippets live in the `samples/`_ folder.
81+
82+
.. _samples/: https://github.com/googleapis/llama-index-cloud-sql-pg-python/tree/main/samples
83+
84+
Vector Store Usage
85+
~~~~~~~~~~~~~~~~~~~
86+
87+
Use a vector store to store embedded data and perform vector search.
88+
89+
.. code-block:: python
90+
91+
import google.auth
92+
from llama_index.core import Settings
93+
from llama_index.embeddings.vertex import VertexTextEmbedding
94+
from llama_index_cloud_sql_pg import PostgresEngine, PostgresVectorStore
95+
96+
97+
credentials, project_id = google.auth.default()
98+
engine = await PostgresEngine.afrom_instance(
99+
"project-id", "region", "my-cluster", "my-instance", "my-database"
100+
)
101+
Settings.embed_model = VertexTextEmbedding(
102+
model_name="textembedding-gecko@003",
103+
project="project-id",
104+
credentials=credentials,
105+
)
106+
107+
vector_store = await PostgresVectorStore.create(
108+
engine=engine, table_name="vector_store"
109+
)
110+
111+
112+
Document Store Usage
113+
~~~~~~~~~~~~~~~~~~~~~
114+
115+
Use a document store to make storage and maintenance of data easier.
116+
117+
.. code-block:: python
118+
119+
from llama_index_cloud_sql_pg import PostgresEngine, PostgresDocumentStore
120+
121+
122+
engine = await PostgresEngine.afrom_instance(
123+
"project-id", "region", "my-cluster", "my-instance", "my-database"
124+
)
125+
doc_store = await PostgresDocumentStore.create(
126+
engine=engine, table_name="doc_store"
127+
)
128+
129+
130+
Index Store Usage
131+
~~~~~~~~~~~~~~~~~~~~~~~~~~
132+
133+
Use an index store to keep track of indexes built on documents.
134+
135+
.. code:: python
136+
137+
from llama_index_cloud_sql_pg import PostgresIndexStore, PostgresEngine
138+
139+
140+
engine = await PostgresEngine.from_instance(
141+
"project-id", "region", "my-cluster", "my-instance", "my-database"
142+
)
143+
index_store = await PostgresIndexStore.create(
144+
engine=engine, table_name="index_store"
145+
)
146+
147+
148+
Contributions
149+
~~~~~~~~~~~~~
16150

17151
Contributions to this library are always welcome and highly encouraged.
18152

19-
See [CONTRIBUTING](CONTRIBUTING.md) for more information how to get started.
153+
See `CONTRIBUTING`_ for more information how to get started.
20154

21155
Please note that this project is released with a Contributor Code of Conduct. By participating in
22-
this project you agree to abide by its terms. See [Code of Conduct](CODE_OF_CONDUCT.md) for more
156+
this project you agree to abide by its terms. See `Code of Conduct`_ for more
23157
information.
24158

25-
## License
159+
.. _`CONTRIBUTING`: https://github.com/googleapis/llama-index-cloud-sql-pg-python/tree/main/CONTRIBUTING.md
160+
.. _`Code of Conduct`: https://github.com/googleapis/llama-index-cloud-sql-pg-python/tree/main/CODE_OF_CONDUCT.md
161+
162+
License
163+
-------
164+
165+
Apache 2.0 - See
166+
`LICENSE <https://github.com/googleapis/llama-index-cloud-sql-pg-python/tree/main/LICENSE>`_
167+
for more information.
168+
169+
Disclaimer
170+
----------
26171

27-
Apache 2.0 - See [LICENSE](LICENSE) for more information.
172+
This is not an officially supported Google product.

0 commit comments

Comments
 (0)