File tree Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ impl DriaComputeNode {
11
11
/// Returns the task count within the channels, `single` and `batch`.
12
12
#[ inline( always) ]
13
13
pub fn get_pending_task_count ( & self ) -> [ usize ; 2 ] {
14
+ // TODO: return the number of tasks in the channels as well
14
15
[
15
16
self . pending_tasks_single . len ( ) ,
16
17
self . pending_tasks_batch . len ( ) ,
Original file line number Diff line number Diff line change
1
+ use dkn_workflows:: { Executor , Model , Workflow } ;
2
+
3
+ #[ tokio:: test]
4
+ #[ ignore = "requires API keys" ]
5
+ async fn test_workflow ( ) {
6
+ dotenvy:: dotenv ( ) . ok ( ) ; // read api key
7
+ let workflow = serde_json:: from_value :: < Workflow > ( serde_json:: json!( {
8
+ "steps" : [ { "source" : "A" , "target" : "__end" } ] ,
9
+ "tasks" : [
10
+ {
11
+ "id" : "A" ,
12
+ "name" : "" ,
13
+ "outputs" : [
14
+ {
15
+ "key" : "result" ,
16
+ "type" : "write" ,
17
+ "value" : "__result"
18
+ }
19
+ ] ,
20
+ "messages" : [
21
+ {
22
+ "role" : "user" ,
23
+ "content" : "Hey there."
24
+ }
25
+ ] ,
26
+ "operator" : "generation" ,
27
+ "description" : ""
28
+ } ,
29
+ {
30
+ "id" : "__end" ,
31
+ "name" : "end" ,
32
+ "messages" : [
33
+ {
34
+ "role" : "user" ,
35
+ "content" : "End of the task"
36
+ }
37
+ ] ,
38
+ "operator" : "end" ,
39
+ "description" : "End of the task"
40
+ }
41
+ ] ,
42
+ "config" : {
43
+ "tools" : [
44
+ "ALL"
45
+ ] ,
46
+ "max_time" : 250 ,
47
+ "max_steps" : 10
48
+ } ,
49
+ "return_value" : {
50
+ "input" : {
51
+ "key" : "result" ,
52
+ "type" : "read"
53
+ }
54
+ }
55
+ } ) )
56
+ . unwrap ( ) ;
57
+
58
+ let executor = Executor :: new ( Model :: GPT4oMini ) ;
59
+ let result = executor
60
+ . execute ( None , & workflow, & mut Default :: default ( ) )
61
+ . await
62
+ . unwrap ( ) ;
63
+ println ! ( "Result: {:?}" , result) ;
64
+ }
You can’t perform that action at this time.
0 commit comments