GoogleCloudPlatform / GoogleCloudPlatform/generative-ai

Ready patch: accept both snippet status key styles in Vertex AI Search client

Open
#2,749 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
17.7k
Forks
4.5k
Avg merge
12h 38m
Merged PRs (30d)
42

Description

I prepared a small fix for `search/cloud-function/python/vertex_ai_search_client.py` that accepts both `snippetStatus` and `snippet_status` when parsing snippet-only document results.

The branch is already pushed here:
- compare view: https://github.com/GoogleCloudPlatform/generative-ai/compare/main...Gujiassh:fix/snippet-status-key-compat
- fork branch: `Gujiassh:fix/snippet-status-key-compat`

Why this matters:
- some payloads use snake_case `snippet_status`
- the current parser only accepts camelCase `snippetStatus`
- when that happens, snippet-only results get silently dropped even though the snippet succeeded

Patch contents:
- accept both key styles in `_parse_snippets`
- add a regression test covering both variants in `test_vertex_ai_search_client.py`

Local verification on the branch:
- `search/cloud-function/python/.venv/bin/python -m pytest test_vertex_ai_search_client.py -k snippet_only_accepts_snippet_status_variants -q`
- `search/cloud-function/python/.venv/bin/python -m pytest test_vertex_ai_search_client.py -q`

I wasn't able to open a PR directly because GitHub rejected `CreatePullRequest` for this repository from my account, but the branch and compare URL are ready if a maintainer wants to cherry-pick or reopen it as a PR.

Contributor guide

Open the contributing guide

Research direction

Start with search/cloud-function/python/vertex_ai_search_client.py and the _parse_snippets entry point, then review test_vertex_ai_search_client.py and the existing snippet-only tests. Run the two pytest commands named in the issue; done means both snippet status key variants are covered and the focused and full test runs pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, python
Domain
backend, search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.