@sisense/sdk-ai-core 0.5.1 → 0.6.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/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/engines/build-query/build-query-engine.d.ts +11 -0
- package/dist/engines/build-query/build-query-engine.d.ts.map +1 -0
- package/dist/engines/build-query/index.d.ts +3 -0
- package/dist/engines/build-query/index.d.ts.map +1 -0
- package/dist/engines/build-query/types.d.ts +34 -0
- package/dist/engines/build-query/types.d.ts.map +1 -0
- package/dist/engines/chart-builder/chart-builder-engine.d.ts +4 -3
- package/dist/engines/chart-builder/chart-builder-engine.d.ts.map +1 -1
- package/dist/engines/chart-builder/create-chart/create-chart.d.ts +3 -2
- package/dist/engines/chart-builder/create-chart/create-chart.d.ts.map +1 -1
- package/dist/engines/chart-builder/create-chart/generate-chart-table.d.ts +2 -1
- package/dist/engines/chart-builder/create-chart/generate-chart-table.d.ts.map +1 -1
- package/dist/engines/chart-builder/types.d.ts +46 -18
- package/dist/engines/chart-builder/types.d.ts.map +1 -1
- package/dist/engines/chart-builder/update-chart/chart-options-schemas.d.ts +218 -218
- package/dist/engines/chart-builder/update-chart/schemas.d.ts +24 -24
- package/dist/engines/data-source-fields/data-source-fields-engine.d.ts +7 -6
- package/dist/engines/data-source-fields/data-source-fields-engine.d.ts.map +1 -1
- package/dist/engines/data-source-fields/types.d.ts +1 -43
- package/dist/engines/data-source-fields/types.d.ts.map +1 -1
- package/dist/engines/index.d.ts +1 -0
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4606 -2136
- package/dist/index.js.map +1 -1
- package/dist/services/llm/llm-consumption-service.d.ts +17 -0
- package/dist/services/llm/llm-consumption-service.d.ts.map +1 -0
- package/dist/utils/create-custom-fetch.d.ts +10 -0
- package/dist/utils/create-custom-fetch.d.ts.map +1 -0
- package/dist/utils/http-client.d.ts +2 -5
- package/dist/utils/http-client.d.ts.map +1 -1
- package/dist/utils/user-action-tracking.d.ts +17 -26
- package/dist/utils/user-action-tracking.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,14 @@ export declare const TOOL_NAME_RECOMMEND_QUERIES = "recommendQueries";
|
|
|
5
5
|
export declare const TOOL_NAME_GET_DASHBOARDS = "getDashboards";
|
|
6
6
|
export declare const TOOL_NAME_GET_DATA_SOURCES = "getDataSources";
|
|
7
7
|
export declare const TOOL_NAME_GET_DATA_SOURCE_FIELDS = "getDataSourceFields";
|
|
8
|
+
export declare const TOOL_NAME_BUILD_QUERY = "buildQuery";
|
|
8
9
|
export declare const TOOL_CONTEXT_MAX_ASSETS = 10;
|
|
9
10
|
export declare const MAX_DATA_SOURCE_FIELDS_SUMMARY = 200;
|
|
10
11
|
export declare const DEFAULT_LLM = "LLM_PLACEHOLDER";
|
|
12
|
+
export declare const HEADER_USER_ACTION_ID = "x-user-action-id";
|
|
13
|
+
export declare const HEADER_TRACEPARENT = "traceparent";
|
|
14
|
+
export declare const HEADER_INTERFACE_NAME = "x-interface-name";
|
|
15
|
+
export declare const HEADER_FEATURE_NAME = "x-feature-name";
|
|
16
|
+
export declare const HEADER_QUOTA_ID = "x-quota-id";
|
|
17
|
+
export declare const ALLOWED_HEADERS: string[];
|
|
11
18
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,eAAe,CAAC;AACpD,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAC5D,eAAO,MAAM,4BAA4B,mBAAmB,CAAC;AAC7D,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAC9D,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AACxD,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gCAAgC,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,eAAe,CAAC;AACpD,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAC5D,eAAO,MAAM,4BAA4B,mBAAmB,CAAC;AAC7D,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAC9D,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AACxD,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gCAAgC,wBAAwB,CAAC;AACtE,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAGlD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAG1C,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAGlD,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAG7C,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAChD,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,eAAO,MAAM,eAAe,UAM3B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { buildQuerySchema, BuildQueryContext, QueryResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Standalone build query engine - completely decoupled from any UI or store
|
|
5
|
+
* Converts a natural language query into an NLQ result and dataset
|
|
6
|
+
* @param params - The parameters containing data source title and query prompt
|
|
7
|
+
* @param context - Context with tool call ID and optional httpClient
|
|
8
|
+
* @returns The query result with queryId, nlqResult, and dataset
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildQueryEngine(params: z.infer<typeof buildQuerySchema>, context: BuildQueryContext): Promise<QueryResult>;
|
|
11
|
+
//# sourceMappingURL=build-query-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-query-engine.d.ts","sourceRoot":"","sources":["../../../src/engines/build-query/build-query-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EACxC,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAuCtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engines/build-query/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
3
|
+
import { NlqV3Result } from '../../services/nlq/nlq-service';
|
|
4
|
+
/**
|
|
5
|
+
* Schema for buildQuery engine parameters
|
|
6
|
+
*/
|
|
7
|
+
export declare const buildQuerySchema: z.ZodObject<{
|
|
8
|
+
dataSourceTitle: z.ZodString;
|
|
9
|
+
queryPrompt: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
dataSourceTitle: string;
|
|
12
|
+
queryPrompt: string;
|
|
13
|
+
}, {
|
|
14
|
+
dataSourceTitle: string;
|
|
15
|
+
queryPrompt: string;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Context interface for buildQueryEngine
|
|
19
|
+
*/
|
|
20
|
+
export interface BuildQueryContext {
|
|
21
|
+
/** Tool call ID for tracking */
|
|
22
|
+
toolCallId: string;
|
|
23
|
+
/** HTTP client for API calls (optional, uses singleton if not provided) */
|
|
24
|
+
httpClient?: HttpClient;
|
|
25
|
+
/** Optional ID generator for testability (defaults to nanoidHex(12)) */
|
|
26
|
+
generateQueryId?: () => string;
|
|
27
|
+
}
|
|
28
|
+
export interface QueryResult {
|
|
29
|
+
queryId: string;
|
|
30
|
+
title: string;
|
|
31
|
+
nlqResult: NlqV3Result;
|
|
32
|
+
dataset: {} | string | null;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/engines/build-query/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAS3B,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,EAAE,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;CAC5B"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ChartSummary, BuildChartContext, buildChartSchema } from './types';
|
|
1
|
+
import { ChartSummary, BuildChartContext, buildChartSchema, buildChartSchemaNaturalConversation } from './types';
|
|
2
|
+
import { QueryResult } from '../build-query/types';
|
|
2
3
|
import { default as z } from 'zod';
|
|
3
4
|
/**
|
|
4
5
|
* Build contextual system prompt for chart builder
|
|
5
6
|
*/
|
|
6
|
-
export declare function buildContextualSystemPrompt(chartSummaries: ChartSummary[]): string;
|
|
7
|
+
export declare function buildContextualSystemPrompt(chartSummaries: ChartSummary[], querySummaries?: QueryResult[]): string;
|
|
7
8
|
/**
|
|
8
9
|
* Standalone chart builder engine - completely decoupled from any UI or store
|
|
9
10
|
* @param params - The parameters for the chart builder
|
|
10
11
|
* @param context - All external dependencies injected
|
|
11
12
|
* @returns The chart summary
|
|
12
13
|
*/
|
|
13
|
-
export declare function buildChartEngine(params: z.infer<typeof buildChartSchema>, context: BuildChartContext): Promise<ChartSummary>;
|
|
14
|
+
export declare function buildChartEngine(params: z.infer<typeof buildChartSchema> | z.infer<typeof buildChartSchemaNaturalConversation>, context: BuildChartContext): Promise<ChartSummary>;
|
|
14
15
|
//# sourceMappingURL=chart-builder-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-builder-engine.d.ts","sourceRoot":"","sources":["../../../src/engines/chart-builder/chart-builder-engine.ts"],"names":[],"mappings":"AACA,OAAO,EACN,YAAY,EAUZ,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-builder-engine.d.ts","sourceRoot":"","sources":["../../../src/engines/chart-builder/chart-builder-engine.ts"],"names":[],"mappings":"AACA,OAAO,EACN,YAAY,EAUZ,iBAAiB,EACjB,gBAAgB,EAChB,mCAAmC,EACnC,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAanD,OAAO,CAAC,MAAM,KAAK,CAAC;AAqHpB;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,cAAc,EAAE,YAAY,EAAE,EAC9B,cAAc,CAAC,EAAE,WAAW,EAAE,UAkC9B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EACH,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAChC,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,EACtD,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,YAAY,CAAC,CAsEvB"}
|
|
@@ -6,9 +6,10 @@ type GenerateChartParams = {
|
|
|
6
6
|
chartPrompt: string;
|
|
7
7
|
chartType: NullableChartType;
|
|
8
8
|
chartTitle: string;
|
|
9
|
+
queryId?: string | null;
|
|
9
10
|
};
|
|
10
|
-
export declare const generateChart: ({ dataSourceTitle, queryPrompt, chartPrompt, chartType, chartTitle, }: GenerateChartParams, context: BuildChartContext) => Promise<ExtendedChartWidgetProps>;
|
|
11
|
-
export declare const createChart: ({ queryPrompt, chartPrompt, chartType, chartTitle, }: z.infer<typeof createChartSchema>, context: BuildChartContext) => Promise<{
|
|
11
|
+
export declare const generateChart: ({ dataSourceTitle, queryPrompt, chartPrompt, chartType, chartTitle, queryId, }: GenerateChartParams, context: BuildChartContext) => Promise<ExtendedChartWidgetProps>;
|
|
12
|
+
export declare const createChart: ({ queryPrompt, chartPrompt, chartType, chartTitle, queryId: paramsQueryId, }: z.infer<typeof createChartSchema>, context: BuildChartContext) => Promise<{
|
|
12
13
|
message: string;
|
|
13
14
|
}>;
|
|
14
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-chart.d.ts","sourceRoot":"","sources":["../../../../src/engines/chart-builder/create-chart/create-chart.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,MAAM,UAAU,CAAC;AAKlB,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,KAAK,mBAAmB,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"create-chart.d.ts","sourceRoot":"","sources":["../../../../src/engines/chart-builder/create-chart/create-chart.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,MAAM,UAAU,CAAC;AAKlB,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,KAAK,mBAAmB,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,aAAa,GACzB,gFAOG,mBAAmB,EACtB,SAAS,iBAAiB,KACxB,OAAO,CAAC,wBAAwB,CAgDlC,CAAC;AAEF,eAAO,MAAM,WAAW,GACvB,8EAMG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,EACpC,SAAS,iBAAiB;;EAiC1B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExtendedChartWidgetProps } from '../types';
|
|
2
2
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
3
|
-
|
|
3
|
+
import { QueryResult } from '../../build-query/types';
|
|
4
|
+
export declare const generateChartTable: (dataSourceTitle: string, queryPrompt: string, isNlqV3Enabled?: boolean, httpClient?: HttpClient, queryId?: string | null, retrieveQuery?: (queryId: string) => QueryResult | null) => Promise<ExtendedChartWidgetProps>;
|
|
4
5
|
//# sourceMappingURL=generate-chart-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-chart-table.d.ts","sourceRoot":"","sources":["../../../../src/engines/chart-builder/create-chart/generate-chart-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAOpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-chart-table.d.ts","sourceRoot":"","sources":["../../../../src/engines/chart-builder/create-chart/generate-chart-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAOpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAQtD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAwItD,eAAO,MAAM,kBAAkB,GAC9B,iBAAiB,MAAM,EACvB,aAAa,MAAM,EACnB,iBAAiB,OAAO,EACxB,aAAa,UAAU,EACvB,UAAU,MAAM,GAAG,IAAI,EACvB,gBAAgB,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,IAAI,sCA2BvD,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { HttpClient } from '@sisense/sdk-rest-client';
|
|
|
4
4
|
import { default as OpenAI } from 'openai';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { NlqResponseData } from '@sisense/sdk-ui/ai';
|
|
7
|
+
import { QueryResult } from '../build-query/types';
|
|
7
8
|
export type ArtifactReference = {
|
|
8
9
|
artifactId?: string;
|
|
9
10
|
};
|
|
@@ -64,12 +65,12 @@ export declare const axesMapping: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
64
65
|
breakBy: z.ZodArray<z.ZodNumber, "many">;
|
|
65
66
|
}, "strict", z.ZodTypeAny, {
|
|
66
67
|
value: number[];
|
|
67
|
-
type: "
|
|
68
|
+
type: "area" | "column" | "line" | "bar" | "polar";
|
|
68
69
|
category: number[];
|
|
69
70
|
breakBy: number[];
|
|
70
71
|
}, {
|
|
71
72
|
value: number[];
|
|
72
|
-
type: "
|
|
73
|
+
type: "area" | "column" | "line" | "bar" | "polar";
|
|
73
74
|
category: number[];
|
|
74
75
|
breakBy: number[];
|
|
75
76
|
}>, z.ZodObject<{
|
|
@@ -192,21 +193,22 @@ export declare const axesMapping: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
192
193
|
locationLevel: z.ZodEnum<["auto", "country", "state", "city"]>;
|
|
193
194
|
}, "strict", z.ZodTypeAny, {
|
|
194
195
|
type: "scattermap";
|
|
196
|
+
details: number[];
|
|
195
197
|
size: number[];
|
|
196
198
|
geo: number[];
|
|
197
199
|
colorBy: number[];
|
|
198
|
-
details: number[];
|
|
199
200
|
locationLevel: "auto" | "country" | "state" | "city";
|
|
200
201
|
}, {
|
|
201
202
|
type: "scattermap";
|
|
203
|
+
details: number[];
|
|
202
204
|
size: number[];
|
|
203
205
|
geo: number[];
|
|
204
206
|
colorBy: number[];
|
|
205
|
-
details: number[];
|
|
206
207
|
locationLevel: "auto" | "country" | "state" | "city";
|
|
207
208
|
}>]>;
|
|
208
209
|
export declare const nullableChartType: z.ZodNullable<z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>>;
|
|
209
210
|
export declare const chartIdSchema: z.ZodDefault<z.ZodString>;
|
|
211
|
+
export declare const queryIdSchema: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
210
212
|
export declare const chartRecommendationsSchema: z.ZodObject<{
|
|
211
213
|
chartType: z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>;
|
|
212
214
|
axesMapping: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -216,12 +218,12 @@ export declare const chartRecommendationsSchema: z.ZodObject<{
|
|
|
216
218
|
breakBy: z.ZodArray<z.ZodNumber, "many">;
|
|
217
219
|
}, "strict", z.ZodTypeAny, {
|
|
218
220
|
value: number[];
|
|
219
|
-
type: "
|
|
221
|
+
type: "area" | "column" | "line" | "bar" | "polar";
|
|
220
222
|
category: number[];
|
|
221
223
|
breakBy: number[];
|
|
222
224
|
}, {
|
|
223
225
|
value: number[];
|
|
224
|
-
type: "
|
|
226
|
+
type: "area" | "column" | "line" | "bar" | "polar";
|
|
225
227
|
category: number[];
|
|
226
228
|
breakBy: number[];
|
|
227
229
|
}>, z.ZodObject<{
|
|
@@ -344,24 +346,24 @@ export declare const chartRecommendationsSchema: z.ZodObject<{
|
|
|
344
346
|
locationLevel: z.ZodEnum<["auto", "country", "state", "city"]>;
|
|
345
347
|
}, "strict", z.ZodTypeAny, {
|
|
346
348
|
type: "scattermap";
|
|
349
|
+
details: number[];
|
|
347
350
|
size: number[];
|
|
348
351
|
geo: number[];
|
|
349
352
|
colorBy: number[];
|
|
350
|
-
details: number[];
|
|
351
353
|
locationLevel: "auto" | "country" | "state" | "city";
|
|
352
354
|
}, {
|
|
353
355
|
type: "scattermap";
|
|
356
|
+
details: number[];
|
|
354
357
|
size: number[];
|
|
355
358
|
geo: number[];
|
|
356
359
|
colorBy: number[];
|
|
357
|
-
details: number[];
|
|
358
360
|
locationLevel: "auto" | "country" | "state" | "city";
|
|
359
361
|
}>]>;
|
|
360
362
|
}, "strip", z.ZodTypeAny, {
|
|
361
|
-
chartType: "
|
|
363
|
+
chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
|
|
362
364
|
axesMapping: {
|
|
363
365
|
value: number[];
|
|
364
|
-
type: "
|
|
366
|
+
type: "area" | "column" | "line" | "bar" | "polar";
|
|
365
367
|
category: number[];
|
|
366
368
|
breakBy: number[];
|
|
367
369
|
} | {
|
|
@@ -403,17 +405,17 @@ export declare const chartRecommendationsSchema: z.ZodObject<{
|
|
|
403
405
|
color: number[];
|
|
404
406
|
} | {
|
|
405
407
|
type: "scattermap";
|
|
408
|
+
details: number[];
|
|
406
409
|
size: number[];
|
|
407
410
|
geo: number[];
|
|
408
411
|
colorBy: number[];
|
|
409
|
-
details: number[];
|
|
410
412
|
locationLevel: "auto" | "country" | "state" | "city";
|
|
411
413
|
};
|
|
412
414
|
}, {
|
|
413
|
-
chartType: "
|
|
415
|
+
chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
|
|
414
416
|
axesMapping: {
|
|
415
417
|
value: number[];
|
|
416
|
-
type: "
|
|
418
|
+
type: "area" | "column" | "line" | "bar" | "polar";
|
|
417
419
|
category: number[];
|
|
418
420
|
breakBy: number[];
|
|
419
421
|
} | {
|
|
@@ -455,10 +457,10 @@ export declare const chartRecommendationsSchema: z.ZodObject<{
|
|
|
455
457
|
color: number[];
|
|
456
458
|
} | {
|
|
457
459
|
type: "scattermap";
|
|
460
|
+
details: number[];
|
|
458
461
|
size: number[];
|
|
459
462
|
geo: number[];
|
|
460
463
|
colorBy: number[];
|
|
461
|
-
details: number[];
|
|
462
464
|
locationLevel: "auto" | "country" | "state" | "city";
|
|
463
465
|
};
|
|
464
466
|
}>;
|
|
@@ -472,21 +474,37 @@ export declare const buildChartSchema: z.ZodObject<{
|
|
|
472
474
|
dataSourceTitle: string;
|
|
473
475
|
userPrompt: string;
|
|
474
476
|
}>;
|
|
477
|
+
export declare const buildChartSchemaNaturalConversation: z.ZodObject<{
|
|
478
|
+
dataSourceTitle: z.ZodString;
|
|
479
|
+
userPrompt: z.ZodString;
|
|
480
|
+
queryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
481
|
+
}, "strip", z.ZodTypeAny, {
|
|
482
|
+
dataSourceTitle: string;
|
|
483
|
+
userPrompt: string;
|
|
484
|
+
queryId?: string | null | undefined;
|
|
485
|
+
}, {
|
|
486
|
+
dataSourceTitle: string;
|
|
487
|
+
userPrompt: string;
|
|
488
|
+
queryId?: string | null | undefined;
|
|
489
|
+
}>;
|
|
475
490
|
export declare const createChartSchema: z.ZodObject<{
|
|
476
491
|
queryPrompt: z.ZodString;
|
|
477
492
|
chartPrompt: z.ZodString;
|
|
478
493
|
chartType: z.ZodNullable<z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>>;
|
|
479
494
|
chartTitle: z.ZodString;
|
|
495
|
+
queryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
480
496
|
}, "strip", z.ZodTypeAny, {
|
|
481
|
-
chartType: "line" | "area" | "bar" | "column" | "polar" | "pie" | "funnel" | "treemap" | "sunburst" | "scatter" | "indicator" | "areamap" | "boxplot" | "scattermap" | "arearange" | "table" | null;
|
|
482
497
|
queryPrompt: string;
|
|
498
|
+
chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange" | null;
|
|
499
|
+
queryId: string | null;
|
|
483
500
|
chartPrompt: string;
|
|
484
501
|
chartTitle: string;
|
|
485
502
|
}, {
|
|
486
|
-
chartType: "line" | "area" | "bar" | "column" | "polar" | "pie" | "funnel" | "treemap" | "sunburst" | "scatter" | "indicator" | "areamap" | "boxplot" | "scattermap" | "arearange" | "table" | null;
|
|
487
503
|
queryPrompt: string;
|
|
504
|
+
chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange" | null;
|
|
488
505
|
chartPrompt: string;
|
|
489
506
|
chartTitle: string;
|
|
507
|
+
queryId?: string | null | undefined;
|
|
490
508
|
}>;
|
|
491
509
|
export declare const updateChartSchema: z.ZodObject<{
|
|
492
510
|
userPrompt: z.ZodString;
|
|
@@ -521,11 +539,11 @@ export declare const updateChartTypeSchema: z.ZodObject<{
|
|
|
521
539
|
} & {
|
|
522
540
|
chartType: z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>;
|
|
523
541
|
}, "strip", z.ZodTypeAny, {
|
|
524
|
-
chartType: "
|
|
542
|
+
chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
|
|
525
543
|
userPrompt: string;
|
|
526
544
|
chartId: string;
|
|
527
545
|
}, {
|
|
528
|
-
chartType: "
|
|
546
|
+
chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
|
|
529
547
|
userPrompt: string;
|
|
530
548
|
chartId?: string | undefined;
|
|
531
549
|
}>;
|
|
@@ -598,6 +616,8 @@ export interface BuildChartContext {
|
|
|
598
616
|
dataSourceTitle: string;
|
|
599
617
|
/** Chart summaries to be used as context */
|
|
600
618
|
chartSummaries?: ChartSummary[];
|
|
619
|
+
/** query results to be used as context */
|
|
620
|
+
querySummaries?: QueryResult[];
|
|
601
621
|
/**
|
|
602
622
|
* Retrieve a chart by its ID
|
|
603
623
|
* @param chartId - The ID of the chart to retrieve
|
|
@@ -610,9 +630,17 @@ export interface BuildChartContext {
|
|
|
610
630
|
* @param chartWidgetProps - The chart widget props to save
|
|
611
631
|
*/
|
|
612
632
|
saveChart?: (chartId: string, chartWidgetProps: ExtendedChartWidgetProps) => void;
|
|
633
|
+
/**
|
|
634
|
+
* Retrieve a query result by its ID
|
|
635
|
+
* @param queryId - The ID of the query to retrieve
|
|
636
|
+
* @returns The query result, or null if not found
|
|
637
|
+
*/
|
|
638
|
+
retrieveQuery?: (queryId: string) => QueryResult | null;
|
|
613
639
|
/** Whether NLQ V3 is enabled */
|
|
614
640
|
isNlqV3Enabled?: boolean;
|
|
615
641
|
httpClient?: HttpClient;
|
|
616
642
|
openAIClient?: OpenAI;
|
|
643
|
+
/** ID of a prior query result when this chart uses that query; otherwise null/undefined */
|
|
644
|
+
queryId?: string | null;
|
|
617
645
|
}
|
|
618
646
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/engines/chart-builder/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/engines/chart-builder/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,MAAM,iBAAiB,GAAG;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,CAC3D,gBAAgB,EAChB,OAAO,CACP,GACA,iB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