Skip to content

Commit d5a2b01

Browse files
committed
chroe(docs): README update
1 parent 60b8626 commit d5a2b01

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

README.md

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,65 +44,73 @@ virtualenv <your-env>
4444
<your-env>\Scripts\pip.exe install llama-index-spanner
4545
```
4646

47-
<!-- ### Spanner Property Graph Store Usage
47+
### Spanner Property Graph Store Usage
4848

4949
Use `SpannerPropertyGraphStore` to store nodes and edges extracted from documents.
5050

5151
```python
5252
from llama_index_spanner import SpannerPropertyGraphStore
5353

54-
graph = SpannerPropertyGraphStore(
54+
graph_store = SpannerPropertyGraphStore(
5555
instance_id="my-instance",
5656
database_id="my-database",
5757
graph_name="my_graph",
5858
)
5959
```
6060

61-
See the full [Spanner Graph Store](https://github.com/googleapis/langchain-google-spanner-python/blob/main/docs/graph_store.ipynb) tutorial.
61+
See the full [Spanner Graph Store](https://github.com/googleapis/llama-index-spanner-python/blob/main/docs/property_graph_store.ipynb) tutorial.
6262

6363
### Spanner Graph Retrievers Usage
6464

65-
Use `SpannerGraphTextToGQLRetriever` to translate natural language question to GQL and query SpannerGraphStore.
65+
Use `SpannerGraphTextToGQLRetriever` to translate natural language question to GQL and query SpannerPropertyGraphStore.
6666

6767
```python
68-
from langchain_google_spanner import SpannerGraphStore, SpannerGraphTextToGQLRetriever
69-
from langchain_google_vertexai import ChatVertexAI
68+
from llama_index_spanner import (
69+
SpannerPropertyGraphStore,
70+
SpannerGraphTextToGQLRetriever,
71+
)
72+
from llama_index.llms.google_genai import GoogleGenAI
7073

71-
graph = SpannerGraphStore(
74+
graph_store = SpannerPropertyGraphStore(
7275
instance_id="my-instance",
7376
database_id="my-database",
7477
graph_name="my_graph",
7578
)
76-
llm = ChatVertexAI()
77-
retriever = SpannerGraphTextToGQLRetriever.from_params(
78-
graph_store=graph,
79-
llm=llm
79+
llm = GoogleGenAI(
80+
model="gemini-2.0-flash",
8081
)
81-
retriever.invoke("Where does Elias Thorne's sibling live?")
82+
retriever = SpannerGraphTextToGQLRetriever(graph_store=graph_store, llm=llm)
83+
retriever.retrieve("Where does Elias Thorne's sibling live?")
84+
8285
```
8386

84-
Use `SpannerGraphVectorContextRetriever` to perform vector search on embeddings that are stored in the nodes in a SpannerGraphStore. If expand\_by\_hops is provided, the nodes and edges at a distance upto the expand\_by\_hops from the nodes found in the vector search will also be returned.
87+
Use `SpannerGraphCustomRetriever` to query your SpannerPropertyGraphStore with a hybrid approach, combining natural language to GQL translation with vector search capabilities.
8588

8689
```python
87-
from langchain_google_spanner import SpannerGraphStore, SpannerGraphVectorContextRetriever
88-
from langchain_google_vertexai import ChatVertexAI, VertexAIEmbeddings
90+
from llama_index_spanner import SpannerPropertyGraphStore, SpannerGraphCustomRetriever
91+
from llama_index.llms.google_genai import GoogleGenAI
92+
from llama_index.embeddings.google_genai import GoogleGenAIEmbedding
8993

90-
graph = SpannerGraphStore(
94+
graph_store = SpannerPropertyGraphStore(
9195
instance_id="my-instance",
9296
database_id="my-database",
9397
graph_name="my_graph",
9498
)
95-
embedding_service = VertexAIEmbeddings(model_name="text-embedding-004")
96-
retriever = SpannerGraphVectorContextRetriever.from_params(
97-
graph_store=graph,
98-
embedding_service=embedding_service,
99-
label_expr="Person",
100-
embeddings_column="embeddings",
101-
top_k=1,
102-
expand_by_hops=1,
103-
)
104-
retriever.invoke("Who lives in desert?")
105-
``` -->
99+
llm = GoogleGenAI(
100+
model="gemini-2.0-flash",
101+
)
102+
embed_model = GoogleGenAIEmbedding(model_name="text-embedding-004")
103+
retriever = SpannerGraphCustomRetriever(
104+
similarity_top_k=4,
105+
path_depth=2,
106+
graph_store=graph_store,
107+
llm=llm,
108+
embed_model=embed_model,
109+
)
110+
retriever.retriever("Who lives in desert?")
111+
```
112+
113+
See the full [Spanner Graph Retrievers](https://github.com/googleapis/llama-index-spanner-python/blob/main/docs/graph_retriver.ipynb) tutorial.
106114

107115
## Contributing
108116

0 commit comments

Comments
 (0)