Skip to content
Open
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
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 88
extend-ignore = E203, W503, E501, E741, E731
exclude = .git,.venv,.nox,build,dist
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ branchProtectionRules:
requiredStatusCheckContexts:
- "cla/google"
- "lint"
- "integration-test-pr-py39 (langchain-spanner-testing)"
- "integration-test-pr-py310 (langchain-spanner-testing)"
- "integration-test-pr-py311 (langchain-spanner-testing)"
- "integration-test-pr-py312 (langchain-spanner-testing)"
- "integration-test-pr-py313 (langchain-spanner-testing)"
- "conventionalcommits.org"
- "header-check"
# - Add required status checks like presubmit tests
Expand Down
6 changes: 3 additions & 3 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ These tests are registered as required tests in `.github/sync-repo-settings.yaml

#### Trigger Setup

Cloud Build triggers (for Python versions 3.9 to 3.11) were created with the following specs:
Cloud Build triggers (for Python versions 3.10 to 3.13) were created with the following specs:

```YAML
name: integration-test-pr-py39
description: Run integration tests on PR for Python 3.9
description: Run integration tests on PR for Python 3.10
filename: integration.cloudbuild.yaml
github:
name: langchain-google-spanner-python
Expand All @@ -55,7 +55,7 @@ substitutions:
_INSTANCE_ID: <ADD_VALUE>
_PG_DATABASE: <ADD_VALUE>
_GOOGLE_DATABASE: <ADD_VALUE>
_VERSION: "3.9"
_VERSION: "3.10"
```

Use `gcloud builds triggers import --source=trigger.yaml` to create triggers via the command line
Expand Down
30 changes: 19 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ With `virtualenv`_, it’s possible to install this library without needing syst
Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^

Python >= 3.9
Python >= 3.10

Mac/Linux
^^^^^^^^^
Expand Down Expand Up @@ -73,15 +73,19 @@ Use a vector store to store embedded data and perform vector search.

.. code-block:: python
from langchain_google_spanner import SpannerVectorstore
from langchain.embeddings import VertexAIEmbeddings
from langchain_google_spanner import SpannerVectorStore
from langchain_google_genai import GoogleGenerativeAIEmbeddings
embeddings_service = VertexAIEmbeddings(model_name="textembedding-gecko@003")
embeddings_service = GoogleGenerativeAIEmbeddings(
model="textembedding-gecko@003",
project="my-project",
vertexai=True,
)
vectorstore = SpannerVectorStore(
instance_id="my-instance",
database_id="my-database",
table_name="my-table",
embeddings=embedding_service
embeddings=embeddings_service
)
See the full `Vector Store`_ tutorial.
Expand Down Expand Up @@ -159,15 +163,15 @@ Use ``SpannerGraphQAChain`` for question answering over a graph stored in Spanne
.. code:: python
from langchain_google_spanner import SpannerGraphStore, SpannerGraphQAChain
from langchain_google_vertexai import ChatVertexAI
from langchain_google_genai import ChatGoogleGenerativeAI
graph = SpannerGraphStore(
instance_id="my-instance",
database_id="my-database",
graph_name="my_graph",
)
llm = ChatVertexAI()
llm = ChatGoogleGenerativeAI()
chain = SpannerGraphQAChain.from_llm(
llm,
graph=graph,
Expand All @@ -187,15 +191,15 @@ Use ``SpannerGraphTextToGQLRetriever`` to translate natural language question to
.. code:: python
from langchain_google_spanner import SpannerGraphStore, SpannerGraphTextToGQLRetriever
from langchain_google_vertexai import ChatVertexAI
from langchain_google_genai import ChatGoogleGenerativeAI
graph = SpannerGraphStore(
instance_id="my-instance",
database_id="my-database",
graph_name="my_graph",
)
llm = ChatVertexAI()
llm = ChatGoogleGenerativeAI()
retriever = SpannerGraphTextToGQLRetriever.from_params(
graph_store=graph,
llm=llm
Expand All @@ -207,15 +211,19 @@ Use ``SpannerGraphVectorContextRetriever`` to perform vector search on embedding
.. code:: python
from langchain_google_spanner import SpannerGraphStore, SpannerGraphVectorContextRetriever
from langchain_google_vertexai import ChatVertexAI, VertexAIEmbeddings
from langchain_google_genai import GoogleGenerativeAIEmbeddings
graph = SpannerGraphStore(
instance_id="my-instance",
database_id="my-database",
graph_name="my_graph",
)
embedding_service = VertexAIEmbeddings(model_name="text-embedding-004")
embedding_service = GoogleGenerativeAIEmbeddings(
model="gemini-embedding-2",
project="my-project",
vertexai=True,
)
retriever = SpannerGraphVectorContextRetriever.from_params(
graph_store=graph,
embedding_service=embedding_service,
Expand Down
8 changes: 4 additions & 4 deletions docs/graph_qa_chain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
"# @title Extract Nodes and Edges from text snippets\n",
"from langchain_core.documents import Document\n",
"from langchain_experimental.graph_transformers import LLMGraphTransformer\n",
"from langchain_google_vertexai import ChatVertexAI\n",
"from langchain_google_genai import ChatGoogleGenerativeAI\n",
"from langchain_text_splitters import RecursiveCharacterTextSplitter\n",
"\n",
"text_snippets = [\n",
Expand Down Expand Up @@ -333,7 +333,7 @@
"documents = [Document(page_content=t) for t in text_snippets]\n",
"text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n",
"splits = text_splitter.split_documents(documents)\n",
"llm = ChatVertexAI(model=\"gemini-1.5-flash\", temperature=0)\n",
"llm = ChatGoogleGenerativeAI(model=\"gemini-1.5-flash\", temperature=0)\n",
"llm_transformer = LLMGraphTransformer(\n",
" llm=llm,\n",
" allowed_nodes=[\"College\", \"Deparatment\", \"Person\", \"Year\", \"Company\"],\n",
Expand Down Expand Up @@ -495,11 +495,11 @@
"source": [
"from google.cloud import spanner\n",
"from langchain_google_spanner import SpannerGraphQAChain\n",
"from langchain_google_vertexai import ChatVertexAI\n",
"from langchain_google_genai import ChatGoogleGenerativeAI\n",
"from IPython.core.display import HTML\n",
"\n",
"# Initialize llm object\n",
"llm = ChatVertexAI(model=\"gemini-2.0-flash-001\", temperature=0)\n",
"llm = ChatGoogleGenerativeAI(model=\"gemini-3.1-flash-lite\", temperature=0)\n",
"\n",
"# Initialize GraphQAChain\n",
"chain = SpannerGraphQAChain.from_llm(\n",
Expand Down
Loading
Loading