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

Adds a program routine runner. #304

Merged
merged 3 commits into from
Jan 21, 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
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
Loading
Loading