Skip to content

Commit

Permalink
feat(agents-api): Misc fixes in agents-api
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Oct 19, 2024
1 parent ffd0f76 commit 54e04a0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion agents-api/agents_api/activities/task_steps/log_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ async def log_step(context: StepContext) -> StepOutcome:

template: str = context.current_step.log
output = await render_template(
template, context.model_dump(), skip_vars=["developer_id"]
template,
context.model_dump(include_remote=True),
skip_vars=["developer_id"],
)

result = StepOutcome(output=output)
Expand Down
7 changes: 6 additions & 1 deletion agents-api/agents_api/activities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,18 @@ class stdlib_statistics:
"statistics": stdlib_statistics,
}

constants = {
"NEWLINE": "\n",
}


@beartype
def get_evaluator(
names: dict[str, Any], extra_functions: dict[str, Callable] | None = None
) -> SimpleEval:
evaluator = EvalWithCompoundTypes(
names=names | stdlib, functions=ALLOWED_FUNCTIONS | (extra_functions or {})
names=names | stdlib | constants,
functions=ALLOWED_FUNCTIONS | (extra_functions or {}),
)

return evaluator
Expand Down
2 changes: 2 additions & 0 deletions agents-api/agents_api/common/interceptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async def execute_activity(self, input: ExecuteActivityInput):
CompleteAsyncError,
TemporalError,
FailureError,
ApplicationError,
):
raise
except BaseException as e:
Expand Down Expand Up @@ -78,6 +79,7 @@ async def execute_workflow(self, input: ExecuteWorkflowInput):
CompleteAsyncError,
TemporalError,
FailureError,
ApplicationError,
):
raise
except BaseException as e:
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/common/utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
jinja_env.globals["true"] = True
jinja_env.globals["false"] = False
jinja_env.globals["null"] = None

jinja_env.globals["NEWLINE"] = "\n"

simple_jinja_regex = re.compile(r"{{|{%.+}}|%}", re.DOTALL)

Expand Down
2 changes: 1 addition & 1 deletion agents-api/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_doc(
client=client,
)

time.sleep(0.1)
time.sleep(0.5)

yield doc

Expand Down

0 comments on commit 54e04a0

Please sign in to comment.