Skip to content

Commit 7bdd79e

Browse files
authored
Merge pull request #36 from looker-open-source/uat_llm
Add LLM summaries and Kmeans model objective
2 parents 31aff02 + 88c50ea commit 7bdd79e

File tree

5 files changed

+1085
-2541
lines changed

5 files changed

+1085
-2541
lines changed

README.md

+32-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ The service account used by the BigQuery connection chosen in Step 1 should have
2525
- BigQuery Job User
2626
- Vertex AI User
2727

28-
2928
#### 3. Create BigQuery Dataset for ML Models
3029

3130
Create a dataset (e.g., `looker_bqml`) in the BigQuery connection's GCP project.
@@ -49,7 +48,7 @@ The application can be installed directly from [Looker Marketplace](https://mark
4948

5049
#### 5. Configure Application with User Attributes
5150

52-
The application uses three [Looker user attributes](https://cloud.google.com/looker/docs/admin-panel-users-user-attributes) to store its configuration settings. The following user attributes are required for the application to work properly. Each user attribute needs to be named exactly as listed below with a data type of `String`. The recommended setting for user access is `None`.
51+
The application uses three [Looker user attributes](https://cloud.google.com/looker/docs/admin-panel-users-user-attributes) to store its configuration settings. The following user attributes are required for the application to work properly. Each user attribute needs to be named exactly as listed below with a data type of `String`. The recommended setting for user access is `View`.
5352

5453
Create the following user attributes and set their default values.
5554

@@ -70,3 +69,34 @@ We recommend creating a new Looker role to easily manage user access to the appl
7069
- Create a new Looker permission set named `ML Accelerator` containing all the permisions in the [default User permission set](https://cloud.google.com/looker/docs/admin-panel-users-roles#default_permission_sets) AND the `use_sql_runner` permission
7170
- Create a new Looker role named `ML Accelerator` using the new model and permission set
7271
- Assign the `ML Accelerator` role to Looker users and groups
72+
73+
#### 7. Setup AI-Generated Model Evaluation Summaries
74+
75+
After release 2.2, the application can use text generating AI to summarize the model evaluation to more clearly communicate model performance. This optional feature requires additional setup.
76+
77+
##### 7a: Add an External Connection from Bigquery to Vertex
78+
In BigQuery, an [external connection](https://cloud.google.com/bigquery/docs/external-data-sources) is required to connect it to pre-trained models in Vertex AI. If one is not already set up, you must do so. A tutorial can also be found [here](https://cloud.google.com/bigquery/docs/generate-text-tutorial).
79+
1. Under the same gcp project already in use for the application, verify the [BigQuery Connection](https://console.cloud.google.com/apis/library/bigqueryconnection.googleapis.com) and [Vertex AI](https://console.cloud.google.com/apis/library/aiplatform.googleapis.com) APIs are both enabled.
80+
2. In BigQuery click “add,” then "Connections to external data sources."
81+
3. Select "BigLake and remote function" and use the same location as the dataset already in use by the application
82+
4. The ID will be the name of your connection. Since it could be used to connect to any number of pre-trained models in vertex it is wise to choose something generic, such as “ext-vertex-ai”
83+
5. Create the connection
84+
6. Go to the connection and copy the service account ID. In order to access remote functions from Vertex AI, the [BigQuery connection delegation service agent](https://cloud.google.com/iam/docs/service-agents#bigquery-connection-delegation-service-agent) (of the form bqcx-[#]@gcp-sa-bigquery-condel.iam.gserviceaccount.com) that is associated with this connection must have the "Vertex AI User" role, which can be added in IAM.
85+
86+
##### 7b: Create the Remote Text-Generation Model
87+
88+
In BigQuery, enter the following statement in the query editor (this code uses the suggested naming conventions for the the steps above and assumes region is US-Multi). The text-bison@002 model is suggested, but other LLM models with good performance generating text could also be used. The model_name will be later added as a User Attribute value. A suggestion for model_name is "mla-text-bison"
89+
```
90+
CREATE OR REPLACE MODEL project_id.dataset_id.model_name
91+
REMOTE WITH CONNECTION `us.ext-vertex-ai`
92+
OPTIONS (endpoint = 'text-bison@002');
93+
```
94+
This will take a few minutes to load and will not return any results.
95+
96+
##### 7c: Update the Relevant User Attribute
97+
98+
Similar to section 5 above.
99+
100+
| **Required User Attribute Name** | **Default Value Description** |
101+
|-----------------------------------------------------------------|--------------------------------|
102+
| marketplace_bqml_ext_ml_accelerator_generate_text_model_name | Name chosen in step 7b above |

bundle.js

+1,022-2,529
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifest.lkml

+14-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ project_name: "marketplace_bqml_ext"
33
application: ml-accelerator {
44
label: "Machine Learning Accelerator"
55
file: "bundle.js"
6-
sri_hash: "2Se7ajYLg8GY60c+rlO+X9q3qFnDjV4C7uiYgLWn8iM+/ufBt/+IR+bVOyVc+kmp"
6+
sri_hash: "spnMLxVFVZ71aj3VUpreZGBwpLD9+lzINATVhn47QEAgD5WGV85ID3R9wFiSakLq"
77
entitlements: {
88
core_api_methods: [
99
"all_lookml_models",
10+
"all_users",
1011
"create_query",
1112
"run_query",
1213
"lookml_model_explore",
14+
"get_model",
1315
"model_fieldname_suggestions",
1416
"me",
1517
"user_attribute_user_values",
@@ -25,6 +27,7 @@ application: ml-accelerator {
2527
scoped_user_attributes: [
2628
"bigquery_connection_name",
2729
"bqml_model_dataset_name",
30+
"generate_text_model_name",
2831
"gcp_project",
2932
]
3033
}
@@ -35,10 +38,18 @@ constant: CONNECTION_NAME {
3538
export: override_required
3639
}
3740

41+
constant: GCP_PROJECT {
42+
value: "{{_user_attributes['marketplace_bqml_ext_ml_accelerator_gcp_project']}}"
43+
}
44+
3845
constant: BQML_MODEL_DATASET_NAME {
3946
value: "{{_user_attributes['marketplace_bqml_ext_ml_accelerator_bqml_model_dataset_name']}}"
4047
}
4148

42-
constant: GCP_PROJECT {
43-
value: "{{_user_attributes['marketplace_bqml_ext_ml_accelerator_gcp_project']}}"
49+
constant: GENERATE_TEXT_MODEL_NAME {
50+
value: "{{_user_attributes['marketplace_bqml_ext_ml_accelerator_generate_text_model_name']}}"
4451
}
52+
# First create an LLM model in the same dataset as specified in constant "BQML_MODEL_DATASET_NAME", then provide model name here
53+
# https://cloud.google.com/bigquery/docs/generate-text
54+
# Also, modify the service account used for the connection to obtain a new permission: bigquery.connections.use
55+
# This is available to users with role Bigquery Connection User (https://cloud.google.com/iam/docs/understanding-roles#bigquery.connectionUser)

marketplace.json

+16-6
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,43 @@
1515
},
1616
"user_attributes": {
1717
"bigquery_connection_name": {
18-
"label": "Machine Learning Accelerator Setting: BigQuery Connection Name",
18+
"label": "BigQuery Connection Name",
1919
"description": "The BigQuery connection the application will be allowed to use. Must be the same connection as chosen above.",
2020
"type": "string",
2121
"required": true,
2222
"value_is_hidden": false,
23-
"user_can_view": false,
23+
"user_can_view": true,
2424
"user_can_edit": false,
2525
"default_value": "",
2626
"value_constraint": "connection"
2727
},
2828
"gcp_project": {
29-
"label": "Machine Learning Accelerator Setting: GCP Project ID",
29+
"label": "GCP Project ID",
3030
"description": "The GCP project ID for the BigQuery dataset where ML models will be saved.",
3131
"type": "string",
3232
"required": true,
3333
"value_is_hidden": false,
34-
"user_can_view": false,
34+
"user_can_view": true,
3535
"user_can_edit": false,
3636
"default_value": ""
3737
},
3838
"bqml_model_dataset_name": {
39-
"label": "Machine Learning Accelerator Setting: BQML Model Dataset Name",
39+
"label": "BQML Model Dataset Name",
4040
"description": "The dataset where ML models will be saved. Create a new dataset for BQML models (recommended) or choose the same dataset used for Looker PDTs.",
4141
"type": "string",
4242
"required": true,
4343
"value_is_hidden": false,
44-
"user_can_view": false,
44+
"user_can_view": true,
45+
"user_can_edit": false,
46+
"default_value": ""
47+
},
48+
"generate_text_model_name": {
49+
"label": "GenAI Text Model Name",
50+
"description": "Name of an LLM model to generate text summaries (optional feature). Must be in same dataset as above. See https://github.com/looker-open-source/app-ml-accelerator/blob/main/README.md#7-setup-ai-generated-evaluation-summaries for setup instructions.",
51+
"type": "string",
52+
"required": false,
53+
"value_is_hidden": false,
54+
"user_can_view": true,
4555
"user_can_edit": false,
4656
"default_value": ""
4757
}

0 commit comments

Comments
 (0)