@dxos/assistant 0.8.2-main.12df754 → 0.8.2-main.36232bc
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/lib/browser/index.mjs +270 -150
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +7 -7
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +266 -149
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +270 -150
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +7 -7
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/session/index.d.ts +1 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +29 -4
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +17 -0
- package/dist/types/src/session/version-pin.d.ts.map +1 -0
- package/dist/types/src/session/version-pin.test.d.ts +2 -0
- package/dist/types/src/session/version-pin.test.d.ts.map +1 -0
- package/dist/types/src/testing/test-schema.d.ts +2 -2
- package/dist/types/src/testing/test-schema.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/bin/chat.ts +2 -2
- package/src/cypher/combinators.test.ts +4 -4
- package/src/cypher/execution-plan.test.ts +1 -1
- package/src/cypher/query-executor.test.ts +1 -1
- package/src/cypher/schema.test.ts +3 -3
- package/src/session/index.ts +1 -0
- package/src/session/session.test.ts +2 -1
- package/src/session/session.ts +283 -147
- package/src/session/version-pin.test.ts +26 -0
- package/src/session/version-pin.ts +43 -0
- package/src/testing/query.test.ts +3 -3
- package/src/testing/test-data.ts +5 -5
- package/src/testing/test-schema.ts +3 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Schema as S } from 'effect';
|
|
2
2
|
import { Message, type ArtifactDefinition, type Tool } from '@dxos/artifact';
|
|
3
3
|
import { Event } from '@dxos/async';
|
|
4
|
+
import { ObjectVersion } from '@dxos/echo-db';
|
|
5
|
+
import { type ObjectId } from '@dxos/echo-schema';
|
|
4
6
|
import { type AIServiceClient, type GenerateRequest } from '../ai-service';
|
|
5
7
|
/**
|
|
6
8
|
* Contains message history, tools, current context.
|
|
@@ -12,6 +14,19 @@ import { type AIServiceClient, type GenerateRequest } from '../ai-service';
|
|
|
12
14
|
* Could be run locally in the app or remotely.
|
|
13
15
|
* Could be personal or shared.
|
|
14
16
|
*/
|
|
17
|
+
/**
|
|
18
|
+
* Resolves artifact ids to their versions.
|
|
19
|
+
* Used to give the model a sense of the changes to the artifacts made by users during the conversation.
|
|
20
|
+
* The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
|
|
21
|
+
* a diff is inserted into the conversation.
|
|
22
|
+
*/
|
|
23
|
+
export type ArtifactDiffResolver = (artifacts: {
|
|
24
|
+
id: ObjectId;
|
|
25
|
+
lastVersion: ObjectVersion;
|
|
26
|
+
}[]) => Promise<Map<ObjectId, {
|
|
27
|
+
version: ObjectVersion;
|
|
28
|
+
diff?: string;
|
|
29
|
+
}>>;
|
|
15
30
|
export type SessionRunOptions = {
|
|
16
31
|
client: AIServiceClient;
|
|
17
32
|
artifacts: ArtifactDefinition[];
|
|
@@ -28,13 +43,19 @@ export type SessionRunOptions = {
|
|
|
28
43
|
* Pre-require artifacts.
|
|
29
44
|
*/
|
|
30
45
|
requiredArtifactIds?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* @see ArtifactDiffResolver
|
|
48
|
+
*/
|
|
49
|
+
artifactDiffResolver?: ArtifactDiffResolver;
|
|
31
50
|
};
|
|
32
|
-
type OperationModel = 'planning' | '
|
|
51
|
+
type OperationModel = 'planning' | 'importing' | 'configured';
|
|
33
52
|
export type AiSessionOptions = {
|
|
34
53
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
54
|
+
* Determines the agent's handling of the artifacts definitions:
|
|
55
|
+
*
|
|
56
|
+
* - `planning`: The model will create a plan with required artifacts for each step.
|
|
57
|
+
* - `importing`: The model can query registry and only pull in the artifacts that are required to complete the task.
|
|
58
|
+
* - `configured`: The available artifacts are pre-selected and the model cannot select additional artifacts.
|
|
38
59
|
*/
|
|
39
60
|
operationModel: OperationModel;
|
|
40
61
|
};
|
|
@@ -199,6 +220,10 @@ export declare class AISession {
|
|
|
199
220
|
}>;
|
|
200
221
|
constructor(_options: AiSessionOptions);
|
|
201
222
|
run(options: SessionRunOptions): Promise<Message[]>;
|
|
223
|
+
private _formatUserPrompt;
|
|
224
|
+
private _createQueryArtifactsTool;
|
|
225
|
+
private _createRequireTool;
|
|
226
|
+
private _createPlanningTool;
|
|
202
227
|
abort(): void;
|
|
203
228
|
}
|
|
204
229
|
declare const AIServiecOverloadedError_base: S.TaggedErrorClass<AIServiecOverloadedError, "AIServiecOverloadedError", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAEL,OAAO,EAEP,KAAK,kBAAkB,EAEvB,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAgB,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK1D,OAAO,EAAqB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAyB,MAAM,eAAe,CAAC;AAGrH;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,aAAa,CAAA;CAAE,EAAE,KAAK,OAAO,CACvG,GAAG,CACD,QAAQ,EACR;IACE,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CACF,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,eAAe,CAAC;IAExB,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,IAAI,EAAE,CAAC;IAEd,OAAO,EAAE,OAAO,EAAE,CAAC;IAEnB,MAAM,EAAE,MAAM,CAAC;IAEf,iBAAiB,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAEnD,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAEnC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,CAAC;AAEF,KAAK,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;OAMG;IACH,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,qBAAa,SAAS;IAmCR,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAlCrC,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IAEnD,yDAAyD;IACzD,OAAO,CAAC,QAAQ,CAAiB;IAEjC,kCAAkC;IAClC,OAAO,CAAC,OAAO,CAA+B;IAE9C,gCAAgC;IAChC,OAAO,CAAC,QAAQ,CAAiB;IAEjC;;OAEG;IACH,SAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAwB;IAE/C;;OAEG;IACH,SAAgB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAsB;IAE3C;;OAEG;IACH,SAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAuB;IAE7C,SAAgB,WAAW,4CAA4B;IAEvD;;OAEG;IACH,SAAgB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAwB;gBAEtB,QAAQ,EAAE,gBAAgB;IAQjD,GAAG,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YA6G3C,iBAAiB;IAsC/B,OAAO,CAAC,yBAAyB;IAiBjC,OAAO,CAAC,kBAAkB;IA+B1B,OAAO,CAAC,mBAAmB;IAoF3B,KAAK;CAGN;;;;AAuDD,qBAAa,wBAAyB,SAAQ,6BAG7C;CAAG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { MessageContentBlock } from '@dxos/artifact';
|
|
3
|
+
import type { ObjectVersion } from '@dxos/echo-db';
|
|
4
|
+
import { type BaseEchoObject } from '@dxos/echo-schema';
|
|
5
|
+
declare const VersionPinSchema: Schema.Struct<{
|
|
6
|
+
objectId: import("@dxos/echo-schema").ObjectIdClass;
|
|
7
|
+
version: Schema.Schema<ObjectVersion, ObjectVersion, never>;
|
|
8
|
+
}>;
|
|
9
|
+
export interface VersionPin extends Schema.Schema.Type<typeof VersionPinSchema> {
|
|
10
|
+
}
|
|
11
|
+
export declare const VersionPin: typeof VersionPinSchema & {
|
|
12
|
+
DISPOSITION: 'version-pin';
|
|
13
|
+
fromObject: (object: BaseEchoObject) => VersionPin;
|
|
14
|
+
createBlock: (pin: VersionPin) => MessageContentBlock;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=version-pin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKlE,QAAA,MAAM,gBAAgB;;;EAKpB,CAAC;AACH,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AAElF,eAAO,MAAM,UAAU,EAAE,OAAO,gBAAgB,GAAG;IACjD,WAAW,EAAE,aAAa,CAAC;IAC3B,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,UAAU,CAAC;IACnD,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,mBAAmB,CAAC;CAiBvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-pin.test.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.test.ts"],"names":[],"mappings":""}
|
|
@@ -31,7 +31,7 @@ export declare const Task: S.mutable<S.Struct<{
|
|
|
31
31
|
}>>;
|
|
32
32
|
export interface Task extends S.Schema.Type<typeof Task> {
|
|
33
33
|
}
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const Organization: S.mutable<S.Struct<{
|
|
35
35
|
id: S.SchemaClass<string, string, never>;
|
|
36
36
|
name: S.SchemaClass<string, string, never>;
|
|
37
37
|
projects: S.Array$<import("@dxos/echo-schema").Ref$<{
|
|
@@ -45,6 +45,6 @@ export declare const Org: S.mutable<S.Struct<{
|
|
|
45
45
|
email?: string | undefined;
|
|
46
46
|
}>>;
|
|
47
47
|
}>>;
|
|
48
|
-
export interface
|
|
48
|
+
export interface Organization extends S.Schema.Type<typeof Organization> {
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=test-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-schema.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,QAAQ,sCAAyE,CAAC;AAE/F,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;GAeb,CAAC;AACL,MAAM,WAAW,IAAK,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC;CAAG;AAE3D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"test-schema.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,QAAQ,sCAAyE,CAAC;AAE/F,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;GAeb,CAAC;AACL,MAAM,WAAW,IAAK,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC;CAAG;AAE3D,eAAO,MAAM,YAAY;;;;;;;;;;;;;GAcrB,CAAC;AACL,MAAM,WAAW,YAAa,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/assistant",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.36232bc",
|
|
4
4
|
"description": "Natural language interface to DXOS",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"parjs": "^1.3.9",
|
|
41
41
|
"parsimmon": "^1.18.1",
|
|
42
42
|
"ulidx": "^2.3.0",
|
|
43
|
-
"@dxos/artifact": "0.8.2-main.
|
|
44
|
-
"@dxos/async": "0.8.2-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/echo-
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/live-object": "0.8.2-main.
|
|
52
|
-
"@dxos/log": "0.8.2-main.
|
|
53
|
-
"@dxos/node-std": "0.8.2-main.
|
|
54
|
-
"@dxos/util": "0.8.2-main.
|
|
43
|
+
"@dxos/artifact": "0.8.2-main.36232bc",
|
|
44
|
+
"@dxos/async": "0.8.2-main.36232bc",
|
|
45
|
+
"@dxos/context": "0.8.2-main.36232bc",
|
|
46
|
+
"@dxos/debug": "0.8.2-main.36232bc",
|
|
47
|
+
"@dxos/echo-schema": "0.8.2-main.36232bc",
|
|
48
|
+
"@dxos/invariant": "0.8.2-main.36232bc",
|
|
49
|
+
"@dxos/keys": "0.8.2-main.36232bc",
|
|
50
|
+
"@dxos/echo-db": "0.8.2-main.36232bc",
|
|
51
|
+
"@dxos/live-object": "0.8.2-main.36232bc",
|
|
52
|
+
"@dxos/log": "0.8.2-main.36232bc",
|
|
53
|
+
"@dxos/node-std": "0.8.2-main.36232bc",
|
|
54
|
+
"@dxos/util": "0.8.2-main.36232bc"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/parsimmon": "^1.10.9",
|
package/src/bin/chat.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
createSystemPrompt,
|
|
20
20
|
createTestData,
|
|
21
21
|
Contact,
|
|
22
|
-
|
|
22
|
+
Organization,
|
|
23
23
|
Project,
|
|
24
24
|
Task,
|
|
25
25
|
} from '../testing';
|
|
@@ -33,7 +33,7 @@ const dataSource = createTestData();
|
|
|
33
33
|
|
|
34
34
|
const cypherTool = createCypherTool(dataSource);
|
|
35
35
|
|
|
36
|
-
const schemaTypes = [
|
|
36
|
+
const schemaTypes = [Organization, Project, Task, Contact];
|
|
37
37
|
|
|
38
38
|
const spaceId = SpaceId.random();
|
|
39
39
|
const threadId = ObjectId.random();
|
|
@@ -77,7 +77,7 @@ describe('Cypher Combinators', () => {
|
|
|
77
77
|
test('match clause', ({ expect }) => {
|
|
78
78
|
testParser(matchClause, 'MATCH (n:Person)');
|
|
79
79
|
testParser(matchClause, 'MATCH (n:Person)-[r:KNOWS]->(m:Person)');
|
|
80
|
-
testParser(matchClause, 'MATCH (o:
|
|
80
|
+
testParser(matchClause, 'MATCH (o:Organization)-[:HAS_EMPLOYEE]->(e:Employee)');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
test('where clause', ({ expect }) => {
|
|
@@ -116,15 +116,15 @@ describe('Cypher Combinators', () => {
|
|
|
116
116
|
);
|
|
117
117
|
testParser(
|
|
118
118
|
cypherQuery,
|
|
119
|
-
'MATCH (o:
|
|
119
|
+
'MATCH (o:Organization)-[:HAS_EMPLOYEE]->(e:Employee)-[:WORKS_ON]->(p:Project) WHERE o.name = "DXOS" AND p.name = "Composer" RETURN e.name, e.id, p.name, p.id',
|
|
120
120
|
);
|
|
121
121
|
testParser(
|
|
122
122
|
cypherQuery,
|
|
123
|
-
'MATCH (n:
|
|
123
|
+
'MATCH (n:Organization {name: "DXOS"})-[:HAS_EMPLOYEE]->(m:Employee)<-[:WORKS_ON]-(p:Project {name: "Composer"}) RETURN m.name AS employee',
|
|
124
124
|
);
|
|
125
125
|
testParser(
|
|
126
126
|
cypherQuery,
|
|
127
|
-
"MATCH (org:
|
|
127
|
+
"MATCH (org:Organization {name: 'DXOS'})-[:ORG_EMPLOYEES]->(c:Contact)<-[:TASK_ASSIGNEE]-(t:Task)-[:TASK_PROJECT]->(p:Project {name: 'Composer'}) RETURN c.name",
|
|
128
128
|
);
|
|
129
129
|
});
|
|
130
130
|
});
|
|
@@ -21,7 +21,7 @@ describe('Execution Plan', () => {
|
|
|
21
21
|
test('complex query', ({ expect }) => {
|
|
22
22
|
const plan = createExecutionPlan(
|
|
23
23
|
parseCypherQuery(
|
|
24
|
-
"MATCH (org:
|
|
24
|
+
"MATCH (org:Organization {name: 'DXOS'})-[:ORG_EMPLOYEES]->(c:Contact)<-[:TASK_ASSIGNEE]-(:Task)-[:TASK_PROJECT]->(p:Project {name: 'Composer'}) RETURN c.name",
|
|
25
25
|
),
|
|
26
26
|
);
|
|
27
27
|
log('', { plan });
|
|
@@ -25,7 +25,7 @@ test.skip('run', async ({ expect }) => {
|
|
|
25
25
|
const result = await executeQuery(
|
|
26
26
|
dataSource,
|
|
27
27
|
`
|
|
28
|
-
MATCH (org:
|
|
28
|
+
MATCH (org:Organization {name: 'DXOS'})-[:ORG_EMPLOYEES]->(c:Contact)<-[:TASK_ASSIGNEE]-(t:Task)-[:TASK_PROJECT]->(p:Project {name: 'Composer'})
|
|
29
29
|
RETURN c.name, t.name
|
|
30
30
|
`,
|
|
31
31
|
);
|
|
@@ -7,10 +7,10 @@ import { test } from 'vitest';
|
|
|
7
7
|
import { toJsonSchema } from '@dxos/echo-schema';
|
|
8
8
|
|
|
9
9
|
import { formatJsonSchemaForLLM } from './schema';
|
|
10
|
-
import { Contact,
|
|
10
|
+
import { Contact, Organization, Project, Task } from '../testing';
|
|
11
11
|
|
|
12
|
-
test('
|
|
13
|
-
const jsonSchema = [
|
|
12
|
+
test('Organization-Project-Task-Contact schema', async ({ expect }) => {
|
|
13
|
+
const jsonSchema = [Organization, Project, Task, Contact].map((schema) => toJsonSchema(schema));
|
|
14
14
|
const result = formatJsonSchemaForLLM(jsonSchema);
|
|
15
15
|
// log('result', { result });
|
|
16
16
|
expect(result).toHaveLength(8);
|
package/src/session/index.ts
CHANGED
|
@@ -39,7 +39,7 @@ describe.skip('AISession with Ollama', () => {
|
|
|
39
39
|
// const aiClient = new OllamaClient({
|
|
40
40
|
// overrides: { model: 'llama3.1:8b' },
|
|
41
41
|
// });
|
|
42
|
-
const session = new AISession({ operationModel: '
|
|
42
|
+
const session = new AISession({ operationModel: 'configured' });
|
|
43
43
|
|
|
44
44
|
const objects = new Set<string>();
|
|
45
45
|
|
|
@@ -140,6 +140,7 @@ describe.skip('AISession with Ollama', () => {
|
|
|
140
140
|
client: aiClient,
|
|
141
141
|
tools: [],
|
|
142
142
|
artifacts: [calendarArtifact, tableArtifact, mapArtifact, scriptArtifact],
|
|
143
|
+
requiredArtifactIds: [calendarArtifact.id, tableArtifact.id, mapArtifact.id, scriptArtifact.id],
|
|
143
144
|
history: [],
|
|
144
145
|
generationOptions: {
|
|
145
146
|
model: '@anthropic/claude-3-5-haiku-20241022',
|