ai.internal._gcp_project_id

(internal) Resolves the Google Cloud project id from `credentials_json` when it carries one, else from the google-auth chain (`GOOGLE_CLOUD_PROJECT` / `GCLOUD_PROJECT`, the ADC and gcloud config files, the metadata server).

Reference version

Signature

function ai.internal._gcp_project_id(credentials_json: string | null) -> string | null

(internal) Resolves the Google Cloud project id from credentials_json when it carries one, else from the google-auth chain (GOOGLE_CLOUD_PROJECT / GCLOUD_PROJECT, the ADC and gcloud config files, the metadata server).

Discovery is best-effort and never fails: every unreadable or absent source is simply skipped.

Returns

The project id, or null when it is not discoverable — the caller decides whether that is fatal.

Source:<builtin>/ai/ns_internal/auth.bamlbytes 19372038