Skip to content

Commit e871c2b

Browse files
docs: add basic MySQLVectorStore usage to README (#58)
* docs: add basic MySQLVectorStore usage to README * chore: update code block * chore: update sample for consistency * Update README.md --------- Co-authored-by: Averi Kitsch <akitsch@google.com>
1 parent 5b80694 commit e871c2b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,28 @@ source <your-env>/bin/activate
3333
<your-env>/bin/pip install langchain-google-cloud-sql-mysql
3434
```
3535

36+
## Vector Store Usage
37+
38+
Use a [vector store](https://python.langchain.com/docs/modules/data_connection/vectorstores/) to store
39+
embedded data and perform vector search.
40+
41+
```python
42+
from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLVectorStore
43+
from langchain_google_vertexai import VertexAIEmbeddings
44+
45+
46+
engine = MySQLEngine.from_instance("project-id", "region", "my-instance", "my-database")
47+
engine.init_vectorstore_table(
48+
table_name="my-table-name",
49+
vector_size=768, # Vector size for `VertexAIEmbeddings()`
50+
)
51+
vectorstore = MySQLVectorStore(
52+
engine,
53+
embedding_service=VertextAIEmbeddings(),
54+
table_name="my-table-name",
55+
)
56+
```
57+
3658
## Document Loader Usage
3759

3860
Use a [document loader](https://python.langchain.com/docs/modules/data_connection/document_loaders/) to load data as LangChain `Document`s.

0 commit comments

Comments
 (0)