@loopstack/accessing-tool-results-example-workflow 0.19.0 → 0.20.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/README.md +54 -16
- package/dist/workflow-tool-results.workflow.d.ts +10 -2
- package/dist/workflow-tool-results.workflow.d.ts.map +1 -1
- package/dist/workflow-tool-results.workflow.js +14 -12
- package/dist/workflow-tool-results.workflow.js.map +1 -1
- package/dist/workflow-tool-results.workflow.yaml +4 -4
- package/package.json +5 -5
- package/src/__tests__/workflow-tool-results.workflow.spec.ts +11 -11
- package/src/workflow-tool-results.workflow.ts +14 -14
- package/src/workflow-tool-results.workflow.yaml +4 -4
package/README.md
CHANGED
|
@@ -10,10 +10,10 @@ The Tool Results Example Workflow shows how to retrieve and use data returned by
|
|
|
10
10
|
|
|
11
11
|
By using this workflow as a reference, you'll learn how to:
|
|
12
12
|
|
|
13
|
-
- Access tool results using call IDs
|
|
13
|
+
- Access tool results using call IDs via `runtime.tools`
|
|
14
14
|
- Access tool results using call indices
|
|
15
15
|
- Retrieve data from previous transitions
|
|
16
|
-
- Create custom helper functions for data extraction
|
|
16
|
+
- Create custom helper functions that access `runtime` for data extraction
|
|
17
17
|
|
|
18
18
|
This example is useful for developers learning to build data-driven workflows that need to pass information between steps.
|
|
19
19
|
|
|
@@ -48,18 +48,48 @@ Use npm install if you want to use and maintain the module as node dependency.
|
|
|
48
48
|
|
|
49
49
|
> This step is automatically done for you when using the `loopstack add` command.
|
|
50
50
|
|
|
51
|
-
- Add `
|
|
51
|
+
- Add `ToolResultsExampleModule` to the imports of `default.module.ts` or any other custom module.
|
|
52
52
|
- Inject the `WorkflowToolResultsWorkflow` workflow to your workspace class using the `@InjectWorkflow()` decorator.
|
|
53
53
|
|
|
54
54
|
See here for more information about working with [Modules](https://loopstack.ai/docs/building-with-loopstack/creating-a-module) and [Workspaces](https://loopstack.ai/docs/building-with-loopstack/creating-workspaces)
|
|
55
55
|
|
|
56
56
|
## How It Works
|
|
57
57
|
|
|
58
|
+
### Workflow Class
|
|
59
|
+
|
|
60
|
+
The workflow declares tools, typed runtime, and a helper function:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
@Workflow({
|
|
64
|
+
configFile: __dirname + '/workflow-tool-results.workflow.yaml',
|
|
65
|
+
})
|
|
66
|
+
export class WorkflowToolResultsWorkflow {
|
|
67
|
+
@InjectTool() private createValue: CreateValue;
|
|
68
|
+
@InjectTool() private createChatMessage: CreateChatMessage;
|
|
69
|
+
|
|
70
|
+
@Runtime()
|
|
71
|
+
runtime: {
|
|
72
|
+
tools: {
|
|
73
|
+
create_some_data: {
|
|
74
|
+
say_hello: {
|
|
75
|
+
data: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
@DefineHelper()
|
|
82
|
+
theMessage(): string {
|
|
83
|
+
return this.runtime.tools.create_some_data.say_hello.data;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
58
88
|
### Accessing Tool Results
|
|
59
89
|
|
|
60
90
|
#### 1. Using Call IDs
|
|
61
91
|
|
|
62
|
-
Assign a unique `id` to a tool call, then reference it via `
|
|
92
|
+
Assign a unique `id` to a tool call, then reference it via `runtime.tools.<transition_id>.<call_id>.data`:
|
|
63
93
|
|
|
64
94
|
```yaml
|
|
65
95
|
- id: say_hello
|
|
@@ -69,7 +99,8 @@ Assign a unique `id` to a tool call, then reference it via `metadata.tools.<tran
|
|
|
69
99
|
|
|
70
100
|
- tool: createChatMessage
|
|
71
101
|
args:
|
|
72
|
-
|
|
102
|
+
role: 'assistant'
|
|
103
|
+
content: 'Data from specific call id: {{ runtime.tools.create_some_data.say_hello.data }}'
|
|
73
104
|
```
|
|
74
105
|
|
|
75
106
|
#### 2. Using Call Indices
|
|
@@ -79,37 +110,44 @@ Access tool results by their position (zero-indexed) within the transition:
|
|
|
79
110
|
```yaml
|
|
80
111
|
- tool: createChatMessage
|
|
81
112
|
args:
|
|
82
|
-
|
|
113
|
+
role: 'assistant'
|
|
114
|
+
content: 'Data from first tool call: {{ runtime.tools.create_some_data.0.data }}'
|
|
83
115
|
```
|
|
84
116
|
|
|
85
117
|
#### 3. Across Transitions
|
|
86
118
|
|
|
87
|
-
Tool results persist and can be accessed from subsequent transitions using the same patterns:
|
|
119
|
+
Tool results persist and can be accessed from subsequent transitions using the same `runtime.tools` patterns:
|
|
88
120
|
|
|
89
121
|
```yaml
|
|
90
122
|
# In a later transition
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
123
|
+
- id: access_data
|
|
124
|
+
from: data_created
|
|
125
|
+
to: end
|
|
126
|
+
call:
|
|
127
|
+
- tool: createChatMessage
|
|
128
|
+
args:
|
|
129
|
+
role: 'assistant'
|
|
130
|
+
content: 'Data from previous transition: {{ runtime.tools.create_some_data.say_hello.data }}'
|
|
94
131
|
```
|
|
95
132
|
|
|
96
133
|
#### 4. Using Helper Functions
|
|
97
134
|
|
|
98
|
-
Define custom helper functions in your workflow class
|
|
135
|
+
Define custom helper functions in your workflow class that access `this.runtime` directly:
|
|
99
136
|
|
|
100
137
|
```typescript
|
|
101
138
|
@DefineHelper()
|
|
102
|
-
|
|
103
|
-
return
|
|
139
|
+
theMessage(): string {
|
|
140
|
+
return this.runtime.tools.create_some_data.say_hello.data;
|
|
104
141
|
}
|
|
105
142
|
```
|
|
106
143
|
|
|
107
|
-
Then use them in your YAML configuration:
|
|
144
|
+
Then use them in your YAML configuration (no arguments needed):
|
|
108
145
|
|
|
109
146
|
```yaml
|
|
110
147
|
- tool: createChatMessage
|
|
111
148
|
args:
|
|
112
|
-
|
|
149
|
+
role: 'assistant'
|
|
150
|
+
content: 'Data access using custom helper: {{ theMessage }}'
|
|
113
151
|
```
|
|
114
152
|
|
|
115
153
|
## Dependencies
|
|
@@ -117,7 +155,7 @@ Then use them in your YAML configuration:
|
|
|
117
155
|
This workflow uses the following Loopstack modules:
|
|
118
156
|
|
|
119
157
|
- `@loopstack/core` - Core framework functionality
|
|
120
|
-
- `@loopstack/
|
|
158
|
+
- `@loopstack/create-chat-message-tool` - Provides `CreateChatMessage` tool
|
|
121
159
|
- `@loopstack/create-value-tool` - Provides `CreateValue` tool
|
|
122
160
|
|
|
123
161
|
## About
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { WorkflowMetadataInterface } from '@loopstack/common';
|
|
2
1
|
export declare class WorkflowToolResultsWorkflow {
|
|
3
2
|
private createValue;
|
|
4
3
|
private createChatMessage;
|
|
5
|
-
|
|
4
|
+
runtime: {
|
|
5
|
+
tools: {
|
|
6
|
+
create_some_data: {
|
|
7
|
+
say_hello: {
|
|
8
|
+
data: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
theMessage(): string;
|
|
6
14
|
}
|
|
7
15
|
//# sourceMappingURL=workflow-tool-results.workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-tool-results.workflow.d.ts","sourceRoot":"","sources":["../src/workflow-tool-results.workflow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-tool-results.workflow.d.ts","sourceRoot":"","sources":["../src/workflow-tool-results.workflow.ts"],"names":[],"mappings":"AAIA,qBAGa,2BAA2B;IACxB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,iBAAiB,CAAoB;IAG3D,OAAO,EAAE;QACP,KAAK,EAAE;YACL,gBAAgB,EAAE;gBAChB,SAAS,EAAE;oBACT,IAAI,EAAE,MAAM,CAAC;iBACd,CAAC;aACH,CAAC;SACH,CAAC;KACH,CAAC;IAGF,UAAU,IAAI,MAAM;CAGrB"}
|
|
@@ -10,36 +10,38 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.WorkflowToolResultsWorkflow = void 0;
|
|
13
|
-
const common_1 = require("@
|
|
14
|
-
const common_2 = require("@loopstack/common");
|
|
13
|
+
const common_1 = require("@loopstack/common");
|
|
15
14
|
const create_chat_message_tool_1 = require("@loopstack/create-chat-message-tool");
|
|
16
15
|
const create_value_tool_1 = require("@loopstack/create-value-tool");
|
|
17
16
|
let WorkflowToolResultsWorkflow = class WorkflowToolResultsWorkflow {
|
|
18
17
|
createValue;
|
|
19
18
|
createChatMessage;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return tools.create_some_data.say_hello.data;
|
|
19
|
+
runtime;
|
|
20
|
+
theMessage() {
|
|
21
|
+
return this.runtime.tools.create_some_data.say_hello.data;
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
exports.WorkflowToolResultsWorkflow = WorkflowToolResultsWorkflow;
|
|
26
25
|
__decorate([
|
|
27
|
-
(0,
|
|
26
|
+
(0, common_1.InjectTool)(),
|
|
28
27
|
__metadata("design:type", create_value_tool_1.CreateValue)
|
|
29
28
|
], WorkflowToolResultsWorkflow.prototype, "createValue", void 0);
|
|
30
29
|
__decorate([
|
|
31
|
-
(0,
|
|
30
|
+
(0, common_1.InjectTool)(),
|
|
32
31
|
__metadata("design:type", create_chat_message_tool_1.CreateChatMessage)
|
|
33
32
|
], WorkflowToolResultsWorkflow.prototype, "createChatMessage", void 0);
|
|
34
33
|
__decorate([
|
|
35
|
-
(0,
|
|
34
|
+
(0, common_1.Runtime)(),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], WorkflowToolResultsWorkflow.prototype, "runtime", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, common_1.DefineHelper)(),
|
|
36
39
|
__metadata("design:type", Function),
|
|
37
|
-
__metadata("design:paramtypes", [
|
|
40
|
+
__metadata("design:paramtypes", []),
|
|
38
41
|
__metadata("design:returntype", String)
|
|
39
|
-
], WorkflowToolResultsWorkflow.prototype, "
|
|
42
|
+
], WorkflowToolResultsWorkflow.prototype, "theMessage", null);
|
|
40
43
|
exports.WorkflowToolResultsWorkflow = WorkflowToolResultsWorkflow = __decorate([
|
|
41
|
-
(0, common_1.
|
|
42
|
-
(0, common_2.Workflow)({
|
|
44
|
+
(0, common_1.Workflow)({
|
|
43
45
|
configFile: __dirname + '/workflow-tool-results.workflow.yaml',
|
|
44
46
|
})
|
|
45
47
|
], WorkflowToolResultsWorkflow);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-tool-results.workflow.js","sourceRoot":"","sources":["../src/workflow-tool-results.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"workflow-tool-results.workflow.js","sourceRoot":"","sources":["../src/workflow-tool-results.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAgF;AAChF,kFAAwE;AACxE,oEAA2D;AAKpD,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAChB,WAAW,CAAc;IACzB,iBAAiB,CAAoB;IAG3D,OAAO,CAQL;IAGF,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC;IAC5D,CAAC;CACF,CAAA;AAnBY,kEAA2B;AAChB;IAArB,IAAA,mBAAU,GAAE;8BAAsB,+BAAW;gEAAC;AACzB;IAArB,IAAA,mBAAU,GAAE;8BAA4B,4CAAiB;sEAAC;AAG3D;IADC,IAAA,gBAAO,GAAE;;4DASR;AAGF;IADC,IAAA,qBAAY,GAAE;;;;6DAGd;sCAlBU,2BAA2B;IAHvC,IAAA,iBAAQ,EAAC;QACR,UAAU,EAAE,SAAS,GAAG,sCAAsC;KAC/D,CAAC;GACW,2BAA2B,CAmBvC"}
|
|
@@ -15,13 +15,13 @@ transitions:
|
|
|
15
15
|
- tool: createChatMessage
|
|
16
16
|
args:
|
|
17
17
|
role: 'assistant'
|
|
18
|
-
content: 'Data from specific call id: {{
|
|
18
|
+
content: 'Data from specific call id: {{ runtime.tools.create_some_data.say_hello.data }}'
|
|
19
19
|
|
|
20
20
|
# Access the data using the call index
|
|
21
21
|
- tool: createChatMessage
|
|
22
22
|
args:
|
|
23
23
|
role: 'assistant'
|
|
24
|
-
content: 'Data from first tool call: {{
|
|
24
|
+
content: 'Data from first tool call: {{ runtime.tools.create_some_data.0.data }}'
|
|
25
25
|
|
|
26
26
|
- id: access_data
|
|
27
27
|
from: data_created
|
|
@@ -31,10 +31,10 @@ transitions:
|
|
|
31
31
|
- tool: createChatMessage
|
|
32
32
|
args:
|
|
33
33
|
role: 'assistant'
|
|
34
|
-
content: 'Data from previous transition: {{
|
|
34
|
+
content: 'Data from previous transition: {{ runtime.tools.create_some_data.say_hello.data }}'
|
|
35
35
|
|
|
36
36
|
# Access the data using a custom helper function of the workflow
|
|
37
37
|
- tool: createChatMessage
|
|
38
38
|
args:
|
|
39
39
|
role: 'assistant'
|
|
40
|
-
content: 'Data access using custom helper: {{
|
|
40
|
+
content: 'Data access using custom helper: {{ theMessage }}'
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"tool",
|
|
11
11
|
"workflow"
|
|
12
12
|
],
|
|
13
|
-
"version": "0.
|
|
13
|
+
"version": "0.20.1",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"author": {
|
|
16
16
|
"name": "Jakob Klippel",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"watch": "nest build --watch"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@loopstack/common": "^0.
|
|
35
|
-
"@loopstack/core-ui-module": "^0.
|
|
36
|
-
"@loopstack/create-chat-message-tool": "^0.
|
|
37
|
-
"@loopstack/create-value-tool": "^0.
|
|
34
|
+
"@loopstack/common": "^0.20.0",
|
|
35
|
+
"@loopstack/core-ui-module": "^0.20.1",
|
|
36
|
+
"@loopstack/create-chat-message-tool": "^0.20.1",
|
|
37
|
+
"@loopstack/create-value-tool": "^0.20.1",
|
|
38
38
|
"@nestjs/common": "^11.1.12",
|
|
39
39
|
"zod": "^4.3.5"
|
|
40
40
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestingModule } from '@nestjs/testing';
|
|
2
|
-
import {
|
|
2
|
+
import { RunContext, getBlockHelpers } from '@loopstack/common';
|
|
3
3
|
import { WorkflowProcessorService } from '@loopstack/core';
|
|
4
4
|
import { CoreUiModule } from '@loopstack/core-ui-module';
|
|
5
5
|
import { CreateChatMessage, CreateChatMessageToolModule } from '@loopstack/create-chat-message-tool';
|
|
@@ -39,12 +39,12 @@ describe('WorkflowToolResultsWorkflow', () => {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('should have extractMessage helper', () => {
|
|
42
|
-
expect(getBlockHelpers(workflow)).toContain('
|
|
42
|
+
expect(getBlockHelpers(workflow)).toContain('theMessage');
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
describe('tool result access', () => {
|
|
46
46
|
it('should access tool results by call id and index in same transition', async () => {
|
|
47
|
-
const context =
|
|
47
|
+
const context = {} as RunContext;
|
|
48
48
|
mockCreateValue.execute.mockResolvedValue({ data: 'Hello World.' });
|
|
49
49
|
mockCreateChatMessage.execute.mockResolvedValue({ data: undefined });
|
|
50
50
|
|
|
@@ -55,6 +55,7 @@ describe('WorkflowToolResultsWorkflow', () => {
|
|
|
55
55
|
{ input: 'Hello World.' },
|
|
56
56
|
expect.anything(),
|
|
57
57
|
expect.anything(),
|
|
58
|
+
expect.anything(),
|
|
58
59
|
);
|
|
59
60
|
|
|
60
61
|
// Verify CreateChatMessage received resolved template values
|
|
@@ -65,6 +66,7 @@ describe('WorkflowToolResultsWorkflow', () => {
|
|
|
65
66
|
},
|
|
66
67
|
expect.anything(),
|
|
67
68
|
expect.anything(),
|
|
69
|
+
expect.anything(),
|
|
68
70
|
);
|
|
69
71
|
|
|
70
72
|
expect(mockCreateChatMessage.execute).toHaveBeenCalledWith(
|
|
@@ -74,20 +76,16 @@ describe('WorkflowToolResultsWorkflow', () => {
|
|
|
74
76
|
},
|
|
75
77
|
expect.anything(),
|
|
76
78
|
expect.anything(),
|
|
79
|
+
expect.anything(),
|
|
77
80
|
);
|
|
78
81
|
});
|
|
79
82
|
|
|
80
83
|
it('should access tool results from previous transition', async () => {
|
|
81
|
-
const context =
|
|
84
|
+
const context = {} as RunContext;
|
|
82
85
|
mockCreateValue.execute.mockResolvedValue({ data: 'Hello World.' });
|
|
83
86
|
mockCreateChatMessage.execute.mockResolvedValue({ data: undefined });
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// Should complete both transitions
|
|
88
|
-
const history = result.state.getHistory();
|
|
89
|
-
expect(history.some((h) => h.metadata.transition?.transition === 'create_some_data')).toBe(true);
|
|
90
|
-
expect(history.some((h) => h.metadata.transition?.transition === 'access_data')).toBe(true);
|
|
88
|
+
await processor.process(workflow, {}, context);
|
|
91
89
|
|
|
92
90
|
expect(mockCreateChatMessage.execute).toHaveBeenCalledWith(
|
|
93
91
|
{
|
|
@@ -96,11 +94,12 @@ describe('WorkflowToolResultsWorkflow', () => {
|
|
|
96
94
|
},
|
|
97
95
|
expect.anything(),
|
|
98
96
|
expect.anything(),
|
|
97
|
+
expect.anything(),
|
|
99
98
|
);
|
|
100
99
|
});
|
|
101
100
|
|
|
102
101
|
it('should access tool results using custom helper', async () => {
|
|
103
|
-
const context =
|
|
102
|
+
const context = {} as RunContext;
|
|
104
103
|
mockCreateValue.execute.mockResolvedValue({ data: 'Hello World.' });
|
|
105
104
|
mockCreateChatMessage.execute.mockResolvedValue({ data: undefined });
|
|
106
105
|
|
|
@@ -113,6 +112,7 @@ describe('WorkflowToolResultsWorkflow', () => {
|
|
|
113
112
|
},
|
|
114
113
|
expect.anything(),
|
|
115
114
|
expect.anything(),
|
|
115
|
+
expect.anything(),
|
|
116
116
|
);
|
|
117
117
|
});
|
|
118
118
|
});
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DefineHelper, InjectTool, Workflow, WorkflowMetadataInterface } from '@loopstack/common';
|
|
1
|
+
import { DefineHelper, InjectTool, Runtime, Workflow } from '@loopstack/common';
|
|
3
2
|
import { CreateChatMessage } from '@loopstack/create-chat-message-tool';
|
|
4
3
|
import { CreateValue } from '@loopstack/create-value-tool';
|
|
5
4
|
|
|
6
|
-
interface WorkflowToolsMetadata {
|
|
7
|
-
create_some_data: {
|
|
8
|
-
say_hello: {
|
|
9
|
-
data: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@Injectable()
|
|
15
5
|
@Workflow({
|
|
16
6
|
configFile: __dirname + '/workflow-tool-results.workflow.yaml',
|
|
17
7
|
})
|
|
@@ -19,9 +9,19 @@ export class WorkflowToolResultsWorkflow {
|
|
|
19
9
|
@InjectTool() private createValue: CreateValue;
|
|
20
10
|
@InjectTool() private createChatMessage: CreateChatMessage;
|
|
21
11
|
|
|
12
|
+
@Runtime()
|
|
13
|
+
runtime: {
|
|
14
|
+
tools: {
|
|
15
|
+
create_some_data: {
|
|
16
|
+
say_hello: {
|
|
17
|
+
data: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
22
23
|
@DefineHelper()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return tools.create_some_data.say_hello.data;
|
|
24
|
+
theMessage(): string {
|
|
25
|
+
return this.runtime.tools.create_some_data.say_hello.data;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -15,13 +15,13 @@ transitions:
|
|
|
15
15
|
- tool: createChatMessage
|
|
16
16
|
args:
|
|
17
17
|
role: 'assistant'
|
|
18
|
-
content: 'Data from specific call id: {{
|
|
18
|
+
content: 'Data from specific call id: {{ runtime.tools.create_some_data.say_hello.data }}'
|
|
19
19
|
|
|
20
20
|
# Access the data using the call index
|
|
21
21
|
- tool: createChatMessage
|
|
22
22
|
args:
|
|
23
23
|
role: 'assistant'
|
|
24
|
-
content: 'Data from first tool call: {{
|
|
24
|
+
content: 'Data from first tool call: {{ runtime.tools.create_some_data.0.data }}'
|
|
25
25
|
|
|
26
26
|
- id: access_data
|
|
27
27
|
from: data_created
|
|
@@ -31,10 +31,10 @@ transitions:
|
|
|
31
31
|
- tool: createChatMessage
|
|
32
32
|
args:
|
|
33
33
|
role: 'assistant'
|
|
34
|
-
content: 'Data from previous transition: {{
|
|
34
|
+
content: 'Data from previous transition: {{ runtime.tools.create_some_data.say_hello.data }}'
|
|
35
35
|
|
|
36
36
|
# Access the data using a custom helper function of the workflow
|
|
37
37
|
- tool: createChatMessage
|
|
38
38
|
args:
|
|
39
39
|
role: 'assistant'
|
|
40
|
-
content: 'Data access using custom helper: {{
|
|
40
|
+
content: 'Data access using custom helper: {{ theMessage }}'
|