jsfe 0.5.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 +25 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,7 +139,7 @@ async function aiCallback(systemInstruction, userMessage) {
|
|
|
139
139
|
method: "POST",
|
|
140
140
|
headers: {
|
|
141
141
|
"Content-Type": "application/json",
|
|
142
|
-
"Authorization": `Bearer ${
|
|
142
|
+
"Authorization": `Bearer ${process.env.OPENAI_API_KEY}`
|
|
143
143
|
},
|
|
144
144
|
body: JSON.stringify({
|
|
145
145
|
model: "gpt-4o-mini",
|
|
@@ -201,11 +201,34 @@ const flowsMenu = [
|
|
|
201
201
|
steps: [
|
|
202
202
|
{ type: "SAY", value: "Let's process your payment." },
|
|
203
203
|
{ type: "SAY-GET", variable: "amount", value: "Enter amount:" },
|
|
204
|
-
{ type: "CALL-TOOL", tool: "PaymentProcessor", args: {...} }
|
|
204
|
+
{ type: "CALL-TOOL", tool: "PaymentProcessor", args: {...}, variable: "payment_result", }
|
|
205
205
|
]
|
|
206
206
|
}
|
|
207
207
|
];
|
|
208
208
|
```
|
|
209
|
+
#### Referencing Tool Results in Later Steps
|
|
210
|
+
When a CALL-TOOL step finishes, it can store the returned data into a variable you name via the variable property. That variable will hold the entire return object from the tool.
|
|
211
|
+
```javascript
|
|
212
|
+
Using variable
|
|
213
|
+
{
|
|
214
|
+
"type": "CALL-TOOL",
|
|
215
|
+
"tool": "CreateSupportTicket",
|
|
216
|
+
"variable": "ticket_result",
|
|
217
|
+
"args": {
|
|
218
|
+
"subject": "{{subject}}",
|
|
219
|
+
"description": "{{description}}",
|
|
220
|
+
"customer_email": "{{customer_email}}"
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"type": "SAY",
|
|
225
|
+
"value": "Ticket created: {{ticket_result.ticket.id}} — we'll email updates to {{ticket_result.ticket.customer_email}}."
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
##### Important:
|
|
229
|
+
Whatever your tool returns becomes the value of the variable you specify.
|
|
230
|
+
Because you get the raw return object, you do not need to use .result in your template paths—just reference the keys the tool returns (ticket_result.ticket.id, ticket_result.ok, etc.).
|
|
231
|
+
If you omit variable, you won’t be able to access the tool’s output later.
|
|
209
232
|
|
|
210
233
|
#### 2. **Tools Registry** - External Integrations
|
|
211
234
|
```javascript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "TypeScript workflow engine for conversational/automation apps: multi-flow orchestration, interrupt/resume, stack-based control, robust errors, and flexible tool/REST integration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ron Pinkas",
|