Skip to content

Commit

Permalink
Merge pull request #495 from julep-ai/f/haidar-session
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorrr authored Sep 10, 2024
2 parents d5f088e + 2e1bb65 commit 32793b0
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
def validate_transition_targets(data: CreateTransitionRequest) -> None:
# Make sure the current/next targets are valid
match data.type:
case "finish" | "finish_branch" | "error" | "cancelled":
assert (
data.next is None
), "Next target must be None for finish/finish_branch/error/cancelled"
# case "finish" | "finish_branch" | "error" | "cancelled":
# assert (
# data.next is None
# ), "Next target must be None for finish/finish_branch/error/cancelled"

case "init_branch" | "init":
assert (
Expand All @@ -47,8 +47,8 @@ def validate_transition_targets(data: CreateTransitionRequest) -> None:
data.next.step > data.current.step
), "Next step must be greater than current"

case _:
raise ValueError(f"Invalid transition type: {data.type}")
# case _:
# raise ValueError(f"Invalid transition type: {data.type}")


@rewrap_exceptions(
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/workflows/task_execution/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ async def run(
context,
#
schedule_to_close_timeout=timedelta(
seconds=3 if debug or testing else 600
seconds=30 if debug or testing else 600
),
)
workflow.logger.debug(
Expand Down
4 changes: 2 additions & 2 deletions agents-api/agents_api/workflows/task_execution/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async def execute_map_reduce_step(
result = await workflow.execute_activity(
task_steps.base_evaluate,
args=[reduce, {"results": result, "_": output}],
schedule_to_close_timeout=timedelta(seconds=2),
schedule_to_close_timeout=timedelta(seconds=30),
)

return result
Expand Down Expand Up @@ -243,7 +243,7 @@ async def execute_map_reduce_step_parallel(
{"results": results, "_": batch_results},
extra_lambda_strs,
],
schedule_to_close_timeout=timedelta(seconds=5),
schedule_to_close_timeout=timedelta(seconds=30),
)

except BaseException as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def transition(
return await workflow.execute_activity(
task_steps.transition_step,
args=[context, transition_request],
schedule_to_close_timeout=timedelta(seconds=2),
schedule_to_close_timeout=timedelta(seconds=30),
)

except Exception as e:
Expand Down
82 changes: 82 additions & 0 deletions reclaim-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Reclaim Example
description: This is an example of a reclaim task.

input_schema:
type: object
properties:
screenshot_base64:
type: string
parameter_names:
type: array
items:
type: string

main:
- over: _.parameter_names
parallelism: 10
map:
prompt:
- role: system
content: |-
You are "{{agent.name}}" -- {{agent.description}}.
# Instructions:
{% for instruction in agent.instructions %}
{{loop.index}}. {{instruction}}
{% endfor %}
# Task:
- The user will provide you with a screenshot that contains some data that needs to be extracted.
- The user will also provide you with the name of the parameter you need to extract from the screenshot.
- You should analyze the screenshot carefully and locate the target data (e.g., username, ID, rating) as described in the provider details.
- Pay attention to the format of the data you are extracting; for example, Steam IDs are 17-digit numbers.
- If you are looking for an ID, it will usually be near labels like 'ID:', or similar text within the screenshot.
# Guidelines:
- Think step by step before providing a response.
- Your final response should be a JSON object with the structure:
```json
{
"<parameter_name>": "VALUE",
"additional_data": {"ADDITIONAL_INFO": "(IF NEEDED)"}
}
```
- If the parameter is not found, respond with:
```json
{
"<parameter_name>": null,
"error": "ERROR_MESSAGE"
}
```
- The final json object you respond with should be within ```json {<json_object>}```
- role: user
content:
- type: text
text: |-
In the screenshot attached, find the parameter `{{_}}` and extract it according to the instructions.
- type: image_url
image_url:
url: 'data:image/png;base64,{{inputs[0].screenshot_base64}}'

- evaluate:
results: "[result.choices[0].message.content for result in _]"

- foreach:
in: _
do:
evaluate:
parsed_result: load_json(_.split('```json')[1].split('```')[0])


# workflow: extract_workflow
# arguments:
# parameter_name: _
# screenshot_base64: _.screenshot_base64

# extract_workflow:
# - evaluate:
# result: _.choices[0].message.content

0 comments on commit 32793b0

Please sign in to comment.