Skip to content

Commit

Permalink
Adds a program routine runner. (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
payneio authored Jan 21, 2025
1 parent d13dcfd commit c54848a
Show file tree
Hide file tree
Showing 13 changed files with 584 additions and 38 deletions.
5 changes: 0 additions & 5 deletions assistants/skill-assistant/assistant/skill_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@ async def get_or_register_assistant(
mount_dir="/mnt/data",
chat_driver_config=chat_driver_config,
),
# FormFillerSkill(
# name="form_filler",
# chat_driver_config=chat_driver_config,
# language_model=language_model,
# ),
GuidedConversationSkillDefinition(
name="guided_conversation",
language_model=language_model,
Expand Down
11 changes: 11 additions & 0 deletions libraries/python/skills/skill-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ When a skill is registered to an assistant, a user will be able to see the
skill's actions by running the message command `/list_actions` and routines with
`/list_routines`.

The skill library helps in maintaining and distributing functionality with
skills as each skill is a separate Python package, however skills refer to other
skills using a [skill registry](#skill-registry).

See: [skill.py](./skill_library/skill.py)

#### Actions
Expand Down Expand Up @@ -86,6 +90,13 @@ Currently we provide three functional routine/routine runner implementations:
routine](../skills/guided-conversation-skill/guided_conversation_skill/guided_conversation_skill.py)
is a good example of this technique.

- [Program routine](./skill_library/routine/program_routine.py) ([Program
routine
runner](./skill_library/routine_runners/program/program_routine_runner.py))

Write a routine in a subset of Python. Works now, but in development... will
add more local function support, error handling, more assistant actions, etc.

- (Future) Recipes (natural language routines)

We aim to create a type of routine that can be specified in more ordinary,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

from ..utilities import find_template_vars
from .routine import Routine

Expand All @@ -17,6 +19,13 @@ def __init__(
)
self.program = program

def validate(self, arg_set: dict[str, Any]) -> None:
"""
Validate the routine with the given arguments.
"""
# TODO: implement this.
pass

def __str__(self) -> str:
template_vars = find_template_vars(self.program)
return f"{self.name}(vars: {template_vars}): {self.description}"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .action_list_routine_runner import ActionListRoutineRunner
from .instruction_routine_runner import InstructionRoutineRunner
from .program_routine_runner import ProgramRoutineRunner
from .program.program_routine_runner import ProgramRoutineRunner
from .state_machine_routine_runner import StateMachineRoutineRunner

RunnerTypes = Union[ActionListRoutineRunner, InstructionRoutineRunner, ProgramRoutineRunner, StateMachineRoutineRunner]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def run(
# set.
parsed_routine = parse_template(routine.routine, arg_set)

# Get current step and locals from the stack frame state.
# Set current step and locals to the stack frame state.
async with run_context.stack_frame_state() as state:
state["routine"] = parsed_routine
current_step = state.get("current_step", 0)
Expand Down
Empty file.
Loading

0 comments on commit c54848a

Please sign in to comment.