@querypanel/node-sdk 1.2.0 → 1.2.2

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 CHANGED
@@ -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.
package/dist/index.cjs CHANGED
@@ -1764,7 +1764,9 @@ async function ask(client, queryEngine, question, options, signal) {
1764
1764
  ...options.maxRetry ? { max_retry: options.maxRetry } : {},
1765
1765
  ...tenantSettings ? { tenant_settings: tenantSettings } : {},
1766
1766
  ...databaseName ? { database: databaseName } : {},
1767
- ...metadata?.dialect ? { dialect: metadata.dialect } : {}
1767
+ ...metadata?.dialect ? { dialect: metadata.dialect } : {},
1768
+ ...options.model?.trim() ? { model: options.model.trim() } : {},
1769
+ ...options.pipeline === "v2" && options.systemPrompt?.trim() ? { system_prompt: options.systemPrompt.trim() } : {}
1768
1770
  },
1769
1771
  tenantId,
1770
1772
  options.userId,