Skip to content

Commit 332943c

Browse files
authored
chore(fix): Fix broken links in Readme and mypy fixes in the test files (#21)
* chore: release 0.1.0 Release-As: 0.1.0 * chore(fix):Fix broken links in Readme + mypy fixes in the test files * chore(fix):fix lint errors * chore(fix): fix mypy on google.cloud.spanner * chore(update): Addressing PR comments * chore(fix): remove unnecessary variable
1 parent c853271 commit 332943c

File tree

8 files changed

+113
-79
lines changed

8 files changed

+113
-79
lines changed

.github/header-checker-lint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@ ignoreFiles:
3636
- '.github/header-checker-lint.yml'
3737
- '.github/sync-repo-settings.yaml'
3838
- '.github/workflows/docs.yml'
39-
- '.kokoro/**'
4039
- '**/requirements.txt'
4140
- '**/requirements-test.txt'

.github/trusted-contribution.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ annotations:
2828
- type: comment
2929
text: "/gcbrun"
3030
# Trigger Kokoro example
31-
# - type: label
32-
# text: "kokoro:force-run"
31+
- type: label
32+
text: "kokoro:force-run"

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ jobs:
5252
black --check .
5353
isort --check .
5454
55-
# - name: Run type-check
56-
# run: mypy --install-types --non-interactive .
55+
- name: Run type-check
56+
run: mypy --install-types --non-interactive .

DEVELOPER.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Learn more by reading [How should I write my commits?](https://github.com/google
3030

3131
### CI Platform Setup
3232

33-
Cloud Build is used to run tests against Google Cloud resources in test project: langchain-spanner-testing.
33+
Cloud Build is used to run tests against Google Cloud resources in test project: llamaindex-spanner-testing.
3434
Each test has a corresponding Cloud Build trigger, see [all triggers][triggers].
3535
These tests are registered as required tests in `.github/sync-repo-settings.yaml`.
3636

@@ -43,7 +43,7 @@ name: integration-test-pr-py39
4343
description: Run integration tests on PR for Python 3.9
4444
filename: integration.cloudbuild.yaml
4545
github:
46-
name: langchain-google-spanner-python
46+
name: llama-index-spanner-python
4747
owner: googleapis
4848
pullRequest:
4949
branch: .*
@@ -54,9 +54,9 @@ ignoredFiles:
5454
- .github/**
5555
- "*.md"
5656
substitutions:
57-
_INSTANCE_ID: <ADD_VALUE>
58-
_PG_DATABASE: <ADD_VALUE>
59-
_GOOGLE_DATABASE: <ADD_VALUE>
57+
_SPANNER_INSTANCE_ID: <ADD_VALUE>
58+
_SPANNER_DATABASE_ID: <ADD_VALUE>
59+
_SPANNER_GRAPH_NAME: <ADD_VALUE>
6060
_VERSION: "3.9"
6161
```
6262

@@ -72,7 +72,7 @@ Use `gcloud builds triggers import --source=trigger.yaml` to create triggers via
7272
* Run integration test:
7373

7474
```bash
75-
gcloud builds submit --config integration.cloudbuild.yaml --region us-central1 --substitutions=_INSTANCE_ID=$INSTANCE_ID
75+
gcloud builds submit --config integration.cloudbuild.yaml --region us-central1 --substitutions=_SPANNER_INSTANCE_ID=$_SPANNER_INSTANCE_ID
7676
```
7777

7878
#### Trigger
@@ -92,4 +92,4 @@ Here is a breakdown of the report:
9292
- `Missing`: lines that are not covered by tests.
9393

9494

95-
[triggers]: https://console.cloud.google.com/cloud-build/triggers?e=13802955&project=langchain-spanner-testing
95+
[triggers]: https://console.cloud.google.com/cloud-build/triggers?e=13802955&project=llamaindex-spanner-testing

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ retriever = SpannerGraphCustomRetriever(
111111
similarity_top_k=4,
112112
path_depth=2,
113113
graph_store=graph_store,
114-
llm=llm,
114+
llm_text_to_gql=llm,
115115
embed_model=embed_model,
116+
llmranker_top_n=3,
116117
)
117118
retriever.retriever("Who lives in desert?")
118119
```
@@ -123,12 +124,12 @@ See the full [Spanner Graph Retrievers](https://github.com/googleapis/llama-inde
123124

124125
Contributions to this library are always welcome and highly encouraged.
125126

126-
See [CONTRIBUTING](CONTRIBUTING.md) for more information how to get started.
127+
See [CONTRIBUTING](https://github.com/googleapis/llama-index-spanner-python/blob/main/CONTRIBUTING.md) for more information how to get started.
127128

128129
Please note that this project is released with a Contributor Code of Conduct. By participating in
129-
this project you agree to abide by its terms. See [Code of Conduct](CODE_OF_CONDUCT.md) for more
130+
this project you agree to abide by its terms. See [Code of Conduct](https://github.com/googleapis/llama-index-spanner-python/blob/main/CODE_OF_CONDUCT.md) for more
130131
information.
131132

132133
## License
133134

134-
Apache 2.0 - See [LICENSE](LICENSE) for more information.
135+
Apache 2.0 - See [LICENSE](https://github.com/googleapis/llama-index-spanner-python/blob/main/LICENSE) for more information.

src/llama_index_spanner/graph_retriever.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ def __init__(
7979
llm: Optional[LLM] = None,
8080
text_to_gql_prompt: Optional[PromptTemplate] = None,
8181
gql_validator: Optional[Callable[[str], bool]] = None,
82-
include_raw_response_as_metadata: Optional[bool] = False,
83-
max_gql_fix_retries: Optional[int] = 1,
84-
verify_gql: Optional[bool] = True,
85-
summarize_response: Optional[bool] = False,
82+
include_raw_response_as_metadata: bool = False,
83+
max_gql_fix_retries: int = 1,
84+
verify_gql: bool = True,
85+
summarize_response: bool = False,
8686
summarization_template: Optional[Union[PromptTemplate, str]] = None,
8787
**kwargs,
8888
) -> None:
@@ -132,7 +132,9 @@ def __init__(
132132

133133
def _validate_generated_gql(self, gql_query: str) -> str:
134134
if self.gql_validator is not None:
135-
return self.gql_validator(gql_query)
135+
is_valid = self.gql_validator(gql_query)
136+
if not is_valid:
137+
raise ValueError(f"Generated GQL is not valid: {gql_query}")
136138
return gql_query
137139

138140
def execute_query(self, gql_query: str) -> List[Any]:
@@ -277,10 +279,10 @@ def init(
277279
llm_text_to_gql: Optional[LLM] = None,
278280
text_to_gql_prompt: Optional[PromptTemplate] = None,
279281
gql_validator: Optional[Callable[[str], bool]] = None,
280-
include_raw_response_as_metadata: Optional[bool] = False,
281-
max_gql_fix_retries: Optional[int] = 1,
282-
verify_gql: Optional[bool] = True,
283-
summarize_response: Optional[bool] = False,
282+
include_raw_response_as_metadata: bool = False,
283+
max_gql_fix_retries: int = 1,
284+
verify_gql: bool = True,
285+
summarize_response: bool = False,
284286
summarization_template: Optional[Union[PromptTemplate, str]] = None,
285287
## LLM reranker params
286288
llm_for_reranker: Optional[LLM] = None,

0 commit comments

Comments
 (0)