Skip to content

meow#10

Merged
agha64113-creator merged 169 commits into
agha64113-creator:mainfrom
GoogleCloudPlatform:main
May 3, 2026
Merged

meow#10
agha64113-creator merged 169 commits into
agha64113-creator:mainfrom
GoogleCloudPlatform:main

Conversation

@agha64113-creator

Copy link
Copy Markdown
Owner

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Follow the CONTRIBUTING Guide.
  • You are listed as the author in your notebook or README file.
  • Your account is listed in CODEOWNERS for the file(s).
  • Ensure the tests and linter pass (Run nox -s format from the repository root to format).

Fixes #<issue_number_goes_here> 🦕

lakeyk and others added 30 commits November 10, 2025 10:12
Added code requirements for handling Google Cloud project IDs.
…support Gemini Data Analytics Thinking and Looker RAG tools features. Mark Python enablement to false as default.

PiperOrigin-RevId: 831900150
Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
Separate the dependencies with new line
Added a missing import (from vertexai import Client)
Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
@agha64113-creator agha64113-creator requested a review from Copilot May 2, 2026 20:21
@agha64113-creator agha64113-creator self-assigned this May 2, 2026
@agha64113-creator agha64113-creator added the bug Something isn't working label May 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

Looking for bugs?

Check back in a few minutes. An AI review agent is analyzing this pull request.

Grey Divider

Qodo Logo

@agha64113-creator

Copy link
Copy Markdown
Owner Author

meow

@agha64113-creator

Copy link
Copy Markdown
Owner Author

meow

@agha64113-creator

Copy link
Copy Markdown
Owner Author

Meow. ow I have a good understanding. I need to create a Go implementation of the cloud function. The problem statement shows an integration test file that needs to be created. But the integration test references Go types that don't exist yet: Config, NewClient, EngineDataType, EngineChunkType, SummaryType, and the client's Search, SearchWithPageSize, Close methods.
I need to create:

  1. go/go.mod - Go module file
  2. go/main.go - the cloud function implementation with the client
  3. go/integration_test.go - the integration tests from the diff
  4. The supporting types and methods that the tests expect
    Let me start building out the full implementation.

Progress update: Initial plan for Go cloud function implementation

  • Create search/cloud-function/go/ directory structure
  • Create go.mod for the Go module
  • Create main.go with Config, types, Client, NewClient, Search, SearchWithPageSize, Close and HTTP handler
  • Create integration_test.go with integration tests from problem statement
  • Create README.md for the Go implementation
    Output
    $ git push -v origin copilot/add-license-comments
    Pushing to https://github.com/agha64113-creator/generative-ai
    To https://github.com/agha64113-creator/generative-ai
    = [up to date] copilot/add-license-comments -> copilot/add-license-comments
    updating local tracking ref 'refs/remotes/origin/copilot/add-license-comments'
    Everything up-to-date

Progress reported successfully.

General-purpose: Create Go cloud function for Vertex AI Search

Let me first look at the Python implementation to understand what needs to be mirrored.

Explore Python cloud function implementation
$ find /home/runner/work/generative-ai/generative-ai/search/cloud-function/python/ -type f | head -20 && echo "---" && ls /home/runner/work/generative-ai/generative-ai/search/cloud-function/
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/main.py
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/README.md
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/test_vertex_ai_search_client.py
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/requirements.txt
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/setup_env.sh
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/vertex_ai_search_client.py
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/.env.example
/home/runner/work/generative-ai/generative-ai/search/cloud-function/python/test_integration_vertex_search_client.py

README.md python
<exited with exit code 0>

View 2 files

