Skip to content

Commit d13ff51

Browse files
authored
Merge pull request #17 from thedadams/add-sub-tools
feat: add support for subTool option
2 parents 62c8113 + af4508b commit d13ff51

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

.github/workflows/run_tests.yaml

-19
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,6 @@ on:
1111
required: true
1212

1313
jobs:
14-
check-perms:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Get User Permission
18-
id: checkAccess
19-
uses: actions-cool/check-user-permission@v2
20-
with:
21-
require: write
22-
username: ${{ github.triggering_actor }}
23-
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
- name: Check User Permission
26-
if: steps.checkAccess.outputs.require-result == 'false'
27-
run: |
28-
echo "${{ github.triggering_actor }} does not have permissions on this repo."
29-
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
30-
echo "Job originally triggered by ${{ github.actor }}"
31-
exit 1
32-
3314
test-linux:
3415
needs: check-perms
3516
runs-on: ubuntu-latest

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ opts= {
7878
"cache-dir": "/path/to/dir",
7979
"quiet": True|False(default),
8080
"chdir": "/path/to/dir",
81+
"subTool": "tool-name",
8182
}
8283

8384
Cache can be set to true or false to enable or disable caching globally or it can be set at the individual tool level. The cache-dir can be set to a directory to use for caching. If not set, the default cache directory will be used.

gptscript/command.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"cacheDir": "--cache-dir=",
1010
"quiet": "--quiet=",
1111
"chdir": "--chdir=",
12+
"subTool": "--sub-tool=",
1213
}
1314

1415

tests/test_gptscript.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def complex_tool():
5757
@pytest.fixture
5858
def tool_list():
5959
return [
60-
Tool(tools=["echo"], instructions="echo hello times"),
60+
Tool(tools=["echo"], instructions="echo hello there"),
61+
Tool(name="other", tools=["echo"], instructions="echo hello somewhere else"),
6162
Tool(
6263
name="echo",
6364
tools=["sys.exec"],
@@ -104,7 +105,12 @@ def test_exec_complex_tool(complex_tool):
104105
# Test execution with a list of tools
105106
def test_exec_tool_list(tool_list):
106107
out, err = exec(tool_list)
107-
assert out is not None, "Expected some output from exec using a list of tools"
108+
assert out.strip() == "hello there", "Unexpected output from exec using a list of tools"
109+
110+
111+
def test_exec_tool_list_with_sub_tool(tool_list):
112+
out, err = exec(tool_list, opts={"subTool": "other"})
113+
assert out.strip() == "hello somewhere else", "Unexpected output from exec using a list of tools with sub tool"
108114

109115

110116
# Test streaming execution of a complex tool

0 commit comments

Comments
 (0)