Skip to content

feat: add support for subTool option #17

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

Merged
merged 1 commit into from
Apr 26, 2024
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
19 changes: 0 additions & 19 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ on:
required: true

jobs:
check-perms:
runs-on: ubuntu-latest
steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1

test-linux:
needs: check-perms
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ opts= {
"cache-dir": "/path/to/dir",
"quiet": True|False(default),
"chdir": "/path/to/dir",
"subTool": "tool-name",
}

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.
Expand Down
1 change: 1 addition & 0 deletions gptscript/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"cacheDir": "--cache-dir=",
"quiet": "--quiet=",
"chdir": "--chdir=",
"subTool": "--sub-tool=",
}


Expand Down
10 changes: 8 additions & 2 deletions tests/test_gptscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def complex_tool():
@pytest.fixture
def tool_list():
return [
Tool(tools=["echo"], instructions="echo hello times"),
Tool(tools=["echo"], instructions="echo hello there"),
Tool(name="other", tools=["echo"], instructions="echo hello somewhere else"),
Tool(
name="echo",
tools=["sys.exec"],
Expand Down Expand Up @@ -104,7 +105,12 @@ def test_exec_complex_tool(complex_tool):
# Test execution with a list of tools
def test_exec_tool_list(tool_list):
out, err = exec(tool_list)
assert out is not None, "Expected some output from exec using a list of tools"
assert out.strip() == "hello there", "Unexpected output from exec using a list of tools"


def test_exec_tool_list_with_sub_tool(tool_list):
out, err = exec(tool_list, opts={"subTool": "other"})
assert out.strip() == "hello somewhere else", "Unexpected output from exec using a list of tools with sub tool"


# Test streaming execution of a complex tool
Expand Down