GoogleCloudPlatform / firebase-extensions

Apache License 2.0
74 stars 36 forks source link

[Multimodal Tasks with the Gemini API] Publisher Model not found #522

Open jaybconsulting opened 3 months ago

jaybconsulting commented 3 months ago

Describe your configuration

Describe the problem

When I added a new document to the users/{uid}/{realmId} collection in my Firestore database, a "status" map was added to my document with an "error" key of "An error occurred while processing the provided message, failed to generate content, see function logs for details".

The Cloud Function logs show the following message:

{
  "textPayload": "ClientError: [VertexAI.ClientError]: got status: 404 Not Found. {\"error\":{\"code\":404,\"message\":\"Publisher Model `projects/booksmart-6870c/locations/us-west2/publishers/google/models/gemini-1.0-pro` not found.\",\"status\":\"NOT_FOUND\"}}\n    at throwErrorIfNotOK (/workspace/node_modules/@google-cloud/vertexai/build/src/functions/post_fetch_processing.js:32:19)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async generateContentStream (/workspace/node_modules/@google-cloud/vertexai/build/src/functions/generate_content.js:90:5)\n    at async VertexLanguageClient.generate (/workspace/lib/generative-client/vertex_ai.js:63:36)\n    at async /workspace/lib/index.js:69:24 {\n  stackTrace: undefined\n}",
  "insertId": "66730b4f000e0547422191ef",
  "resource": {
    "type": "cloud_function",
    "labels": {
      "region": "us-west2",
      "project_id": "booksmart-6870c",
      "function_name": "ext-firestore-multimodal-genai-generateText"
    }
  },
  "timestamp": "2024-06-19T16:46:07.918855Z",
  "severity": "ERROR",
  "labels": {
    "execution_id": "9iw8yb7ut9vu",
    "instance_id": "005b708770540ea71cb38bf2fec9bdf216ac60625d6040905efe49549d0ceb2c0c128afcd54de1b780ddc45206897b345986dc2a6b07cf307977340d34843e1d",
    "runtime_version": "nodejs18_20240616_18_20_3_RC00"
  },
  "logName": "projects/booksmart-6870c/logs/cloudfunctions.googleapis.com%2Fcloud-functions",
  "trace": "projects/booksmart-6870c/traces/282d831499c124eb2167ceec4c69a637",
  "receiveTimestamp": "2024-06-19T16:46:08.078329165Z",
  "errorGroups": [
    {
      "id": "CN7n7NT9uMq9bw"
    }
  ]
}

Here's the error for better readability:

{"error":
   {"code":404,
    "message": "Publisher Model `projects/booksmart-6870c/locations/us-west2/publishers/google/models/gemini-1.0-pro` not found.",
   "status":"NOT_FOUND"
   }
}
at throwErrorIfNotOK (/workspace/node_modules/@google-cloud/vertexai/build/src/functions/post_fetch_processing.js:32:19)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async generateContentStream (/workspace/node_modules/@google-cloud/vertexai/build/src/functions/generate_content.js:90:5)

at async VertexLanguageClient.generate (/workspace/lib/generative-client/vertex_ai.js:63:36)

at async /workspace/lib/index.js:69:24 

{stackTrace: undefined}

Steps to reproduce:

Added the extension to my project, filled out the configuration, then added a document to the appropriate collection (users/{uid}/{realmId}

Expected result

Adding a "output" map to my document with a response from the Gemini API.

Actual result

Added a "status" map to my document with the error message described above.

jaybconsulting commented 3 months ago

Figured it out. Was the same issue as issue 380, here: https://github.com/GoogleCloudPlatform/firebase-extensions/issues/380

Note that the documentation here https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations says us-west2 is available for Vertex AI, but clearly that's not the case. As outlined in issue 380 as well, the drop down menu when setting up the extension still has us-west2. This should be removed until it's supported.

jaybconsulting commented 3 months ago

Keeping it open so the documentation and the dropdown in the extension setup screen can be fixed.