@datagrok/grokky 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/deploy-grokky/SKILL.md +193 -0
- package/.grokignore +2 -0
- package/.turbo/turbo-build.log +24 -0
- package/.vscode/settings.json +16 -0
- package/CHANGELOG.md +151 -8
- package/CLAUDE.md +284 -0
- package/CREDITS.md +173 -0
- package/LICENSE.md +16 -0
- package/README.md +24 -0
- package/bdd/bdd.config.json +1 -0
- package/bdd/bindings/elements.ts +9 -0
- package/bdd/bindings/steps.ts +787 -0
- package/bdd/features/ai-panel/platform-work.feature +63 -0
- package/bdd/features/ai-panel/session.feature +69 -0
- package/bdd/features/ai-panel/table-work.feature +99 -0
- package/bdd/generated/ai-panel/platform-work.test.ts +103 -0
- package/bdd/generated/ai-panel/session.test.ts +100 -0
- package/bdd/generated/ai-panel/table-work.test.ts +150 -0
- package/bdd/package.json +1 -0
- package/bdd/tsconfig.json +13 -0
- package/css/ai.css +637 -49
- package/dist/package-test.js +4 -1707
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +742 -92317
- package/dist/package.js.map +1 -1
- package/dockerfiles/claude-runtime/.dockerignore +1 -0
- package/{.eslintrc.json → dockerfiles/claude-runtime/.eslintrc.json} +7 -16
- package/dockerfiles/claude-runtime/Dockerfile +73 -13
- package/dockerfiles/claude-runtime/agent/grokky_agent/__init__.py +0 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/__main__.py +80 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/browser_tools.py +180 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/config.py +26 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/formats.py +155 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/guard.py +87 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.py +212 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.yaml +45 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/__init__.py +8 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/plugin.yaml +3 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/protocol.py +174 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/__init__.py +21 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/anthropic.py +21 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/azure.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/base.py +127 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/bedrock.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/custom.py +40 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/databricks.py +54 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openai_platform.py +41 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openrouter.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/session.py +471 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/skills.py +44 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/structured.py +40 -0
- package/dockerfiles/claude-runtime/container.json +2 -2
- package/dockerfiles/claude-runtime/entrypoint.sh +20 -0
- package/dockerfiles/claude-runtime/package-lock.json +1721 -306
- package/dockerfiles/claude-runtime/package.json +20 -5
- package/dockerfiles/claude-runtime/plugin/.claude-plugin/plugin.json +5 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-calc-column/SKILL.md +92 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-data/SKILL.md +250 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-toolkit/SKILL.md +395 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-df-and-columns/SKILL.md +454 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-entities/SKILL.md +38 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-exec/SKILL.md +209 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-filtering/SKILL.md +185 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-grid-customization/SKILL.md +270 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-projects/SKILL.md +100 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-selection/SKILL.md +344 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-undo/SKILL.md +78 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-viewers/SKILL.md +303 -0
- package/dockerfiles/claude-runtime/pyproject.toml +18 -0
- package/dockerfiles/claude-runtime/src/agent/pool.ts +411 -0
- package/dockerfiles/claude-runtime/src/agent/turn.ts +153 -0
- package/dockerfiles/claude-runtime/src/constants.ts +20 -0
- package/dockerfiles/claude-runtime/src/credentials.ts +45 -0
- package/dockerfiles/claude-runtime/src/grounding.ts +104 -0
- package/dockerfiles/claude-runtime/src/help-index.ts +118 -0
- package/dockerfiles/claude-runtime/src/privileges.ts +8 -0
- package/dockerfiles/claude-runtime/src/prompts.ts +211 -0
- package/dockerfiles/claude-runtime/src/server.ts +134 -234
- package/dockerfiles/claude-runtime/src/session.ts +328 -0
- package/dockerfiles/claude-runtime/src/shared-api-client.ts +112 -0
- package/dockerfiles/claude-runtime/src/stream-filter.ts +80 -0
- package/dockerfiles/claude-runtime/src/sync/home-files.ts +80 -0
- package/dockerfiles/claude-runtime/src/sync/orchestrator.ts +214 -0
- package/dockerfiles/claude-runtime/src/sync/packages.ts +145 -0
- package/dockerfiles/claude-runtime/src/sync/shared-connections.ts +87 -0
- package/dockerfiles/claude-runtime/src/sync/workspace.ts +68 -0
- package/dockerfiles/claude-runtime/src/tasks.ts +124 -0
- package/dockerfiles/claude-runtime/src/tool-summary.ts +66 -0
- package/dockerfiles/claude-runtime/src/types.ts +142 -23
- package/dockerfiles/claude-runtime/src/user/installed-packages.ts +17 -0
- package/dockerfiles/claude-runtime/src/user/staged-workspace.ts +80 -0
- package/dockerfiles/claude-runtime/src/user/user-dir.ts +108 -0
- package/dockerfiles/claude-runtime/src/verify.ts +136 -0
- package/dockerfiles/claude-runtime/src/watchdog.ts +115 -0
- package/dockerfiles/claude-runtime/test/credentials.test.js +43 -0
- package/dockerfiles/claude-runtime/test/grounding.test.js +191 -0
- package/dockerfiles/claude-runtime/test/help-index.test.js +115 -0
- package/dockerfiles/claude-runtime/test/plugin-skills.test.js +57 -0
- package/dockerfiles/claude-runtime/test/prompts.test.js +62 -0
- package/dockerfiles/claude-runtime/test/reaper.test.js +60 -0
- package/dockerfiles/claude-runtime/test/stream-filter.test.js +132 -0
- package/dockerfiles/claude-runtime/test/tasks.test.js +74 -0
- package/dockerfiles/claude-runtime/test/user-dir.test.js +71 -0
- package/dockerfiles/claude-runtime/test/verify.test.js +187 -0
- package/dockerfiles/claude-runtime/test/watchdog.test.js +43 -0
- package/dockerfiles/mcp-server/.eslintrc.json +39 -0
- package/dockerfiles/mcp-server/Dockerfile +10 -2
- package/dockerfiles/mcp-server/package-lock.json +1743 -98
- package/dockerfiles/mcp-server/package.json +27 -5
- package/dockerfiles/mcp-server/src/api-client.ts +123 -66
- package/dockerfiles/mcp-server/src/format.ts +51 -0
- package/dockerfiles/mcp-server/src/index.ts +44 -113
- package/dockerfiles/mcp-server/src/ops.ts +325 -0
- package/dockerfiles/mcp-server/src/shared-api-client.ts +81 -0
- package/dockerfiles/mcp-server/test/format.test.js +62 -0
- package/dockerfiles/mcp-server/test/ops.test.js +84 -0
- package/dockerfiles/mcp-server/test/shared-api-client.test.js +35 -0
- package/dockerfiles/queue/Dockerfile +2 -0
- package/dockerfiles/queue/container.json +7 -0
- package/docs/AUDIT-2026-08-03.md +1064 -0
- package/docs/BENCHMARK.md +292 -0
- package/docs/CLAUDE_CODE_FLOW.md +746 -0
- package/docs/EXAMPLES.md +82 -0
- package/docs/FEATURES.md +71 -0
- package/docs/IMPLEMENTATION.md +128 -0
- package/docs/LATENCY.md +170 -0
- package/docs/VISION.md +36 -0
- package/files/benchmark/suite.yaml +404 -0
- package/files/scripts/process-cro-results.md +14 -0
- package/files/suggestions.yaml +344 -0
- package/package.json +39 -97
- package/src/ai/ai-window.ts +157 -0
- package/src/ai/benchmark/benchmark.ts +737 -0
- package/src/ai/db-view-functions.ts +56 -0
- package/src/ai/engine.ts +98 -0
- package/src/ai/gemma-engine.ts +81 -0
- package/src/ai/panel.ts +1385 -0
- package/src/ai/prompt-suggestions.ts +209 -0
- package/src/ai/search/combined-search.ts +244 -0
- package/src/{llm-utils → ai/search}/query-matching.ts +46 -167
- package/src/{llm-utils → ai}/storage.ts +0 -1
- package/src/ai/table-tools.ts +145 -0
- package/src/ai/ui.ts +720 -0
- package/src/ai/usage-limiter.ts +105 -0
- package/src/ai/view-tools.ts +352 -0
- package/src/claude/ai-feature.ts +16 -0
- package/src/claude/exec-blocks.ts +176 -0
- package/src/claude/queue-task.ts +84 -0
- package/src/claude/runtime-client.ts +310 -0
- package/src/claude/turn-log.ts +114 -0
- package/src/claude/undoable.ts +105 -0
- package/src/{llm-utils → db}/db-index-tools.ts +24 -32
- package/src/db/sql-tools.ts +336 -0
- package/src/depr/LLM-client.ts +251 -0
- package/src/depr/ai-panel.ts +174 -0
- package/src/depr/chatgpt-assistant.ts +257 -0
- package/src/depr/creds.ts +30 -0
- package/src/depr/deepwikiclient.ts +118 -0
- package/src/depr/indexes/dg-repository-index.ts +266 -0
- package/src/depr/interfaces.ts +170 -0
- package/src/depr/is-help-request.ts +39 -0
- package/src/depr/prompt-engine.ts +52 -0
- package/src/depr/rendering-tools.ts +103 -0
- package/src/depr/script-tools.ts +785 -0
- package/src/depr/tableview-tools.ts +746 -0
- package/src/depr/viewers-ai.ts +67 -0
- package/src/package-api.ts +87 -28
- package/src/package-test.ts +1 -0
- package/src/package.g.ts +98 -48
- package/src/package.ts +211 -157
- package/src/polyfills.ts +12 -0
- package/src/utils.ts +128 -0
- package/tsconfig.json +8 -70
- package/webpack.config.js +3 -49
- package/.eslintignore +0 -2
- package/src/ai-panel.ts +0 -174
- package/src/claude-code/claude-panel.ts +0 -34
- package/src/claude-code/claude-runtime-client.ts +0 -148
- package/src/llm-utils/LLM-client.ts +0 -251
- package/src/llm-utils/combined-search.ts +0 -162
- package/src/llm-utils/creds.ts +0 -30
- package/src/llm-utils/deepwikiclient.ts +0 -118
- package/src/llm-utils/indexes/dg-repository-index.ts +0 -266
- package/src/llm-utils/panel.ts +0 -866
- package/src/llm-utils/script-tools.ts +0 -784
- package/src/llm-utils/sql-tools.ts +0 -840
- package/src/llm-utils/tableview-tools.ts +0 -704
- package/src/llm-utils/ui.ts +0 -315
- package/src/prompt-engine/chatgpt-assistant.ts +0 -257
- package/src/prompt-engine/interfaces.ts +0 -170
- package/src/prompt-engine/prompt-engine.ts +0 -52
- package/src/prompt-engine/rendering-tools.ts +0 -103
- package/src/prompts/is-help-request.ts +0 -26
- package/src/viewers-ai.ts +0 -67
- /package/src/{llm-utils → db}/indexes/biologics-index.ts +0 -0
- /package/src/{llm-utils → db}/indexes/chembl-index.ts +0 -0
- /package/src/{llm-utils → db}/query-meta-utils.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-chat-completions-provider.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-responses-provider.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/types.ts +0 -0
- /package/src/{llm-utils/depr → depr}/depr.ts +0 -0
- /package/src/{llm-utils/depr → depr}/embeddings.ts +0 -0
- /package/src/{llm-utils/depr → depr}/sql-utils.ts +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// import * as grok from 'datagrok-api/grok';
|
|
2
|
+
// import * as ui from 'datagrok-api/ui';
|
|
3
|
+
// import * as DG from 'datagrok-api/dg';
|
|
4
|
+
// import {getCurrentViewersString, getDataFrameDescription, getViewerDescriptionsString} from '../../utils';
|
|
5
|
+
// import {ModelType, LLMClient} from './LLM-client';
|
|
6
|
+
|
|
7
|
+
// type IViewerResponse = {
|
|
8
|
+
// viewerType: string;
|
|
9
|
+
// properties: {[index: string]: any};
|
|
10
|
+
// }
|
|
11
|
+
|
|
12
|
+
// /**
|
|
13
|
+
// * Examples of queries:
|
|
14
|
+
// * - plot width by height
|
|
15
|
+
// * - show me age distribution
|
|
16
|
+
// * - age distribution by disease
|
|
17
|
+
// * - plot age, height, and weight on the 3d scatter plot
|
|
18
|
+
// * - Plot width by height in a trellis plot split by race
|
|
19
|
+
// * - Plot weight by height for selected rows only
|
|
20
|
+
// * - form with all columns starting with "s"
|
|
21
|
+
// * */
|
|
22
|
+
// export async function askAiTableView(view: DG.TableView, question: string) {
|
|
23
|
+
// const prompt = getPrompt(view, question);
|
|
24
|
+
// //console.log(prompt);
|
|
25
|
+
// // TODO: substitute with the OpenAI client call
|
|
26
|
+
// const res = LLMClient.getInstance();
|
|
27
|
+
// const answer = await res.generalPromptCached(ModelType.Fast, '', prompt);
|
|
28
|
+
// //console.log(answer);
|
|
29
|
+
// //grok.shell.info(answer);
|
|
30
|
+
|
|
31
|
+
// const response: IViewerResponse = JSON.parse(answer);
|
|
32
|
+
// if (DG.Viewer.CORE_VIEWER_TYPES.includes(response.viewerType))
|
|
33
|
+
// view.addViewer(response.viewerType, response.properties);
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// export function askAiTableViewDialog(view: DG.TableView) {
|
|
37
|
+
// const input = ui.input.textArea('Question', {value: 'Plot width by height'});
|
|
38
|
+
|
|
39
|
+
// ui.dialog('Ask AI')
|
|
40
|
+
// .addInput('Question', input)
|
|
41
|
+
// .onOK(async () => {
|
|
42
|
+
// askAiTableView(view, input.value);
|
|
43
|
+
// })
|
|
44
|
+
// .show();
|
|
45
|
+
// }
|
|
46
|
+
|
|
47
|
+
// const getPrompt = (view: DG.TableView, question: string) => {
|
|
48
|
+
// return `
|
|
49
|
+
// Below is the structure of the dataframe a user is working with, and the interfaces for Datagrok visualizations.
|
|
50
|
+
// Your task is to identify which visualization to use, and which properties to set for what the user asks.
|
|
51
|
+
// For column name properties, you can only use names from the dataframe.
|
|
52
|
+
// Give the answer in the JSON format that can be directly parsed (no annotations or anything like that)
|
|
53
|
+
// with the "viewerType" identifying viewer type, and
|
|
54
|
+
// "properties" containing properties, like in this example:
|
|
55
|
+
// {"viewerType": "Histogram", "properties": {"valueColumnName": "Age", "markerSize": 15}}
|
|
56
|
+
|
|
57
|
+
// ${getCurrentViewersString(view)}
|
|
58
|
+
|
|
59
|
+
// User question: ${question}
|
|
60
|
+
|
|
61
|
+
// DataFrame structure:
|
|
62
|
+
// ${JSON.stringify(getDataFrameDescription(view.dataFrame))}
|
|
63
|
+
|
|
64
|
+
// Viewers:
|
|
65
|
+
// ${getViewerDescriptionsString()}`;
|
|
66
|
+
// };
|
|
67
|
+
|
package/src/package-api.ts
CHANGED
|
@@ -20,61 +20,120 @@ export namespace funcs {
|
|
|
20
20
|
return await grok.functions.call('Grokky:CombinedLLMSearchProvider', {});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export async function gemmaEngine(): Promise<any> {
|
|
24
|
+
return await grok.functions.call('Grokky:GemmaEngine', {});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function claudeEngine(): Promise<any> {
|
|
28
|
+
return await grok.functions.call('Grokky:ClaudeEngine', {});
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export async function askHelpLLMProvider(prompt: string ): Promise<any> {
|
|
27
|
-
return await grok.functions.call('Grokky:AskHelpLLMProvider', { prompt });
|
|
32
|
+
* Get answers from AI assistant based on Datagrok documentation and public code.
|
|
33
|
+
*/
|
|
34
|
+
export async function askHelpLLMProvider(prompt: string , sessionId?: string ): Promise<any> {
|
|
35
|
+
return await grok.functions.call('Grokky:AskHelpLLMProvider', { prompt, sessionId });
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
* Run the Grokky latency/accuracy benchmark suite (files/benchmark/suite.yaml) and download a JSON + Markdown report tagged with the given label. Run after logging in; open no special view.
|
|
40
|
+
* @param {string} label - Config label for this run, e.g. baseline / medium-effort
|
|
41
|
+
* @param {number} reps - Repetitions per prompt (default 3)
|
|
42
|
+
* @param {string} only - Run only part of the suite: comma-separated categories, difficulties, or prompt substrings.
|
|
43
|
+
*/
|
|
44
|
+
export async function runBenchmark(label: string , reps?: number , only?: string ): Promise<string> {
|
|
45
|
+
return await grok.functions.call('Grokky:RunBenchmark', { label, reps, only });
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export async function
|
|
41
|
-
return await grok.functions.call('Grokky:
|
|
49
|
+
* Holds the admission slot for one AI chat turn streaming over the browser WebSocket - see queue-task.ts
|
|
50
|
+
*/
|
|
51
|
+
export async function aiChatTurnTask(sessionId: string , taskId: string ): Promise<string> {
|
|
52
|
+
return await grok.functions.call('Grokky:AiChatTurnTask', { sessionId, taskId });
|
|
42
53
|
}
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Compare two or more saved benchmark runs (comma-separated labels) into one Markdown report and download it.
|
|
57
|
+
* @param {string} labels - Comma-separated run labels, the first being the reference arm
|
|
58
|
+
*/
|
|
59
|
+
export async function compareBenchmarks(labels: string ): Promise<string> {
|
|
60
|
+
return await grok.functions.call('Grokky:CompareBenchmarks', { labels });
|
|
46
61
|
}
|
|
47
62
|
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Plans and executes function steps to achieve needed results
|
|
65
|
+
*/
|
|
66
|
+
export async function smartChainExecutionProvider(prompt: string , sessionId?: string ): Promise<any> {
|
|
67
|
+
return await grok.functions.call('Grokky:SmartChainExecutionProvider', { prompt, sessionId });
|
|
50
68
|
}
|
|
51
69
|
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Tries to find a query which has the similar pattern as the prompt user entered and executes it
|
|
72
|
+
*/
|
|
73
|
+
export async function llmSearchQueryProvider(prompt: string , sessionId?: string ): Promise<any> {
|
|
74
|
+
return await grok.functions.call('Grokky:LlmSearchQueryProvider', { prompt, sessionId });
|
|
54
75
|
}
|
|
55
76
|
|
|
56
77
|
export async function findMatchingPatternQuery(prompt: string ): Promise<string> {
|
|
57
78
|
return await grok.functions.call('Grokky:FindMatchingPatternQuery', { prompt });
|
|
58
79
|
}
|
|
59
80
|
|
|
60
|
-
export async function askDocumentationCached(prompt: string ): Promise<string> {
|
|
61
|
-
return await grok.functions.call('Grokky:AskDocumentationCached', { prompt });
|
|
62
|
-
}
|
|
63
|
-
|
|
64
81
|
export async function setupAIQueryEditor(view: DG.View , connectionID: string , queryEditorRoot: any , setAndRunFunc: any ): Promise<boolean> {
|
|
65
82
|
return await grok.functions.call('Grokky:SetupAIQueryEditor', { view, connectionID, queryEditorRoot, setAndRunFunc });
|
|
66
83
|
}
|
|
67
84
|
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
/**
|
|
86
|
+
* List the catalogs available on this connection
|
|
87
|
+
*/
|
|
88
|
+
export async function listDbCatalogs(view: DG.View ): Promise<string> {
|
|
89
|
+
return await grok.functions.call('Grokky:ListDbCatalogs', { view });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* List schemas of a catalog (defaults to the connection default catalog)
|
|
94
|
+
*/
|
|
95
|
+
export async function listDbSchemas(view: DG.View , catalogName?: string ): Promise<string> {
|
|
96
|
+
return await grok.functions.call('Grokky:ListDbSchemas', { view, catalogName });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* List tables of a schema with row counts
|
|
101
|
+
*/
|
|
102
|
+
export async function listDbTables(view: DG.View , schemaName: string , catalogName?: string ): Promise<string> {
|
|
103
|
+
return await grok.functions.call('Grokky:ListDbTables', { view, schemaName, catalogName });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Detailed column info (types, comments, ranges, sample values) for the given tables. Table refs: catalog.schema.table, schema.table, or table
|
|
108
|
+
* @param {string} tables - Comma-separated table references to describe
|
|
109
|
+
*/
|
|
110
|
+
export async function getDbTableDetails(view: DG.View , tables: string ): Promise<string> {
|
|
111
|
+
return await grok.functions.call('Grokky:GetDbTableDetails', { view, tables });
|
|
70
112
|
}
|
|
71
113
|
|
|
72
|
-
|
|
73
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Foreign-key relationships involving the given tables — use to build correct JOINs
|
|
116
|
+
* @param {string} tables - Comma-separated table references
|
|
117
|
+
*/
|
|
118
|
+
export async function listDbJoins(view: DG.View , tables: string ): Promise<string> {
|
|
119
|
+
return await grok.functions.call('Grokky:ListDbJoins', { view, tables });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Test-execute a SELECT (auto-LIMITed) and report row count, columns, and a sample row. Use to validate SQL before setQueryAndRun
|
|
124
|
+
* @param {string} sql - The SQL to test
|
|
125
|
+
* @param {string} description - One line describing what the query does
|
|
126
|
+
*/
|
|
127
|
+
export async function getSqlTestResult(view: DG.View , sql: string , description: string ): Promise<string> {
|
|
128
|
+
return await grok.functions.call('Grokky:GetSqlTestResult', { view, sql, description });
|
|
74
129
|
}
|
|
75
130
|
|
|
76
|
-
|
|
77
|
-
|
|
131
|
+
/**
|
|
132
|
+
* @param {string} dbName
|
|
133
|
+
* choices: ["biologics","chembl"]
|
|
134
|
+
*/
|
|
135
|
+
export async function moveMetaToDB(dbName: string ): Promise<void> {
|
|
136
|
+
return await grok.functions.call('Grokky:MoveMetaToDB', { dbName });
|
|
78
137
|
}
|
|
79
138
|
|
|
80
139
|
export async function indexDatabaseSchema(): Promise<void> {
|
package/src/package-test.ts
CHANGED
package/src/package.g.ts
CHANGED
|
@@ -19,101 +19,151 @@ export function combinedLLMSearchProvider() : any {
|
|
|
19
19
|
return PackageFunctions.combinedLLMSearchProvider();
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
//output: dynamic result
|
|
23
|
+
//meta.role: aiEngine
|
|
24
|
+
export function gemmaEngine() : any {
|
|
25
|
+
return PackageFunctions.gemmaEngine();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//output: dynamic result
|
|
29
|
+
//meta.role: aiEngine
|
|
30
|
+
export function claudeEngine() : any {
|
|
31
|
+
return PackageFunctions.claudeEngine();
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
//name: Help
|
|
23
|
-
//description: Get answers from
|
|
35
|
+
//description: Get answers from AI assistant based on Datagrok documentation and public code.
|
|
24
36
|
//input: string prompt
|
|
37
|
+
//input: string sessionId { optional: true }
|
|
25
38
|
//output: widget result
|
|
26
39
|
//meta.role: aiSearchProvider
|
|
27
40
|
//meta.useWhen: If the user is asking questions about how to do something, how to write the code on platform, how to execute tasks, or any other questions related to Datagrok platform functionalities and capabilities. The tone of the prompt should generally sound like "how do I do this" / "what is this". for example, "what sequence notations are supported?
|
|
28
|
-
export async function askHelpLLMProvider(prompt: string) : Promise<any> {
|
|
29
|
-
return await PackageFunctions.askHelpLLMProvider(prompt);
|
|
41
|
+
export async function askHelpLLMProvider(prompt: string, sessionId?: string) : Promise<any> {
|
|
42
|
+
return await PackageFunctions.askHelpLLMProvider(prompt, sessionId);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//description: Run the Grokky latency/accuracy benchmark suite (files/benchmark/suite.yaml) and download a JSON + Markdown report tagged with the given label. Run after logging in; open no special view.
|
|
46
|
+
//input: string label { description: Config label for this run, e.g. baseline / medium-effort }
|
|
47
|
+
//input: int reps { optional: true; description: Repetitions per prompt (default 3) }
|
|
48
|
+
//input: string only { optional: true; description: Run only part of the suite: comma-separated categories, difficulties, or prompt substrings. }
|
|
49
|
+
//output: string result
|
|
50
|
+
export async function runBenchmark(label: string, reps?: number, only?: string) : Promise<string> {
|
|
51
|
+
return await PackageFunctions.runBenchmark(label, reps, only);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//description: Holds the admission slot for one AI chat turn streaming over the browser WebSocket - see queue-task.ts
|
|
55
|
+
//input: string sessionId
|
|
56
|
+
//input: string taskId
|
|
57
|
+
//output: string result
|
|
58
|
+
//meta.queue: true
|
|
59
|
+
export async function aiChatTurnTask(sessionId: string, taskId: string) : Promise<string> {
|
|
60
|
+
return await PackageFunctions.aiChatTurnTask(sessionId, taskId);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//description: Compare two or more saved benchmark runs (comma-separated labels) into one Markdown report and download it.
|
|
64
|
+
//input: string labels { description: Comma-separated run labels, the first being the reference arm }
|
|
65
|
+
//output: string result
|
|
66
|
+
export async function compareBenchmarks(labels: string) : Promise<string> {
|
|
67
|
+
return await PackageFunctions.compareBenchmarks(labels);
|
|
30
68
|
}
|
|
31
69
|
|
|
32
70
|
//name: Execute
|
|
33
71
|
//description: Plans and executes function steps to achieve needed results
|
|
34
72
|
//input: string prompt
|
|
73
|
+
//input: string sessionId { optional: true }
|
|
35
74
|
//output: widget result
|
|
36
75
|
//meta.role: aiSearchProvider
|
|
37
76
|
//meta.useWhen: If the prompt looks like a user has a goal to achieve something with concrete input(s), and wants the system to plan and execute a series of steps/functions to achieve that goal. This relates to functions that analyse or mutate data, not get it. for example, adme properties of CHEMBL1234, enumerate some peptide, etc... Also, if the tone of the prompt sounds like "Do something to something", use this function
|
|
38
|
-
export async function smartChainExecutionProvider(prompt: string) : Promise<any> {
|
|
39
|
-
return await PackageFunctions.smartChainExecutionProvider(prompt);
|
|
77
|
+
export async function smartChainExecutionProvider(prompt: string, sessionId?: string) : Promise<any> {
|
|
78
|
+
return await PackageFunctions.smartChainExecutionProvider(prompt, sessionId);
|
|
40
79
|
}
|
|
41
80
|
|
|
42
81
|
//name: Query
|
|
43
82
|
//description: Tries to find a query which has the similar pattern as the prompt user entered and executes it
|
|
44
83
|
//input: string prompt
|
|
84
|
+
//input: string sessionId { optional: true }
|
|
45
85
|
//output: widget result
|
|
46
86
|
//meta.role: aiSearchProvider
|
|
47
87
|
//meta.useWhen: if the prompt suggest that the user is looking for a data table result and the prompt resembles a query pattern. for example, "bioactivity data for shigella" or "compounds similar to aspirin" or first 100 chembl compounds. there should be some parts of user prompt that could match parameters in some query, like shigella, aspirin, first 100 etc. Always use this function when user wants to get the data without any further processing or calculating
|
|
48
|
-
export async function llmSearchQueryProvider(prompt: string) : Promise<any> {
|
|
49
|
-
return await PackageFunctions.llmSearchQueryProvider(prompt);
|
|
88
|
+
export async function llmSearchQueryProvider(prompt: string, sessionId?: string) : Promise<any> {
|
|
89
|
+
return await PackageFunctions.llmSearchQueryProvider(prompt, sessionId);
|
|
50
90
|
}
|
|
51
91
|
|
|
52
|
-
//input: string model
|
|
53
|
-
//input: string systemPrompt
|
|
54
92
|
//input: string prompt
|
|
55
|
-
//input: dynamic schema
|
|
56
93
|
//output: string result
|
|
57
94
|
//meta.cache: all
|
|
58
95
|
//meta.cache.invalidateOn: 0 0 1 * *
|
|
59
|
-
export async function
|
|
60
|
-
return await PackageFunctions.
|
|
96
|
+
export async function findMatchingPatternQuery(prompt: string) : Promise<string> {
|
|
97
|
+
return await PackageFunctions.findMatchingPatternQuery(prompt);
|
|
61
98
|
}
|
|
62
99
|
|
|
63
|
-
//input:
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
100
|
+
//input: view view
|
|
101
|
+
//input: string connectionID
|
|
102
|
+
//input: dynamic queryEditorRoot
|
|
103
|
+
//input: dynamic setAndRunFunc
|
|
104
|
+
//output: bool result
|
|
105
|
+
export async function setupAIQueryEditor(view: DG.ViewBase, connectionID: string, queryEditorRoot: any, setAndRunFunc: any) : Promise<boolean> {
|
|
106
|
+
return await PackageFunctions.setupAIQueryEditor(view, connectionID, queryEditorRoot, setAndRunFunc);
|
|
69
107
|
}
|
|
70
108
|
|
|
71
|
-
//
|
|
109
|
+
//description: List the catalogs available on this connection
|
|
110
|
+
//input: view view
|
|
72
111
|
//output: string result
|
|
73
|
-
//meta.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return await PackageFunctions.getExecutionPlan(userGoal);
|
|
112
|
+
//meta.viewType: DataQueryView
|
|
113
|
+
export async function listDbCatalogs(view: any) : Promise<string> {
|
|
114
|
+
return await PackageFunctions.listDbCatalogs(view);
|
|
77
115
|
}
|
|
78
116
|
|
|
79
|
-
//
|
|
117
|
+
//description: List schemas of a catalog (defaults to the connection default catalog)
|
|
118
|
+
//input: view view
|
|
119
|
+
//input: string catalogName { optional: true }
|
|
80
120
|
//output: string result
|
|
81
|
-
//meta.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return await PackageFunctions.findMatchingPatternQuery(prompt);
|
|
121
|
+
//meta.viewType: DataQueryView
|
|
122
|
+
export async function listDbSchemas(view: any, catalogName?: string) : Promise<string> {
|
|
123
|
+
return await PackageFunctions.listDbSchemas(view, catalogName);
|
|
85
124
|
}
|
|
86
125
|
|
|
87
|
-
//
|
|
126
|
+
//description: List tables of a schema with row counts
|
|
127
|
+
//input: view view
|
|
128
|
+
//input: string schemaName
|
|
129
|
+
//input: string catalogName { optional: true }
|
|
88
130
|
//output: string result
|
|
89
|
-
//meta.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return await PackageFunctions.askDocumentationCached(prompt);
|
|
131
|
+
//meta.viewType: DataQueryView
|
|
132
|
+
export async function listDbTables(view: any, schemaName: string, catalogName?: string) : Promise<string> {
|
|
133
|
+
return await PackageFunctions.listDbTables(view, schemaName, catalogName);
|
|
93
134
|
}
|
|
94
135
|
|
|
136
|
+
//description: Detailed column info (types, comments, ranges, sample values) for the given tables. Table refs: catalog.schema.table, schema.table, or table
|
|
95
137
|
//input: view view
|
|
96
|
-
//input: string
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return await PackageFunctions.setupAIQueryEditor(view, connectionID, queryEditorRoot, setAndRunFunc);
|
|
138
|
+
//input: string tables { description: Comma-separated table references to describe }
|
|
139
|
+
//output: string result
|
|
140
|
+
//meta.viewType: DataQueryView
|
|
141
|
+
export async function getDbTableDetails(view: any, tables: string) : Promise<string> {
|
|
142
|
+
return await PackageFunctions.getDbTableDetails(view, tables);
|
|
102
143
|
}
|
|
103
144
|
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
-
|
|
145
|
+
//description: Foreign-key relationships involving the given tables — use to build correct JOINs
|
|
146
|
+
//input: view view
|
|
147
|
+
//input: string tables { description: Comma-separated table references }
|
|
148
|
+
//output: string result
|
|
149
|
+
//meta.viewType: DataQueryView
|
|
150
|
+
export async function listDbJoins(view: any, tables: string) : Promise<string> {
|
|
151
|
+
return await PackageFunctions.listDbJoins(view, tables);
|
|
107
152
|
}
|
|
108
153
|
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
154
|
+
//description: Test-execute a SELECT (auto-LIMITed) and report row count, columns, and a sample row. Use to validate SQL before setQueryAndRun
|
|
155
|
+
//input: view view
|
|
156
|
+
//input: string sql { description: The SQL to test }
|
|
157
|
+
//input: string description { description: One line describing what the query does }
|
|
158
|
+
//output: string result
|
|
159
|
+
//meta.viewType: DataQueryView
|
|
160
|
+
export async function getSqlTestResult(view: any, sql: string, description: string) : Promise<string> {
|
|
161
|
+
return await PackageFunctions.getSqlTestResult(view, sql, description);
|
|
112
162
|
}
|
|
113
163
|
|
|
114
|
-
//
|
|
115
|
-
export async function
|
|
116
|
-
await PackageFunctions.
|
|
164
|
+
//input: string dbName { choices: ["biologics","chembl"] }
|
|
165
|
+
export async function moveMetaToDB(dbName: string) : Promise<void> {
|
|
166
|
+
await PackageFunctions.moveMetaToDB(dbName);
|
|
117
167
|
}
|
|
118
168
|
|
|
119
169
|
//name: indexDatabaseSchema
|