Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Enable VertexAISearchTool for different regions (ex. EU) #3167

Copy link
Copy link
@nhellwig

Description

@nhellwig
Issue body actions

At the moment when using the DiscoveryEngineSearchTool I could not find a way to specify client_options like api_endpoint.
When having a data store in EU region this leads to an error:

400 Incorrect API endpoint used. The current endpoint can only serve traffic from "global" region, but got "eu" region from the API request. Please follow https://cloud.google.com/generative-ai-app-builder/docs/locations to use the correct regional API endpoint.

My suggestions would be to implement client_options as parameter in DiscoveryEngineSearchTool like this:

class DiscoveryEngineSearchTool(FunctionTool):
  """Tool for searching the discovery engine."""

  def __init__(
      self,
      data_store_id: Optional[str] = None,
      data_store_specs: Optional[
          list[types.VertexAISearchDataStoreSpec]
      ] = None,
      search_engine_id: Optional[str] = None,
      filter: Optional[str] = None,
      max_results: Optional[int] = None,
      client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
  ):

...

     self._discovery_engine_client = discoveryengine.SearchServiceClient(
            client_options=client_options,
            credentials=credentials,
        )
...

I can try to create PR if needed.

Metadata

Metadata

Assignees

Labels

tools[Component] This issue is related to tools[Component] This issue is related to tools

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.