Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch committed Jan 23, 2024
1 parent 618f3d9 commit f367bc6
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 176 deletions.
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"]
5 changes: 1 addition & 4 deletions tests/document_loader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
from google.cloud.spanner import Client, KeySet # type: ignore
from langchain_core.documents import Document

from langchain_google_spanner.document_loader import (
SpannerDocumentSaver,
SpannerLoader,
)
from langchain_google_spanner.document_loader import SpannerDocumentSaver, SpannerLoader

INSTANCE = "my-instance"
GOOGLE_DATABASE = "my-google-database"
Expand Down

0 comments on commit f367bc6

Please sign in to comment.