Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
python-version: "3.11"

- name: Install requirements
run: pip install .[test]
run: pip install -e .[test]

- name: Run linters
run: |
Expand Down
341 changes: 170 additions & 171 deletions docs/document_loader.ipynb
Original file line number Diff line number Diff line change
@@ -1,173 +1,172 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Google DATABASE\n",
"\n",
"[Google DATABASE](https://cloud.google.com/DATABASE).\n",
"\n",
"Load documents from `DATABASE`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Pre-reqs"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"%pip install PACKAGE_NAME"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from PACKAGE import LOADER"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Basic Usage"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load from table"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"loader = LOADER()\n",
"\n",
"data = loader.load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load from query"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"loader = LOADER()\n",
"\n",
"data = loader.load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Customize Document Page Content & Metadata"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"loader = LOADER(\n",
"\n",
")\n",
"\n",
"data = loader.load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Customize Page Content Format"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Save Documents to table"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"saver = SAVER()\n",
"saver.add_documents(docs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Customize Connection & Authentication"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from google.cloud.DATABASE import Client\n",
"creds = \"\"\n",
"client = Client(creds=creds)\n",
"loader = LOADER(\n",
" client=client,\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Google DATABASE\n",
"\n",
"[Google DATABASE](https://cloud.google.com/DATABASE).\n",
"\n",
"Load documents from `DATABASE`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Pre-reqs"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"%pip install PACKAGE_NAME"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from PACKAGE import LOADER"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Basic Usage"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load from table"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"loader = LOADER()\n",
"\n",
"data = loader.load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load from query"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"loader = LOADER()\n",
"\n",
"data = loader.load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Customize Document Page Content & Metadata"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"loader = LOADER()\n",
"\n",
"data = loader.load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Customize Page Content Format"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Save Documents to table"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"saver = SAVER()\n",
"saver.add_documents(docs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Customize Connection & Authentication"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from google.cloud.DATABASE import Client\n",
"\n",
"creds = \"\"\n",
"client = Client(creds=creds)\n",
"loader = LOADER(\n",
" client=client,\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ Changelog = "https://github.com/googleapis/langchain-google-spanner-python/blob/
[project.optional-dependencies]
test = [
"black==23.12.0",
"black[jupyter]==23.12.0",
"isort==5.13.2",
"mypy==1.7.1",
"pytest-asyncio==0.23.0",
"pytest==7.4.4",
"pytest-asyncio==0.23.0",
"types-google-cloud-ndb==2.2.0.20240106"
]

Expand Down
4 changes: 4 additions & 0 deletions src/langchain_google_spanner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from langchain_google_spanner.document_loader import SpannerDocumentSaver, SpannerLoader

__all__ = ["SpannerLoader", "SpannerDocumentSaver"]
Loading