digipair 0.53.0 → 0.54.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/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "digipair",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "type": "commonjs",
5
5
  "bin": {
6
6
  "digipair": "./bin/digipair.js"
7
7
  },
8
8
  "dependencies": {
9
- "@digipair/engine": "0.53.0",
10
- "@digipair/skill-chatbot": "0.53.0",
11
- "@digipair/skill-common": "0.53.0",
12
- "@digipair/skill-cron": "0.53.0",
13
- "@digipair/skill-basic": "0.53.0",
14
- "@digipair/skill-debug": "0.53.0",
15
- "@digipair/skill-dsp": "0.53.0",
16
- "@digipair/skill-editor": "0.53.0",
17
- "@digipair/skill-factory": "0.53.0",
18
- "@digipair/skill-http": "0.53.0",
19
- "@digipair/skill-llm": "0.53.0",
20
- "@digipair/skill-openai": "0.53.0",
21
- "@digipair/skill-service": "0.53.0",
22
- "@digipair/skill-sse": "0.53.0",
23
- "@digipair/skill-temporal": "0.53.0",
24
- "@digipair/skill-web": "0.53.0",
25
- "@digipair/skill-logger": "0.53.0",
26
- "@digipair/skill-process": "0.53.0",
9
+ "@digipair/engine": "0.54.0",
10
+ "@digipair/skill-chatbot": "0.54.0",
11
+ "@digipair/skill-common": "0.54.0",
12
+ "@digipair/skill-cron": "0.54.0",
13
+ "@digipair/skill-basic": "0.54.0",
14
+ "@digipair/skill-debug": "0.54.0",
15
+ "@digipair/skill-dsp": "0.54.0",
16
+ "@digipair/skill-editor": "0.54.0",
17
+ "@digipair/skill-factory": "0.54.0",
18
+ "@digipair/skill-http": "0.54.0",
19
+ "@digipair/skill-llm": "0.54.0",
20
+ "@digipair/skill-openai": "0.54.0",
21
+ "@digipair/skill-service": "0.54.0",
22
+ "@digipair/skill-sse": "0.54.0",
23
+ "@digipair/skill-temporal": "0.54.0",
24
+ "@digipair/skill-web": "0.54.0",
25
+ "@digipair/skill-logger": "0.54.0",
26
+ "@digipair/skill-process": "0.54.0",
27
27
  "tslib": "^2.6.3",
28
28
  "@nestjs/common": "^10.3.9",
29
29
  "@nestjs/core": "^10.3.9",
@@ -0,0 +1,103 @@
1
+ {
2
+ "summary": "Add a digipair from OpenAPI",
3
+ "description": "Adding a new digipair from OpenAPI v3.",
4
+ "library": "@digipair/skill-chatbot",
5
+ "element": "boost",
6
+ "metadata": { "standalone": true },
7
+ "properties": {
8
+ "steps": [
9
+ {
10
+ "name": "Initialisation",
11
+ "execute": [
12
+ {
13
+ "library": "digipair:admin",
14
+ "element": "answer",
15
+ "properties": {
16
+ "assistant": "What is the id for the new digipair ?",
17
+ "boost": [{ "prompt": true, "required": true, "step": "Api" }]
18
+ }
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ "name": "Api",
24
+ "execute": [
25
+ {
26
+ "library": "@digipair/skill-basic",
27
+ "element": "setVariable",
28
+ "properties": {
29
+ "name": "infos",
30
+ "execute": [
31
+ {
32
+ "library": "@digipair/skill-dsp",
33
+ "element": "generate",
34
+ "properties": {
35
+ "signature": "\"Extract the information for creating the digipair from the user's comment\"\ncomment:string \"User's comment describing the digipair to create\" -> \n name:string \"Very short name of the agent from the comment in french\", \n description:string \"Short description of the agent from the comment\", \n assistant:string \"Assistant's response to confirm that the digipair has been successfully added and recall to the user to update his API key from the agent configuration\"",
36
+ "input": { "comment": "{{request.body.prompt}}" }
37
+ }
38
+ }
39
+ ]
40
+ }
41
+ },
42
+ {
43
+ "library": "digipair:admin",
44
+ "element": "answer",
45
+ "properties": {
46
+ "assistant": "What is the OpenAPI v3 JSON url ?",
47
+ "boost": [
48
+ {
49
+ "prompt": true,
50
+ "required": true,
51
+ "step": "Execution",
52
+ "inputs": [
53
+ {
54
+ "library": "@digipair/skill-web-inputs",
55
+ "element": "digipair-input-hidden",
56
+ "properties": {
57
+ "value": {
58
+ "digipair": "EVALUATE:request.body.prompt",
59
+ "name": "EVALUATE:variables.infos.name",
60
+ "description": "EVALUATE:variables.infos.description",
61
+ "assistant": "EVALUATE:variables.infos.assistant"
62
+ }
63
+ }
64
+ }
65
+ ]
66
+ }
67
+ ]
68
+ }
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "name": "Execution",
74
+ "execute": [
75
+ {
76
+ "library": "@digipair/skill-editor",
77
+ "element": "addDigipair",
78
+ "properties": {
79
+ "template": "openapi-apikey",
80
+ "data": {
81
+ "digipair": "EVALUATE:request.body.inputs[1].value.digipair",
82
+ "name": "EVALUATE:request.body.inputs[1].value.name",
83
+ "description": "EVALUATE:request.body.inputs[1].value.description",
84
+ "api": "EVALUATE:request.body.prompt",
85
+ "key": "API_KEY"
86
+ },
87
+ "digipair": "EVALUATE:request.body.inputs[1].value.digipair"
88
+ }
89
+ },
90
+ {
91
+ "library": "digipair:admin",
92
+ "element": "answer",
93
+ "properties": {
94
+ "assistant": "EVALUATE:request.body.inputs[1].value.assistant",
95
+ "command": [{ "library": "@digipair/skill-web-interact", "element": "reload" }]
96
+ }
97
+ }
98
+ ]
99
+ }
100
+ ]
101
+ },
102
+ "pins": []
103
+ }
@@ -3,7 +3,7 @@
3
3
  "description": "Adding a new digipair.",
4
4
  "library": "@digipair/skill-chatbot",
5
5
  "element": "boost",
6
- "metadata": {},
6
+ "metadata": { "standalone": true },
7
7
  "properties": {
8
8
  "steps": [
9
9
  {
@@ -14,14 +14,7 @@
14
14
  "element": "answer",
15
15
  "properties": {
16
16
  "assistant": "What is the id for the new digipair ?",
17
- "boost": [
18
- {
19
- "step": "Execution",
20
- "prompt": true,
21
- "required": true,
22
- "inputs": []
23
- }
24
- ]
17
+ "boost": [{ "prompt": true, "required": true, "step": "Execution" }]
25
18
  }
26
19
  }
27
20
  ]
@@ -39,7 +32,7 @@
39
32
  "library": "@digipair/skill-dsp",
40
33
  "element": "generate",
41
34
  "properties": {
42
- "signature": "\"Extract the information for creating the digipair from the user's comment\" comment:string \"User's comment describing the digipair to create\" -> name:string \"Very short name of the digipair\", description:string \"Short description of the digipair\", assistant:string \"Assistant's response to confirm that the digipair has been successfully added\"",
35
+ "signature": "\"Extract the information for creating the digipair from the user's comment\"\ncomment:string \"User's comment describing the digipair to create\" -> \n name:string \"Very short name of the agent from the comment\", \n description:string \"Short description of the agent from the comment\", \n assistant:string \"Assistant's response to confirm that the digipair has been successfully added\"",
43
36
  "input": { "comment": "{{request.body.prompt}}" }
44
37
  }
45
38
  }
@@ -50,28 +43,20 @@
50
43
  "library": "@digipair/skill-editor",
51
44
  "element": "addDigipair",
52
45
  "properties": {
53
- "digipair": "{{request.body.prompt}}",
54
- "template": "default",
46
+ "template": "openapi-apikey",
55
47
  "data": {
56
- "digipair": "{{request.body.prompt}}",
57
- "name": "{{variables.infos.name}}",
58
- "description": "{{variables.infos.description}}"
59
- }
60
- }
61
- },
62
- {
63
- "library": "@digipair/skill-editor",
64
- "element": "reasoning",
65
- "properties": {
66
- "digipair": "{{request.body.prompt}}",
67
- "reasoning": "config"
48
+ "digipair": "EVALUATE:request.body.prompt",
49
+ "name": "EVALUATE:variables.infos.name",
50
+ "description": "EVALUATE:variables.infos.description"
51
+ },
52
+ "digipair": "EVALUATE:request.body.prompt"
68
53
  }
69
54
  },
70
55
  {
71
56
  "library": "digipair:admin",
72
57
  "element": "answer",
73
58
  "properties": {
74
- "assistant": "{{variables.infos.assistant}}",
59
+ "assistant": "EVALUATE:variables.infos.assistant",
75
60
  "command": [{ "library": "@digipair/skill-web-interact", "element": "reload" }]
76
61
  }
77
62
  }
@@ -9,23 +9,23 @@
9
9
  "textSecondary": "#FFFFFF"
10
10
  },
11
11
  "libraries": {
12
- "@digipair/skill-service": "0.53.0",
13
- "@digipair/skill-chatbot": "0.53.0",
14
- "@digipair/skill-cron": "0.53.0",
15
- "@digipair/skill-editor": "0.53.0",
16
- "@digipair/skill-common": "0.53.0",
17
- "@digipair/skill-dsp": "0.53.0",
18
- "@digipair/skill-web": "0.53.0",
19
- "@digipair/skill-http": "0.53.0",
20
- "@digipair/skill-basic": "0.53.0",
21
- "@digipair/skill-web-jsoneditor": "0.53.0",
22
- "@digipair/skill-web-notification": "0.53.0",
23
- "@digipair/skill-web-chatbot": "0.53.0",
24
- "@digipair/skill-web-editor": "0.53.0",
25
- "@digipair/skill-web-inputs": "0.53.0",
26
- "@digipair/skill-web-spectrum": "0.53.0",
27
- "@digipair/skill-web-interact": "0.53.0",
28
- "@digipair/skill-web-font-awesome": "0.53.0"
12
+ "@digipair/skill-service": "0.54.0",
13
+ "@digipair/skill-chatbot": "0.54.0",
14
+ "@digipair/skill-cron": "0.54.0",
15
+ "@digipair/skill-editor": "0.54.0",
16
+ "@digipair/skill-common": "0.54.0",
17
+ "@digipair/skill-dsp": "0.54.0",
18
+ "@digipair/skill-web": "0.54.0",
19
+ "@digipair/skill-http": "0.54.0",
20
+ "@digipair/skill-basic": "0.54.0",
21
+ "@digipair/skill-web-jsoneditor": "0.54.0",
22
+ "@digipair/skill-web-notification": "0.54.0",
23
+ "@digipair/skill-web-chatbot": "0.54.0",
24
+ "@digipair/skill-web-editor": "0.54.0",
25
+ "@digipair/skill-web-inputs": "0.54.0",
26
+ "@digipair/skill-web-spectrum": "0.54.0",
27
+ "@digipair/skill-web-interact": "0.54.0",
28
+ "@digipair/skill-web-font-awesome": "0.54.0"
29
29
  },
30
30
  "variables": {},
31
31
  "privates": {
@@ -91,6 +91,28 @@
91
91
  }
92
92
  ]
93
93
  }
