Skip to content

Commit eb444af

Browse files
authored
Merge branch 'main' into issue_173
2 parents 9b427f0 + 22f2158 commit eb444af

10 files changed

Lines changed: 275 additions & 94 deletions

File tree

.github/workflows/docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
1414
- name: Setup Python
15-
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
15+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
1616
with:
1717
python-version: "3.10"
1818
- name: Install nox
@@ -26,9 +26,9 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
3030
- name: Setup Python
31-
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
31+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
3232
with:
3333
python-version: "3.10"
3434
- name: Install nox

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
3535

3636
- name: Setup Python
37-
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
37+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3838
with:
3939
python-version: "3.11"
4040

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Use a vector store to store embedded data and perform vector search.
7373

7474
.. code-block:: python
7575
76-
from langchain_google_sapnner import SpannerVectorstore
76+
from langchain_google_spanner import SpannerVectorstore
7777
from langchain.embeddings import VertexAIEmbeddings
7878
7979
embeddings_service = VertexAIEmbeddings(model_name="textembedding-gecko@003")

integration.cloudbuild.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ steps:
3636
timeout: "7200s"
3737
substitutions:
3838
_INSTANCE_ID: test-instance
39-
_GOOGLE_DATABASE: test-google-db
40-
_PG_DATABASE: test-pg-db
39+
_GOOGLE_DATABASE: test-gsql-db
40+
_PG_DATABASE: test-pgsql-db
4141
_VERSION: "3.9"
4242

4343
options:

src/langchain_google_spanner/graph_qa.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class VerifyGqlOutput(BaseModel):
7171
INTERMEDIATE_STEPS_KEY = "intermediate_steps"
7272

7373

74+
class InvalidGQLGenerationError(ValueError):
75+
def __init__(self, message, intermediate_steps=None):
76+
self.intermediate_steps = intermediate_steps
77+
super().__init__(message)
78+
79+
7480
class SpannerGraphQAChain(Chain):
7581
"""Chain for question-answering against a Spanner Graph database by
7682
generating GQL statements from natural language questions.
@@ -268,7 +274,9 @@ def execute_with_retry(
268274
finally:
269275
retries += 1
270276

271-
raise ValueError("The generated gql query is invalid")
277+
raise InvalidGQLGenerationError(
278+
"The generated gql query is invalid", intermediate_steps
279+
)
272280

273281
def log_invalid_query(
274282
self,
@@ -323,7 +331,9 @@ def _call(
323331
_run_manager, intermediate_steps, question, verified_gql
324332
)
325333
if not final_gql:
326-
raise ValueError("No GQL was generated.")
334+
raise InvalidGQLGenerationError(
335+
"No GQL was generated.", intermediate_steps
336+
)
327337
_run_manager.on_text("Full Context:", end="\n", verbose=self.verbose)
328338
_run_manager.on_text(
329339
str(context), color="green", end="\n", verbose=self.verbose

0 commit comments

Comments
 (0)