Skip to content

Commit 33391a9

Browse files
committed
feat: add support for subTool option
1 parent 62c8113 commit 33391a9

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"artists": [{
3+
"name": "Ariella Marquez",
4+
"description": "Ariella Marquez is a vibrant graphic artist from the bustling streets of Mexico City, whose work is deeply influenced by the rich tapestry of her culture. Her muse is the chaotic beauty of urban life, from the vivid street art that adorns the city's walls to the lively markets filled with colorful crafts and textiles. Ariella's art is a celebration of resilience and joy, blending traditional Mexican motifs with modern graphic design techniques to create pieces that are both nostalgic and forward-looking."
5+
},
6+
{
7+
"name": "Finn O'Reilly",
8+
"description": "Hailing from the serene landscapes of Ireland, Finn O'Reilly is a graphic artist whose muse is the mystical allure of nature. Finn's work is a homage to the ancient Celtic myths and the rugged beauty of the Irish countryside. Through his art, he seeks to capture the ethereal quality of natural light and the intricate patterns of flora and fauna. Finn's approach to graphic design is poetic and introspective, aiming to evoke a sense of wonder and connection with the earth."
9+
},
10+
{
11+
"name": "Sakura Tanaka",
12+
"description": "Sakura Tanaka is a Tokyo-based graphic artist whose muse is the delicate balance between tradition and innovation. Inspired by the ephemeral beauty of cherry blossoms and the precision of Japanese calligraphy, Sakura's work is a testament to the minimalist aesthetic. Her art is characterized by clean lines, subtle colors, and a harmonious blend of old and new. Sakura's vision is to create graphic designs that convey tranquility and simplicity, reflecting the Zen philosophy that influences much of her creative process."
13+
}]
14+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"artists": [{
3+
"name": "Eloise Hart",
4+
"description": "Eloise Hart draws her inspiration from the natural world, focusing on the intricate patterns found in nature’s design. From the fractal beauty of ferns to the complex color schemes of butterfly wings, her digital illustrations are a vibrant testament to the wonders of the natural world. Eloise believes that every element in nature holds a story worth telling, and she dedicates her art to exploring these narratives, blending realism with a touch of whimsy to bring the outdoors into the digital realm."
5+
},
6+
{
7+
"name": "Mikhail Vetrov",
8+
"description": "Mikhail Vetrov is a traditional painter whose muse is the bustling life of urban landscapes. Born and raised in a sprawling metropolis, he captures the dynamic energy and the stark contrasts of city life. His canvases are filled with vivid scenes of crowded streets, neon lights, and the occasional quiet moments of solitude found in urban environments. Mikhail’s work is a reflection on the isolation and connectivity experienced by individuals in the modern world, offering a gritty yet poetic view of city living."
9+
},
10+
{
11+
"name": "Lila Desai",
12+
"description": "Lila Desai’s art is deeply rooted in her cultural heritage, drawing inspiration from the rich tapestry of Indian mythology and folklore. Her paintings are a fusion of traditional motifs and contemporary themes, exploring the balance between ancient wisdom and modern life. Lila uses a palette of vibrant colors to bring her depictions of gods, goddesses, and mythical creatures to life, each piece a celebration of her identity and a homage to the stories passed down through generations. Her work not only captivates the viewer with its beauty but also invites them to delve into the depths of cultural narratives and personal introspection."
13+
}]
14+
}

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)