Skip to content

Commit

Permalink
Merge pull request #461 from julep-ai/x/fix-typespec-foreach
Browse files Browse the repository at this point in the history
fix(agents-api): Fix typespec for foreach step and regenerate
  • Loading branch information
whiterabbit1983 authored Aug 19, 2024
2 parents 72da581 + 9c01928 commit 633c4f7
Show file tree
Hide file tree
Showing 41 changed files with 1,116 additions and 402 deletions.
18 changes: 9 additions & 9 deletions agents-api/agents_api/autogen/Tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CaseThen(BaseModel):
The condition to evaluate
"""
then: (
Any
EvaluateStep
| ToolCallStep
| YieldStep
| PromptStep
Expand Down Expand Up @@ -165,8 +165,8 @@ class ForeachDo(BaseModel):
"""
The variable to iterate over
"""
do: list[
Any
do: (
EvaluateStep
| ToolCallStep
| YieldStep
| PromptStep
Expand All @@ -179,7 +179,7 @@ class ForeachDo(BaseModel):
| EmbedStep
| SearchStep
| WaitForInputStep
]
)
"""
The steps to run for each iteration
"""
Expand Down Expand Up @@ -217,7 +217,7 @@ class IfElseWorkflowStep(BaseWorkflowStep):
The condition to evaluate
"""
then: (
Any
EvaluateStep
| ToolCallStep
| YieldStep
| PromptStep
Expand All @@ -235,7 +235,7 @@ class IfElseWorkflowStep(BaseWorkflowStep):
The steps to run if the condition is true
"""
else_: Annotated[
Any
EvaluateStep
| ToolCallStep
| YieldStep
| PromptStep
Expand Down Expand Up @@ -289,9 +289,9 @@ class MapReduceStep(BaseWorkflowStep):
"""
The steps to run for each iteration
"""
reduce: str
reduce: str | None = None
"""
The expression to reduce the results (`_` is a list of outputs)
The expression to reduce the results (`_` is a list of outputs). If not provided, the results are returned as a list.
"""


Expand All @@ -301,7 +301,7 @@ class ParallelStep(BaseWorkflowStep):
)
kind_: Literal["parallel"] = "parallel"
parallel: list[
Any
EvaluateStep
| ToolCallStep
| YieldStep
| PromptStep
Expand Down
232 changes: 116 additions & 116 deletions agents-api/poetry.lock

Large diffs are not rendered by default.

38 changes: 36 additions & 2 deletions sdks/python/julep/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@
TaskExecutionsRouteListRequestSortBy,
TaskExecutionsRouteListResponse,
TasksBaseWorkflowStep,
TasksBaseWorkflowStep_Embed,
TasksBaseWorkflowStep_Error,
TasksBaseWorkflowStep_Foreach,
TasksBaseWorkflowStep_Get,
TasksBaseWorkflowStep_IfElse,
TasksBaseWorkflowStep_Log,
TasksBaseWorkflowStep_MapReduce,
TasksBaseWorkflowStep_Parallel,
TasksBaseWorkflowStep_Prompt,
TasksBaseWorkflowStep_Return,
TasksBaseWorkflowStep_Search,
TasksBaseWorkflowStep_Set,
TasksBaseWorkflowStep_Sleep,
TasksBaseWorkflowStep_Switch,
TasksBaseWorkflowStep_ToolCall,
TasksBaseWorkflowStep_WaitForInput,
TasksBaseWorkflowStep_Yield,
TasksCaseThen,
TasksCaseThenThen,
TasksCreateTaskRequest,
Expand All @@ -152,7 +169,7 @@
TasksErrorWorkflowStep,
TasksEvaluateStep,
TasksForeachDo,
TasksForeachDoDoItem,
TasksForeachDoDo,
TasksForeachStep,
TasksGetStep,
TasksIfElseWorkflowStep,
Expand Down Expand Up @@ -393,6 +410,23 @@
"TaskExecutionsRouteListRequestSortBy",
"TaskExecutionsRouteListResponse",
"TasksBaseWorkflowStep",
"TasksBaseWorkflowStep_Embed",
"TasksBaseWorkflowStep_Error",
"TasksBaseWorkflowStep_Foreach",
"TasksBaseWorkflowStep_Get",
"TasksBaseWorkflowStep_IfElse",
"TasksBaseWorkflowStep_Log",
"TasksBaseWorkflowStep_MapReduce",
"TasksBaseWorkflowStep_Parallel",
"TasksBaseWorkflowStep_Prompt",
"TasksBaseWorkflowStep_Return",
"TasksBaseWorkflowStep_Search",
"TasksBaseWorkflowStep_Set",
"TasksBaseWorkflowStep_Sleep",
"TasksBaseWorkflowStep_Switch",
"TasksBaseWorkflowStep_ToolCall",
"TasksBaseWorkflowStep_WaitForInput",
"TasksBaseWorkflowStep_Yield",
"TasksCaseThen",
"TasksCaseThenThen",
"TasksCreateTaskRequest",
Expand All @@ -419,7 +453,7 @@
"TasksErrorWorkflowStep",
"TasksEvaluateStep",
"TasksForeachDo",
"TasksForeachDoDoItem",
"TasksForeachDoDo",
"TasksForeachStep",
"TasksGetStep",
"TasksIfElseWorkflowStep",
Expand Down
24 changes: 12 additions & 12 deletions sdks/python/julep/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ def tasks_route_create(
Returns
-------
CommonResourceCreatedResponse
The request has succeeded and a new resource has been created as a result.
The request has succeeded.
Examples
--------
Expand Down Expand Up @@ -1709,14 +1709,14 @@ def tasks_create_or_update_route_create_or_update(
input_schema: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> CommonResourceUpdatedResponse:
) -> CommonResourceCreatedResponse:
"""
Create or update a task
Parameters
----------
parent_id : CommonUuid
ID of parent resource
ID of the agent
id : CommonUuid
Expand All @@ -1743,8 +1743,8 @@ def tasks_create_or_update_route_create_or_update(
Returns
-------
CommonResourceUpdatedResponse
The request has succeeded.
CommonResourceCreatedResponse
The request has succeeded and a new resource has been created as a result.
Examples
--------
Expand Down Expand Up @@ -1787,7 +1787,7 @@ def tasks_create_or_update_route_create_or_update(
)
try:
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(CommonResourceUpdatedResponse, _response.json()) # type: ignore
return pydantic_v1.parse_obj_as(CommonResourceCreatedResponse, _response.json()) # type: ignore
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
Expand Down Expand Up @@ -4729,7 +4729,7 @@ async def tasks_route_create(
Returns
-------
CommonResourceCreatedResponse
The request has succeeded and a new resource has been created as a result.
The request has succeeded.
Examples
--------
Expand Down Expand Up @@ -5468,14 +5468,14 @@ async def tasks_create_or_update_route_create_or_update(
input_schema: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> CommonResourceUpdatedResponse:
) -> CommonResourceCreatedResponse:
"""
Create or update a task
Parameters
----------
parent_id : CommonUuid
ID of parent resource
ID of the agent
id : CommonUuid
Expand All @@ -5502,8 +5502,8 @@ async def tasks_create_or_update_route_create_or_update(
Returns
-------
CommonResourceUpdatedResponse
The request has succeeded.
CommonResourceCreatedResponse
The request has succeeded and a new resource has been created as a result.
Examples
--------
Expand Down Expand Up @@ -5554,7 +5554,7 @@ async def main() -> None:
)
try:
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(CommonResourceUpdatedResponse, _response.json()) # type: ignore
return pydantic_v1.parse_obj_as(CommonResourceCreatedResponse, _response.json()) # type: ignore
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/julep/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2345,7 +2345,7 @@ client.tasks_create_or_update_route_create_or_update(
<dl>
<dd>

**parent_id:** `CommonUuid` — ID of parent resource
**parent_id:** `CommonUuid` — ID of the agent

</dd>
</dl>
Expand Down
42 changes: 39 additions & 3 deletions sdks/python/julep/api/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,26 @@
TaskExecutionsRouteListRequestSortBy,
)
from .task_executions_route_list_response import TaskExecutionsRouteListResponse
from .tasks_base_workflow_step import TasksBaseWorkflowStep
from .tasks_base_workflow_step import (
TasksBaseWorkflowStep,
TasksBaseWorkflowStep_Embed,
TasksBaseWorkflowStep_Error,
TasksBaseWorkflowStep_Foreach,
TasksBaseWorkflowStep_Get,
TasksBaseWorkflowStep_IfElse,
TasksBaseWorkflowStep_Log,
TasksBaseWorkflowStep_MapReduce,
TasksBaseWorkflowStep_Parallel,
TasksBaseWorkflowStep_Prompt,
TasksBaseWorkflowStep_Return,
TasksBaseWorkflowStep_Search,
TasksBaseWorkflowStep_Set,
TasksBaseWorkflowStep_Sleep,
TasksBaseWorkflowStep_Switch,
TasksBaseWorkflowStep_ToolCall,
TasksBaseWorkflowStep_WaitForInput,
TasksBaseWorkflowStep_Yield,
)
from .tasks_case_then import TasksCaseThen
from .tasks_case_then_then import TasksCaseThenThen
from .tasks_create_task_request import TasksCreateTaskRequest
Expand Down Expand Up @@ -189,7 +208,7 @@
from .tasks_error_workflow_step import TasksErrorWorkflowStep
from .tasks_evaluate_step import TasksEvaluateStep
from .tasks_foreach_do import TasksForeachDo
from .tasks_foreach_do_do_item import TasksForeachDoDoItem
from .tasks_foreach_do_do import TasksForeachDoDo
from .tasks_foreach_step import TasksForeachStep
from .tasks_get_step import TasksGetStep
from .tasks_if_else_workflow_step import TasksIfElseWorkflowStep
Expand Down Expand Up @@ -432,6 +451,23 @@
"TaskExecutionsRouteListRequestSortBy",
"TaskExecutionsRouteListResponse",
"TasksBaseWorkflowStep",
"TasksBaseWorkflowStep_Embed",
"TasksBaseWorkflowStep_Error",
"TasksBaseWorkflowStep_Foreach",
"TasksBaseWorkflowStep_Get",
"TasksBaseWorkflowStep_IfElse",
"TasksBaseWorkflowStep_Log",
"TasksBaseWorkflowStep_MapReduce",
"TasksBaseWorkflowStep_Parallel",
"TasksBaseWorkflowStep_Prompt",
"TasksBaseWorkflowStep_Return",
"TasksBaseWorkflowStep_Search",
"TasksBaseWorkflowStep_Set",
"TasksBaseWorkflowStep_Sleep",
"TasksBaseWorkflowStep_Switch",
"TasksBaseWorkflowStep_ToolCall",
"TasksBaseWorkflowStep_WaitForInput",
"TasksBaseWorkflowStep_Yield",
"TasksCaseThen",
"TasksCaseThenThen",
"TasksCreateTaskRequest",
Expand All @@ -458,7 +494,7 @@
"TasksErrorWorkflowStep",
"TasksEvaluateStep",
"TasksForeachDo",
"TasksForeachDoDoItem",
"TasksForeachDoDo",
"TasksForeachStep",
"TasksGetStep",
"TasksIfElseWorkflowStep",
Expand Down
Loading

0 comments on commit 633c4f7

Please sign in to comment.