Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ terraform.tfstate*
*.tfstate
.venv
node_modules
looker.ini

.vertex_cf_auth_token
dist
Expand Down
52 changes: 44 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ Additionally, the extension provides:
- Insight Summarization
- Dynamic Explore Selection

## Setup

Please follow these steps in order for a successful installation.
1. Backend Setup - setup the GCP backend for communicating with the Vertex API [using these instructions.](./explore-assistant-backend/README.md)
2. Looker Connection - setup a Looker connection to the BigQuery dataset created in step 1 [using these instructions.](https://cloud.google.com/looker/docs/db-config-google-bigquery)
3. Example generation - generate a list of examples and upload them to BigQuery [using these instructions.](./explore-assistant-examples/README.md)
4. Frontend Setup - setup Looker Extension Framework Applications [using these instructions.](./explore-assistant-extension/README.md)

### Technologies Used
#### Frontend
- [React](https://reactjs.org/)
Expand All @@ -44,6 +36,50 @@ Please follow these steps in order for a successful installation.
- [Vertex AI](https://cloud.google.com/vertex-ai)
- [Cloud Functions](https://cloud.google.com/functions)

## Get Started

Getting started involves (*in this order*):
1. Clone or download a copy of this repository to your development machine.
If you have a git ssh_config:
```bash
# cd ~/ Optional. your user directory is usually a good place to git clone to.
git clone git@github.com:looker-open-source/looker-explore-assistant.git
```

If not:
```bash
# cd ~/ Optional. your user directory is usually a good place to git clone to.
git clone https://github.com/looker-open-source/looker-explore-assistant.git
```
Alternatively, open up this repository in:  
[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://shell.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/looker-open-source/looker-explore-assistant.git&cloudshell_workspace=explore-assistant-extension)
2. Make sure [pip](https://pip.pypa.io/en/stable/cli/pip_install/) is installed on your computer to run the `pip install -r requirements.txt` command line in the setup section.
3. Install [`google-cloud-sdk`](https://cloud.google.com/sdk/docs/install) in the looker-explore-assistant directory to install Google Cloud SDK before the backend setup.
>To install google-cloud-sdk, you can use this command `brew install —cask google-cloud-sdk`. Ensure you have [Homebrew](https://brew.sh/) installed first
4. Create a GCP Project (you’ll need the ID later). It does not have to be the same project as the prompt tables but it is recommended for simplicity
5. Create a Looker connection for that BigQuery project
6. Create an empty Looker project
- Add the connection name to the model file
- Configure git
- That’s all you need to do for now. This is where the extension framework will be deployed. The connection should be the same as the one that holds the prompts

The local cloud function backend and example generation require some python packages. It is recommended to create a python virtual environment and install the dependencies:

```bash
# Use python3 on Mac OS
python -m venv .venv
source .venv/bin/activate
pip install -r ./explore-assistant-examples/requirements.txt
pip install -r ./explore-assistant-cloud-function/requirements.txt
```
> If you hit a blocker with directory permissions, use `chmod +x <FILE NAME>` to allow write permissions.

## Setup

1. Backend Setup - setup the GCP backend for communicating with the Vertex API [using these instructions.](./explore-assistant-backend/README.md)
2. Example generation - generate a list of examples and upload them to BigQuery [using these instructions.](./explore-assistant-examples/README.md)
3. Frontend Setup - setup Looker Extension Framework Applications by following [these instructions](./explore-assistant-extension/README.md).

## Recommendations for fine tuning the model

This app uses a one shot prompt technique for fine tuning a model, meaning that all the metadata for the model is contained in the prompt. It's a good technique for a small dataset, but for a larger dataset, you may want to use a more traditional fine tuning approach. This is a simple implementation, but you can also use a more sophisticated approach that involves generating embeddings for explore metadata and leveraging a vector database for indexing.
Expand Down
19 changes: 2 additions & 17 deletions explore-assistant-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,16 @@ This Terraform configuration establishes a backend for the Looker Explore Assist

The Explore Assistant also uses a set of examples to improve the quality of its answers. We store those examples in BigQuery. Please see the comparisons below when deciding which deployment approach to use.

## Google Project

A Google Cloud Project is necessary to provision backend resources. A new google project simplifies installation. If an existing google project is used, Terraform will not be usable.

## Cloud Shell Setup

To simplify the backend installation, you can use the following link to open a Google Cloud Shell.

[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/bytecodeio/looker-explore-assistant&cloudshell_tutorial=./explore-assistant-backend/cloudshell_README.md&shellonly=true&cloudshell_git_branch=marketplace_deploy)
Within the cloud shell, these [installation instructions](./cloudshell_README.md) will be shown.

## Development Setup

Alternately, follow the below directions for a manual compilation and install.

### What backend should I use?

Here we list the reasons and tradeoffs of each deployment approach in an effort to scope the right backend deployment approach based on individual preferences and existing setups. The backend setup will default for a Cloud Run installation.
Here we list the reasons and tradeoffs of each deployment approach in an effort to scope the right backend deployment approach based on individual preferences and existing setups.

**Regardless of Backend**:
* Any Looker database connection can be used for fetching the actual data returned from the natural language query url
* They implement the same API, as in no Looker Credentials are stored in the backends and the arguments are the same (*ie. model parameters and a prompt*)
* By default both approaches fetch examples from a BigQuery table out of simplicity. For Cloud Functions you can modify [this React Hook](../explore-assistant-extension/src/hooks/useBigQueryExamples.ts) and change the `connection_name` on line 18 to point to the non BQ database connection in Looker that houses your example prompts/training data.

**For Cloud Function/Run**:
* Default method.
* Generally speaking, this approach is recommended for folks who want more development control on the backend
* Your programming language of choice can be used
* Workflows for custom codeflow like using custom models, combining models to improve results, fetching from external datastores, etc. are supported
Expand All @@ -48,6 +32,7 @@ Here we list the reasons and tradeoffs of each deployment approach in an effort

## Prerequisites

- Terraform installed on your machine.
- Access to a GCP account with permission to create and manage resources.
- A GCP project where the resources will be deployed.

Expand Down
231 changes: 0 additions & 231 deletions explore-assistant-backend/cloudshell_README.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
terraform {
backend "gcs" {
bucket = "${TF_VAR_project_id}-terraform-state"
prefix = "terraform/state"
}
}
1 change: 1 addition & 0 deletions explore-assistant-backend/terraform/bigquery_examples.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ resource "google_bigquery_job" "create_explore_assistant_examples_table" {
}
}


resource "google_bigquery_job" "create_explore_assistant_refinement_examples_table" {
job_id = "create_explore_assistant_refinement_examples_table-${formatdate("YYYYMMDDhhmmss", timestamp())}"
query {
Expand Down
Loading