@deepagents/text2sql 0.2.3 → 0.3.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/index.d.ts +7 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +882 -2730
- package/dist/index.js.map +4 -4
- package/dist/lib/adapters/adapter.d.ts +67 -10
- package/dist/lib/adapters/adapter.d.ts.map +1 -1
- package/dist/lib/adapters/grounding.ticket.d.ts +21 -0
- package/dist/lib/adapters/grounding.ticket.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/column-stats.grounding.d.ts +32 -0
- package/dist/lib/adapters/groundings/column-stats.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/constraint.grounding.d.ts +31 -0
- package/dist/lib/adapters/groundings/constraint.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/context.d.ts +41 -0
- package/dist/lib/adapters/groundings/context.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/grounding.d.ts +8 -0
- package/dist/lib/adapters/groundings/grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/grounding.js +507 -0
- package/dist/lib/adapters/groundings/grounding.js.map +7 -0
- package/dist/lib/adapters/groundings/indexes.grounding.d.ts +30 -0
- package/dist/lib/adapters/groundings/indexes.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/info.grounding.d.ts +29 -0
- package/dist/lib/adapters/groundings/info.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/low-cardinality.grounding.d.ts +35 -0
- package/dist/lib/adapters/groundings/low-cardinality.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/report.grounding.d.ts +38 -0
- package/dist/lib/adapters/groundings/report.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/row-count.grounding.d.ts +30 -0
- package/dist/lib/adapters/groundings/row-count.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/table.grounding.d.ts +61 -0
- package/dist/lib/adapters/groundings/table.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/view.grounding.d.ts +57 -0
- package/dist/lib/adapters/groundings/view.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/column-stats.postgres.grounding.d.ts +12 -0
- package/dist/lib/adapters/postgres/column-stats.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/constraint.postgres.grounding.d.ts +11 -0
- package/dist/lib/adapters/postgres/constraint.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/index.d.ts +43 -0
- package/dist/lib/adapters/postgres/index.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/index.js +1640 -0
- package/dist/lib/adapters/postgres/index.js.map +7 -0
- package/dist/lib/adapters/postgres/indexes.postgres.grounding.d.ts +15 -0
- package/dist/lib/adapters/postgres/indexes.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/info.postgres.grounding.d.ts +11 -0
- package/dist/lib/adapters/postgres/info.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/low-cardinality.postgres.grounding.d.ts +14 -0
- package/dist/lib/adapters/postgres/low-cardinality.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/postgres.d.ts +26 -0
- package/dist/lib/adapters/postgres/postgres.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/row-count.postgres.grounding.d.ts +11 -0
- package/dist/lib/adapters/postgres/row-count.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/table.postgres.grounding.d.ts +21 -0
- package/dist/lib/adapters/postgres/table.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/view.postgres.grounding.d.ts +16 -0
- package/dist/lib/adapters/postgres/view.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/column-stats.sqlite.grounding.d.ts +12 -0
- package/dist/lib/adapters/sqlite/column-stats.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/constraint.sqlite.grounding.d.ts +15 -0
- package/dist/lib/adapters/sqlite/constraint.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/index.d.ts +43 -0
- package/dist/lib/adapters/sqlite/index.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/index.js +1215 -0
- package/dist/lib/adapters/sqlite/index.js.map +7 -0
- package/dist/lib/adapters/sqlite/indexes.sqlite.grounding.d.ts +11 -0
- package/dist/lib/adapters/sqlite/indexes.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/info.sqlite.grounding.d.ts +11 -0
- package/dist/lib/adapters/sqlite/info.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/low-cardinality.sqlite.grounding.d.ts +14 -0
- package/dist/lib/adapters/sqlite/low-cardinality.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/row-count.sqlite.grounding.d.ts +11 -0
- package/dist/lib/adapters/sqlite/row-count.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/sqlite.d.ts +25 -0
- package/dist/lib/adapters/sqlite/sqlite.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/table.sqlite.grounding.d.ts +17 -0
- package/dist/lib/adapters/sqlite/table.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/view.sqlite.grounding.d.ts +12 -0
- package/dist/lib/adapters/sqlite/view.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/column-stats.sqlserver.grounding.d.ts +12 -0
- package/dist/lib/adapters/sqlserver/column-stats.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/constraint.sqlserver.grounding.d.ts +11 -0
- package/dist/lib/adapters/sqlserver/constraint.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/index.d.ts +43 -0
- package/dist/lib/adapters/sqlserver/index.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/index.js +1693 -0
- package/dist/lib/adapters/sqlserver/index.js.map +7 -0
- package/dist/lib/adapters/sqlserver/indexes.sqlserver.grounding.d.ts +15 -0
- package/dist/lib/adapters/sqlserver/indexes.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/info.sqlserver.grounding.d.ts +11 -0
- package/dist/lib/adapters/sqlserver/info.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/low-cardinality.sqlserver.grounding.d.ts +14 -0
- package/dist/lib/adapters/sqlserver/low-cardinality.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/row-count.sqlserver.grounding.d.ts +11 -0
- package/dist/lib/adapters/sqlserver/row-count.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/sqlserver.d.ts +26 -0
- package/dist/lib/adapters/sqlserver/sqlserver.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/table.sqlserver.grounding.d.ts +21 -0
- package/dist/lib/adapters/sqlserver/table.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/view.sqlserver.grounding.d.ts +16 -0
- package/dist/lib/adapters/sqlserver/view.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/agents/suggestions.agents.d.ts +0 -2
- package/dist/lib/agents/suggestions.agents.d.ts.map +1 -1
- package/dist/lib/agents/teachables.agent.d.ts +0 -3
- package/dist/lib/agents/teachables.agent.d.ts.map +1 -1
- package/dist/lib/agents/text2sql.agent.d.ts +69 -29
- package/dist/lib/agents/text2sql.agent.d.ts.map +1 -1
- package/dist/lib/file-cache.d.ts +12 -0
- package/dist/lib/file-cache.d.ts.map +1 -0
- package/dist/lib/instructions.d.ts +3 -0
- package/dist/lib/instructions.d.ts.map +1 -0
- package/dist/lib/instructions.js +386 -0
- package/dist/lib/instructions.js.map +7 -0
- package/dist/lib/memory/memory.prompt.d.ts +3 -0
- package/dist/lib/memory/memory.prompt.d.ts.map +1 -0
- package/dist/lib/memory/memory.store.d.ts +5 -0
- package/dist/lib/memory/memory.store.d.ts.map +1 -0
- package/dist/lib/memory/sqlite.store.d.ts +14 -0
- package/dist/lib/memory/sqlite.store.d.ts.map +1 -0
- package/dist/lib/memory/store.d.ts +40 -0
- package/dist/lib/memory/store.d.ts.map +1 -0
- package/dist/lib/prompt.d.ts +1 -6
- package/dist/lib/prompt.d.ts.map +1 -1
- package/dist/lib/sql.d.ts +26 -35
- package/dist/lib/sql.d.ts.map +1 -1
- package/dist/lib/teach/teachables.d.ts +184 -13
- package/dist/lib/teach/teachables.d.ts.map +1 -1
- package/dist/lib/teach/teachings.d.ts.map +1 -1
- package/dist/lib/teach/xml.d.ts.map +1 -1
- package/package.json +38 -4
- package/dist/lib/adapters/postgres.d.ts +0 -31
- package/dist/lib/adapters/postgres.d.ts.map +0 -1
- package/dist/lib/adapters/resolveTables.spec.d.ts +0 -2
- package/dist/lib/adapters/resolveTables.spec.d.ts.map +0 -1
- package/dist/lib/adapters/sqlite.d.ts +0 -30
- package/dist/lib/adapters/sqlite.d.ts.map +0 -1
- package/dist/lib/adapters/sqlserver.d.ts +0 -31
- package/dist/lib/adapters/sqlserver.d.ts.map +0 -1
- package/dist/lib/agents/brief.agent.d.ts +0 -21
- package/dist/lib/agents/brief.agent.d.ts.map +0 -1
- package/dist/lib/memory/user-profile.d.ts +0 -39
- package/dist/lib/memory/user-profile.d.ts.map +0 -1
package/dist/lib/sql.d.ts
CHANGED
|
@@ -1,55 +1,46 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type AgentModel } from '@deepagents/agent';
|
|
3
|
-
import type { Adapter, IntrospectOptions
|
|
4
|
-
import { TmpCache } from './agents/brief.agent.ts';
|
|
1
|
+
import { type UIMessage } from 'ai';
|
|
2
|
+
import { type Agent, type AgentModel } from '@deepagents/agent';
|
|
3
|
+
import type { Adapter, IntrospectOptions } from './adapters/adapter.ts';
|
|
5
4
|
import { type RenderingTools } from './agents/text2sql.agent.ts';
|
|
6
5
|
import { History } from './history/history.ts';
|
|
6
|
+
import type { TeachablesStore } from './memory/store.ts';
|
|
7
7
|
import { type Teachables } from './teach/teachables.ts';
|
|
8
|
+
export interface InspectionResult {
|
|
9
|
+
/** The grounding/introspection data (database schema context as XML) */
|
|
10
|
+
grounding: string;
|
|
11
|
+
/** The full instructions XML that would be sent to the agent */
|
|
12
|
+
instructions: string;
|
|
13
|
+
/** User-specific teachables that were loaded */
|
|
14
|
+
userTeachables: Teachables[];
|
|
15
|
+
/** System teachings configured */
|
|
16
|
+
systemTeachings: Teachables[];
|
|
17
|
+
/** Tool names available to the agent */
|
|
18
|
+
tools: string[];
|
|
19
|
+
}
|
|
8
20
|
export declare class Text2Sql {
|
|
9
21
|
#private;
|
|
10
22
|
constructor(config: {
|
|
11
23
|
adapter: Adapter;
|
|
12
|
-
cache: TmpCache;
|
|
13
24
|
history: History;
|
|
14
25
|
version: string;
|
|
15
26
|
tools?: RenderingTools;
|
|
16
27
|
instructions?: Teachables[];
|
|
28
|
+
model?: AgentModel;
|
|
29
|
+
memory?: TeachablesStore;
|
|
17
30
|
});
|
|
18
31
|
explain(sql: string): Promise<string>;
|
|
19
|
-
toSql(
|
|
20
|
-
|
|
21
|
-
}>;
|
|
22
|
-
inspect(): Promise<string>;
|
|
32
|
+
toSql(query: string, options?: {
|
|
33
|
+
tools?: RenderingTools;
|
|
34
|
+
}): Promise<string>;
|
|
23
35
|
instruct(...dataset: Teachables[]): void;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
teachings: string;
|
|
28
|
-
}>;
|
|
29
|
-
tag(input: string): Promise<{
|
|
30
|
-
generate: () => Promise<string>;
|
|
31
|
-
stream: () => ReadableStream<InferUIMessageChunk<UIMessage<unknown, UIDataTypes, UITools>>>;
|
|
32
|
-
}>;
|
|
33
|
-
suggest(): Promise<{
|
|
34
|
-
question: string;
|
|
35
|
-
sql: string;
|
|
36
|
-
businessValue: string;
|
|
37
|
-
}[]>;
|
|
38
|
-
single(input: string): Promise<import("ai").StreamTextResult<import("ai").ToolSet, {
|
|
39
|
-
sql?: string | undefined;
|
|
40
|
-
}> & {
|
|
41
|
-
state: {
|
|
42
|
-
introspection: Introspection;
|
|
43
|
-
context: string;
|
|
44
|
-
adapterInfo: string;
|
|
45
|
-
renderingTools?: RenderingTools;
|
|
46
|
-
teachings: string;
|
|
47
|
-
userProfile?: string;
|
|
48
|
-
};
|
|
36
|
+
inspect(agent: Agent): Promise<{
|
|
37
|
+
tools: string[];
|
|
38
|
+
prompt: string;
|
|
49
39
|
}>;
|
|
40
|
+
index(options?: IntrospectOptions): Promise<string>;
|
|
50
41
|
chat(messages: UIMessage[], params: {
|
|
51
42
|
chatId: string;
|
|
52
43
|
userId: string;
|
|
53
|
-
}
|
|
44
|
+
}): Promise<import("ai").AsyncIterableStream<import("ai").InferUIMessageChunk<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>>>;
|
|
54
45
|
}
|
|
55
46
|
//# sourceMappingURL=sql.d.ts.map
|
package/dist/lib/sql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../src/lib/sql.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../src/lib/sql.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,IAAI,CAAC;AAGZ,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EAIhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,KAAK,UAAU,EAMhB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAElB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IAErB,gDAAgD;IAChD,cAAc,EAAE,UAAU,EAAE,CAAC;IAE7B,kCAAkC;IAClC,eAAe,EAAE,UAAU,EAAE,CAAC;IAE9B,wCAAwC;IACxC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,qBAAa,QAAQ;;gBAYP,MAAM,EAAE;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,cAAc,CAAC;QACvB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;QAC5B,KAAK,CAAC,EAAE,UAAU,CAAC;QACnB,MAAM,CAAC,EAAE,eAAe,CAAC;KAC1B;IAaY,OAAO,CAAC,GAAG,EAAE,MAAM;IASnB,KAAK,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,cAAc,CAAA;KAAE,GACnC,OAAO,CAAC,MAAM,CAAC;IA8BX,QAAQ,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE;IAI3B,OAAO,CAAC,KAAK,EAAE,KAAK;;;;IA4CpB,KAAK,CAAC,OAAO,CAAC,EAAE,iBAAiB;IA4BjC,IAAI,CACf,QAAQ,EAAE,SAAS,EAAE,EACrB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB;CAoGJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface Teachables {
|
|
2
|
-
type: 'term' | 'hint' | 'guardrail' | 'explain' | 'example' | 'clarification' | 'workflow' | 'quirk' | 'styleGuide' | 'analogy' | 'user_profile';
|
|
2
|
+
type: 'term' | 'hint' | 'guardrail' | 'explain' | 'example' | 'clarification' | 'workflow' | 'quirk' | 'styleGuide' | 'analogy' | 'glossary' | 'user_profile' | 'identity' | 'persona' | 'alias' | 'preference' | 'context' | 'correction';
|
|
3
3
|
format: () => string;
|
|
4
4
|
}
|
|
5
5
|
export type GeneratedTeachable = {
|
|
@@ -22,7 +22,7 @@ export type GeneratedTeachable = {
|
|
|
22
22
|
} | {
|
|
23
23
|
type: 'example';
|
|
24
24
|
question: string;
|
|
25
|
-
|
|
25
|
+
answer: string;
|
|
26
26
|
note?: string;
|
|
27
27
|
} | {
|
|
28
28
|
type: 'clarification';
|
|
@@ -51,6 +51,33 @@ export type GeneratedTeachable = {
|
|
|
51
51
|
insight?: string;
|
|
52
52
|
therefore?: string;
|
|
53
53
|
pitfall?: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'glossary';
|
|
56
|
+
entries: Record<string, string>;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'identity';
|
|
59
|
+
name?: string;
|
|
60
|
+
role?: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'persona';
|
|
63
|
+
name: string;
|
|
64
|
+
role: string;
|
|
65
|
+
tone: string;
|
|
66
|
+
} | {
|
|
67
|
+
type: 'alias';
|
|
68
|
+
term: string;
|
|
69
|
+
meaning: string;
|
|
70
|
+
} | {
|
|
71
|
+
type: 'preference';
|
|
72
|
+
aspect: string;
|
|
73
|
+
value: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'context';
|
|
76
|
+
description: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'correction';
|
|
79
|
+
subject: string;
|
|
80
|
+
clarification: string;
|
|
54
81
|
};
|
|
55
82
|
/**
|
|
56
83
|
* Teach the system domain-specific vocabulary and business terminology.
|
|
@@ -194,34 +221,34 @@ export declare function explain(input: {
|
|
|
194
221
|
* and handling domain-specific query structures.
|
|
195
222
|
*
|
|
196
223
|
* @param input.question - The natural language question or request
|
|
197
|
-
* @param input.
|
|
224
|
+
* @param input.answer - The correct answer that responds to the question
|
|
198
225
|
* @param input.note - Optional note or explanation about the example
|
|
199
226
|
*
|
|
200
227
|
* @example
|
|
201
228
|
* // Energy/Utilities dataset
|
|
202
229
|
* example({
|
|
203
230
|
* question: "show me peak demand hours for the last week",
|
|
204
|
-
*
|
|
231
|
+
* answer: "SELECT DATE_TRUNC('hour', reading_timestamp) as hour, MAX(consumption_kwh) as peak_demand FROM meter_readings WHERE reading_timestamp >= CURRENT_DATE - INTERVAL '7 days' GROUP BY hour ORDER BY peak_demand DESC LIMIT 10"
|
|
205
232
|
* })
|
|
206
233
|
*
|
|
207
234
|
* @example
|
|
208
235
|
* // Agriculture/Farm Management dataset
|
|
209
236
|
* example({
|
|
210
237
|
* question: "what is the average yield per acre by crop type this season",
|
|
211
|
-
*
|
|
238
|
+
* answer: "SELECT crop_type, AVG(harvest_quantity / field_acres) as yield_per_acre FROM harvests WHERE harvest_date >= '2024-01-01' GROUP BY crop_type ORDER BY yield_per_acre DESC"
|
|
212
239
|
* })
|
|
213
240
|
*
|
|
214
241
|
* @example
|
|
215
242
|
* // Travel/Hospitality dataset
|
|
216
243
|
* example({
|
|
217
244
|
* question: "show me hotel occupancy rate for this month",
|
|
218
|
-
*
|
|
245
|
+
* answer: "SELECT hotel_name, (SUM(occupied_rooms) / SUM(total_rooms)) * 100 as occupancy_rate FROM daily_occupancy WHERE date >= DATE_TRUNC('month', CURRENT_DATE) GROUP BY hotel_id, hotel_name ORDER BY occupancy_rate DESC",
|
|
219
246
|
* note: "Occupancy rate is a percentage - multiply by 100 for readable output"
|
|
220
247
|
* })
|
|
221
248
|
*/
|
|
222
249
|
export declare function example(input: {
|
|
223
250
|
question: string;
|
|
224
|
-
|
|
251
|
+
answer: string;
|
|
225
252
|
note?: string;
|
|
226
253
|
}): Teachables;
|
|
227
254
|
/**
|
|
@@ -452,11 +479,155 @@ export declare function analogy(input: {
|
|
|
452
479
|
therefore?: string;
|
|
453
480
|
pitfall?: string;
|
|
454
481
|
}): Teachables;
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
482
|
+
/**
|
|
483
|
+
* Map business terms directly to SQL expressions or fragments.
|
|
484
|
+
*
|
|
485
|
+
* Use this to teach the system how to CALCULATE or QUERY specific business concepts.
|
|
486
|
+
* The system will substitute these SQL patterns when users mention the term.
|
|
487
|
+
*
|
|
488
|
+
* **Glossary vs Alias:**
|
|
489
|
+
* - `alias` = user vocabulary → table/column name ("the big table" → "orders table")
|
|
490
|
+
* - `glossary` = business term → SQL expression ("revenue" → "SUM(orders.total_amount)")
|
|
491
|
+
*
|
|
492
|
+
* In short: alias renames, glossary computes.
|
|
493
|
+
*
|
|
494
|
+
* @param entries - Record mapping business terms to their SQL expressions
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* glossary({
|
|
498
|
+
* "revenue": "SUM(orders.total_amount)",
|
|
499
|
+
* "average order value": "AVG(orders.total_amount)",
|
|
500
|
+
* "active user": "last_login > NOW() - INTERVAL '30 days'",
|
|
501
|
+
* "churned": "status = 'churned'",
|
|
502
|
+
* "power user": "order_count > 10",
|
|
503
|
+
* "net revenue": "SUM(orders.total_amount) - SUM(refunds.amount)",
|
|
504
|
+
* })
|
|
505
|
+
*/
|
|
506
|
+
export declare function glossary(entries: Record<string, string>): Teachables;
|
|
507
|
+
/**
|
|
508
|
+
* Define the user's identity including name and/or role.
|
|
509
|
+
*
|
|
510
|
+
* Use this to capture who the user is and what lens they view data through.
|
|
511
|
+
* Helps tailor explanations, terminology, and focus areas.
|
|
512
|
+
*
|
|
513
|
+
* @param input.name - The user's name (optional)
|
|
514
|
+
* @param input.role - The user's role or position (optional)
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* identity({ name: "John", role: "VP of Sales" })
|
|
518
|
+
* identity({ role: "Data analyst in the marketing team" })
|
|
519
|
+
* identity({ name: "Sarah" })
|
|
520
|
+
* identity({ role: "Finance manager focused on cost optimization" })
|
|
521
|
+
*/
|
|
522
|
+
export declare function identity(input: {
|
|
523
|
+
name?: string;
|
|
524
|
+
role?: string;
|
|
525
|
+
}): Teachables;
|
|
526
|
+
/**
|
|
527
|
+
* Define an AI persona with a name, role, and communication tone.
|
|
528
|
+
*
|
|
529
|
+
* Use this to customize the assistant's personality and how it communicates.
|
|
530
|
+
* The persona influences the style and approach of responses.
|
|
531
|
+
*
|
|
532
|
+
* @param input.name - The persona's name
|
|
533
|
+
* @param input.role - The persona's role or expertise
|
|
534
|
+
* @param input.tone - The communication style (e.g., friendly, professional, concise)
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* persona({ name: "DataBot", role: "SQL Expert", tone: "friendly and encouraging" })
|
|
538
|
+
* persona({ name: "QueryMaster", role: "Database Analyst", tone: "professional and concise" })
|
|
539
|
+
* persona({ name: "SQLHelper", role: "Data Assistant", tone: "casual and approachable" })
|
|
540
|
+
*/
|
|
541
|
+
export declare function persona(input: {
|
|
542
|
+
name: string;
|
|
543
|
+
role: string;
|
|
544
|
+
tone: string;
|
|
461
545
|
}): Teachables;
|
|
546
|
+
/**
|
|
547
|
+
* Define user-specific term meanings and vocabulary.
|
|
548
|
+
*
|
|
549
|
+
* Use this when the user has their own definitions for terms that might
|
|
550
|
+
* differ from standard or domain definitions. Like `term()` but personal.
|
|
551
|
+
*
|
|
552
|
+
* @param termName - The term the user uses
|
|
553
|
+
* @param meaning - What the user means by this term
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* alias("revenue", "gross revenue before deductions, not net")
|
|
557
|
+
* alias("active users", "users who logged in within the last 30 days")
|
|
558
|
+
* alias("the big table", "the orders table")
|
|
559
|
+
* alias("Q4", "October through December, not fiscal Q4")
|
|
560
|
+
*/
|
|
561
|
+
export declare function alias(termName: string, meaning: string): Teachables;
|
|
562
|
+
/**
|
|
563
|
+
* Define how the user prefers results presented.
|
|
564
|
+
*
|
|
565
|
+
* Use this to capture output formatting, style, and behavioral preferences
|
|
566
|
+
* that should apply to all interactions with this user.
|
|
567
|
+
*
|
|
568
|
+
* @param aspect - What aspect of output this preference applies to
|
|
569
|
+
* @param value - The user's preference
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* preference("date format", "YYYY-MM-DD")
|
|
573
|
+
* preference("output style", "tables over charts unless trend data")
|
|
574
|
+
* preference("detail level", "always show the SQL query in responses")
|
|
575
|
+
* preference("row limit", "default to 50 rows unless I ask for more")
|
|
576
|
+
* preference("explanation style", "brief and to the point")
|
|
577
|
+
*/
|
|
578
|
+
export declare function preference(aspect: string, value: string): Teachables;
|
|
579
|
+
/**
|
|
580
|
+
* Define the user's current working focus or project.
|
|
581
|
+
*
|
|
582
|
+
* Use this to capture temporary context that helps inform defaults,
|
|
583
|
+
* assumptions, and suggestions. Should be updated as focus changes.
|
|
584
|
+
*
|
|
585
|
+
* @param description - What the user is currently working on
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* context("Preparing Q4 board presentation")
|
|
589
|
+
* context("Investigating drop in signups last week")
|
|
590
|
+
* context("Working on EMEA regional analysis for strategy meeting")
|
|
591
|
+
* context("Debugging discrepancy in revenue numbers")
|
|
592
|
+
*/
|
|
593
|
+
export declare function context(description: string): Teachables;
|
|
594
|
+
/**
|
|
595
|
+
* Record a correction the user made to previous understanding.
|
|
596
|
+
*
|
|
597
|
+
* Use this when the user corrects a misunderstanding about data, columns,
|
|
598
|
+
* or business logic. Prevents repeating the same mistake.
|
|
599
|
+
*
|
|
600
|
+
* @param subject - What was misunderstood
|
|
601
|
+
* @param clarification - The correct understanding
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* correction("status column", "1 = active, 0 = inactive, not boolean true/false")
|
|
605
|
+
* correction("orders table", "Use orders_v2, not the deprecated legacy_orders table")
|
|
606
|
+
* correction("date field", "order_date is when order was placed, ship_date is when shipped")
|
|
607
|
+
* correction("revenue calculation", "Must exclude refunds and chargebacks")
|
|
608
|
+
*/
|
|
609
|
+
export declare function correction(subject: string, clarification: string): Teachables;
|
|
610
|
+
export declare function teachable(tag: string, ...teachables: Teachables[]): Teachables;
|
|
611
|
+
export declare function toInstructions(tag: string, ...teachables: Teachables[]): string;
|
|
612
|
+
export declare function toTeachables(generated: GeneratedTeachable[]): Teachables[];
|
|
613
|
+
/**
|
|
614
|
+
* Default export containing all system teachable factory functions.
|
|
615
|
+
* Excludes user-specific teachables (identity, alias, preference, context, correction).
|
|
616
|
+
*/
|
|
617
|
+
declare const _default: {
|
|
618
|
+
persona: typeof persona;
|
|
619
|
+
term: typeof term;
|
|
620
|
+
hint: typeof hint;
|
|
621
|
+
guardrail: typeof guardrail;
|
|
622
|
+
explain: typeof explain;
|
|
623
|
+
example: typeof example;
|
|
624
|
+
clarification: typeof clarification;
|
|
625
|
+
workflow: typeof workflow;
|
|
626
|
+
quirk: typeof quirk;
|
|
627
|
+
styleGuide: typeof styleGuide;
|
|
628
|
+
analogy: typeof analogy;
|
|
629
|
+
glossary: typeof glossary;
|
|
630
|
+
teachable: typeof teachable;
|
|
631
|
+
};
|
|
632
|
+
export default _default;
|
|
462
633
|
//# sourceMappingURL=teachables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachables.d.ts","sourceRoot":"","sources":["../../../src/lib/teach/teachables.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,IAAI,EACA,MAAM,GACN,MAAM,GACN,WAAW,GACX,SAAS,GACT,SAAS,GACT,eAAe,GACf,UAAU,GACV,OAAO,GACP,YAAY,GACZ,SAAS,GACT,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"teachables.d.ts","sourceRoot":"","sources":["../../../src/lib/teach/teachables.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,IAAI,EACA,MAAM,GACN,MAAM,GACN,WAAW,GACX,SAAS,GACT,SAAS,GACT,eAAe,GACf,UAAU,GACV,OAAO,GACP,YAAY,GACZ,SAAS,GACT,UAAU,GACV,cAAc,GAEd,UAAU,GACV,SAAS,GACT,O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,MAAM,GAAG,UAAU,CAMpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAKvD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,UAAU,CAS7E;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,GAAG,UAAU,EAAE,UAAU,EAAE,GAC1B,UAAU,CAKZ;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,GAAG,UAAU,EAAE,UAAU,EAAE,GAC1B,MAAM,CAmDR;AAwBD,wBAAgB,YAAY,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,UAAU,EAAE,CA0E1E;AAED;;;GAGG;;;;;;;;;;;;;;;;AACH,wBAcE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachings.d.ts","sourceRoot":"","sources":["../../../src/lib/teach/teachings.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAMhB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"teachings.d.ts","sourceRoot":"","sources":["../../../src/lib/teach/teachings.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAMhB,MAAM,iBAAiB,CAAC;wBAiFpB,UAAU,EAAE;AA/EjB,wBA+EkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../src/lib/teach/xml.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAQjE;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAShE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../src/lib/teach/xml.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAQjE;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAShE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAU/C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepagents/text2sql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"eval": "evalite",
|
|
7
|
+
"eval:dev": "evalite watch"
|
|
8
|
+
},
|
|
5
9
|
"main": "./dist/index.js",
|
|
6
10
|
"module": "./dist/index.js",
|
|
7
11
|
"types": "./dist/index.d.ts",
|
|
@@ -12,6 +16,36 @@
|
|
|
12
16
|
"types": "./dist/index.d.ts",
|
|
13
17
|
"import": "./dist/index.js",
|
|
14
18
|
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./instructions": {
|
|
21
|
+
"development": "./src/lib/instructions.ts",
|
|
22
|
+
"types": "./dist/lib/instructions.d.ts",
|
|
23
|
+
"import": "./dist/lib/instructions.js",
|
|
24
|
+
"default": "./dist/lib/instructions.js"
|
|
25
|
+
},
|
|
26
|
+
"./grounding": {
|
|
27
|
+
"development": "./src/lib/adapters/groundings/grounding.ts",
|
|
28
|
+
"types": "./dist/lib/adapters/groundings/grounding.d.ts",
|
|
29
|
+
"import": "./dist/lib/adapters/groundings/grounding.js",
|
|
30
|
+
"default": "./dist/lib/adapters/groundings/grounding.js"
|
|
31
|
+
},
|
|
32
|
+
"./sqlite": {
|
|
33
|
+
"development": "./src/lib/adapters/sqlite/index.ts",
|
|
34
|
+
"types": "./dist/lib/adapters/sqlite/index.d.ts",
|
|
35
|
+
"import": "./dist/lib/adapters/sqlite/index.js",
|
|
36
|
+
"default": "./dist/lib/adapters/sqlite/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./postgres": {
|
|
39
|
+
"development": "./src/lib/adapters/postgres/index.ts",
|
|
40
|
+
"types": "./dist/lib/adapters/postgres/index.d.ts",
|
|
41
|
+
"import": "./dist/lib/adapters/postgres/index.js",
|
|
42
|
+
"default": "./dist/lib/adapters/postgres/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./sqlserver": {
|
|
45
|
+
"development": "./src/lib/adapters/sqlserver/index.ts",
|
|
46
|
+
"types": "./dist/lib/adapters/sqlserver/index.d.ts",
|
|
47
|
+
"import": "./dist/lib/adapters/sqlserver/index.js",
|
|
48
|
+
"default": "./dist/lib/adapters/sqlserver/index.js"
|
|
15
49
|
}
|
|
16
50
|
},
|
|
17
51
|
"files": [
|
|
@@ -24,13 +58,13 @@
|
|
|
24
58
|
},
|
|
25
59
|
"dependencies": {
|
|
26
60
|
"@ai-sdk/groq": "2.0.26",
|
|
27
|
-
"@deepagents/agent": "0.
|
|
61
|
+
"@deepagents/agent": "0.3.0",
|
|
28
62
|
"ai": "^5.0.102",
|
|
29
63
|
"autoevals": "^0.0.131",
|
|
30
64
|
"dedent": "1.7.0",
|
|
31
65
|
"zod": "^3.25.76 || ^4.0.0",
|
|
32
|
-
"evalite": "
|
|
33
|
-
"@deepagents/toolbox": "0.
|
|
66
|
+
"evalite": "beta",
|
|
67
|
+
"@deepagents/toolbox": "0.3.0",
|
|
34
68
|
"pluralize": "^8.0.0",
|
|
35
69
|
"openai": "5.12.2",
|
|
36
70
|
"uuid": "^13.0.0"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Adapter, type AdapterInfo, type AdapterInfoProvider, type IntrospectOptions, type Introspection, type Relationship, type Table, type TablesFilter } from './adapter.ts';
|
|
2
|
-
type ExecuteFunction = (sql: string) => Promise<any> | any;
|
|
3
|
-
type ValidateFunction = (sql: string) => Promise<string | void> | string | void;
|
|
4
|
-
type IntrospectFunction = () => Promise<Introspection> | Introspection;
|
|
5
|
-
export type PostgresAdapterOptions = {
|
|
6
|
-
execute: ExecuteFunction;
|
|
7
|
-
validate?: ValidateFunction;
|
|
8
|
-
introspect?: IntrospectFunction;
|
|
9
|
-
schemas?: string[];
|
|
10
|
-
info?: AdapterInfoProvider;
|
|
11
|
-
tables?: TablesFilter;
|
|
12
|
-
};
|
|
13
|
-
export declare function formatPostgresError(sql: string, error: unknown): {
|
|
14
|
-
error: string;
|
|
15
|
-
error_type: string;
|
|
16
|
-
suggestion: string;
|
|
17
|
-
sql_attempted: string;
|
|
18
|
-
};
|
|
19
|
-
export declare class Postgres extends Adapter {
|
|
20
|
-
#private;
|
|
21
|
-
constructor(options: PostgresAdapterOptions);
|
|
22
|
-
introspect(options?: IntrospectOptions): Promise<Introspection>;
|
|
23
|
-
execute(sql: string): Promise<any>;
|
|
24
|
-
validate(sql: string): Promise<string | void>;
|
|
25
|
-
info(): Promise<AdapterInfo>;
|
|
26
|
-
formatInfo(info: AdapterInfo): string;
|
|
27
|
-
getTables(): Promise<Table[]>;
|
|
28
|
-
getRelationships(): Promise<Relationship[]>;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=postgres.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../src/lib/adapters/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAElB,KAAK,YAAY,EACjB,KAAK,KAAK,EAEV,KAAK,YAAY,EAElB,MAAM,cAAc,CAAC;AAEtB,KAAK,eAAe,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3D,KAAK,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;AAChF,KAAK,kBAAkB,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;AAEvE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAwEF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;;;;;EA0B9D;AAED,qBAAa,QAAS,SAAQ,OAAO;;gBAKvB,OAAO,EAAE,sBAAsB;IAW5B,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAkD/D,OAAO,CAAC,GAAG,EAAE,MAAM;IAInB,QAAQ,CAAC,GAAG,EAAE,MAAM;IAcpB,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;IAQlC,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM;IAiB/B,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IA+CtC,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAmalD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTables.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/adapters/resolveTables.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Adapter, type AdapterInfo, type AdapterInfoProvider, type IntrospectOptions, type Introspection, type Relationship, type Table, type TablesFilter } from './adapter.ts';
|
|
2
|
-
type ExecuteFunction = (sql: string) => Promise<any> | any;
|
|
3
|
-
type ValidateFunction = (sql: string) => Promise<string | void> | string | void;
|
|
4
|
-
type IntrospectFunction = () => Promise<Introspection> | Introspection;
|
|
5
|
-
export type SqliteAdapterOptions = {
|
|
6
|
-
execute: ExecuteFunction;
|
|
7
|
-
validate?: ValidateFunction;
|
|
8
|
-
introspect?: IntrospectFunction;
|
|
9
|
-
info?: AdapterInfoProvider;
|
|
10
|
-
tables?: TablesFilter;
|
|
11
|
-
};
|
|
12
|
-
export declare function formatError(sql: string, error: unknown): {
|
|
13
|
-
error: string;
|
|
14
|
-
error_type: string;
|
|
15
|
-
suggestion: string;
|
|
16
|
-
sql_attempted: string;
|
|
17
|
-
};
|
|
18
|
-
export declare class Sqlite extends Adapter {
|
|
19
|
-
#private;
|
|
20
|
-
constructor(options: SqliteAdapterOptions);
|
|
21
|
-
introspect(options?: IntrospectOptions): Promise<Introspection>;
|
|
22
|
-
execute(sql: string): Promise<any>;
|
|
23
|
-
validate(sql: string): Promise<string | void>;
|
|
24
|
-
info(): Promise<AdapterInfo>;
|
|
25
|
-
formatInfo(info: AdapterInfo): string;
|
|
26
|
-
getTables(): Promise<Table[]>;
|
|
27
|
-
getRelationships(): Promise<Relationship[]>;
|
|
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UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM;IAiB/B,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAwCtC,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAoWlD"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Adapter, type AdapterInfo, type AdapterInfoProvider, type IntrospectOptions, type Introspection, type Relationship, type Table, type TablesFilter } from './adapter.ts';
|
|
2
|
-
type ExecuteFunction = (sql: string) => Promise<any> | any;
|
|
3
|
-
type ValidateFunction = (sql: string) => Promise<string | void> | string | void;
|
|
4
|
-
type IntrospectFunction = () => Promise<Introspection> | Introspection;
|
|
5
|
-
export type SqlServerAdapterOptions = {
|
|
6
|
-
execute: ExecuteFunction;
|
|
7
|
-
validate?: ValidateFunction;
|
|
8
|
-
introspect?: IntrospectFunction;
|
|
9
|
-
schemas?: string[];
|
|
10
|
-
info?: AdapterInfoProvider;
|
|
11
|
-
tables?: TablesFilter;
|
|
12
|
-
};
|
|
13
|
-
export declare function formatSqlServerError(sql: string, error: unknown): {
|
|
14
|
-
error: string;
|
|
15
|
-
error_type: string;
|
|
16
|
-
suggestion: string;
|
|
17
|
-
sql_attempted: string;
|
|
18
|
-
};
|
|
19
|
-
export declare class SqlServer extends Adapter {
|
|
20
|
-
#private;
|
|
21
|
-
constructor(options: SqlServerAdapterOptions);
|
|
22
|
-
introspect(options?: IntrospectOptions): Promise<Introspection>;
|
|
23
|
-
execute(sql: string): Promise<any>;
|
|
24
|
-
validate(sql: string): Promise<string | void>;
|
|
25
|
-
info(): Promise<AdapterInfo>;
|
|
26
|
-
formatInfo(info: AdapterInfo): string;
|
|
27
|
-
getTables(): Promise<Table[]>;
|
|
28
|
-
getRelationships(): Promise<Relationship[]>;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=sqlserver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqlserver.d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AAK,EAAE,CAAC;IAkD7B,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CA4b3D"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type StreamFunction } from '@deepagents/agent';
|
|
2
|
-
import { type Introspection } from '../adapters/adapter.ts';
|
|
3
|
-
export declare class TmpCache {
|
|
4
|
-
path: string;
|
|
5
|
-
constructor(watermark: string, extension?: string);
|
|
6
|
-
get(): Promise<string | null>;
|
|
7
|
-
set(content: string): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
export declare class JsonCache<T> extends TmpCache {
|
|
10
|
-
constructor(watermark: string);
|
|
11
|
-
read(): Promise<T | null>;
|
|
12
|
-
write(data: T): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
export declare function generateBrief(introspection: Introspection, cache: TmpCache): Promise<string>;
|
|
15
|
-
export declare function toBrief(forceRefresh?: boolean): StreamFunction<{
|
|
16
|
-
cache: TmpCache;
|
|
17
|
-
introspection: Introspection;
|
|
18
|
-
}, {
|
|
19
|
-
context: string;
|
|
20
|
-
}>;
|
|
21
|
-
//# sourceMappingURL=brief.agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brief.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/brief.agent.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGrE,qBAAa,QAAQ;IACZ,IAAI,EAAE,MAAM,CAAC;gBACR,SAAS,EAAE,MAAM,EAAE,SAAS,SAAS;IAK3C,GAAG;IAOT,GAAG,CAAC,OAAO,EAAE,MAAM;CAGpB;AAED,qBAAa,SAAS,CAAC,CAAC,CAAE,SAAQ,QAAQ;gBAC5B,SAAS,EAAE,MAAM;IAIvB,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAQ/B,KAAK,CAAC,IAAI,EAAE,CAAC;CAGd;AAmED,wBAAsB,aAAa,CACjC,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,QAAQ,mBAOhB;AAED,wBAAgB,OAAO,CAAC,YAAY,UAAQ,GAAG,cAAc,CAC3D;IACE,KAAK,EAAE,QAAQ,CAAC;IAChB,aAAa,EAAE,aAAa,CAAC;CAC9B,EACD;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CACpB,CA4CA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export type UserProfileItem = {
|
|
2
|
-
type: 'fact' | 'preference' | 'present';
|
|
3
|
-
text: string;
|
|
4
|
-
};
|
|
5
|
-
export type UserProfileData = {
|
|
6
|
-
items: UserProfileItem[];
|
|
7
|
-
lastUpdated: string;
|
|
8
|
-
};
|
|
9
|
-
export declare class UserProfileStore {
|
|
10
|
-
private userId;
|
|
11
|
-
private path;
|
|
12
|
-
constructor(userId: string);
|
|
13
|
-
/**
|
|
14
|
-
* Retrieve the full user profile data.
|
|
15
|
-
*/
|
|
16
|
-
get(): Promise<UserProfileData>;
|
|
17
|
-
/**
|
|
18
|
-
* Save the user profile data.
|
|
19
|
-
*/
|
|
20
|
-
private save;
|
|
21
|
-
/**
|
|
22
|
-
* Add an item to the profile.
|
|
23
|
-
*/
|
|
24
|
-
add(type: UserProfileItem['type'], text: string): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Remove a specific item from the profile.
|
|
27
|
-
*/
|
|
28
|
-
remove(type: UserProfileItem['type'], text: string): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Clear the entire profile.
|
|
31
|
-
*/
|
|
32
|
-
clear(): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Get the formatted XML string for the system prompt.
|
|
35
|
-
*/
|
|
36
|
-
toXml(): Promise<string>;
|
|
37
|
-
}
|
|
38
|
-
export declare function toUserProfileXml(items: UserProfileItem[]): string;
|
|
39
|
-
//# sourceMappingURL=user-profile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-profile.d.ts","sourceRoot":"","sources":["../../../src/lib/memory/user-profile.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAMF,qBAAa,gBAAgB;IAGf,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,IAAI,CAAS;gBAED,MAAM,EAAE,MAAM;IAMlC;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;IAiBrC;;OAEG;YACW,IAAI;IAKlB;;OAEG;IACG,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrE;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxE;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;CAI/B;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,CAgCjE"}
|