looker-open-source / looker-explore-assistant

A React Application for interacting with Looker data through natural language.
MIT License
83 stars 52 forks source link

Uncaught TypeError when deploying the extension-bigquery #20

Closed plc1220 closed 5 months ago

plc1220 commented 5 months ago

I've follow through the steps, except for step 4 on the npm run start as I'm running from cloudshell

Straight jump to step 5 npm run build, had a small error on "clean script not defined", edited the package.json and add clean:"", and successfully built. Copied to looker project and all went fine, the extension UI showed up, but freeze once clicked Run Prompt. Checked bigquery job history and the job was there.

Checked on F12 Dev tool here's the error

Screenshot 2024-03-28 at 1 49 46 AM

Change prompt and it'll appear the same error. Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'generated_content') at bundle.js:765:8408

Not sure how to fix this, guidance would be greatly appreciated.

Thanks!

LukaFontanilla commented 5 months ago

It sounds like the BigQuery query issued from the Explore Assistant either returned undefined OR the data structure gemini-pro returns changed. I'd recommend grabbing the SQL generated either via Looker -> Admin -> Queries or via BQ Job History and running that in BigQuery or Looker's SQL Runner. Does a result with the generated url return? If so what does that look like ? It would also be worth double confirming that the LookML Explore and Model are inputted correctly into the SQL and that the BQML Model, Dataset and Table all match what has been created in your environment. If following the default instructions in the repo that should be the case as of the latest commit.

LukaFontanilla commented 5 months ago

Additionally on the Looker side, the network request to look for would be something like this: api/internal/core/4.0/sql_queries/<some slug>/run/json with an expected output of: [ { "generated_content": "<generated_explore_url>" } ]

There should only be one row, as the sql query will filter for a specific Looker model and explore from the table created in the instructions. The LLM output will be labeled as generated_content as that is default on the SQL Query side.

plc1220 commented 5 months ago

@LukaFontanilla Thanks for the help! Apparently I made a spelling mistake when creating the example table, realized it when rerun the query in bigq~ Fixed that and it worked like a charm!