@deepagents/text2sql 0.3.0 → 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/README.md +167 -0
- package/dist/finetune/convert-to-gguf.d.ts +18 -0
- package/dist/finetune/convert-to-gguf.d.ts.map +1 -0
- package/dist/finetune/run-finetune.d.ts +23 -0
- package/dist/finetune/run-finetune.d.ts.map +1 -0
- package/dist/finetune/run-mlx.d.ts +22 -0
- package/dist/finetune/run-mlx.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1795 -284
- package/dist/index.js.map +4 -4
- package/dist/lib/adapters/adapter.d.ts +8 -3
- package/dist/lib/adapters/adapter.d.ts.map +1 -1
- package/dist/lib/adapters/{grounding.ticket.d.ts → groundings/abstract.grounding.d.ts} +2 -2
- package/dist/lib/adapters/groundings/abstract.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/column-stats.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/column-stats.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/column-values.grounding.d.ts +76 -0
- package/dist/lib/adapters/groundings/column-values.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/constraint.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/constraint.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/context.d.ts +1 -1
- package/dist/lib/adapters/groundings/context.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/{grounding.d.ts → index.d.ts} +8 -5
- package/dist/lib/adapters/groundings/index.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/{grounding.js → index.js} +411 -206
- package/dist/lib/adapters/groundings/index.js.map +7 -0
- package/dist/lib/adapters/groundings/indexes.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/indexes.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/info.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/info.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/report.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/report.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/row-count.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/row-count.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/table.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/table.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/groundings/view.grounding.d.ts +1 -1
- package/dist/lib/adapters/groundings/view.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/postgres/column-stats.postgres.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/postgres/column-values.postgres.grounding.d.ts +17 -0
- package/dist/lib/adapters/postgres/column-values.postgres.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/postgres/index.d.ts +4 -4
- package/dist/lib/adapters/postgres/index.d.ts.map +1 -1
- package/dist/lib/adapters/postgres/index.js +239 -33
- package/dist/lib/adapters/postgres/index.js.map +4 -4
- package/dist/lib/adapters/postgres/postgres.d.ts +1 -0
- package/dist/lib/adapters/postgres/postgres.d.ts.map +1 -1
- package/dist/lib/adapters/sqlite/column-values.sqlite.grounding.d.ts +17 -0
- package/dist/lib/adapters/sqlite/column-values.sqlite.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/constraint.sqlite.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/sqlite/index.d.ts +4 -4
- package/dist/lib/adapters/sqlite/index.d.ts.map +1 -1
- package/dist/lib/adapters/sqlite/index.js +218 -46
- package/dist/lib/adapters/sqlite/index.js.map +4 -4
- package/dist/lib/adapters/sqlite/sqlite.d.ts +1 -0
- package/dist/lib/adapters/sqlite/sqlite.d.ts.map +1 -1
- package/dist/lib/adapters/sqlserver/column-values.sqlserver.grounding.d.ts +17 -0
- package/dist/lib/adapters/sqlserver/column-values.sqlserver.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/sqlserver/index.d.ts +4 -4
- package/dist/lib/adapters/sqlserver/index.d.ts.map +1 -1
- package/dist/lib/adapters/sqlserver/index.js +185 -32
- package/dist/lib/adapters/sqlserver/index.js.map +4 -4
- package/dist/lib/adapters/sqlserver/sqlserver.d.ts +1 -0
- package/dist/lib/adapters/sqlserver/sqlserver.d.ts.map +1 -1
- package/dist/lib/agents/chat1.agent.d.ts +50 -0
- package/dist/lib/agents/chat1.agent.d.ts.map +1 -0
- package/dist/lib/agents/chat2.agent.d.ts +68 -0
- package/dist/lib/agents/chat2.agent.d.ts.map +1 -0
- package/dist/lib/agents/chat3.agent.d.ts +80 -0
- package/dist/lib/agents/chat3.agent.d.ts.map +1 -0
- package/dist/lib/agents/chat4.agent.d.ts +88 -0
- package/dist/lib/agents/chat4.agent.d.ts.map +1 -0
- package/dist/lib/agents/question.agent.d.ts +23 -0
- package/dist/lib/agents/question.agent.d.ts.map +1 -0
- package/dist/lib/agents/sql.agent.d.ts +62 -0
- package/dist/lib/agents/sql.agent.d.ts.map +1 -0
- package/dist/lib/agents/teachables.agent.d.ts +8 -9
- package/dist/lib/agents/teachables.agent.d.ts.map +1 -1
- package/dist/lib/agents/text2sql.agent.d.ts +0 -1
- package/dist/lib/agents/text2sql.agent.d.ts.map +1 -1
- package/dist/lib/checkpoint.d.ts +99 -0
- package/dist/lib/checkpoint.d.ts.map +1 -0
- package/dist/lib/instructions.js +50 -21
- package/dist/lib/instructions.js.map +2 -2
- package/dist/lib/sql.d.ts +83 -3
- package/dist/lib/sql.d.ts.map +1 -1
- package/dist/lib/syntheize.d.ts +2 -0
- package/dist/lib/syntheize.d.ts.map +1 -0
- package/dist/lib/synthesis/decorators/deduplicated-producer.d.ts +26 -0
- package/dist/lib/synthesis/decorators/deduplicated-producer.d.ts.map +1 -0
- package/dist/lib/synthesis/decorators/filtered-producer.d.ts +26 -0
- package/dist/lib/synthesis/decorators/filtered-producer.d.ts.map +1 -0
- package/dist/lib/synthesis/decorators/index.d.ts +7 -0
- package/dist/lib/synthesis/decorators/index.d.ts.map +1 -0
- package/dist/lib/synthesis/decorators/validated-producer.d.ts +33 -0
- package/dist/lib/synthesis/decorators/validated-producer.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/base-contextual-extractor.d.ts +76 -0
- package/dist/lib/synthesis/extractors/base-contextual-extractor.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/full-context-extractor.d.ts +25 -0
- package/dist/lib/synthesis/extractors/full-context-extractor.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/index.d.ts +8 -0
- package/dist/lib/synthesis/extractors/index.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/last-query-extractor.d.ts +30 -0
- package/dist/lib/synthesis/extractors/last-query-extractor.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/message-extractor.d.ts +27 -0
- package/dist/lib/synthesis/extractors/message-extractor.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/segmented-context-extractor.d.ts +48 -0
- package/dist/lib/synthesis/extractors/segmented-context-extractor.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/sql-extractor.d.ts +27 -0
- package/dist/lib/synthesis/extractors/sql-extractor.d.ts.map +1 -0
- package/dist/lib/synthesis/extractors/windowed-context-extractor.d.ts +30 -0
- package/dist/lib/synthesis/extractors/windowed-context-extractor.d.ts.map +1 -0
- package/dist/lib/synthesis/index.d.ts +6 -0
- package/dist/lib/synthesis/index.d.ts.map +1 -0
- package/dist/lib/synthesis/index.js +2069 -0
- package/dist/lib/synthesis/index.js.map +7 -0
- package/dist/lib/synthesis/synthesizers/breadth-evolver.d.ts +34 -0
- package/dist/lib/synthesis/synthesizers/breadth-evolver.d.ts.map +1 -0
- package/dist/lib/synthesis/synthesizers/depth-evolver.d.ts +41 -0
- package/dist/lib/synthesis/synthesizers/depth-evolver.d.ts.map +1 -0
- package/dist/lib/synthesis/synthesizers/index.d.ts +7 -0
- package/dist/lib/synthesis/synthesizers/index.d.ts.map +1 -0
- package/dist/lib/synthesis/synthesizers/persona-generator.d.ts +34 -0
- package/dist/lib/synthesis/synthesizers/persona-generator.d.ts.map +1 -0
- package/dist/lib/synthesis/synthesizers/schema-synthesizer.d.ts +39 -0
- package/dist/lib/synthesis/synthesizers/schema-synthesizer.d.ts.map +1 -0
- package/dist/lib/synthesis/synthesizers/styles.d.ts +8 -0
- package/dist/lib/synthesis/synthesizers/styles.d.ts.map +1 -0
- package/dist/lib/synthesis/synthesizers/teachings-generator.d.ts +32 -0
- package/dist/lib/synthesis/synthesizers/teachings-generator.d.ts.map +1 -0
- package/dist/lib/synthesis/types.d.ts +26 -0
- package/dist/lib/synthesis/types.d.ts.map +1 -0
- package/dist/lib/teach/teachables.d.ts +18 -3
- package/dist/lib/teach/teachables.d.ts.map +1 -1
- package/dist/lib/teach/teachings.d.ts +9 -2
- package/dist/lib/teach/teachings.d.ts.map +1 -1
- package/package.json +32 -15
- package/dist/lib/adapters/grounding.ticket.d.ts.map +0 -1
- package/dist/lib/adapters/groundings/grounding.d.ts.map +0 -1
- package/dist/lib/adapters/groundings/grounding.js.map +0 -7
- package/dist/lib/adapters/groundings/low-cardinality.grounding.d.ts +0 -35
- package/dist/lib/adapters/groundings/low-cardinality.grounding.d.ts.map +0 -1
- package/dist/lib/adapters/postgres/low-cardinality.postgres.grounding.d.ts +0 -14
- package/dist/lib/adapters/postgres/low-cardinality.postgres.grounding.d.ts.map +0 -1
- package/dist/lib/adapters/sqlite/low-cardinality.sqlite.grounding.d.ts +0 -14
- package/dist/lib/adapters/sqlite/low-cardinality.sqlite.grounding.d.ts.map +0 -1
- package/dist/lib/adapters/sqlserver/low-cardinality.sqlserver.grounding.d.ts +0 -14
- package/dist/lib/adapters/sqlserver/low-cardinality.sqlserver.grounding.d.ts.map +0 -1
|
@@ -22,5 +22,6 @@ export declare class SqlServer extends Adapter {
|
|
|
22
22
|
runQuery<Row>(sql: string): Promise<Row[]>;
|
|
23
23
|
quoteIdentifier(name: string): string;
|
|
24
24
|
escape(value: string): string;
|
|
25
|
+
buildSampleRowsQuery(tableName: string, columns: string[] | undefined, limit: number): string;
|
|
25
26
|
}
|
|
26
27
|
//# sourceMappingURL=sqlserver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlserver.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapters/sqlserver/sqlserver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,WAAW,EAKhB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAmFF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;;;;;EA0B/D;AAED,qBAAa,SAAU,SAAQ,OAAO;;IAEpC,SAAkB,SAAS,EAAE,WAAW,EAAE,CAAC;IAC3C,SAAkB,aAAa,SAAS;IACxC,SAAkB,aAAa,WAAiC;gBAEpD,OAAO,EAAE,uBAAuB;IAY7B,OAAO,CAAC,GAAG,EAAE,MAAM;IAInB,QAAQ,CAAC,GAAG,EAAE,MAAM;IAgBpB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIhD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIrC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"sqlserver.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapters/sqlserver/sqlserver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,WAAW,EAKhB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAmFF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;;;;;EA0B/D;AAED,qBAAa,SAAU,SAAQ,OAAO;;IAEpC,SAAkB,SAAS,EAAE,WAAW,EAAE,CAAC;IAC3C,SAAkB,aAAa,SAAS;IACxC,SAAkB,aAAa,WAAiC;gBAEpD,OAAO,EAAE,uBAAuB;IAY7B,OAAO,CAAC,GAAG,EAAE,MAAM;IAInB,QAAQ,CAAC,GAAG,EAAE,MAAM;IAgBpB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIhD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIrC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI7B,oBAAoB,CAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GACZ,MAAM;CA6eV"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Adapter } from '../adapters/adapter.ts';
|
|
2
|
+
import type { TeachablesStore } from '../memory/store.ts';
|
|
3
|
+
import type { Teachables } from '../teach/teachables.ts';
|
|
4
|
+
export type Chat1State = {
|
|
5
|
+
/** Database adapter for query execution */
|
|
6
|
+
adapter: Adapter;
|
|
7
|
+
/** Schema introspection XML */
|
|
8
|
+
introspection: string;
|
|
9
|
+
/** Teachings/instructions for SQL generation */
|
|
10
|
+
instructions: Teachables[];
|
|
11
|
+
/** Combined teachings string for the agent prompt */
|
|
12
|
+
teachings: string;
|
|
13
|
+
/** Optional memory store for user teachables */
|
|
14
|
+
memory?: TeachablesStore;
|
|
15
|
+
/** User ID for memory operations */
|
|
16
|
+
userId?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Result returned by the query_database tool
|
|
20
|
+
*/
|
|
21
|
+
export interface QueryDatabaseResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
/** The generated SQL query */
|
|
24
|
+
sql?: string;
|
|
25
|
+
/** Query results as array of rows */
|
|
26
|
+
data?: unknown[];
|
|
27
|
+
/** Error message if generation or execution failed */
|
|
28
|
+
error?: string;
|
|
29
|
+
/** Number of attempts made during SQL generation */
|
|
30
|
+
attempts?: number;
|
|
31
|
+
}
|
|
32
|
+
declare const tools: {
|
|
33
|
+
query_database: import("ai").Tool<{
|
|
34
|
+
question: string;
|
|
35
|
+
reasoning?: string | undefined;
|
|
36
|
+
}, QueryDatabaseResult>;
|
|
37
|
+
scratchpad: import("ai").Tool<{
|
|
38
|
+
reflection: string;
|
|
39
|
+
}, string>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Chat1 Agent - Table Augmented Generation with combined query tool.
|
|
43
|
+
*
|
|
44
|
+
* This agent receives user questions and uses the query_database tool
|
|
45
|
+
* to fetch data. The SQL generation is delegated to the specialized
|
|
46
|
+
* sqlQueryAgent via the toSql() function.
|
|
47
|
+
*/
|
|
48
|
+
export declare const chat1Agent: import("@deepagents/agent").Agent<never, Chat1State, Chat1State>;
|
|
49
|
+
export { tools as chat1Tools };
|
|
50
|
+
//# sourceMappingURL=chat1.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat1.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/chat1.agent.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,MAAM,MAAM,UAAU,GAAG;IACvB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,KAAK;;;;;;;;CAgEV,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,kEAUrB,CAAC;AAEH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Adapter } from '../adapters/adapter.ts';
|
|
2
|
+
import type { TeachablesStore } from '../memory/store.ts';
|
|
3
|
+
import type { Teachables } from '../teach/teachables.ts';
|
|
4
|
+
export type Chat2State = {
|
|
5
|
+
/** Database adapter for query execution */
|
|
6
|
+
adapter: Adapter;
|
|
7
|
+
/** Schema introspection XML */
|
|
8
|
+
introspection: string;
|
|
9
|
+
/** Teachings/instructions for SQL generation */
|
|
10
|
+
instructions: Teachables[];
|
|
11
|
+
/** Combined teachings string for the agent prompt */
|
|
12
|
+
teachings: string;
|
|
13
|
+
/** Optional memory store for user teachables */
|
|
14
|
+
memory?: TeachablesStore;
|
|
15
|
+
/** User ID for memory operations */
|
|
16
|
+
userId?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Result returned by the generate_sql tool
|
|
20
|
+
*/
|
|
21
|
+
export interface GenerateSqlToolResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
/** The generated and validated SQL query */
|
|
24
|
+
sql?: string;
|
|
25
|
+
/** Error message if generation failed */
|
|
26
|
+
error?: string;
|
|
27
|
+
/** Number of attempts made during SQL generation */
|
|
28
|
+
attempts?: number;
|
|
29
|
+
/** Validation errors encountered during generation */
|
|
30
|
+
validationErrors?: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result returned by the execute_sql tool
|
|
34
|
+
*/
|
|
35
|
+
export interface ExecuteSqlToolResult {
|
|
36
|
+
success: boolean;
|
|
37
|
+
/** Query results as array of rows */
|
|
38
|
+
data?: unknown[];
|
|
39
|
+
/** Error message if execution failed */
|
|
40
|
+
error?: string;
|
|
41
|
+
/** Row count of results */
|
|
42
|
+
rowCount?: number;
|
|
43
|
+
}
|
|
44
|
+
declare const tools: {
|
|
45
|
+
generate_sql: import("ai").Tool<{
|
|
46
|
+
question: string;
|
|
47
|
+
reasoning?: string | undefined;
|
|
48
|
+
}, GenerateSqlToolResult>;
|
|
49
|
+
execute_sql: import("ai").Tool<{
|
|
50
|
+
sql: string;
|
|
51
|
+
reasoning?: string | undefined;
|
|
52
|
+
}, ExecuteSqlToolResult>;
|
|
53
|
+
scratchpad: import("ai").Tool<{
|
|
54
|
+
reflection: string;
|
|
55
|
+
}, string>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Chat2 Agent - Table Augmented Generation with peek support.
|
|
59
|
+
*
|
|
60
|
+
* This agent uses separate generate_sql and execute_sql tools,
|
|
61
|
+
* allowing it to review the SQL before execution. This enables:
|
|
62
|
+
* - Transparency: Agent knows what SQL will be run
|
|
63
|
+
* - Control: Agent can refine before executing
|
|
64
|
+
* - Explanation: Agent can describe its approach to the user
|
|
65
|
+
*/
|
|
66
|
+
export declare const chat2Agent: import("@deepagents/agent").Agent<never, Chat2State, Chat2State>;
|
|
67
|
+
export { tools as chat2Tools };
|
|
68
|
+
//# sourceMappingURL=chat2.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat2.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/chat2.agent.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,MAAM,MAAM,UAAU,GAAG;IACvB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,KAAK;;;;;;;;;;;;CAwGV,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,kEAkBrB,CAAC;AAEH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Adapter } from '../adapters/adapter.ts';
|
|
2
|
+
import type { TeachablesStore } from '../memory/store.ts';
|
|
3
|
+
import { type Teachables } from '../teach/teachables.ts';
|
|
4
|
+
export type Chat3State = {
|
|
5
|
+
/** Database adapter for query execution */
|
|
6
|
+
adapter: Adapter;
|
|
7
|
+
/** Schema introspection XML */
|
|
8
|
+
introspection: string;
|
|
9
|
+
/** Teachings/instructions for SQL generation */
|
|
10
|
+
instructions: Teachables[];
|
|
11
|
+
/** Combined teachings string for the agent prompt */
|
|
12
|
+
teachings: string;
|
|
13
|
+
/** Optional memory store for user teachables */
|
|
14
|
+
memory?: TeachablesStore;
|
|
15
|
+
/** User ID for memory operations */
|
|
16
|
+
userId?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Result from the collaborative query tool
|
|
20
|
+
*/
|
|
21
|
+
export interface CollaborativeQueryResult {
|
|
22
|
+
/** Whether a final SQL was produced */
|
|
23
|
+
success: boolean;
|
|
24
|
+
/** The generated SQL (if success) */
|
|
25
|
+
sql?: string;
|
|
26
|
+
/** Query results (if executed) */
|
|
27
|
+
data?: unknown[];
|
|
28
|
+
/** Confidence level of the SQL */
|
|
29
|
+
confidence?: 'high' | 'medium' | 'low';
|
|
30
|
+
/** Assumptions made during generation */
|
|
31
|
+
assumptions?: string[];
|
|
32
|
+
/** Clarification question (if needed) */
|
|
33
|
+
clarificationNeeded?: string;
|
|
34
|
+
/** Context for clarification */
|
|
35
|
+
clarificationContext?: string;
|
|
36
|
+
/** Options for clarification */
|
|
37
|
+
clarificationOptions?: string[];
|
|
38
|
+
/** Reason if unanswerable */
|
|
39
|
+
unanswerableReason?: string;
|
|
40
|
+
/** Suggested alternatives if unanswerable */
|
|
41
|
+
suggestions?: string[];
|
|
42
|
+
/** Error message if something failed */
|
|
43
|
+
error?: string;
|
|
44
|
+
}
|
|
45
|
+
declare const tools: {
|
|
46
|
+
consult_sql_agent: import("ai").Tool<{
|
|
47
|
+
question: string;
|
|
48
|
+
context?: string | undefined;
|
|
49
|
+
previousClarification?: string | undefined;
|
|
50
|
+
}, CollaborativeQueryResult>;
|
|
51
|
+
execute_sql: import("ai").Tool<{
|
|
52
|
+
sql: string;
|
|
53
|
+
}, {
|
|
54
|
+
success: boolean;
|
|
55
|
+
error: string;
|
|
56
|
+
data?: undefined;
|
|
57
|
+
rowCount?: undefined;
|
|
58
|
+
} | {
|
|
59
|
+
success: boolean;
|
|
60
|
+
data: any[];
|
|
61
|
+
rowCount: number | undefined;
|
|
62
|
+
error?: undefined;
|
|
63
|
+
}>;
|
|
64
|
+
scratchpad: import("ai").Tool<{
|
|
65
|
+
reflection: string;
|
|
66
|
+
}, string>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Chat3 Agent - Table Augmented Generation with agent collaboration.
|
|
70
|
+
*
|
|
71
|
+
* This agent collaborates with a specialized SQL agent that can:
|
|
72
|
+
* - Express confidence levels
|
|
73
|
+
* - Surface assumptions
|
|
74
|
+
* - Request clarification
|
|
75
|
+
*
|
|
76
|
+
* This enables higher quality SQL generation through dialogue.
|
|
77
|
+
*/
|
|
78
|
+
export declare const chat3Agent: import("@deepagents/agent").Agent<never, Chat3State, Chat3State>;
|
|
79
|
+
export { tools as chat3Tools };
|
|
80
|
+
//# sourceMappingURL=chat3.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat3.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/chat3.agent.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAA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AC;AAEH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import type { Adapter } from '../adapters/adapter.ts';
|
|
3
|
+
import type { TeachablesStore } from '../memory/store.ts';
|
|
4
|
+
import { type Teachables } from '../teach/teachables.ts';
|
|
5
|
+
export type Chat4State = {
|
|
6
|
+
/** Database adapter for query execution */
|
|
7
|
+
adapter: Adapter;
|
|
8
|
+
/** Schema introspection XML */
|
|
9
|
+
introspection: string;
|
|
10
|
+
/** Teachings/instructions for SQL generation */
|
|
11
|
+
instructions: Teachables[];
|
|
12
|
+
/** Combined teachings string for the agent prompt */
|
|
13
|
+
teachings: string;
|
|
14
|
+
/** Optional memory store for user teachables */
|
|
15
|
+
memory?: TeachablesStore;
|
|
16
|
+
/** User ID for memory operations */
|
|
17
|
+
userId?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Schema for question decomposition
|
|
21
|
+
*/
|
|
22
|
+
declare const questionDecompositionSchema: z.ZodObject<{
|
|
23
|
+
originalQuestion: z.ZodString;
|
|
24
|
+
breakdown: z.ZodArray<z.ZodString>;
|
|
25
|
+
entities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
filters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
+
aggregation: z.ZodOptional<z.ZodString>;
|
|
28
|
+
ambiguities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
type QuestionDecomposition = z.infer<typeof questionDecompositionSchema>;
|
|
31
|
+
/**
|
|
32
|
+
* Result from the decomposed query tool
|
|
33
|
+
*/
|
|
34
|
+
export interface DecomposedQueryResult {
|
|
35
|
+
success: boolean;
|
|
36
|
+
/** The original question */
|
|
37
|
+
question?: string;
|
|
38
|
+
/** How the question was decomposed */
|
|
39
|
+
decomposition?: QuestionDecomposition;
|
|
40
|
+
/** The generated SQL */
|
|
41
|
+
sql?: string;
|
|
42
|
+
/** Query results */
|
|
43
|
+
data?: unknown[];
|
|
44
|
+
/** How breakdown components were addressed */
|
|
45
|
+
reasoning?: string;
|
|
46
|
+
/** Error message if failed */
|
|
47
|
+
error?: string;
|
|
48
|
+
/** Number of generation attempts */
|
|
49
|
+
attempts?: number;
|
|
50
|
+
}
|
|
51
|
+
declare const tools: {
|
|
52
|
+
query_with_decomposition: import("ai").Tool<{
|
|
53
|
+
question: string;
|
|
54
|
+
breakdown: string[];
|
|
55
|
+
entities?: string[] | undefined;
|
|
56
|
+
filters?: string[] | undefined;
|
|
57
|
+
aggregation?: string | undefined;
|
|
58
|
+
ambiguities?: string[] | undefined;
|
|
59
|
+
}, DecomposedQueryResult>;
|
|
60
|
+
execute_sql: import("ai").Tool<{
|
|
61
|
+
sql: string;
|
|
62
|
+
}, {
|
|
63
|
+
success: boolean;
|
|
64
|
+
error: string;
|
|
65
|
+
data?: undefined;
|
|
66
|
+
rowCount?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
success: boolean;
|
|
69
|
+
data: any[];
|
|
70
|
+
rowCount: number | undefined;
|
|
71
|
+
error?: undefined;
|
|
72
|
+
}>;
|
|
73
|
+
scratchpad: import("ai").Tool<{
|
|
74
|
+
reflection: string;
|
|
75
|
+
}, string>;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Chat4 Agent - Table Augmented Generation with question decomposition.
|
|
79
|
+
*
|
|
80
|
+
* This agent breaks down questions into semantic components before
|
|
81
|
+
* generating SQL. This approach:
|
|
82
|
+
* - Ensures all aspects of the question are addressed
|
|
83
|
+
* - Makes the reasoning explicit
|
|
84
|
+
* - Helps with complex multi-part questions
|
|
85
|
+
*/
|
|
86
|
+
export declare const chat4Agent: import("@deepagents/agent").Agent<never, Chat4State, Chat4State>;
|
|
87
|
+
export { tools as chat4Tools };
|
|
88
|
+
//# sourceMappingURL=chat4.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
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M,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;CAiLV,CAAC;AAyCF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,kEA2BrB,CAAC;AAEH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AgentModel } from '@deepagents/agent';
|
|
2
|
+
export type QuestionComplexity = 'low' | 'medium' | 'hard' | 'window';
|
|
3
|
+
export interface GenerateQuestionsParams {
|
|
4
|
+
/** Database schema introspection */
|
|
5
|
+
introspection: string;
|
|
6
|
+
/** Complexity level for generated questions */
|
|
7
|
+
complexity: QuestionComplexity;
|
|
8
|
+
/** Number of questions to generate */
|
|
9
|
+
count: number;
|
|
10
|
+
/** Optional prompt to prepend (e.g., persona context) */
|
|
11
|
+
prompt?: string;
|
|
12
|
+
/** Optional model override */
|
|
13
|
+
model?: AgentModel;
|
|
14
|
+
}
|
|
15
|
+
export interface GenerateQuestionsResult {
|
|
16
|
+
questions: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generate natural language questions from database schema.
|
|
20
|
+
* Used for creating synthetic training data for text-to-SQL models.
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateQuestions(params: GenerateQuestionsParams): Promise<GenerateQuestionsResult>;
|
|
23
|
+
//# sourceMappingURL=question.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/question.agent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,mBAAmB,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AA8GtE,MAAM,WAAW,uBAAuB;IACtC,oCAAoC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,UAAU,EAAE,kBAAkB,CAAC;IAC/B,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAiBlC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type AgentModel } from '@deepagents/agent';
|
|
2
|
+
import type { Adapter } from '../adapters/adapter.ts';
|
|
3
|
+
import { type Teachables } from '../teach/teachables.ts';
|
|
4
|
+
export type GenerateSqlResult = {
|
|
5
|
+
success: true;
|
|
6
|
+
sql: string;
|
|
7
|
+
} | {
|
|
8
|
+
success: false;
|
|
9
|
+
error: string;
|
|
10
|
+
isUnanswerable?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type GenerateSqlParams = {
|
|
13
|
+
input: string;
|
|
14
|
+
model: AgentModel;
|
|
15
|
+
temperature: number;
|
|
16
|
+
introspection: string;
|
|
17
|
+
instructions: Teachables[];
|
|
18
|
+
previousError?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Generate SQL from natural language using the SQL agent.
|
|
22
|
+
* Handles JSON validation errors from the API by returning an error result.
|
|
23
|
+
*/
|
|
24
|
+
declare function generateSql(params: GenerateSqlParams): Promise<GenerateSqlResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Exported object for mockability in tests.
|
|
27
|
+
* Use `mock.method(sqlGenerators, 'generateSql', ...)` to mock.
|
|
28
|
+
*/
|
|
29
|
+
export declare const sqlGenerators: {
|
|
30
|
+
generateSql: typeof generateSql;
|
|
31
|
+
};
|
|
32
|
+
export interface ToSqlOptions {
|
|
33
|
+
/** The natural language input to convert to SQL */
|
|
34
|
+
input: string;
|
|
35
|
+
/** Database adapter for validation */
|
|
36
|
+
adapter: Adapter;
|
|
37
|
+
/** Introspection/schema context */
|
|
38
|
+
introspection: string;
|
|
39
|
+
/** Instructions/teachings to include */
|
|
40
|
+
instructions: Teachables[];
|
|
41
|
+
/** Optional model override */
|
|
42
|
+
model?: AgentModel;
|
|
43
|
+
/** Maximum retry attempts on validation failure (default: 3) */
|
|
44
|
+
maxRetries?: number;
|
|
45
|
+
}
|
|
46
|
+
export interface ToSqlResult {
|
|
47
|
+
/** The generated SQL query */
|
|
48
|
+
sql: string;
|
|
49
|
+
/** Number of attempts made */
|
|
50
|
+
attempts: number;
|
|
51
|
+
/** Validation errors encountered (if any retries occurred) */
|
|
52
|
+
errors?: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate SQL from natural language with post-generation validation.
|
|
56
|
+
* Retries generation if validation fails, including the error in the retry prompt.
|
|
57
|
+
* Also retries on API-level JSON validation errors from the model.
|
|
58
|
+
* Does NOT retry when the question is unanswerable (intentional error response).
|
|
59
|
+
*/
|
|
60
|
+
export declare function toSql(options: ToSqlOptions): Promise<ToSqlResult>;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=sql.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/sql.agent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,mBAAmB,CAAC;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,wBAAwB,CAAC;AAqDhC,MAAM,MAAM,iBAAiB,GACzB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF;;;GAGG;AACH,iBAAe,WAAW,CACxB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAgE5B;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;;CAEzB,CAAC;AAoCF,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA6BvE"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type AgentModel } from '@deepagents/agent';
|
|
2
|
+
import { type Teachables } from '../teach/teachables.ts';
|
|
3
|
+
export interface GenerateToTeachingsOptions {
|
|
4
|
+
model?: AgentModel;
|
|
5
|
+
}
|
|
6
|
+
export declare function toTeachings(input: {
|
|
7
|
+
schema: string;
|
|
5
8
|
context?: string;
|
|
6
|
-
|
|
7
|
-
}, {
|
|
8
|
-
context?: string;
|
|
9
|
-
adapterInfo?: string;
|
|
10
|
-
}>;
|
|
9
|
+
}, options?: GenerateToTeachingsOptions): Promise<Teachables[]>;
|
|
11
10
|
//# sourceMappingURL=teachables.agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachables.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/teachables.agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"teachables.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/teachables.agent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAC;AAwIhC,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,wBAAsB,WAAW,CAC/B,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3C,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,UAAU,EAAE,CAAC,CAoCvB"}
|
|
@@ -58,7 +58,6 @@ export declare const memoryTools: {
|
|
|
58
58
|
id: string;
|
|
59
59
|
}, string>;
|
|
60
60
|
};
|
|
61
|
-
export declare const sqlQueryAgent: import("@deepagents/agent").Agent<unknown, import("@deepagents/agent").ContextVariables, import("@deepagents/agent").ContextVariables>;
|
|
62
61
|
/**
|
|
63
62
|
* An agent that does Table Augmented Generation for Text-to-SQL tasks.
|
|
64
63
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text2sql.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/text2sql.agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"text2sql.agent.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/text2sql.agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,IAAI,CAAC;AAQrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAmHlE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK;SACT,MAAM;;mBAGI,MAAM;eACV,MAAM;aACR,eAAe;aACf,MAAM;;mBAHA,MAAM;eACV,MAAM;aACR,eAAe;aACf,MAAM;EAiBjB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export interface CheckpointOptions {
|
|
2
|
+
/** Path to the checkpoint file */
|
|
3
|
+
path: string;
|
|
4
|
+
/** Hash to detect config changes - if changed, checkpoint is invalidated */
|
|
5
|
+
configHash?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Codec for encoding/decoding values during checkpoint operations.
|
|
9
|
+
* Use this when storing objects with methods (like Teachables) that need
|
|
10
|
+
* to be serialized to plain JSON and restored with their methods.
|
|
11
|
+
*/
|
|
12
|
+
export interface Codec<T, TSerialized = unknown> {
|
|
13
|
+
/** Convert runtime value to JSON-serializable format */
|
|
14
|
+
encode: (value: T) => TSerialized;
|
|
15
|
+
/** Convert stored JSON back to runtime value */
|
|
16
|
+
decode: (serialized: TSerialized) => T;
|
|
17
|
+
}
|
|
18
|
+
interface PointEntry {
|
|
19
|
+
inputHash: string;
|
|
20
|
+
output: unknown;
|
|
21
|
+
}
|
|
22
|
+
interface PointData {
|
|
23
|
+
committed: boolean;
|
|
24
|
+
entries: PointEntry[];
|
|
25
|
+
}
|
|
26
|
+
export declare class Checkpoint {
|
|
27
|
+
private path;
|
|
28
|
+
private configHash;
|
|
29
|
+
private points;
|
|
30
|
+
private constructor();
|
|
31
|
+
/**
|
|
32
|
+
* Load checkpoint from file, or return empty checkpoint if none exists.
|
|
33
|
+
* Handles corrupted files and config changes gracefully.
|
|
34
|
+
*/
|
|
35
|
+
static load(options: CheckpointOptions): Promise<Checkpoint>;
|
|
36
|
+
/**
|
|
37
|
+
* Run a single computation with checkpointing.
|
|
38
|
+
* If already completed, returns cached value.
|
|
39
|
+
*
|
|
40
|
+
* @param key - Unique identifier for this computation
|
|
41
|
+
* @param computation - Async function that produces the value
|
|
42
|
+
* @param codec - Optional codec for encoding/decoding non-primitive values
|
|
43
|
+
*/
|
|
44
|
+
run<T>(key: string, computation: () => Promise<T>, codec?: Codec<T>): Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a resumable checkpoint point for iterative operations.
|
|
47
|
+
*
|
|
48
|
+
* @param step - Unique identifier for this checkpoint point
|
|
49
|
+
*/
|
|
50
|
+
point<T>(step: string): Point<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Process each input with automatic checkpointing and concurrency.
|
|
53
|
+
*
|
|
54
|
+
* @param step - Unique identifier for this checkpoint
|
|
55
|
+
* @param inputs - Items to process
|
|
56
|
+
* @param process - Function to process each input
|
|
57
|
+
* @param options - Optional settings like concurrency
|
|
58
|
+
* @returns All outputs (use `.flat()` if outputs are arrays)
|
|
59
|
+
*/
|
|
60
|
+
each<I, O>(step: string, inputs: Iterable<I>, process: (input: I) => Promise<O>, options?: {
|
|
61
|
+
concurrency?: number;
|
|
62
|
+
}): Promise<O[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Get clean output from all completed points.
|
|
65
|
+
* Single-entry points return the value directly, multi-entry return arrays.
|
|
66
|
+
*/
|
|
67
|
+
getOutput(): Record<string, unknown>;
|
|
68
|
+
/** Get the file path where checkpoint is stored */
|
|
69
|
+
getPath(): string;
|
|
70
|
+
private save;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A checkpoint point for tracking iterative operations.
|
|
74
|
+
* Uses input hashing to determine if an operation was already processed.
|
|
75
|
+
*/
|
|
76
|
+
export declare class Point<T> {
|
|
77
|
+
#private;
|
|
78
|
+
private data;
|
|
79
|
+
private persist;
|
|
80
|
+
constructor(data: PointData, persist: () => Promise<void>);
|
|
81
|
+
/**
|
|
82
|
+
* Execute computation if input wasn't processed before.
|
|
83
|
+
* Returns cached output if input hash exists, otherwise executes, saves, and returns.
|
|
84
|
+
*/
|
|
85
|
+
through<I, O>(input: I, compute: () => Promise<O>, codec?: Codec<O>): Promise<O>;
|
|
86
|
+
/** Mark this point as complete. */
|
|
87
|
+
commit(): Promise<void>;
|
|
88
|
+
/** Check if this point has been committed. */
|
|
89
|
+
isCommitted(): boolean;
|
|
90
|
+
/** Get all outputs from this point. */
|
|
91
|
+
values(): T[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Generate a hash from a config object for checkpoint invalidation.
|
|
95
|
+
* If config changes, the checkpoint will be invalidated and pipeline restarts.
|
|
96
|
+
*/
|
|
97
|
+
export declare function hashConfig(config: Record<string, unknown>): string;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=checkpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/lib/checkpoint.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC,EAAE,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