Skip to content

Commit

Permalink
docs: add docloader codelab (#15)
Browse files Browse the repository at this point in the history
* docs: document_loader.ipynb

* feat: update doc

* docs: fix error

* docs: fix lint

* docs: update readme

* docs: update readme

* docs: refine doc

* docs: sync with mysql loader doc

* docs: fix lint

* docs: minor refine
  • Loading branch information
loeng2023 committed Feb 21, 2024
1 parent a546889 commit f58b30f
Show file tree
Hide file tree
Showing 3 changed files with 510 additions and 39 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,25 @@ source <your-env>/bin/activate
<your-env>/bin/pip install langchain-google-cloud-sql-mssql
```

## Usage
## Document Loader Usage


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

```python
from langchain_google_cloud_sql_mssql import CloudSQLVectorstore, CloudSQLLoader, CloudSQLChatMessageHistory
from langchain_google_cloud_sql_mssql import MSSQLEngine, MSSQLLoader


engine = MSSQLEngine.from_instance("project-id", "region", "my-instance", "my-database", "db_user", "db_pass")
loader = MSSQLLoader(
engine,
table_name="my-table-name"
)
docs = loader.lazy_load()
```

See the full [Document Loader][loader] tutorial.

## Contributing

Contributions to this library are always welcome and highly encouraged.
Expand All @@ -61,4 +74,5 @@ This is not an officially supported Google product.
[billing]: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
[api]: https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com
[auth]: https://googleapis.dev/python/google-api-core/latest/auth.html
[venv]: https://virtualenv.pypa.io/en/latest/
[venv]: https://virtualenv.pypa.io/en/latest/
[loader]: ./docs/document_loader.ipynb
Loading

0 comments on commit f58b30f

Please sign in to comment.