@vertesia/workflow 0.79.0 → 0.79.1
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/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js +3 -4
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js.map +1 -1
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +10 -4
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +1 -1
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js +3 -4
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js.map +1 -1
- package/lib/cjs/activities/chunkDocument.js +1 -2
- package/lib/cjs/activities/chunkDocument.js.map +1 -1
- package/lib/cjs/activities/executeInteraction.js +5 -4
- package/lib/cjs/activities/executeInteraction.js.map +1 -1
- package/lib/cjs/activities/generateDocumentProperties.js +2 -3
- package/lib/cjs/activities/generateDocumentProperties.js.map +1 -1
- package/lib/cjs/activities/generateOrAssignContentType.js +2 -3
- package/lib/cjs/activities/generateOrAssignContentType.js.map +1 -1
- package/lib/cjs/activities/index-dsl.js +3 -1
- package/lib/cjs/activities/index-dsl.js.map +1 -1
- package/lib/cjs/activities/media/prepareVideo.js +429 -0
- package/lib/cjs/activities/media/prepareVideo.js.map +1 -0
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js +48 -15
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js.map +1 -1
- package/lib/cjs/activities/notifyWebhook.js +2 -1
- package/lib/cjs/activities/notifyWebhook.js.map +1 -1
- package/lib/cjs/dsl/dsl-workflow.js +6 -1
- package/lib/cjs/dsl/dsl-workflow.js.map +1 -1
- package/lib/cjs/dsl/setup/ActivityContext.js +7 -4
- package/lib/cjs/dsl/setup/ActivityContext.js.map +1 -1
- package/lib/cjs/errors.js +14 -1
- package/lib/cjs/errors.js.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/extractToc.js +2 -2
- package/lib/cjs/iterative-generation/activities/extractToc.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js +7 -4
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/generatePart.js +18 -14
- package/lib/cjs/iterative-generation/activities/generatePart.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/generateToc.js +46 -56
- package/lib/cjs/iterative-generation/activities/generateToc.js.map +1 -1
- package/lib/cjs/iterative-generation/utils.js.map +1 -1
- package/lib/cjs/utils/blobs.js +4 -1
- package/lib/cjs/utils/blobs.js.map +1 -1
- package/lib/cjs/utils/client.js +3 -1
- package/lib/cjs/utils/client.js.map +1 -1
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js +3 -4
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js.map +1 -1
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +10 -4
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +1 -1
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js +3 -4
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js.map +1 -1
- package/lib/esm/activities/chunkDocument.js +1 -2
- package/lib/esm/activities/chunkDocument.js.map +1 -1
- package/lib/esm/activities/executeInteraction.js +5 -4
- package/lib/esm/activities/executeInteraction.js.map +1 -1
- package/lib/esm/activities/generateDocumentProperties.js +2 -3
- package/lib/esm/activities/generateDocumentProperties.js.map +1 -1
- package/lib/esm/activities/generateOrAssignContentType.js +2 -3
- package/lib/esm/activities/generateOrAssignContentType.js.map +1 -1
- package/lib/esm/activities/index-dsl.js +1 -0
- package/lib/esm/activities/index-dsl.js.map +1 -1
- package/lib/esm/activities/media/prepareVideo.js +390 -0
- package/lib/esm/activities/media/prepareVideo.js.map +1 -0
- package/lib/esm/activities/media/transcribeMediaWithGladia.js +50 -17
- package/lib/esm/activities/media/transcribeMediaWithGladia.js.map +1 -1
- package/lib/esm/activities/notifyWebhook.js +2 -1
- package/lib/esm/activities/notifyWebhook.js.map +1 -1
- package/lib/esm/dsl/dsl-workflow.js +6 -1
- package/lib/esm/dsl/dsl-workflow.js.map +1 -1
- package/lib/esm/dsl/setup/ActivityContext.js +10 -7
- package/lib/esm/dsl/setup/ActivityContext.js.map +1 -1
- package/lib/esm/errors.js +12 -0
- package/lib/esm/errors.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/iterative-generation/activities/extractToc.js +3 -3
- package/lib/esm/iterative-generation/activities/extractToc.js.map +1 -1
- package/lib/esm/iterative-generation/activities/finalizeOutput.js +9 -6
- package/lib/esm/iterative-generation/activities/finalizeOutput.js.map +1 -1
- package/lib/esm/iterative-generation/activities/generatePart.js +19 -15
- package/lib/esm/iterative-generation/activities/generatePart.js.map +1 -1
- package/lib/esm/iterative-generation/activities/generateToc.js +46 -56
- package/lib/esm/iterative-generation/activities/generateToc.js.map +1 -1
- package/lib/esm/iterative-generation/utils.js.map +1 -1
- package/lib/esm/utils/blobs.js +4 -1
- package/lib/esm/utils/blobs.js.map +1 -1
- package/lib/esm/utils/client.js +4 -2
- package/lib/esm/utils/client.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/activities/advanced/createDocumentTypeFromInteractionRun.d.ts.map +1 -1
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts.map +1 -1
- package/lib/types/activities/advanced/updateDocumentFromInteractionRun.d.ts.map +1 -1
- package/lib/types/activities/chunkDocument.d.ts.map +1 -1
- package/lib/types/activities/executeInteraction.d.ts +1 -1
- package/lib/types/activities/executeInteraction.d.ts.map +1 -1
- package/lib/types/activities/generateDocumentProperties.d.ts.map +1 -1
- package/lib/types/activities/generateOrAssignContentType.d.ts.map +1 -1
- package/lib/types/activities/index-dsl.d.ts +1 -0
- package/lib/types/activities/index-dsl.d.ts.map +1 -1
- package/lib/types/activities/media/prepareVideo.d.ts +30 -0
- package/lib/types/activities/media/prepareVideo.d.ts.map +1 -0
- package/lib/types/activities/media/transcribeMediaWithGladia.d.ts.map +1 -1
- package/lib/types/dsl/dsl-workflow.d.ts.map +1 -1
- package/lib/types/dsl/setup/ActivityContext.d.ts.map +1 -1
- package/lib/types/errors.d.ts +6 -0
- package/lib/types/errors.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/extractToc.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/generatePart.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/generateToc.d.ts.map +1 -1
- package/lib/types/iterative-generation/utils.d.ts +3 -4
- package/lib/types/iterative-generation/utils.d.ts.map +1 -1
- package/lib/types/utils/blobs.d.ts.map +1 -1
- package/lib/types/utils/client.d.ts +2 -6
- package/lib/types/utils/client.d.ts.map +1 -1
- package/lib/workflows-bundle.js +9494 -6518
- package/package.json +127 -127
- package/src/activities/advanced/createDocumentTypeFromInteractionRun.ts +4 -6
- package/src/activities/advanced/createOrUpdateDocumentFromInteractionRun.ts +10 -4
- package/src/activities/advanced/updateDocumentFromInteractionRun.ts +3 -5
- package/src/activities/chunkDocument.ts +1 -2
- package/src/activities/executeInteraction.ts +13 -11
- package/src/activities/generateDocumentProperties.ts +2 -3
- package/src/activities/generateOrAssignContentType.ts +2 -3
- package/src/activities/index-dsl.ts +1 -0
- package/src/activities/media/prepareVideo.ts +622 -0
- package/src/activities/media/transcribeMediaWithGladia.ts +52 -21
- package/src/activities/notifyWebhook.ts +2 -1
- package/src/dsl/dsl-workflow.ts +7 -1
- package/src/errors.ts +15 -0
- package/src/index.ts +1 -0
- package/src/iterative-generation/activities/generatePart.ts +1 -2
- package/src/iterative-generation/activities/generateToc.ts +1 -2
- package/src/iterative-generation/utils.ts +4 -5
package/package.json
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/vertesia/composableai.git",
|
|
17
|
-
"directory": "zeno/workflow"
|
|
18
|
-
},
|
|
19
|
-
"license": "Apache-2.0",
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@smithy/types": "^3.7.2",
|
|
22
|
-
"@temporalio/proto": "^1.11.5",
|
|
23
|
-
"@temporalio/testing": "^1.11.5",
|
|
24
|
-
"@temporalio/worker": "^1.11.5",
|
|
25
|
-
"@types/jsonwebtoken": "^9.0.7",
|
|
26
|
-
"@types/node": "^22.5.1",
|
|
27
|
-
"@types/papaparse": "^5.3.15",
|
|
28
|
-
"@types/tmp": "^0.2.6",
|
|
29
|
-
"ts-dual-module": "^0.6.3",
|
|
30
|
-
"vitest": "^3.0.9"
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@aws-sdk/client-s3": "^3.693.0",
|
|
34
|
-
"@aws-sdk/client-textract": "^3.693.0",
|
|
35
|
-
"@aws-sdk/credential-providers": "^3.693.0",
|
|
36
|
-
"@temporalio/activity": "^1.11.5",
|
|
37
|
-
"@temporalio/workflow": "^1.11.5",
|
|
38
|
-
"@types/json-schema": "^7.0.15",
|
|
39
|
-
"fast-deep-equal": "^3.1.3",
|
|
40
|
-
"jsonwebtoken": "^9.0.2",
|
|
41
|
-
"mime": "^4.0.0",
|
|
42
|
-
"ms": "3.0.0-canary.1",
|
|
43
|
-
"node-web-stream-adapters": "^0.2.1",
|
|
44
|
-
"p-limit": "^6.2.0",
|
|
45
|
-
"papaparse": "^5.4.1",
|
|
46
|
-
"seedrandom": "^3.0.5",
|
|
47
|
-
"sharp": "^0.33.4",
|
|
48
|
-
"tiktoken": "^1.0.15",
|
|
49
|
-
"tmp": "^0.2.3",
|
|
50
|
-
"tmp-promise": "^3.0.3",
|
|
51
|
-
"yaml": "^2.6.0",
|
|
52
|
-
"@llumiverse/common": "0.22.0",
|
|
53
|
-
"@vertesia/client": "0.79.0",
|
|
54
|
-
"@vertesia/api-fetch-client": "0.79.0",
|
|
55
|
-
"@vertesia/common": "0.79.0",
|
|
56
|
-
"@vertesia/memory": "0.50.0"
|
|
57
|
-
},
|
|
58
|
-
"ts_dual_module": {
|
|
59
|
-
"outDir": "lib",
|
|
60
|
-
"exports": {
|
|
61
|
-
"activities": "./activities/index.js",
|
|
62
|
-
"dsl-activities": "./activities/index-dsl.js",
|
|
63
|
-
"workflows": "./workflows",
|
|
64
|
-
"workflows-bundle": "./workflows-bundle.js",
|
|
65
|
-
"vars": "./vars"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"exports": {
|
|
69
|
-
".": {
|
|
70
|
-
"types": "./lib/types/index.d.ts",
|
|
71
|
-
"import": "./lib/esm/index.js",
|
|
72
|
-
"require": "./lib/cjs/index.js"
|
|
2
|
+
"name": "@vertesia/workflow",
|
|
3
|
+
"version": "0.79.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Vertesia workflow DSL",
|
|
6
|
+
"main": "./lib/esm/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"bundle-workflows": "./bin/bundle-workflows.mjs"
|
|
73
13
|
},
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"build": "pnpm exec tsmod build && node ./bin/bundle-workflows.mjs lib/esm/workflows.js lib/workflows-bundle.js",
|
|
17
|
+
"clean": "rm -rf ./lib tsconfig.tsbuildinfo"
|
|
78
18
|
},
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/vertesia/composableai.git",
|
|
22
|
+
"directory": "zeno/workflow"
|
|
83
23
|
},
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@smithy/types": "^3.7.2",
|
|
27
|
+
"@temporalio/proto": "^1.11.5",
|
|
28
|
+
"@temporalio/testing": "^1.11.5",
|
|
29
|
+
"@temporalio/worker": "^1.11.5",
|
|
30
|
+
"@types/jsonwebtoken": "^9.0.7",
|
|
31
|
+
"@types/node": "^22.5.1",
|
|
32
|
+
"@types/papaparse": "^5.3.15",
|
|
33
|
+
"@types/tmp": "^0.2.6",
|
|
34
|
+
"ts-dual-module": "^0.6.3",
|
|
35
|
+
"vitest": "^3.0.9"
|
|
88
36
|
},
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@aws-sdk/client-s3": "^3.693.0",
|
|
39
|
+
"@aws-sdk/client-textract": "^3.693.0",
|
|
40
|
+
"@aws-sdk/credential-providers": "^3.693.0",
|
|
41
|
+
"@llumiverse/common": "workspace:*",
|
|
42
|
+
"@temporalio/activity": "^1.11.5",
|
|
43
|
+
"@temporalio/workflow": "^1.11.5",
|
|
44
|
+
"@types/json-schema": "^7.0.15",
|
|
45
|
+
"@vertesia/api-fetch-client": "workspace:*",
|
|
46
|
+
"@vertesia/client": "workspace:*",
|
|
47
|
+
"@vertesia/common": "workspace:*",
|
|
48
|
+
"@vertesia/memory": "workspace:*",
|
|
49
|
+
"fast-deep-equal": "^3.1.3",
|
|
50
|
+
"jsonwebtoken": "^9.0.2",
|
|
51
|
+
"mime": "^4.0.0",
|
|
52
|
+
"ms": "3.0.0-canary.1",
|
|
53
|
+
"node-web-stream-adapters": "^0.2.1",
|
|
54
|
+
"p-limit": "^6.2.0",
|
|
55
|
+
"papaparse": "^5.4.1",
|
|
56
|
+
"seedrandom": "^3.0.5",
|
|
57
|
+
"sharp": "^0.33.4",
|
|
58
|
+
"tiktoken": "^1.0.15",
|
|
59
|
+
"tmp": "^0.2.3",
|
|
60
|
+
"tmp-promise": "^3.0.3",
|
|
61
|
+
"yaml": "^2.6.0"
|
|
93
62
|
},
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
63
|
+
"ts_dual_module": {
|
|
64
|
+
"outDir": "lib",
|
|
65
|
+
"exports": {
|
|
66
|
+
"activities": "./activities/index.js",
|
|
67
|
+
"dsl-activities": "./activities/index-dsl.js",
|
|
68
|
+
"workflows": "./workflows",
|
|
69
|
+
"workflows-bundle": "./workflows-bundle.js",
|
|
70
|
+
"vars": "./vars"
|
|
71
|
+
}
|
|
98
72
|
},
|
|
99
|
-
"
|
|
100
|
-
|
|
73
|
+
"exports": {
|
|
74
|
+
".": {
|
|
75
|
+
"types": "./lib/types/index.d.ts",
|
|
76
|
+
"import": "./lib/esm/index.js",
|
|
77
|
+
"require": "./lib/cjs/index.js"
|
|
78
|
+
},
|
|
79
|
+
"./vars": {
|
|
80
|
+
"types": "./lib/types/vars.d.ts",
|
|
81
|
+
"import": "./lib/esm/vars.js",
|
|
82
|
+
"require": "./lib/cjs/vars.js"
|
|
83
|
+
},
|
|
84
|
+
"./activities": {
|
|
85
|
+
"types": "./lib/types/activities/index.d.ts",
|
|
86
|
+
"import": "./lib/esm/activities/index.js",
|
|
87
|
+
"require": "./lib/cjs/activities/index.js"
|
|
88
|
+
},
|
|
89
|
+
"./dsl-activities": {
|
|
90
|
+
"types": "./lib/types/activities/index-dsl.d.ts",
|
|
91
|
+
"import": "./lib/esm/activities/index-dsl.js",
|
|
92
|
+
"require": "./lib/cjs/activities/index-dsl.js"
|
|
93
|
+
},
|
|
94
|
+
"./workflows": {
|
|
95
|
+
"types": "./lib/types/workflows.d.ts",
|
|
96
|
+
"import": "./lib/esm/workflows.js",
|
|
97
|
+
"require": "./lib/cjs/workflows.js"
|
|
98
|
+
},
|
|
99
|
+
"./dsl": {
|
|
100
|
+
"types": "./lib/types/dsl.d.ts",
|
|
101
|
+
"import": "./lib/esm/dsl.js",
|
|
102
|
+
"require": "./lib/cjs/dsl.js"
|
|
103
|
+
},
|
|
104
|
+
"./workflows-bundle": {
|
|
105
|
+
"import": "./lib/workflows-bundle.js"
|
|
106
|
+
},
|
|
107
|
+
"./errors": {
|
|
108
|
+
"types": "./lib/types/errors.d.ts",
|
|
109
|
+
"import": "./lib/esm/errors.js",
|
|
110
|
+
"require": "./lib/cjs/errors.js"
|
|
111
|
+
}
|
|
101
112
|
},
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"./lib/types/dsl/vars.d.ts"
|
|
125
|
-
],
|
|
126
|
-
"errors": [
|
|
127
|
-
"./lib/types/errors.d.ts"
|
|
128
|
-
]
|
|
113
|
+
"types": "./lib/types/index.d.ts",
|
|
114
|
+
"typesVersions": {
|
|
115
|
+
"*": {
|
|
116
|
+
"activities": [
|
|
117
|
+
"./lib/types/activities/index.d.ts"
|
|
118
|
+
],
|
|
119
|
+
"dsl-activities": [
|
|
120
|
+
"./lib/types/activities/index-dsl.d.ts"
|
|
121
|
+
],
|
|
122
|
+
"workflows": [
|
|
123
|
+
"./lib/types/workflows.d.ts"
|
|
124
|
+
],
|
|
125
|
+
"dsl": [
|
|
126
|
+
"./lib/types/dsl.d.ts"
|
|
127
|
+
],
|
|
128
|
+
"vars": [
|
|
129
|
+
"./lib/types/dsl/vars.d.ts"
|
|
130
|
+
],
|
|
131
|
+
"errors": [
|
|
132
|
+
"./lib/types/errors.d.ts"
|
|
133
|
+
]
|
|
134
|
+
}
|
|
129
135
|
}
|
|
130
|
-
|
|
131
|
-
"scripts": {
|
|
132
|
-
"test": "vitest run",
|
|
133
|
-
"build": "pnpm exec tsmod build && node ./bin/bundle-workflows.mjs lib/esm/workflows.js lib/workflows-bundle.js",
|
|
134
|
-
"clean": "rm -rf ./lib tsconfig.tsbuildinfo"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
136
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CreateContentObjectTypePayload, DSLActivityExecutionPayload, DSLActivitySpec, ExecutionRun } from "@vertesia/common";
|
|
2
1
|
import { log } from "@temporalio/activity";
|
|
2
|
+
import { InteractionOutput } from "@vertesia/client";
|
|
3
|
+
import { CreateContentObjectTypePayload, DSLActivityExecutionPayload, DSLActivitySpec, ExecutionRun } from "@vertesia/common";
|
|
3
4
|
import { projectResult } from "../../dsl/projections.js";
|
|
4
5
|
import { setupActivity } from "../../dsl/setup/ActivityContext.js";
|
|
5
6
|
import { ActivityParamNotFoundError } from "../../errors.js";
|
|
6
|
-
import { parseCompletionResultsToJson } from "@llumiverse/common";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export interface CreateDocumentTypeFromInteractionRunParams {
|
|
@@ -29,12 +29,10 @@ export async function createDocumentTypeFromInteractionRun(payload: DSLActivityE
|
|
|
29
29
|
throw new ActivityParamNotFoundError("run", payload.activity);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const jsonResult = parseCompletionResultsToJson(params.run.result);
|
|
32
|
+
const jsonResult = InteractionOutput.from(params.run.result).object();
|
|
35
33
|
|
|
36
34
|
if (!jsonResult.document_type) {
|
|
37
|
-
log.error("No name generated for type: " + JSON.stringify(
|
|
35
|
+
log.error("No name generated for type: " + JSON.stringify(jsonResult), jsonResult);
|
|
38
36
|
throw new Error("No name generated for type");
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -2,7 +2,6 @@ import { log } from "@temporalio/activity";
|
|
|
2
2
|
import { ContentObjectStatus, DSLActivityExecutionPayload, DSLActivitySpec } from "@vertesia/common";
|
|
3
3
|
import { setupActivity } from "../../dsl/setup/ActivityContext.js";
|
|
4
4
|
import { ActivityParamNotFoundError, DocumentNotFoundError } from "../../errors.js";
|
|
5
|
-
import { parseCompletionResultsToJson, completionResultToString } from "@llumiverse/common";
|
|
6
5
|
|
|
7
6
|
interface CreateOrUpdateObjectFromInteractionRunParams {
|
|
8
7
|
/**
|
|
@@ -69,16 +68,23 @@ export async function createOrUpdateDocumentFromInteractionRun(payload: DSLActiv
|
|
|
69
68
|
|
|
70
69
|
|
|
71
70
|
const result = run.result;
|
|
72
|
-
const jsonResult = parseCompletionResultsToJson(run.result);
|
|
73
71
|
const inputData = run.parameters;
|
|
74
72
|
|
|
75
|
-
|
|
73
|
+
// Try to parse result as JSON, fallback to text if not valid JSON
|
|
74
|
+
let jsonResult: any = null;
|
|
75
|
+
try {
|
|
76
|
+
jsonResult = result.object();
|
|
77
|
+
} catch (e) {
|
|
78
|
+
log.info("Result is not valid JSON, will use text content instead", { error: e instanceof Error ? e.message : String(e) });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const name = jsonResult?.['name'] || jsonResult?.["title"] || inputData['name'] || params.fallback_name || undefined;
|
|
76
82
|
|
|
77
83
|
const docPayload = {
|
|
78
84
|
name,
|
|
79
85
|
parent: params.parent ?? undefined,
|
|
80
86
|
properties: jsonResult ? jsonResult : {},
|
|
81
|
-
text: !jsonResult ? result.
|
|
87
|
+
text: !jsonResult ? result.text() : undefined,
|
|
82
88
|
type: type?.id,
|
|
83
89
|
status: ContentObjectStatus.completed,
|
|
84
90
|
generation_run_info: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { InteractionOutput } from "@vertesia/client";
|
|
1
2
|
import { DSLActivityExecutionPayload, DSLActivitySpec, ExecutionRun } from "@vertesia/common";
|
|
2
3
|
import { setupActivity } from "../../dsl/setup/ActivityContext.js";
|
|
3
4
|
import { ActivityParamNotFoundError } from "../../errors.js";
|
|
4
|
-
import { parseCompletionResultsToJson } from "@llumiverse/common";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export interface UpdateDocumentFromInteractionRunParams {
|
|
@@ -23,15 +23,13 @@ export async function updateDocumentFromInteractionRun(payload: DSLActivityExecu
|
|
|
23
23
|
throw new ActivityParamNotFoundError("run", payload.activity);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const docProps = params.run.result;
|
|
26
|
+
const docProps = InteractionOutput.from(params.run.result).object();
|
|
27
27
|
|
|
28
28
|
if (!docProps) {
|
|
29
29
|
return { status: "failed", error: "no-props" };
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
await client.objects.update(objectId, jsonResult);
|
|
32
|
+
await client.objects.update(objectId, docProps);
|
|
35
33
|
|
|
36
34
|
return { status: "success" };
|
|
37
35
|
}
|
|
@@ -3,7 +3,6 @@ import { DSLActivityExecutionPayload, DSLActivitySpec } from "@vertesia/common";
|
|
|
3
3
|
import { setupActivity } from "../dsl/setup/ActivityContext.js";
|
|
4
4
|
import { DocPart } from "../utils/chunks.js";
|
|
5
5
|
import { InteractionExecutionParams, executeInteractionFromActivity } from "./executeInteraction.js";
|
|
6
|
-
import { parseCompletionResultsToJson } from "@llumiverse/common";
|
|
7
6
|
|
|
8
7
|
const INT_CHUNK_DOCUMENT = "sys:ChunkDocument"
|
|
9
8
|
|
|
@@ -83,7 +82,7 @@ export async function chunkDocument(payload: DSLActivityExecutionPayload<ChunkDo
|
|
|
83
82
|
content: instrumented
|
|
84
83
|
});
|
|
85
84
|
|
|
86
|
-
const jsonResult =
|
|
85
|
+
const jsonResult = res.result.object();
|
|
87
86
|
|
|
88
87
|
const parts = jsonResult.parts as DocPart[];
|
|
89
88
|
if (!parts || parts.length === 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Modalities, ModelOptions } from "@llumiverse/common";
|
|
1
|
+
import { CompletionResult, Modalities, ModelOptions } from "@llumiverse/common";
|
|
2
2
|
import { activityInfo, log } from "@temporalio/activity";
|
|
3
3
|
import { VertesiaClient } from "@vertesia/client";
|
|
4
4
|
import { NodeStreamSource } from "@vertesia/client/node";
|
|
@@ -155,40 +155,42 @@ export async function executeInteraction(payload: DSLActivityExecutionPayload<Ex
|
|
|
155
155
|
prompt_data,
|
|
156
156
|
payload.debug_mode,
|
|
157
157
|
);
|
|
158
|
-
|
|
158
|
+
|
|
159
|
+
let completionResult: CompletionResult[] = res.result;
|
|
160
|
+
|
|
159
161
|
// Handle image uploads if the result contains base64 images
|
|
160
162
|
if (res.output_modality === Modalities.image) {
|
|
161
|
-
const images = res.result.
|
|
163
|
+
const images = res.result.images();
|
|
162
164
|
const uploadedImages = await Promise.all(
|
|
163
|
-
images.map((image:
|
|
165
|
+
images.map((image: string, index: number) => {
|
|
164
166
|
// Extract base64 data and create buffer
|
|
165
|
-
const base64Data = image.
|
|
167
|
+
const base64Data = image.replace(/^data:image\/[a-z]+;base64,/, "");
|
|
166
168
|
const buffer = Buffer.from(base64Data, 'base64');
|
|
167
|
-
|
|
169
|
+
|
|
168
170
|
// Generate filename
|
|
169
171
|
const { runId } = activityInfo().workflowExecution;
|
|
170
172
|
const { activityId } = activityInfo();
|
|
171
173
|
const filename = `generated-image-${runId}-${activityId}-${index}.png`;
|
|
172
|
-
|
|
174
|
+
|
|
173
175
|
// Create a readable stream from the buffer
|
|
174
176
|
const stream = Readable.from(buffer);
|
|
175
|
-
|
|
177
|
+
|
|
176
178
|
const source = new NodeStreamSource(
|
|
177
179
|
stream,
|
|
178
180
|
filename,
|
|
179
181
|
"image/png",
|
|
180
182
|
);
|
|
181
|
-
|
|
183
|
+
|
|
182
184
|
return client.files.uploadFile(source);
|
|
183
185
|
})
|
|
184
186
|
);
|
|
185
|
-
|
|
187
|
+
completionResult = uploadedImages.map(file => ({ type: "image", value: file }));
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
return projectResult(payload, params, res, {
|
|
189
191
|
runId: res.id,
|
|
190
192
|
status: res.status,
|
|
191
|
-
result:
|
|
193
|
+
result: completionResult,
|
|
192
194
|
});
|
|
193
195
|
|
|
194
196
|
} catch (error: any) {
|
|
@@ -3,7 +3,6 @@ import { DSLActivityExecutionPayload, DSLActivitySpec } from "@vertesia/common";
|
|
|
3
3
|
import { setupActivity } from "../dsl/setup/ActivityContext.js";
|
|
4
4
|
import { TruncateSpec, truncByMaxTokens } from "../utils/tokens.js";
|
|
5
5
|
import { InteractionExecutionParams, executeInteractionFromActivity } from "./executeInteraction.js";
|
|
6
|
-
import { parseCompletionResultsToJson } from "@llumiverse/common";
|
|
7
6
|
|
|
8
7
|
const INT_EXTRACT_INFORMATION = "sys:ExtractInformation";
|
|
9
8
|
export interface GenerateDocumentPropertiesParams extends InteractionExecutionParams {
|
|
@@ -89,7 +88,7 @@ export async function generateDocumentProperties(
|
|
|
89
88
|
return undefined;
|
|
90
89
|
}
|
|
91
90
|
let text = "";
|
|
92
|
-
const jsonResult =
|
|
91
|
+
const jsonResult = infoRes.result.object();
|
|
93
92
|
if (jsonResult.title) {
|
|
94
93
|
text += jsonResult.title + "\n";
|
|
95
94
|
}
|
|
@@ -106,7 +105,7 @@ export async function generateDocumentProperties(
|
|
|
106
105
|
log.info(`Extracted information from object ${objectId} with type ${type.name}`, { runId: infoRes.id });
|
|
107
106
|
await client.objects.update(doc.id, {
|
|
108
107
|
properties: {
|
|
109
|
-
...
|
|
108
|
+
...infoRes.result.object(),
|
|
110
109
|
etag: doc.text_etag,
|
|
111
110
|
},
|
|
112
111
|
text: getText(),
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
InteractionExecutionParams,
|
|
16
16
|
executeInteractionFromActivity,
|
|
17
17
|
} from "./executeInteraction.js";
|
|
18
|
-
import { parseCompletionResultsToJson } from "@llumiverse/common";
|
|
19
18
|
|
|
20
19
|
const INT_SELECT_DOCUMENT_TYPE = "sys:SelectDocumentType";
|
|
21
20
|
const INT_GENERATE_METADATA_MODEL = "sys:GenerateMetadataModel";
|
|
@@ -134,7 +133,7 @@ export async function generateOrAssignContentType(
|
|
|
134
133
|
},
|
|
135
134
|
);
|
|
136
135
|
|
|
137
|
-
const jsonResult =
|
|
136
|
+
const jsonResult = res.result.object();
|
|
138
137
|
|
|
139
138
|
log.info("Selected Content Type Result: " + JSON.stringify(jsonResult));
|
|
140
139
|
|
|
@@ -197,7 +196,7 @@ async function generateNewType(
|
|
|
197
196
|
},
|
|
198
197
|
);
|
|
199
198
|
|
|
200
|
-
const jsonResult =
|
|
199
|
+
const jsonResult = genTypeRes.result.object();
|
|
201
200
|
|
|
202
201
|
if (!jsonResult.document_type) {
|
|
203
202
|
log.error("No name generated for type", genTypeRes);
|
|
@@ -15,6 +15,7 @@ export { getObjectFromStore } from "./getObjectFromStore.js";
|
|
|
15
15
|
export { handleDslError } from "./handleError.js";
|
|
16
16
|
export { convertPdfToStructuredText } from "./media/processPdfWithTextract.js";
|
|
17
17
|
export { transcribeMedia } from "./media/transcribeMediaWithGladia.js";
|
|
18
|
+
export { prepareVideo } from "./media/prepareVideo.js";
|
|
18
19
|
export { notifyWebhook } from "./notifyWebhook.js";
|
|
19
20
|
export { setDocumentStatus } from "./setDocumentStatus.js";
|
|
20
21
|
export { checkRateLimit } from "./rateLimiter.js";
|