Open1

Vertex AI CacheConfig 設定

ざわきん/zawakinざわきん/zawakin

Generative AI on Vertex AI のキャッシュ設定

https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/multimodal-faqs?hl=ja#caching

キャッシュを無効にする

PROJECT_ID=PROJECT_ID
# Setup project_id
$ gcloud config set project PROJECT_ID

# Setup project_id.
$ gcloud config set project ${PROJECT_ID}

# Opt-out of caching.
$ curl -X PATCH -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/cacheConfig -d '{
  "name": "projects/PROJECT_ID/cacheConfig",
  "disableCache": true
}'

# Response.
{
  "name": "projects/PROJECT_ID/locations/us-central1/projects/PROJECT_ID/cacheConfig/operations/${OPERATION_ID}",
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.protobuf.Empty"
  }
}

キャッシュを有効にする

PROJECT_ID=PROJECT_ID
LOCATION_ID="us-central1"
# Setup project_id
$ gcloud config set project PROJECT_ID

# Setup project_id.
$ gcloud config set project ${PROJECT_ID}

# Opt in to caching.
$ curl -X PATCH     -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/cacheConfig -d '{
  "name": "projects/PROJECT_ID/cacheConfig",
  "disableCache": false
}'

# Response.
{
  "name": "projects/PROJECT_ID/locations/us-central1/projects/PROJECT_ID/cacheConfig/operations/${OPERATION_NUMBER}",
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.protobuf.Empty"
  }
}
    

Generative AI on Vertex AI のキャッシュ設定

https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1beta1/projects/updateCacheConfig