Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Chore] Remove SQL plugin for AI Assistant (#2938)
Xun Li1a68d1bd2262
diff --git a/src/ai-assistant/README.md b/src/ai-assistant/README.mdindex 3ceb88a90..22ea72424 100644--- a/src/ai-assistant/README.md+++ b/src/ai-assistant/README.md@@ -16,7 +16,7 @@ An example of how the AI Assistant Module can be used to update a basemap in KepThis flow enables a seamless interaction where a user can update a basemap in Kepler.gl through a simple AI-driven prompt, showcasing the integration of LLMs with application actions and rendering.-The AI Assistant Module `OpenAssistant` (Github: https://github.com/lixun910/openassistant) is a open-source project that helps adding AI capabilities to your React SPA applications while keeping your data secure and private.+The AI Assistant Module `OpenAssistant` (Github: https://github.com/geodacenter/openassistant) is a open-source project that helps adding AI capabilities to your React SPA applications while keeping your data secure and private.Key features:@@ -40,8 +40,10 @@ From the previous PRs, we have a working prototype of the AI Assistant Module wi2. Change the basemap style.3. Load data from url.4. Create a map layer using variable.-5. Filter the data of a variable.-6. Create a histogram.+5. Create a histogram.+6. Create a scatter plot with regression line.+7. Classify the data of a variable.+8. Spatial join two datasets.The next step is to integrate more kepler.gl features into the AI Assistant Module.@@ -49,14 +51,14 @@ The next step is to integrate more kepler.gl features into the AI Assistant ModuSupport more kepler.gl map layers-- [ ] create map layer based on the dataset metadata (variable names and types)+- [x] create map layer based on the dataset metadata (variable names and types)- [ ] edit layer properties based on the [layer attributes](https://docs.kepler.gl/docs/user-guides/d-layer-attributes)- [ ] blend and rearrange layersSupport color palette- [ ] choose color palette for the layer-- [ ] create custom color palette+- [x] create custom color paletteSupport custom map stylesdiff --git a/src/ai-assistant/package.json b/src/ai-assistant/package.jsonindex 767e96c55..c097aa395 100644--- a/src/ai-assistant/package.json+++ b/src/ai-assistant/package.json@@ -37,7 +37,6 @@"@kepler.gl/types": "3.1.0-alpha.6","@kepler.gl/utils": "3.1.0-alpha.6","@openassistant/core": "^0.0.6",- "@openassistant/duckdb": "^0.0.6","@openassistant/echarts": "^0.0.6","@openassistant/geoda": "^0.0.6","@openassistant/ui": "^0.0.7",diff --git a/src/ai-assistant/src/components/ai-assistant-component.tsx b/src/ai-assistant/src/components/ai-assistant-component.tsxindex 84c90beaf..8412967df 100644--- a/src/ai-assistant/src/components/ai-assistant-component.tsx+++ b/src/ai-assistant/src/components/ai-assistant-component.tsx@@ -11,7 +11,6 @@ import {} from '@openassistant/geoda';import {histogramFunctionDefinition, scatterplotFunctionDefinition} from '@openassistant/echarts';import {AiAssistant} from '@openassistant/ui';-import {queryDuckDBFunctionDefinition} from '@openassistant/duckdb';import '@openassistant/echarts/dist/index.css';import '@openassistant/ui/dist/index.css';@@ -42,7 +41,6 @@ import {getScatterplotValuesFromDataset,getValuesFromDataset,highlightRows,- highlightRowsByColumnValues,saveAsDataset} from '../tools/utils';@@ -84,7 +82,7 @@ function AiAssistantComponentFactory() {const getValuesCallback = (datasetName: string, variableName: string): number[] =>getValuesFromDataset(visState.datasets, datasetName, variableName);- // highlight rows, used by LLM functions+ // highlight rows, used by LLM functions and plots (scatterplot, histogram)const highlightRowsCallback = (datasetName: string, selectedRowIndices: number[]) =>highlightRows(visState.datasets,@@ -94,20 +92,6 @@ function AiAssistantComponentFactory() {keplerGlActions.layerSetIsValid);- const highlightRowsByColumnValuesOnSelected = (- datasetName: string,- columnName: string,- selectedValues: unknown[]- ) =>- highlightRowsByColumnValues(- visState.datasets,- visState.layers,- datasetName,- columnName,- selectedValues,- keplerGlActions.layerSetIsValid- );-// define LLM functionsconst functions = [basemapFunctionDefinition({mapStyleChange: keplerGlActions.mapStyleChange, mapStyle}),@@ -124,12 +108,6 @@ function AiAssistantComponentFactory() {layerVisualChannelConfigChange: keplerGlActions.layerVisualChannelConfigChange,layers: visState.layers}),- queryDuckDBFunctionDefinition({- // duckDB: kepler.gl duckdb instance- getValues: (datasetName: string, variableName: string): number[] =>- getValuesFromDataset(visState.datasets, datasetName, variableName),- onSelected: highlightRowsByColumnValuesOnSelected- }),histogramFunctionDefinition({getValues: getValuesCallback,onSelected: highlightRowsCallbackdiff --git a/src/ai-assistant/src/constants.ts b/src/ai-assistant/src/constants.tsindex 9b7d91333..c071cb23f 100644--- a/src/ai-assistant/src/constants.ts+++ b/src/ai-assistant/src/constants.ts@@ -2,11 +2,14 @@// Copyright contributors to the kepler.gl projectexport const TASK_LIST =- '1. Show dataset/layer/variable info.\n2. Change the basemap style.\n3. Load data from url.\n4. Create a map layer using variable.\n5. Create a histogram.\n6. Classify the data of a variable.\n7. Spatial join two datasets.\n8. Query the data using SQL.';+ '1. Show dataset/layer/variable info.\n2. Change the basemap style.\n3. Load data from url.\n4. Create a map layer using variable.\n5. Create a histogram.\n6. Create a scatter plot with regression line.\n7. Classify the data of a variable.\n8. Spatial join two datasets.';export const WELCOME_MESSAGE = `Hi, I am Kepler.gl AI Assistant!\nHere are some tasks I can help you with:\n\n${TASK_LIST}`;-export const INSTRUCTIONS = `You are a Kepler.gl AI Assistant that can answer questions and help with tasks of mapping, spatial data analysis, and SQL query.+export const INSTRUCTIONS = `You are a Kepler.gl AI Assistant that can answer questions and help with tasks of mapping and spatial data analysis.++Here are the tasks that you can help with:+${TASK_LIST}When responding to user queries:1. Analyze if the task requires one or multiple function calls@@ -17,9 +20,6 @@ When responding to user queries:- Please ask the user to confirm the parameters- If the user doesn't agree, try to provide variable functions to the user- Execute functions in a sequential order-3. For SQL query, please help to generate select query clause using the content of the dataset:- - please only use the columns that are in the dataset context- - please try to use the aggregate functions if possibleYou can execute multiple functions to complete complex tasks, but execute them one at a time in a logical sequence. Always validate the success of each function call before proceeding to the next one.@@ -57,4 +57,4 @@ export const ASSISTANT_NAME = 'kepler-gl-ai-assistant';export const ASSISTANT_DESCRIPTION = 'A Kepler.gl AI Assistant';-export const ASSISTANT_VERSION = '0.0.1-9';+export const ASSISTANT_VERSION = '0.0.2';diff --git a/yarn.lock b/yarn.lockindex a0224d693..d238b8e53 100644--- a/yarn.lock+++ b/yarn.lock@@ -2169,7 +2169,7 @@ __metadata:languageName: nodelinkType: hard-"@duckdb/duckdb-wasm@npm:^1.28.0, @duckdb/duckdb-wasm@npm:^1.29.0":+"@duckdb/duckdb-wasm@npm:^1.28.0":version: 1.29.0resolution: "@duckdb/duckdb-wasm@npm:1.29.0"dependencies:@@ -3197,7 +3197,6 @@ __metadata:"@kepler.gl/types": "npm:3.1.0-alpha.6""@kepler.gl/utils": "npm:3.1.0-alpha.6""@openassistant/core": "npm:^0.0.6"- "@openassistant/duckdb": "npm:^0.0.6""@openassistant/echarts": "npm:^0.0.6""@openassistant/geoda": "npm:^0.0.6""@openassistant/ui": "npm:^0.0.7"@@ -6292,23 +6291,6 @@ __metadata:languageName: nodelinkType: hard-"@openassistant/duckdb@npm:^0.0.6":- version: 0.0.6- resolution: "@openassistant/duckdb@npm:0.0.6"- dependencies:- "@duckdb/duckdb-wasm": "npm:^1.29.0"- "@nextui-org/react": "npm:^2.6.8"- apache-arrow: "npm:^13.0.0"- framer-motion: "npm:^11.15.0"- tailwindcss: "npm:^3.4.17"- peerDependencies:- "@openassistant/core": "*"- react: ">=18.2"- react-dom: ">=18.2"- checksum: 10c0/a3bd66232799d4f4fae377c4cd12ac628ffbd4fd3dda20f8161aaa6e2494903dee4fcb07ff095d9ac634b99404dfef9caa25cb57c8af22b7eed9e9cfe1a9a15b- languageName: node- linkType: hard-"@openassistant/echarts@npm:^0.0.6":version: 0.0.6resolution: "@openassistant/echarts@npm:0.0.6"@@ -9380,13 +9362,6 @@ __metadata:languageName: nodelinkType: hard-"@types/command-line-args@npm:5.2.0":- version: 5.2.0- resolution: "@types/command-line-args@npm:5.2.0"- checksum: 10c0/82a9308c9219fb19619dba302a4c3ccd039c8974b4b2d46265b9c99333168207743cba9c02fd85178d2f7f9a1e6d76c472e3ac45b1616b1f5926877c95ce0169- languageName: node- linkType: hard-"@types/command-line-args@npm:^5.2.3":version: 5.2.3resolution: "@types/command-line-args@npm:5.2.3"@@ -9394,13 +9369,6 @@ __metadata:languageName: nodelinkType: hard-"@types/command-line-usage@npm:5.0.2":- version: 5.0.2- resolution: "@types/command-line-usage@npm:5.0.2"- checksum: 10c0/5553012915df5fcf95e1ef5363fa2d0bc8543d80aa972916cb8e0ab99c0581e573af6e5e9426560367353e86bea7ff11c73d7e1d979190fe8799f6229b6d1e32- languageName: node- linkType: hard-"@types/command-line-usage@npm:^5.0.4":version: 5.0.4resolution: "@types/command-line-usage@npm:5.0.4"@@ -9854,13 +9822,6 @@ __metadata:languageName: nodelinkType: hard-"@types/node@npm:20.3.0":- version: 20.3.0- resolution: "@types/node@npm:20.3.0"- checksum: 10c0/f717d92c29c4877db394b604771b3734216f013312f93252f72c2018aabe8083be905fbcf0644c859938c8183b6e0245faaeaab94c9e78268b87a449bc6ef4aa- languageName: node- linkType: hard-"@types/node@npm:8.0.0":version: 8.0.0resolution: "@types/node@npm:8.0.0"@@ -9891,13 +9852,6 @@ __metadata:languageName: nodelinkType: hard-"@types/pad-left@npm:2.1.1":- version: 2.1.1- resolution: "@types/pad-left@npm:2.1.1"- checksum: 10c0/134a50786e5515e78b7b6a69150e768e877c6986ef637f921b9602d95cc73c0bb44ddbb160d7eb96706be792dc643e8b82617ef9760f4a5fa7f99cd06df03e50- languageName: node- linkType: hard-"@types/pako@npm:^1.0.1":version: 1.0.7resolution: "@types/pako@npm:1.0.7"@@ -10981,26 +10935,6 @@ __metadata:languageName: nodelinkType: hard-"apache-arrow@npm:^13.0.0":- version: 13.0.0- resolution: "apache-arrow@npm:13.0.0"- dependencies:- "@types/command-line-args": "npm:5.2.0"- "@types/command-line-usage": "npm:5.0.2"- "@types/node": "npm:20.3.0"- "@types/pad-left": "npm:2.1.1"- command-line-args: "npm:5.2.1"- command-line-usage: "npm:7.0.1"- flatbuffers: "npm:23.5.26"- json-bignum: "npm:^0.0.3"- pad-left: "npm:^2.1.0"- tslib: "npm:^2.5.3"- bin:- arrow2csv: bin/arrow2csv.js- checksum: 10c0/6be38aa4b60dcf5a4e31b8d2e2a3dbaf98856dc32986a966d3059769f1cf7aaa619abb39c2d9497f5f84a15a20acb897d09a6ffd8ea73f960315168c24067500- languageName: node- linkType: hard-"append-buffer@npm:^1.0.2":version: 1.0.2resolution: "append-buffer@npm:1.0.2"@@ -13245,7 +13179,7 @@ __metadata:languageName: nodelinkType: hard-"command-line-args@npm:5.2.1, command-line-args@npm:^5.2.1":+"command-line-args@npm:^5.2.1":version: 5.2.1resolution: "command-line-args@npm:5.2.1"dependencies:@@ -13257,19 +13191,7 @@ __metadata:languageName: nodelinkType: hard-"command-line-usage@npm:7.0.1":- version: 7.0.1- resolution: "command-line-usage@npm:7.0.1"- dependencies:- array-back: "npm:^6.2.2"- chalk-template: "npm:^0.4.0"- table-layout: "npm:^3.0.0"- typical: "npm:^7.1.1"- checksum: 10c0/195f0fcec49c5fae67ede6de2f810ca708c4e9d550b70f714767ee3e7a153cdcfb2c5234578c843e63494632f68d651173dd108a271bb286b24a72fba5ded61c- languageName: node- linkType: hard--"command-line-usage@npm:^7.0.0, command-line-usage@npm:^7.0.1":+"command-line-usage@npm:^7.0.1":version: 7.0.3resolution: "command-line-usage@npm:7.0.3"dependencies:@@ -16760,13 +16682,6 @@ __metadata:languageName: nodelinkType: hard-"flatbuffers@npm:23.5.26":- version: 23.5.26- resolution: "flatbuffers@npm:23.5.26"- checksum: 10c0/69e0903caa3aa8d2bdbf1557995835fd097806d413abc9b4b7440301a8ae2bd427220be1d613af80609c38d38cdbdeb459706903080433b509ceb64faf91b711- languageName: node- linkType: hard-"flatbuffers@npm:^24.3.25":version: 24.3.25resolution: "flatbuffers@npm:24.3.25"@@ -23294,15 +23209,6 @@ __metadata:languageName: nodelinkType: hard-"pad-left@npm:^2.1.0":- version: 2.1.0- resolution: "pad-left@npm:2.1.0"- dependencies:- repeat-string: "npm:^1.5.4"- checksum: 10c0/446c858bf3f7171cd164569aec074f3fe05ed9bcd03bc4016bb02b14733060344e54965e61667b46b67242ff77ae13d2ef9c35b6b039aed658ef5e9d1872f5d4- languageName: node- linkType: hard-"pako@npm:1.0.11, pako@npm:~1.0.5":version: 1.0.11resolution: "pako@npm:1.0.11"@@ -27449,13 +27355,6 @@ __metadata:languageName: nodelinkType: hard-"stream-read-all@npm:^3.0.1":- version: 3.0.1- resolution: "stream-read-all@npm:3.0.1"- checksum: 10c0/0039a3950dc5d7be91254538526c238985dea6ec3fadb8c1e276ece52b2f801728b3e205ae5e82f22a26f14b8d2cfbc92aedb6ae8d6c34c8a54c55ff74b0e66b- languageName: node- linkType: hard-"stream-shift@npm:^1.0.0":version: 1.0.3resolution: "stream-shift@npm:1.0.3"@@ -28100,23 +27999,6 @@ __metadata:languageName: nodelinkType: hard-"table-layout@npm:^3.0.0":- version: 3.0.2- resolution: "table-layout@npm:3.0.2"- dependencies:- "@75lb/deep-merge": "npm:^1.1.1"- array-back: "npm:^6.2.2"- command-line-args: "npm:^5.2.1"- command-line-usage: "npm:^7.0.0"- stream-read-all: "npm:^3.0.1"- typical: "npm:^7.1.1"- wordwrapjs: "npm:^5.1.0"- bin:- table-layout: bin/cli.js- checksum: 10c0/f2ccda5abe6c834e9cf4259ef7a3da572dfe38aeffe87f6955f0f49bab0d4d6b7b17f7d19b5682b96dd5446d69b50a15117b1a074a1f5236a0706dc53d20f02b- languageName: node- linkType: hard-"table-layout@npm:^4.1.0":version: 4.1.0resolution: "table-layout@npm:4.1.0"@@ -28823,7 +28705,7 @@ __metadata:languageName: nodelinkType: hard-"tslib@npm:2, tslib@npm:^2.5.3, tslib@npm:^2.8.0":+"tslib@npm:2, tslib@npm:^2.8.0":version: 2.8.1resolution: "tslib@npm:2.8.1"checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62