94
+ },
95
+ {
96
+ "library": "@digipair/skill-web-spectrum",
97
+ "element": "sp-menu-item",
98
+ "properties": { "textContent": "Add a digipair OpenAPI" },
99
+ "events": {
100
+ "click": [
101
+ {
102
+ "library": "@digipair/skill-web-interact",
103
+ "element": "execute",
104
+ "properties": {
105
+ "name": "executeBoost",
106
+ "selector": "digipair-chatbot",
107
+ "args": [
108
+ {
109
+ "reasoning": "boost-add-digipair-api"
110
+ }
111
+ ]
112
+ }
113
+ }
114
+ ]
115
+ }
94
116
  }
95
117
  ],
96
118
  "properties": {
@@ -3,9 +3,9 @@
3
3
  "description": "common actions.",
4
4
  "metadata": { "avatar": "avatar.png", "color": "#3b82f6" },
5
5
  "libraries": {
6
- "@digipair/skill-service": "0.53.0",
7
- "@digipair/skill-sse": "0.53.0",
8
- "@digipair/skill-common": "0.53.0"
6
+ "@digipair/skill-service": "0.54.0",
7
+ "@digipair/skill-sse": "0.54.0",
8
+ "@digipair/skill-common": "0.54.0"
9
9
  },
10
10
  "variables": {},
11
11
  "privates": {}
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "library": "@digipair/skill-web-chatbot",
11
11
  "element": "digipair-chatbot-full",
12
- "properties": { "code": "default" }
12
+ "properties": { "code": "<%= digipair %>" }
13
13
  }
