Skip to content

Commit f94f7a2

Browse files
Yuan325averikitsch
andauthored
chore: clean repo (#20)
* chore: clean repo * Update renovate.json5 * Update pyproject.toml * Update requirements.txt * Update lint.yml --------- Co-authored-by: Averi Kitsch <[email protected]>
1 parent 7a77d26 commit f94f7a2

File tree

8 files changed

+73
-29
lines changed

8 files changed

+73
-29
lines changed

.github/renovate.json5

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// Dependency Update Configuration
2-
//
3-
// See https://docs.renovatebot.com/configuration-options/
4-
// See https://json5.org/ for JSON5 syntax
51
{
6-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
72
"extends": [
83
"config:base", // https://docs.renovatebot.com/presets-config/#configbase
94
":semanticCommits", // https://docs.renovatebot.com/presets-default/#semanticcommits
@@ -13,7 +8,7 @@
138
":prConcurrentLimitNone", // View complete backlog as PRs. https://docs.renovatebot.com/presets-default/#prconcurrentlimitnone
149
":prNotPending", // https://docs.renovatebot.com/presets-default/#prnotpending
1510
":prHourlyLimitNone", // https://docs.renovatebot.com/presets-default/#prhourlylimitnone
16-
"docker:enableMajor", // https://docs.renovatebot.com/presets-docker/#dockerenablemajor
11+
":preserveSemverRanges",
1712
],
1813

1914
// Synchronized with a 2 week sprint cycle and outside business hours.
@@ -35,25 +30,8 @@
3530
"dependencyDashboardLabels": [
3631
"type: process",
3732
],
38-
39-
"constraints": {
40-
"python": "3.11"
41-
},
42-
43-
"pip_requirements": {
44-
"fileMatch": ["requirements-test.txt"]
45-
},
4633
"packageRules": [
4734

48-
// Tooling & Runtime behaviors.
49-
{
50-
// Covers Dockerfiles, cloudbuild.yaml, and other docker-based tools.
51-
"groupName": "Docker Runtimes",
52-
"matchDatasources": ["docker"],
53-
// TODO: Uncomment if your Dockerfiles are not included in samples.
54-
// Increases build repeatability, image cache use, and supply chain security.
55-
// "pinDigests": true,
56-
},
5735
{
5836
"groupName": "GitHub Actions",
5937
"matchManagers": ["github-actions"],

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ jobs:
3434
if: "${{ (github.event.action != 'labeled' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) || github.event.label.name == 'tests: run' }}"
3535

3636
steps:
37+
- name: Remove PR label
38+
if: "${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
39+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
40+
with:
41+
github-token: ${{ secrets.GITHUB_TOKEN }}
42+
script: |
43+
try {
44+
await github.rest.issues.removeLabel({
45+
name: 'tests: run',
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
issue_number: context.payload.pull_request.number
49+
});
50+
} catch (e) {
51+
console.log('Failed to remove label. Another job may have already removed it!');
52+
}
53+
3754
- name: Checkout Repository
3855
uses: actions/checkout@v3
3956

@@ -43,6 +60,9 @@ jobs:
4360
python-version: "3.11"
4461

4562
- name: Install requirements
63+
run: pip install -r requirements.txt
64+
65+
- name: Install module (and test requirements)
4666
run: pip install -e .[test]
4767

4868
- name: Run linters

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ docs.metadata
5151
# Virtual environment
5252
env/
5353
venv/
54+
.python-version
5455

5556
# Test logs
5657
coverage.xml

README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Spanner for LangChain
22

3-
*Description*
3+
This package contains the [LangChain][langchain] integrations for Spanner.
44

55
> **🧪 Preview:** This feature is covered by the Pre-GA Offerings Terms of the Google Cloud Terms of Service. Please note that pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. For more information, see the [launch stage descriptions](https://cloud.google.com/products#product-launch-stages)
66
@@ -33,12 +33,42 @@ source <your-env>/bin/activate
3333
<your-env>/bin/pip install langchain-google-spanner
3434
```
3535

36-
## Usage
36+
## Document Loader Usage
37+
38+
Use a document loader to load data as LangChain `Document`s.
39+
40+
```python
41+
from langchain_google_spanner import SpannerLoader
42+
43+
44+
loader = SpannerLoader(
45+
instance_id="my-instance",
46+
database_id="my-database",
47+
query="SELECT * from my_table_name"
48+
)
49+
docs = loader.lazy_load()
50+
```
51+
52+
See the full [Document Loader][loader] tutorial.
53+
54+
## Chat Message History Usage
55+
56+
Use `ChatMessageHistory` to store messages and provide conversation history to LLMs.
3757

3858
```python
39-
from langchain_google_spanner import SpannerVectorstore, SpannerLoader, SpannerChatMessageHistory
59+
from langchain_google_spanner import SpannerChatMessageHistory
60+
61+
62+
history = SpannerChatMessageHistory(
63+
instance_id="my-instance",
64+
database_id="my-database",
65+
table_name="my_table_name",
66+
session_id="my-session_id"
67+
)
4068
```
4169

70+
See the full [Chat Message History][history] tutorial.
71+
4272
## Contributing
4373

4474
Contributions to this library are always welcome and highly encouraged.
@@ -61,4 +91,7 @@ This is not an officially supported Google product.
6191
[billing]: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
6292
[api]: https://console.cloud.google.com/flows/enableapi?apiid=spanner.googleapis.com
6393
[auth]: https://googleapis.dev/python/google-api-core/latest/auth.html
64-
[venv]: https://virtualenv.pypa.io/en/latest/
94+
[venv]: https://virtualenv.pypa.io/en/latest/
95+
[loader]: ./docs/document_loader.ipynb
96+
[history]: ./docs/chat_message_history.ipynb
97+
[langchain]: https://github.com/langchain-ai/langchain

integration.cloudbuild.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
steps:
1616
- id: Install dependencies
17+
name: python:3.11
18+
entrypoint: pip
19+
args: ["install", "--user", "-r", "requirements.txt"]
20+
21+
- id: Install module (and test requirements)
1722
name: python:3.11
1823
entrypoint: pip
1924
args: ["install", ".[test]", "--user"]

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ description = "LangChain integrations for Google Cloud Spanner"
55
readme = "README.md"
66
license = {file = "LICENSE"}
77
requires-python = ">=3.8"
8+
authors = [
9+
{name = "Google LLC", email = "[email protected]"}
10+
]
811
dependencies = [
9-
"langchain==0.1.1",
10-
"google-cloud-spanner==3.41.0"
12+
"langchain-core>=0.1.25, <1.0.0",
13+
"langchain-community>=0.0.18, <1.0.0",
14+
"google-cloud-spanner>=3.41.0, <4.0.0"
1115
]
1216

1317
[tool.setuptools.dynamic]

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
langchain-core==0.1.25
2+
langchain-community==0.0.21
3+
google-cloud-spanner==3.42.0

src/langchain_google_spanner/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)