Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change log-step to a jinja template rather than a simpleeval expression #488

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from beartype import beartype
from temporalio import activity

Expand Down
8 changes: 5 additions & 3 deletions agents-api/agents_api/activities/task_steps/log_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
StepContext,
StepOutcome,
)
from ...common.utils.template import render_template
from ...env import testing
from .base_evaluate import base_evaluate


@beartype
Expand All @@ -17,8 +17,10 @@ async def log_step(context: StepContext) -> StepOutcome:
try:
assert isinstance(context.current_step, LogStep)

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

result = StepOutcome(output=output)
return result
Expand Down
4 changes: 3 additions & 1 deletion agents-api/tests/test_execution_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ async def _(
"other_workflow": [
# Testing that we can access the input
{"evaluate": {"hello": '_["test"]'}},
{"log": '_["hell"]'}, # <--- The "hell" key does not exist
{
"log": '{{_["hell"].strip()}}'
}, # <--- The "hell" key does not exist
],
"main": [
# Testing that we can access the input
Expand Down
Loading