@querypanel/node-sdk 1.0.56 → 1.0.58
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/README.md +15 -2
- package/dist/index.cjs +917 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +534 -9
- package/dist/index.d.ts +534 -9
- package/dist/index.js +915 -64
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ import { Pool } from "pg";
|
|
|
21
21
|
const qp = new QueryPanelSdkAPI(
|
|
22
22
|
process.env.QUERYPANEL_URL!,
|
|
23
23
|
process.env.PRIVATE_KEY!,
|
|
24
|
-
process.env.
|
|
24
|
+
process.env.QUERYPANEL_WORKSPACE_ID!,
|
|
25
25
|
{
|
|
26
26
|
defaultTenantId: process.env.DEFAULT_TENANT_ID,
|
|
27
27
|
},
|
|
@@ -80,6 +80,19 @@ console.table(response.rows);
|
|
|
80
80
|
console.log(response.chart.vegaLiteSpec);
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
### Custom system instructions (v2 pipeline)
|
|
84
|
+
|
|
85
|
+
If you need to enforce tenant-specific policies that should apply to every query (for example, data retention windows), you can inject additional **system prompt** instructions into the v2 pipeline:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const response = await qp.ask("Revenue by product", {
|
|
89
|
+
tenantId: "tenant_123",
|
|
90
|
+
database: "analytics",
|
|
91
|
+
pipeline: "v2",
|
|
92
|
+
systemPrompt: "Retention policy: only query data from the last 30 days.",
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
83
96
|
## Session History & Context-Aware Queries
|
|
84
97
|
|
|
85
98
|
The SDK can link related questions into a session so follow-ups like “filter that to Europe” use prior context. The backend generates a QueryPanel session ID for every query and returns it in the response so you can reuse it.
|
|
@@ -338,7 +351,7 @@ import { QueryPanelSdkAPI } from "https://esm.sh/@querypanel/sdk";
|
|
|
338
351
|
const qp = new QueryPanelSdkAPI(
|
|
339
352
|
Deno.env.get("QUERYPANEL_URL")!,
|
|
340
353
|
Deno.env.get("PRIVATE_KEY")!,
|
|
341
|
-
Deno.env.get("
|
|
354
|
+
Deno.env.get("QUERYPANEL_WORKSPACE_ID")!,
|
|
342
355
|
);
|
|
343
356
|
|
|
344
357
|
// Use the SDK as normal - JWT signing works automatically
|