Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
Add confirmation support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklamers committed Dec 18, 2023
1 parent 1b5e6aa commit e63736c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description: |
Send an inquiry email about a recent purchase to an employee
sample_questions:
- send purchase inquiry email
confirm: true
parameters:
json_schema:
type: object
Expand Down
4 changes: 3 additions & 1 deletion packages/openassistants/openassistants/core/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ async def handle_user_plaintext(
else:
complete, arguments = True, {}

can_autorun = autorun # and selected_function.can_autoru
can_autorun = autorun
if selected_function.confirm:
can_autorun = False

if can_autorun and complete:
# execute
Expand Down
1 change: 1 addition & 0 deletions packages/openassistants/openassistants/functions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class BaseFunction(BaseModel, abc.ABC):
display_name: Optional[str]
description: str
sample_questions: List[str]
confirm: bool = False

@abc.abstractmethod
async def execute(
Expand Down
6 changes: 6 additions & 0 deletions scripts/refresh-poetry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

(
cd examples/fast-api-server
./refresh-poetry.sh
)
17 changes: 17 additions & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

trap "exit" INT TERM ERR
trap "kill 0" EXIT

(
cd examples/fast-api-server
poetry run ./run.sh
) &

(
cd examples/next
yarn dev
) &

wait

0 comments on commit e63736c

Please sign in to comment.