14
14
  ],
15
15
  "styleBody": "background-color:#212E3C;"
@@ -16,8 +16,7 @@
16
16
  "@digipair/skill-basic": "latest",
17
17
  "@digipair/skill-web-chatbot": "latest",
18
18
  "@digipair/skill-web-inputs": "latest",
19
- "@digipair/skill-web-interact": "latest",
20
- "digipair:<%= digipair %>": "latest"
19
+ "@digipair/skill-web-interact": "latest"
21
20
  },
22
21
  "variables": {},
23
22
  "privates": {
@@ -0,0 +1,18 @@
1
+ {
2
+ "summary": "Chatbot",
3
+ "description": "Chatbot",
4
+ "library": "@digipair/skill-web",
5
+ "element": "page",
6
+ "metadata": {},
7
+ "properties": {
8
+ "body": [
9
+ {
10
+ "library": "@digipair/skill-web-chatbot",
11
+ "element": "digipair-chatbot-full",
12
+ "properties": { "code": "<%= digipair %>" }
13
+ }
14
+ ],
15
+ "styleBody": "background-color:#212E3C;"
16
+ },
17
+ "pins": []
18
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "<%= name %>",
3
+ "description": "<%= description %>",
4
+ "metadata": {
5
+ "avatar": "avatar.png",
6
+ "primary": "#51E0DC",
7
+ "textPrimary": "#242E3B",
8
+ "secondary": "#242E3B",
9
+ "textSecondary": "#FFFFFF"
10
+ },
11
+ "libraries": {
12
+ "@digipair/skill-service": "latest",
13
+ "@digipair/skill-chatbot": "latest",
14
+ "@digipair/skill-dsp": "latest",
15
+ "@digipair/skill-web": "latest",
16
+ "@digipair/skill-basic": "latest",
17
+ "@digipair/skill-http": "latest",
18
+ "@digipair/skill-factory": "latest",
19
+ "@digipair/skill-web-chatbot": "latest",
20
+ "@digipair/skill-web-inputs": "latest",
21
+ "@digipair/skill-web-interact": "latest"
22
+ },
23
+ "variables": {},
24
+ "privates": {
25
+ "OPENAPI_URL": "<%= api %>",
26
+ "OPENAPI_AUTHORIZATION_KEY": "Authentification",
27
+ "OPENAPI_AUTHORIZATION_VALUE": "<%= key %>",
28
+ "MODEL_EMBEDDINGS": [
29
+ {
30
+ "library": "@digipair/skill-openai",
31
+ "element": "embeddings",
32
+ "property": { "modelName": "text-embedding-3-small" }
33
+ }
34
+ ],
35
+ "MODEL_DSP": [
36
+ { "library": "@digipair/skill-dsp", "element": "modelOpenAI" }
37
+ ]
38
+ },
39
+ "digipair": "<%= digipair %>"
40
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "summary": "Conversation",
3
+ "description": "Generating a response for the user via the chatbot.",
4
+ "library": "@digipair/skill-chatbot",
5
+ "element": "boost",
6
+ "metadata": {},
7
+ "properties": {
8
+ "steps": [
9
+ {
10
+ "name": "Conversation",
11
+ "execute": [
12
+ {
13
+ "library": "@digipair/skill-dsp",
14
+ "element": "agent",
15
+ "properties": {
16
+ "name": "Assistant",
17
+ "description": "You are a helpful assistant, capable of explaining concepts in a simple manner. If you're unsure of an answer, you can say \"I don't know\" or \"I'm not sure.\"",
18
+ "signature": "\"Provide a very short, precise, and concise answer to the user's question using only your knowledge base.\" userQuestion:string -> answer: string \"Assistant answer\"",
19
+ "input": {
20
+ "userQuestion": "{{request.body.prompt}}"
21
+ }
22
+ }
23
+ },
24
+ {
25
+ "library": "@digipair/skill-chatbot",
26
+ "element": "answer",
27
+ "properties": {
28
+ "assistant": "{{previous.answer}}"
29
+ }
30
+ }
31
+ ]
32
+ }
33
+ ]
34
+ },
35
+ "pins": []
36
+ }
@@ -0,0 +1,264 @@
1
+ {
2
+ "summary": "Appel d'une API",
3
+ "description": "Mécanisme d'appel d'une API",
4
+ "library": "@digipair/skill-service",
5
+ "element": "task",
6
+ "metadata": {},
7
+ "properties": {
8
+ "execute": [
9
+ {
10
+ "library": "@digipair/skill-basic",
11
+ "element": "setVariable",
12
+ "properties": {
13
+ "name": "openapi",
14
+ "execute": [
15
+ {
16
+ "library": "@digipair/skill-http",
17
+ "element": "read",
18
+ "properties": {
19
+ "path": "EVALUATE:privates.OPENAPI_URL"
20
+ }
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "library": "@digipair/skill-basic",
27
+ "element": "setVariable",
28
+ "properties": {
29
+ "name": "server",
30
+ "value": "EVALUATE:variables.openapi.servers[1].url"
31
+ }
32
+ },
33
+ {
34
+ "library": "@digipair/skill-basic",
35
+ "element": "setVariable",
36
+ "properties": {
37
+ "name": "infos",
38
+ "value": "EVALUATE:(for line in get entries(variables.openapi.paths) return { \"path\": line.key, \"value\": get entries(line.value)[item.value.operationId = request.reasoning or item.key = \"parameters\"] })[count(item.value) > 1 or item.value[1].key != \"parameters\"][count(item.value) > 0][1]"
39
+ }
40
+ },
41
+ {
42
+ "library": "@digipair/skill-basic",
43
+ "element": "setVariable",
44
+ "properties": {
45
+ "name": "method",
46
+ "value": "EVALUATE:variables.infos.value[item.key != \"parameters\"][1].key"
47
+ }
48
+ },
49
+ {
50
+ "library": "@digipair/skill-basic",
51
+ "element": "setVariable",
52
+ "properties": {
53
+ "name": "parameters",
54
+ "execute": [
55
+ {
56
+ "library": "@digipair/skill-basic",
57
+ "element": "transform",
58
+ "properties": {
59
+ "value": "EVALUATE:concatenate(\n flatten(variables.infos.value[item.key = \"parameters\"].value),\n flatten(variables.infos.value[item.key != \"parameters\"].value.parameters)\n)"
60
+ }
61
+ }
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ "library": "@digipair/skill-basic",
67
+ "element": "setVariable",
68
+ "properties": {
69
+ "name": "parametersPath",
70
+ "execute": [
71
+ {
72
+ "library": "@digipair/skill-basic",
73
+ "element": "transform",
74
+ "properties": {
75
+ "value": "EVALUATE:for parameter in variables.parameters return get entries(parameter)"
76
+ }
77
+ },
78
+ {
79
+ "library": "@digipair/skill-basic",
80
+ "element": "transform",
81
+ "properties": {
82
+ "value": "EVALUATE:for parameter in previous return if count(parameter[item.key = \"in\" and item.value = \"path\"]) > 0 then parameter else null "
83
+ }
84
+ },
85
+ {
86
+ "library": "@digipair/skill-basic",
87
+ "element": "transform",
88
+ "properties": {
89
+ "value": "EVALUATE:for parameter in previous[item != null] return context(parameter)"
90
+ }
91
+ }
92
+ ]
93
+ }
94
+ },
95
+ {
96
+ "library": "@digipair/skill-basic",
97
+ "element": "setVariable",
98
+ "properties": {
99
+ "name": "parametersQuery",
100
+ "execute": [
101
+ {
102
+ "library": "@digipair/skill-basic",
103
+ "element": "transform",
104
+ "properties": {
105
+ "value": "EVALUATE:for parameter in variables.parameters return get entries(parameter)"
106
+ }
107
+ },
108
+ {
109
+ "library": "@digipair/skill-basic",
110
+ "element": "transform",
111
+ "properties": {
112
+ "value": "EVALUATE:for parameter in previous return if count(parameter[item.key = \"in\" and item.value = \"query\"]) > 0 then parameter else null "
113
+ }
114
+ },
115
+ {
116
+ "library": "@digipair/skill-basic",
117
+ "element": "transform",
118
+ "properties": {
119
+ "value": "EVALUATE:for parameter in previous[item != null] return context(parameter)"
120
+ }
121
+ }
122
+ ]
123
+ }
124
+ },
125
+ {
126
+ "library": "@digipair/skill-basic",
127
+ "element": "setVariable",
128
+ "properties": {
129
+ "name": "parametersHeader",
130
+ "execute": [
131
+ {
132
+ "library": "@digipair/skill-basic",
133
+ "element": "transform",
134
+ "properties": {
135
+ "value": "EVALUATE:for parameter in variables.parameters return get entries(parameter)"
136
+ }
137
+ },
138
+ {
139
+ "library": "@digipair/skill-basic",
140
+ "element": "transform",
141
+ "properties": {
142
+ "value": "EVALUATE:for parameter in previous return if count(parameter[item.key = \"in\" and item.value = \"header\"]) > 0 then parameter else null "
143
+ }
144
+ },
145
+ {
146
+ "library": "@digipair/skill-basic",
147
+ "element": "transform",
148
+ "properties": {
149
+ "value": "EVALUATE:for parameter in previous[item != null] return context(parameter)"
150
+ }
151
+ }
152
+ ]
153
+ }
154
+ },
155
+ {
156
+ "library": "@digipair/skill-basic",
157
+ "element": "setVariable",
158
+ "properties": {
159
+ "name": "path",
160
+ "value": "EVALUATE:variables.infos.path"
161
+ }
162
+ },
163
+ {
164
+ "library": "@digipair/skill-basic",
165
+ "element": "transform",
166
+ "properties": {
167
+ "execute": [
168
+ {
169
+ "library": "@digipair/skill-basic",
170
+ "element": "transform",
171
+ "properties": {
172
+ "value": "EVALUATE:item"
173
+ }
174
+ },
175
+ {
176
+ "library": "@digipair/skill-basic",
177
+ "element": "transform",
178
+ "properties": {
179
+ "value": "EVALUATE:get entries(request.body)[item.key = previous.name][1].value"
180
+ }
181
+ },
182
+ {
183
+ "library": "@digipair/skill-basic",
184
+ "element": "setVariable",
185
+ "properties": {
186
+ "name": "path",
187
+ "value": "EVALUATE:replace(variables.path, \"\\{\" + item.name + \"\\}\", previous)"
188
+ }
189
+ }
190
+ ]
191
+ },
192
+ "conditions": {
193
+ "each": "EVALUATE:variables.parametersPath"
194
+ }
195
+ },
196
+ {
197
+ "library": "@digipair/skill-basic",
198
+ "element": "setVariable",
199
+ "properties": {
200
+ "name": "headers",
201
+ "execute": [
202
+ {
203
+ "library": "@digipair/skill-basic",
204
+ "element": "transform",
205
+ "properties": {
206
+ "value": "EVALUATE:get entries(variables.infos.value[item.key = variables.method].value.requestBody[1].content)"
207
+ }
208
+ },
209
+ {
210
+ "library": "@digipair/skill-basic",
211
+ "element": "transform",
212
+ "properties": {
213
+ "value": "EVALUATE:if previous[item.key = \"application/json\"][1] != null then \n \"application/json\" \nelse if previous[item.key = \"application/x-www-form-urlencoded\"][1] != null then \n \"application/x-www-form-urlencoded\"\nelse\n null"
214
+ }
215
+ },
216
+ {
217
+ "library": "@digipair/skill-basic",
218
+ "element": "transform",
219
+ "properties": {
220
+ "value": "EVALUATE:context merge([\n context((for parameter in get entries(request.body) return if count(variables.parametersHeaders[item.name = parameter.key]) > 0 then parameter else null)[item != null]), \n context([{ \"key\": privates.OPENAPI_AUTHORIZATION_KEY, \"value\": privates.OPENAPI_AUTHORIZATION_VALUE }]),\n if previous != null then\n {\n \"Content-Type\": previous\n }\n else\n {}\n])"
221
+ }
222
+ }
223
+ ]
224
+ }
225
+ },
226
+ {
227
+ "library": "@digipair/skill-basic",
228
+ "element": "setVariable",
229
+ "properties": {
230
+ "name": "body",
231
+ "value": "EVALUATE:context((for parameter in get entries(request.body) return if count(variables.parametersQuery[item.name = parameter.key]) > 0 then parameter else null)[item != null])"
232
+ },
233
+ "conditions": {
234
+ "if": "EVALUATE:variables.infos.value[item.key = variables.method].value.requestBody[1] = null"
235
+ }
236
+ },
237
+ {
238
+ "library": "@digipair/skill-basic",
239
+ "element": "setVariable",
240
+ "properties": {
241
+ "name": "body",
242
+ "value": "EVALUATE:request.body.body"
243
+ },
244
+ "conditions": {
245
+ "if": "EVALUATE:variables.infos.value[item.key = variables.method].value.requestBody[1] != null"
246
+ }
247
+ },
248
+ {
249
+ "library": "@digipair/skill-http",
250
+ "element": "request",
251
+ "properties": {
252
+ "path": "EVALUATE:variables.server + variables.path",
253
+ "method": "EVALUATE:variables.method",
254
+ "body": "EVALUATE:if variables.method != \"get\" and variables.method != \"head\" then variables.body else null",
255
+ "headers": "EVALUATE:variables.headers"
256
+ },
257
+ "conditions": {
258
+ "if": "EVALUATE:true"
259
+ }
260
+ }
261
+ ]
262
+ },
263
+ "pins": []
264
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "description": "L'utilisateur a formulé une demande.",
3
+ "summary": "Demande d'information",
4
+ "library": "@digipair/skill-service",
5
+ "element": "task",
6
+ "metadata": {},
7
+ "properties": {
8
+ "execute": [
9
+ {
10
+ "library": "@digipair/skill-basic",
11
+ "element": "setVariable",
12
+ "properties": {
13
+ "name": "openapi",
14
+ "execute": [
15
+ {
16
+ "library": "@digipair/skill-http",
17
+ "element": "read",
18
+ "properties": { "path": "EVALUATE:privates.OPENAPI_URL" }
19
+ }
20
+ ]
21
+ }
22
+ },
23
+ {
24
+ "library": "@digipair/skill-basic",
25
+ "element": "setVariable",
26
+ "properties": {
27
+ "name": "server",
28
+ "value": "EVALUATE:variables.openapi.servers[1].url"
29
+ }
30
+ },
31
+ {
32
+ "library": "@digipair/skill-basic",
33
+ "element": "setVariable",
34
+ "properties": { "name": "path", "value": "EVALUATE:request.body.path" }
35
+ },
36
+ {
37
+ "library": "@digipair/skill-basic",
38
+ "element": "setVariable",
39
+ "properties": {
40
+ "name": "method",
41
+ "value": "EVALUATE:request.body.method"
42
+ }
43
+ },
44
+ {
45
+ "library": "@digipair/skill-basic",
46
+ "element": "setVariable",
47
+ "properties": { "name": "body", "value": "EVALUATE:request.body.body" }
48
+ },
49
+ {
50
+ "library": "@digipair/skill-basic",
51
+ "element": "setVariable",
52
+ "properties": {
53
+ "name": "headers",
54
+ "value": "EVALUATE:context merge([\n request.body, \n context([{ \"key\": privates.OPENAPI_AUTHORIZATION_KEY, \"value\": privates.OPENAPI_AUTHORIZATION_VALUE }])\n])"
55
+ }
56
+ },
57
+ {
58
+ "library": "@digipair/skill-http",
59
+ "element": "request",
60
+ "properties": {
61
+ "path": "EVALUATE:variables.server + variables.path",
62
+ "method": "EVALUATE:variables.method",
63
+ "body": "EVALUATE:if variables.method != \"get\" and variables.method != \"head\" then variables.body else null",
64
+ "headers": "EVALUATE:variables.headers"
65
+ }
66
+ }
67
+ ]
68
+ },
69
+ "pins": []
70
+ }
@@ -0,0 +1,175 @@
1
+ {
2
+ "description": "Référence à un fichier de schéma JSON.",
3
+ "summary": "Schéma JSON",
4
+ "library": "@digipair/skill-service",
5
+ "element": "service",
6
+ "metadata": {},
7
+ "properties": {
8
+ "execute": [
9
+ {
10
+ "library": "@digipair/skill-factory",
11
+ "element": "headers",
12
+ "properties": {
13
+ "headers": {
14
+ "Content-Type": "application/json"
15
+ }
16
+ }
17
+ },
18
+ {
19
+ "library": "@digipair/skill-basic",
20
+ "element": "setVariable",
21
+ "properties": {
22
+ "name": "openapi",
23
+ "execute": [
24
+ {
25
+ "library": "@digipair/skill-http",
26
+ "element": "read",
27
+ "properties": {
28
+ "path": "EVALUATE:privates.OPENAPI_URL"
29
+ }
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "library": "@digipair/skill-basic",
36
+ "element": "setVariable",
37
+ "properties": {
38
+ "name": "paths",
39
+ "execute": [
40
+ {
41
+ "library": "@digipair/skill-basic",
42
+ "element": "transform",
43
+ "properties": {
44
+ "execute": [
45
+ {
46
+ "library": "@digipair/skill-basic",
47
+ "element": "setVariable",
48
+ "properties": {
49
+ "name": "params",
50
+ "value": []
51
+ }
52
+ },
53
+ {
54
+ "library": "@digipair/skill-basic",
55
+ "element": "transform",
56
+ "properties": {
57
+ "execute": [
58
+ {
59
+ "library": "@digipair/skill-basic",
60
+ "element": "setVariable",
61
+ "properties": {
62
+ "name": "params",
63
+ "value": "EVALUATE:item.value"
64
+ }
65
+ }
66
+ ]
67
+ },
68
+ "conditions": {
69
+ "if": "EVALUATE:item.key = \"parameters\"",
70
+ "each": "EVALUATE:get entries(item.value)"
71
+ }
72
+ },
73
+ {
74
+ "library": "@digipair/skill-basic",
75
+ "element": "transform",
76
+ "properties": {
77
+ "execute": [
78
+ {
79
+ "library": "@digipair/skill-basic",
80
+ "element": "setVariable",
81
+ "properties": {
82
+ "name": "path",
83
+ "value": {
84
+ "key": "EVALUATE:replace(replace(replace(item.value.operationId, \"/\", \"\"), \"\\{\", \"\"), \"\\}\", \"\")",
85
+ "value": "EVALUATE:item.value",
86
+ "method": "EVALUATE:item.key"
87
+ }
88
+ }
89
+ },
90
+ {
91
+ "library": "@digipair/skill-basic",
92
+ "element": "setVariable",
93
+ "properties": {
94
+ "name": "parameters",
95
+ "execute": [
96
+ {
97
+ "library": "@digipair/skill-basic",
98
+ "element": "transform",
99
+ "properties": {
100
+ "value": {
101
+ "name": "EVALUATE:item.name",
102
+ "summary": "EVALUATE:item.name",
103
+ "description": "EVALUATE:if item.description != null then item.description else item.name",
104
+ "required": "EVALUATE:if item.required = true then true else false",
105
+ "schema": {
106
+ "type": "EVALUATE:if list contains([\"string\", \"number\", \"boolean\"], item.schema.type) then item.schema.type else \"object\""
107
+ }
108
+ }
109
+ },
110
+ "conditions": {
111
+ "each": "EVALUATE:if variables.path.value.parameters != null then concatenate(variables.path.value.parameters, variables.params) else variables.params"
112
+ }
113
+ },
114
+ {
115
+ "library": "@digipair/skill-basic",
116
+ "element": "transform",
117
+ "properties": {
118
+ "value": "EVALUATE:if variables.path.value.requestBody != null then \n append(previous, { \n \"name\": \"body\",\n \"summary\": \"body\",\n \"description\": \"body\",\n \"required\": if variables.path.value.requestBody.required = true then true else false,\n \"schema\": { \"type\": \"object\" }\n }) \nelse previous"
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ {
125
+ "library": "@digipair/skill-basic",
126
+ "element": "transform",
127
+ "properties": {
128
+ "value": {
129
+ "key": "EVALUATE:\"/\" + variables.path.key",
130
+ "value": {
131
+ "post": {
132
+ "tags": ["service"],
133
+ "summary": "EVALUATE:if variables.path.value.summary != null then variables.path.value.summary else variables.path.value.operationId",
134
+ "description": "EVALUATE:if variables.path.value.description != null then variables.path.value.description else variables.path.value.operationId",
135
+ "parameters": "EVALUATE:variables.parameters",
136
+ "x-events": []
137
+ }
138
+ }
139
+ }
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ "conditions": {
145
+ "if": "EVALUATE:item.key = \"get\" or item.key = \"post\" or item.key = \"put\" or item.key = \"delete\" or item.key = \"patch\" or item.key = \"head\"",
146
+ "each": "EVALUATE:get entries(item.value)"
147
+ }
148
+ }
149
+ ]
150
+ },
151
+ "conditions": {
152
+ "each": "EVALUATE:get entries(variables.openapi.paths)"
153
+ }
154
+ },
155
+ {
156
+ "library": "@digipair/skill-basic",
157
+ "element": "transform",
158
+ "properties": {
159
+ "value": "EVALUATE:flatten(previous)"
160
+ }
161
+ }
162
+ ]
163
+ }
164
+ },
165
+ {
166
+ "library": "@digipair/skill-basic",
167
+ "element": "transform",
168
+ "properties": {
169
+ "value": "{\n \"openapi\": \"3.0.0\",\n \"info\": {\n \"title\": \"digipair:<%= digipair %>\",\n \"summary\": \"<%= name %>\",\n \"version\": \"0.1.0\",\n \"x-icon\": \"🤖\"\n },\n \"paths\": {\n {{#variables.paths}}\n {{JSONstringify key}}: {{JSONstringify value}},\n {{/variables.paths}}\n \"/answer\": {\n \"post\": {\n \"tags\": [\n \"boost\"\n ],\n \"summary\": \"Response\",\n \"parameters\": [\n {\n \"name\": \"prompt\",\n \"required\": false,\n \"description\": \"User question\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"assistant\",\n \"required\": true,\n \"summary\": \"Assistant's response\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"userId\",\n \"required\": false,\n \"summary\": \"User Id\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"boost\",\n \"required\": false,\n \"summary\": \"Boost used to push the user request\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Boost\"\n }\n }\n },\n {\n \"name\": \"command\",\n \"required\": false,\n \"summary\": \"Commands executed on the chatbot\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"https://schemas.digipair.ai/pinsSettings\"\n }\n }\n },\n {\n \"name\": \"boosts\",\n \"required\": false,\n \"summary\": \"List of proposed boosts\",\n \"schema\": {\n \"type\": \"object\"\n }\n },\n {\n \"name\": \"sources\",\n \"required\": false,\n \"summary\": \"List of sources used to respond to the user\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n }\n },\n {\n \"name\": \"logs\",\n \"required\": false,\n \"summary\": \"Useful information for debugging reasoning\",\n \"schema\": {\n \"type\": \"object\"\n }\n }\n ],\n \"x-events\": []\n }\n },\n \"/request\": {\n \"post\": {\n \"tags\": [\n \"service\"\n ],\n \"summary\": \"Request\",\n \"parameters\": [\n {\n \"name\": \"path\",\n \"required\": true,\n \"summary\": \"Path\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"method\",\n \"required\": true,\n \"summary\": \"Method\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"body\",\n \"required\": false,\n \"summary\": \"Body\",\n \"schema\": {\n \"type\": \"object\"\n }\n },\n {\n \"name\": \"headers\",\n \"required\": false,\n \"summary\": \"Headers\",\n \"schema\": {\n \"type\": \"object\"\n }\n }\n ],\n \"x-events\": []\n }\n }\n },\n \"components\": {\n \"schemas\": {\n \"Boost\": {\n \"type\": \"object\",\n \"tags\": [\n \"boost\"\n ],\n \"summary\": \"Boost\",\n \"properties\": {\n \"prompt\": {\n \"type\": \"boolean\"\n },\n \"required\": {\n \"type\": \"boolean\"\n },\n \"selector\": {\n \"type\": \"string\"\n },\n \"url\": {\n \"type\": \"string\"\n },\n \"step\": {\n \"type\": \"string\"\n },\n \"inputs\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"https://schemas.digipair.ai/pinsSettings\"\n }\n }\n },\n \"required\": []\n }\n }\n }\n}"
170
+ }
171
+ }
172
+ ]
173
+ },
174
+ "pins": []
175
+ }