Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clarification] error likely related to .env variables #74

Open
dennysrega1ado opened this issue Aug 9, 2024 · 5 comments
Open

[Clarification] error likely related to .env variables #74

dennysrega1ado opened this issue Aug 9, 2024 · 5 comments

Comments

@dennysrega1ado
Copy link

We are attempting to set up the Looker Explore Assistant, but we are having difficulty getting it to work.
Initially, it appears to be a parameterization issue, but it might also be related to the example tables.

Error

Error Name:
TypeError

Error Message:
Cannot read properties of undefined (reading 'examples')

Diagnosis:
The error is likely related to your Look specific .env variables.

Troubleshooting Steps
Check the LOOKML_MODEL & LOOKML_EXPLORE env variables for your extension. Are they valid (spelling) & exist in your Looker instance?

Make sure your user has access to this model and explore. At the very least with see_lookml permissions.

Check the Connection environment variables. Do valid BQ connections by those names exist in your Looker instance?

Backend

  • BigQuery was selected as the backend
  • Terraform migration was successfully deployed
  • We have the dataset explore_assistant, one model, and two empty tables (no examples)
image

Front-End

We successfully build the bundle.js following the instructions from the explore-assistant-extension project
We are using the following values in the.env file

LOOKER_MODEL=<model_name>
LOOKER_EXPLORE=<explore_name>
VERTEX_BIGQUERY_LOOKER_CONNECTION_NAME=explore_assistant
VERTEX_BIGQUERY_MODEL_ID=<project>.explore_assistant.explore_assistant_llm
BIGQUERY_EXAMPLE_PROMPTS_CONNECTION_NAME=explore_assistant
BIGQUERY_EXAMPLE_PROMPTS_DATASET_NAME=<project>.explore_assistant

Looker setup

We copied the bundle.js and bundle.js.LICENSE.txt files to the /dist folder in Looker
Our manifest.lkml looks like this

{
  application: explore_assistant {
  label: "Explore Assistant"
  file: "dist/bundle.js"
  entitlements: {
    core_api_methods: [
      "lookml_model_explore",
      "create_sql_query",
      "run_sql_query",
      "run_query",
      "create_query"
    ]
    navigation: yes
    use_embeds: yes
    use_iframes: yes
    new_window: yes
    new_window_external_urls: [
      "https://developers.generativeai.google/*"
    ]
    local_storage: yes
  }
}

Questions

  1. Should we use the jupyter notebook in looker-explore-training to generate examples (train the model) to make it work?
    If so, how many input/output examples are recommended?
  2. Before proceeding, should we thoroughly document all dimensions and measures in the explore by using the Description attribute for every view used by the selected explore?
  3. Is this extension intended to be used with only one Explore? What are its limitations?
@manmat
Copy link

manmat commented Aug 15, 2024

I have the same error, did you find a solution?

@praveenkumar-bidgely
Copy link

praveenkumar-bidgely commented Aug 24, 2024

@dennysrega1ado this seems to be like a standard error given out for any kind of error. There could be couple of possibilities for this.

  1. You don't have correct environment variables setup. Your .env file should have at least below variables defined.

LOOKER_MODEL=genai_test_model
LOOKER_EXPLORE=genai_awb_common
VERTEX_BIGQUERY_LOOKER_CONNECTION_NAME=genai_explore_assistant_test
BIGQUERY_EXAMPLE_PROMPTS_CONNECTION_NAME=genai_explore_assistant_test
VERTEX_BIGQUERY_MODEL_ID=explore_assistant.explore_assistant_llm

  1. You haven't ingested refinement examples or samples into bigquery table. Please do so otherwise it won't work.

  2. Your bigquery connection in looker isn't connecting. It should look like this once you are able to connect.

Screenshot 2024-08-24 at 12 03 00 PM There could be problem with bigquery service account that you have setup. Make sure to seutp a bigquery service account in gcp, upload JSON key into the looker bigquery connection. And also make sure to give below roles to service account. Screenshot 2024-08-24 at 12 05 45 PM

If you are still having problem, then check network tab and see which API is failing and look the response to see where exactly things are erroring out. Refer this document for any other help: https://medium.com/refined-and-refactored/how-to-set-up-genai-x-looker-extension-under-15-minutes-explore-assistant-b1f918ed9c58

@mharry1997
Copy link

mharry1997 commented Aug 28, 2024

Hi, I was running into this error for a while but managed to get it working. I noticed in your post you said you "... have the dataset explore_assistant, one model, and two empty tables (no examples)" - I think that after following these instructions you should have three tables within your explore_assistant dataset (and the one model):

  • explore_assistant_examples
  • explore_assistant_refinement_examples
  • explore_assistant_samples

All three tables are required for the extension to work (and all three should be populated with a single row after following the instructions). The issue we actually ran into was when adding our explore_id as a flag when loading the json files, we just had the explore name when it should be the format modelname:explorename.

As an example this would be the samples.json loading script:
python load_examples.py --project_id project-name --explore_id finance:orders --table_id explore_assistant_samples --column_name samples --json_file samples.json
Where your looker model is called finance and your looker explore is called orders.

In response to your first question (which I imagine why your tables are currently empty), no, the notebook can be used to finetune your model for your particular explores - but just uploading the default json files in explore-assistant-examples will give enough context model to get you started, despite the fact the table/field names in them are unlikely to match up to your own.

In response to your second question, I believe having the descriptions for all your dimensions/measures will help the model.

Not too sure on the third question - haven't got there yet!

Hope that helps

@njia123
Copy link

njia123 commented Oct 9, 2024

finance:orders

I think you mean finance is the model, and orders is the explore name?

@mharry1997
Copy link

Yep, you're right - edited it to correct. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants