Skip to content

feat: automate Discovery Engine completionConfig via public API #16474

@woodmicha

Description

@woodmicha

Determine this is the right repository

  • I determined this is the correct repository in which to report this feature request.

Summary of the feature request

The completionConfig PATCH endpoint is not exposed on the public Google API (discoveryengine.googleapis.com). It is only accessible via the internal browser proxy (discoveryengine.clients6.google.com) used by the GCP Console. Confirmed via:

Raw REST PATCH to googleapis.com/v1alpha and v1 → 404 Method not found
googleapiclient.discovery.build('discoveryengine', 'v1alpha/v1') → discovery document does not list getCompletionConfig or updateCompletionConfig
google-cloud-discoveryengine SDK v0.17.0 (latest) → no update_completion_config method on DataStoreServiceClient in any version module
GCP Console successfully PATCHes via clients6.google.com with an API key — not usable from a service account context

Desired code experience

def test_completion_config(self, data_store_id: str, project_number: str = None) -> None:
    """
    TEMPORARY diagnostic — tries GET and PATCH on the completionConfig resource
    via googleapiclient.discovery for both v1alpha and v1, logging the full response
    for each combination. Remove once configure_autocomplete() is working.
    """
    project_ref = project_number or self.project_id
    name = (
        f"projects/{project_ref}/locations/{self.data_store_location}"
        f"/collections/{self.collection}/dataStores/{data_store_id}/completionConfig"
    )
    patch_body = {
        "name": name,
        "matchingOrder": "exact-prefix",
        "maxSuggestions": 20,
        "minPrefixLength": 1,
        "queryModel": "document-completable",
        "enableMode": "MANUAL",
    }

    credentials, _ = google.auth.default(
        scopes=["https://www.googleapis.com/auth/cloud-platform"]
    )

    for version in ("v1alpha", "v1"):
        try:
            svc = gapi_discovery.build(
                "discoveryengine", version, credentials=credentials,
                discoveryServiceUrl=(
                    f"https://discoveryengine.googleapis.com/$discovery/rest?version={version}"
                ),
            )
            ds = svc.projects().locations().collections().dataStores()

            # GET
            try:
                resp = ds.getCompletionConfig(name=name).execute()
                self.logger.info(f"test_completion_config: GET {version} → {json.dumps(resp)}")
            except Exception as e:
                self.logger.warning(f"test_completion_config: GET {version} → ERROR {e}")

            # PATCH
            body = dict(patch_body)
            if version == "v1":
                body.pop("enableMode", None)
                body["autoLearning"] = True
            try:
                resp = ds.updateCompletionConfig(name=name, body=body).execute()
                self.logger.info(f"test_completion_config: PATCH {version} → {json.dumps(resp)}")
            except Exception as e:
                self.logger.warning(f"test_completion_config: PATCH {version} → ERROR {e}")

        except Exception as e:
            self.logger.error(f"test_completion_config: build {version} → ERROR {e}")

Expected results

Expose the features to get, set, patch CompletionConfig

API client name and version

google-cloud-discoveryengine v0.17.0 (latest)

Use case

Seeking full IaC experience with Discovery Engine. Majority of our use-case is covered with the exception of getting/setting/patching the autocomplete CompletionConfig.

  • Either expose updateCompletionConfig on the public googleapis.com API (v1alpha or v1)

  • Or add update_completion_config to the google-cloud-discoveryengine Python SDK

Additional context

For my use case I can use the console as it's just a onetime change but ideally everything with discovery engine can be supported by python SDK or REST interface. I have another use-case which could lead to thousands of data stores and engines in a SaaS scenario to power agentic flows in points of sale for small merchants which clearly can't require users going into GCP console to change things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage meI really want to be triaged.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions