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

chore(agents-api): remove jinja templates from PromptStep and LogStep #1081

Merged
merged 1 commit into from
Jan 24, 2025
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
10 changes: 3 additions & 7 deletions agents-api/agents_api/activities/task_steps/log_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
StepContext,
StepOutcome,
)
from ...common.utils.template import render_template
from .base_evaluate import base_evaluate


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

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

return StepOutcome(output=output)

Expand Down
10 changes: 0 additions & 10 deletions agents-api/agents_api/activities/task_steps/prompt_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
litellm, # We dont directly import `acompletion` so we can mock it
)
from ...common.protocol.tasks import ExecutionInput, StepContext, StepOutcome
from ...common.utils.template import render_template
from ...env import debug
from .base_evaluate import base_evaluate

Expand Down Expand Up @@ -78,15 +77,6 @@ async def prompt_step(context: StepContext) -> StepOutcome:
# Wrap the prompt in a list if it is not already
prompt = prompt if isinstance(prompt, list) else [{"role": "user", "content": prompt}]

# Render template messages if we didn't evaluate the prompt
if not should_evaluate_prompt:
# Render template messages
prompt = await render_template(
prompt,
context_data,
skip_vars=["developer_id"],
)

if not isinstance(context.execution_input, ExecutionInput):
msg = "Expected ExecutionInput type for context.execution_input"
raise TypeError(msg)
Expand Down
Loading