search/cloud-function/python/main.py

  1. Copyright 2024 Google LLC

  2. Licensed under the Apache License, Version 2.0 (the "License");

  3. you may not use this file except in compliance with the License.

  4. You may obtain a copy of the License at

  5. http://www.apache.org/licenses/LICENSE-2.0

  6. Unless required by applicable law or agreed to in writing, software

  7. distributed under the License is distributed on an "AS IS" BASIS,

  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  9. See the License for the specific language governing permissions and

  10. limitations under the License.

  11. """
  12. VertexAISearchClient for interacting with Google Cloud Vertex AI Search.
  13. This module provides a client class for simplifying interactions with the
  14. Vertex AI Search API. It handles configuration, query construction, and
  15. result parsing.
  16. Example usage:
  17. config = VertexAISearchConfig(
    
  18.     project_id="your-project",
    
  19.     location="global",
    
  20.     data_store_id="your-data-store",
    
  21.     engine_data_type="UNSTRUCTURED",
    
  22.     engine_chunk_type="CHUNK",
    
  23.     summary_type="VERTEX_AI_SEARCH",
    
  24. )
    
  25. client = VertexAISearchClient(config)
    
  26. results = client.search("your search query")
    
  27. print(results)
    
  28. """
  29. from dataclasses import dataclass
  30. import html
  31. import json
  32. import re
  33. from typing import Any, Literal
  34. from google.api_core.client_options import ClientOptions
  35. from google.cloud import discoveryengine_v1alpha as discoveryengine
  36. from google.cloud.discoveryengine_v1alpha.services.search_service.pagers import (
  37. SearchPager,
    
  38. )
  39. from google.cloud.discoveryengine_v1alpha.types import SearchResponse
  40. Define types using string literals, similar to enums.

  41. EngineDataTypeStr = Literal["UNSTRUCTURED", "STRUCTURED", "WEBSITE", "BLENDED"]
  42. EngineChunkTypeStr = Literal[
  43. "DOCUMENT_WITH_SNIPPETS", "DOCUMENT_WITH_EXTRACTIVE_SEGMENTS", "CHUNK"
    
  44. ]
  45. SummaryTypeStr = Literal[
  46. "NONE", "VERTEX_AI_SEARCH", "GENERATE_GROUNDED_ANSWERS", "GEMINI"
    
  47. ]
  48. @DataClass
  49. class VertexAISearchConfig:
  50. """Config for the Vertex AI Search data store."""
    
  51. project_id: str
    
  52. location: str
    
  53. data_store_id: str
    
  54. engine_data_type: EngineDataTypeStr | str
    
  55. engine_chunk_type: EngineChunkTypeStr | str
    
  56. summary_type: SummaryTypeStr | str
    
  57. def __post_init__(self) -> None:
    
  58.     """Validate and convert string inputs to appropriate types."""
    
  59.     self.engine_data_type = self._validate_enum(
    
  60.         self.engine_data_type, EngineDataTypeStr, "UNSTRUCTURED"
    
  61.     )
    
  62.     self.engine_chunk_type = self._validate_enum(
    
  63.         self.engine_chunk_type, EngineChunkTypeStr, "CHUNK"
    
  64.     )
    
  65.     self.summary_type = self._validate_enum(
    
  66.         self.summary_type, SummaryTypeStr, "VERTEX_AI_SEARCH"
    
  67.     )
    
  68. @staticmethod
    
  69. def _validate_enum(value: str, enum_type: Any, default: str) -> str:
    
  70.     """Validate and convert string to enum type."""
    
  71.     if value in enum_type.__args__:
    
  72.         return value
    
  73.     print(f"Warning: Invalid value '{value}'. Using default: '{default}'")
    
  74.     return default
    
  75. def to_dict(self) -> dict[str, str]:
    
  76.     """Convert the config to a dictionary."""
    
  77.     return {
    
  78.         "project_id": self.project_id,
    
  79.         "location": self.location,
    
  80.         "data_store_id": self.data_store_id,
    
  81.         "engine_data_type": self.engine_data_type,
    
  82.         "engine_chunk_type": self.engine_chunk_type,
    
  83.         "summary_type": self.summary_type,
    
  84.     }
    
  85. class VertexAISearchClient:

Repository owner deleted a comment from qodo-code-review Bot May 3, 2026
@agha64113-creator agha64113-creator merged commit 658aed0 into agha64113-creator:main May 3, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.