Skip to content

Commit

Permalink
feat(agents-api): Add parallel flag to map reduce
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <diwank.singh@gmail.com>
  • Loading branch information
creatorrr committed Sep 4, 2024
1 parent 95e0df6 commit 1860574
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 0 deletions.
14 changes: 14 additions & 0 deletions agents-api/agents_api/autogen/Tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ class Main(BaseModel):
A special parameter named `results` is the accumulator and `_` is the current value.
"""
initial: Any = []
"""
The initial value of the reduce expression
"""
parallel: StrictBool = False
"""
Whether to run the reduce expression in parallel
"""


class MainModel(BaseModel):
Expand Down Expand Up @@ -381,6 +388,13 @@ class MainModel(BaseModel):
A special parameter named `results` is the accumulator and `_` is the current value.
"""
initial: Any = []
"""
The initial value of the reduce expression
"""
parallel: StrictBool = False
"""
Whether to run the reduce expression in parallel
"""


class ParallelStep(BaseModel):
Expand Down
7 changes: 7 additions & 0 deletions sdks/ts/src/api/models/Tasks_CreateTaskRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ export type Tasks_CreateTaskRequest = Record<
* A special parameter named `results` is the accumulator and `_` is the current value.
*/
reduce?: Common_PyExpression;
/**
* The initial value of the reduce expression
*/
initial?: any;
/**
* Whether to run the reduce expression in parallel
*/
parallel?: boolean;
})
>
>;
7 changes: 7 additions & 0 deletions sdks/ts/src/api/models/Tasks_PatchTaskRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ export type Tasks_PatchTaskRequest = Record<
* A special parameter named `results` is the accumulator and `_` is the current value.
*/
reduce?: Common_PyExpression;
/**
* The initial value of the reduce expression
*/
initial?: any;
/**
* Whether to run the reduce expression in parallel
*/
parallel?: boolean;
})
>
>;
7 changes: 7 additions & 0 deletions sdks/ts/src/api/models/Tasks_Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ export type Tasks_Task = Record<
* A special parameter named `results` is the accumulator and `_` is the current value.
*/
reduce?: Common_PyExpression;
/**
* The initial value of the reduce expression
*/
initial?: any;
/**
* Whether to run the reduce expression in parallel
*/
parallel?: boolean;
})
>
>;
7 changes: 7 additions & 0 deletions sdks/ts/src/api/models/Tasks_UpdateTaskRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ export type Tasks_UpdateTaskRequest = Record<
* A special parameter named `results` is the accumulator and `_` is the current value.
*/
reduce?: Common_PyExpression;
/**
* The initial value of the reduce expression
*/
initial?: any;
/**
* Whether to run the reduce expression in parallel
*/
parallel?: boolean;
})
>
>;
5 changes: 5 additions & 0 deletions sdks/ts/src/api/schemas/$Tasks_CreateTaskRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ export const $Tasks_CreateTaskRequest = {
],
},
initial: {
description: `The initial value of the reduce expression`,
properties: {},
},
parallel: {
type: "boolean",
description: `Whether to run the reduce expression in parallel`,
},
},
},
],
Expand Down
5 changes: 5 additions & 0 deletions sdks/ts/src/api/schemas/$Tasks_PatchTaskRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ export const $Tasks_PatchTaskRequest = {
],
},
initial: {
description: `The initial value of the reduce expression`,
properties: {},
},
parallel: {
type: "boolean",
description: `Whether to run the reduce expression in parallel`,
},
},
},
],
Expand Down
5 changes: 5 additions & 0 deletions sdks/ts/src/api/schemas/$Tasks_Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ export const $Tasks_Task = {
],
},
initial: {
description: `The initial value of the reduce expression`,
properties: {},
},
parallel: {
type: "boolean",
description: `Whether to run the reduce expression in parallel`,
},
},
},
],
Expand Down
5 changes: 5 additions & 0 deletions sdks/ts/src/api/schemas/$Tasks_UpdateTaskRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ export const $Tasks_UpdateTaskRequest = {
],
},
initial: {
description: `The initial value of the reduce expression`,
properties: {},
},
parallel: {
type: "boolean",
description: `Whether to run the reduce expression in parallel`,
},
},
},
],
Expand Down
4 changes: 4 additions & 0 deletions typespec/tasks/steps.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ model MapReduceStep<Value = unknown, Accumulator = Array<Value>> extends BaseWor
* A special parameter named `results` is the accumulator and `_` is the current value. */
reduce?: ReduceExpression<Value, Accumulator>;

/** The initial value of the reduce expression */
initial?: unknown = #[];

/** Whether to run the reduce expression in parallel */
parallel?: boolean = false;
}

/////////////////////////
Expand Down

0 comments on commit 1860574

Please sign in to comment.