Skip to content

Commit

Permalink
Merge pull request #488 from julep-ai/x/log-step
Browse files Browse the repository at this point in the history
fix: Change log-step to a jinja template rather than a simpleeval expression
  • Loading branch information
HamadaSalhab authored Sep 4, 2024
2 parents d66343d + df220b4 commit 6fe6e4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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

0 comments on commit 6fe6e4e

Please # to comment.