GoogleCloudPlatform / firebase-extensions

Apache License 2.0
75 stars 37 forks source link

[firestore-genai-chatbot] [VertexAI.ClientError]: got status: 404 Not Found #380

Closed suztomo closed 7 months ago

suztomo commented 7 months ago

(I develop an app using Firebase as hobby)

[READ] Step 1: Are you in the right place?

In https://extensions.dev/extensions/googlecloud/firestore-genai-chatbot , the source code points to this repository.

[REQUIRED] Step 2: Describe your configuration

Gemini API Provider
vertex-ai
Google AI API Key (Optional)
Parameter not set
Gemini model
gemini-1.0-pro
Firestore Collection Path
generate
Prompt Field
prompt
Response Field
response
Order Field (Optional)
createTime
Cloud Functions location
us-west2
Context (Optional)
Parameter not set
Temperature (Optional)
Parameter not set
Nucleus sampling probability (Optional)
Parameter not set
Sampling strategy parameter (Optional)
Parameter not set
Candidate count (Optional)
1
Max Output Tokens (Optional)
Parameter not set
Candidates field (Optional)
candidates
Enable per document overrides.
no
Hate Speech Threshold (Optional)
HARM_BLOCK_THRESHOLD_UNSPECIFIED
Dangerous Content Threshold (Optional)
HARM_BLOCK_THRESHOLD_UNSPECIFIED
harassment Content Threshold (Optional)
HARM_BLOCK_THRESHOLD_UNSPECIFIED
Sexual Content Threshold (Optional)
HARM_BLOCK_THRESHOLD_UNSPECIFIED

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

After installation with the default value (I chose "vertex-ai" as the provider), I followed the instruction in "How this extension works" section up to "In a few seconds, you’ll see a createTime field and then a status field should appear in the document. The status field will update as the extension processes the message."

Screenshot 2024-02-17 at 7 44 17 PM
Expected result

I expected the document would be updated without an error.

Actual result

The document was updated with an error.

createTime February 17, 2024 at 7:38:54 PM UTC-5
(timestamp)
prompt "How are you today?"
(string)
status
(map)
error "An error occurred while processing the provided message, Failed to generate response, see function logs for more details."
(string)
state "ERROR"
(string)
updateTime February 17, 2024 at 7:39:00 PM UTC-5
Screenshot 2024-02-17 at 7 43 48 PM

When I checked the Cloud Functions log, it showed the following message:

[VertexAI.ClientError]: got status: 404 Not Found
    at throwErrorIfNotOK (/workspace/node_modules/@google-cloud/vertexai/build/src/index.js:395:15)
    at GenerativeModel.generateContentStream (/workspace/node_modules/@google-cloud/vertexai/build/src/index.js:321:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async VertexDiscussionClient.generateResponse (/workspace/lib/generative-client/vertex_ai.js:54:36)
    at async VertexDiscussionClient.send (/workspace/lib/generative-client/base_class.js:26:16)
    at async FirestoreOnWriteProcessor.generateChatResponse [as processFn] (/workspace/lib/generate_chat_response.js:25:20)
    at async FirestoreOnWriteProcessor.run (/workspace/lib/firestore-onwrite-processor/index.js:83:28) {
  stack_trace: undefined
}
Screenshot 2024-02-17 at 7 46 55 PM

From the error message, it's unclear what it tried to access.

cabljac commented 7 months ago

Hey thanks for opening this, investigating now

cabljac commented 7 months ago

I think this may be a location issue, us-central1 works for me but us-west2 doesn't. I will check if there's anything we're missing here.

cabljac commented 7 months ago

Yeah here's the issue:

https://cloud.google.com/vertex-ai/docs/generative-ai/learn/locations-genai

So if you want to use Vertex AI as a provider you need to pick a supported region.

We should reference this in our docs. Thanks for raising this!

suztomo commented 7 months ago

It worked. I had to uninstall and install to fix the region. Thank you.

Screenshot 2024-02-21 at 8 11 23 AM

By the way, us-west2 (the region not listed in https://cloud.google.com/vertex-ai/docs/generative-ai/learn/locations-genai) is listed in the dropdown.

Screenshot 2024-02-21 at 7 59 48 AM