Skip to content
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
4 changes: 3 additions & 1 deletion examples/human_in_the_loop.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import asyncio

from narada import Agent, Narada, UserAbortedError
from narada_core.actions.models import PromptForUserInputVariable

from narada import Agent, Narada, UserAbortedError


async def main() -> None:
async with Narada() as narada:
Expand All @@ -27,6 +28,7 @@ async def main() -> None:
enum_values=["pricing", "customers", "recent news"],
),
],
prompt_message="Tell us which company to research and what to focus on.",
)

company = values["company"]
Expand Down
1 change: 1 addition & 0 deletions packages/narada-core/src/narada_core/actions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ class PromptForUserInputRequest(BaseModel):
name: Literal["prompt_for_user_input"] = "prompt_for_user_input"
step_id: str
variables: list[PromptForUserInputVariable]
prompt_message: str | None = None


class PromptForUserInputResponse(BaseModel):
Expand Down
5 changes: 4 additions & 1 deletion packages/narada-pyodide/src/narada/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,11 +799,14 @@ async def prompt_for_user_input(
*,
step_id: str,
variables: list[PromptForUserInputVariable],
prompt_message: str | None = None,
timeout: int | None = None,
) -> dict[str, Any]:
"""Prompts the user for one or more input values in the extension UI."""
result = await self._run_extension_action(
PromptForUserInputRequest(step_id=step_id, variables=variables),
PromptForUserInputRequest(
step_id=step_id, prompt_message=prompt_message, variables=variables
),
PromptForUserInputResponse,
timeout=timeout,
)
Expand Down
5 changes: 4 additions & 1 deletion packages/narada/src/narada/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,14 @@ async def prompt_for_user_input(
*,
step_id: str,
variables: list[PromptForUserInputVariable],
prompt_message: str | None = None,
timeout: int | None = None,
) -> dict[str, Any]:
"""Prompts the user for one or more input values in the extension UI."""
result = await self._run_extension_action(
PromptForUserInputRequest(step_id=step_id, variables=variables),
PromptForUserInputRequest(
step_id=step_id, prompt_message=prompt_message, variables=variables
),
PromptForUserInputResponse,
timeout=timeout,
)
Expand Down
Loading