Skip to content

Commit f9637d7

Browse files
committed
wip
1 parent 2b48669 commit f9637d7

29 files changed

+3042
-0
lines changed

workshops/2025-05-17/walkthrough.yaml

Lines changed: 462 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
class DoneForNow {
2+
intent "done_for_now"
3+
message string
4+
}
5+
6+
client<llm> Qwen3 {
7+
provider "openai-generic"
8+
options {
9+
base_url env.BASETEN_BASE_URL
10+
api_key env.BASETEN_API_KEY
11+
}
12+
}
13+
14+
function DetermineNextStep(
15+
thread: string
16+
) -> CalculatorTools | DoneForNow {
17+
client Qwen3
18+
19+
prompt #"
20+
{{ _.role("system") }}
21+
22+
/nothink
23+
24+
You are a helpful assistant that can help with tasks.
25+
26+
{{ _.role("user") }}
27+
28+
You are working on the following thread:
29+
30+
{{ thread }}
31+
32+
What should the next step be?
33+
34+
{{ ctx.output_format }}
35+
"#
36+
}
37+
38+
test HelloWorld {
39+
functions [DetermineNextStep]
40+
args {
41+
thread #"
42+
{
43+
"type": "user_input",
44+
"data": "hello!"
45+
}
46+
"#
47+
}
48+
}
49+
50+
test MathOperation {
51+
functions [DetermineNextStep]
52+
args {
53+
thread #"
54+
{
55+
"type": "user_input",
56+
"data": "can you multiply 3 and 4?"
57+
}
58+
"#
59+
}
60+
}
61+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
class DoneForNow {
2+
intent "done_for_now"
3+
message string
4+
}
5+
6+
client<llm> Qwen3 {
7+
provider "openai-generic"
8+
options {
9+
base_url env.BASETEN_BASE_URL
10+
api_key env.BASETEN_API_KEY
11+
}
12+
}
13+
14+
function DetermineNextStep(
15+
thread: string
16+
) -> CalculatorTools | DoneForNow {
17+
client Qwen3
18+
19+
prompt #"
20+
{{ _.role("system") }}
21+
22+
/nothink
23+
24+
You are a helpful assistant that can help with tasks.
25+
26+
{{ _.role("user") }}
27+
28+
You are working on the following thread:
29+
30+
{{ thread }}
31+
32+
What should the next step be?
33+
34+
{{ ctx.output_format }}
35+
"#
36+
}
37+
38+
test HelloWorld {
39+
functions [DetermineNextStep]
40+
args {
41+
thread #"
42+
{
43+
"type": "user_input",
44+
"data": "hello!"
45+
}
46+
"#
47+
}
48+
@@assert(hello, {{this.intent == "done_for_now"}})
49+
}
50+
51+
test MathOperation {
52+
functions [DetermineNextStep]
53+
args {
54+
thread #"
55+
{
56+
"type": "user_input",
57+
"data": "can you multiply 3 and 4?"
58+
}
59+
"#
60+
}
61+
@@assert(math_operation, {{this.intent == "multiply"}})
62+
}
63+
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
class DoneForNow {
2+
intent "done_for_now"
3+
message string
4+
}
5+
6+
client<llm> Qwen3 {
7+
provider "openai-generic"
8+
options {
9+
base_url env.BASETEN_BASE_URL
10+
api_key env.BASETEN_API_KEY
11+
}
12+
}
13+
function DetermineNextStep(
14+
thread: string
15+
) -> CalculatorTools | DoneForNow {
16+
client Qwen3
17+
18+
prompt #"
19+
{{ _.role("system") }}
20+
21+
/nothink
22+
23+
You are a helpful assistant that can help with tasks.
24+
25+
{{ _.role("user") }}
26+
27+
You are working on the following thread:
28+
29+
{{ thread }}
30+
31+
What should the next step be?
32+
33+
{{ ctx.output_format }}
34+
"#
35+
}
36+
37+
test HelloWorld {
38+
functions [DetermineNextStep]
39+
args {
40+
thread #"
41+
{
42+
"type": "user_input",
43+
"data": "hello!"
44+
}
45+
"#
46+
}
47+
@@assert(intent, {{this.intent == "done_for_now"}})
48+
}
49+
50+
test MathOperation {
51+
functions [DetermineNextStep]
52+
args {
53+
thread #"
54+
{
55+
"type": "user_input",
56+
"data": "can you multiply 3 and 4?"
57+
}
58+
"#
59+
}
60+
@@assert(intent, {{this.intent == "multiply"}})
61+
}
62+
63+
test LongMath {
64+
functions [DetermineNextStep]
65+
args {
66+
thread #"
67+
[
68+
{
69+
"type": "user_input",
70+
"data": "can you multiply 3 and 4, then divide the result by 2 and then add 12 to that result?"
71+
},
72+
{
73+
"type": "tool_call",
74+
"data": {
75+
"intent": "multiply",
76+
"a": 3,
77+
"b": 4
78+
}
79+
},
80+
{
81+
"type": "tool_response",
82+
"data": 12
83+
},
84+
{
85+
"type": "tool_call",
86+
"data": {
87+
"intent": "divide",
88+
"a": 12,
89+
"b": 2
90+
}
91+
},
92+
{
93+
"type": "tool_response",
94+
"data": 6
95+
},
96+
{
97+
"type": "tool_call",
98+
"data": {
99+
"intent": "add",
100+
"a": 6,
101+
"b": 12
102+
}
103+
},
104+
{
105+
"type": "tool_response",
106+
"data": 18
107+
}
108+
]
109+
"#
110+
}
111+
@@assert(intent, {{this.intent == "done_for_now"}})
112+
@@assert(answer, {{"18" in this.message}})
113+
}
114+
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// human tools are async requests to a human
2+
type HumanTools = ClarificationRequest | DoneForNow
3+
4+
class ClarificationRequest {
5+
intent "request_more_information" @description("you can request more information from me")
6+
message string
7+
}
8+
9+
class DoneForNow {
10+
intent "done_for_now"
11+
12+
message string @description(#"
13+
message to send to the user about the work that was done.
14+
"#)
15+
}
16+
17+
client<llm> Qwen3 {
18+
provider "openai-generic"
19+
options {
20+
base_url env.BASETEN_BASE_URL
21+
api_key env.BASETEN_API_KEY
22+
}
23+
}
24+
25+
function DetermineNextStep(
26+
thread: string
27+
) -> HumanTools | CalculatorTools {
28+
client Qwen3
29+
30+
prompt #"
31+
{{ _.role("system") }}
32+
33+
/nothink
34+
35+
You are a helpful assistant that can help with tasks.
36+
37+
{{ _.role("user") }}
38+
39+
You are working on the following thread:
40+
41+
{{ thread }}
42+
43+
What should the next step be?
44+
45+
{{ ctx.output_format }}
46+
"#
47+
}
48+
49+
test HelloWorld {
50+
functions [DetermineNextStep]
51+
args {
52+
thread #"
53+
{
54+
"type": "user_input",
55+
"data": "hello!"
56+
}
57+
"#
58+
}
59+
@@assert(intent, {{this.intent == "done_for_now"}})
60+
}
61+
62+
test MathOperation {
63+
functions [DetermineNextStep]
64+
args {
65+
thread #"
66+
{
67+
"type": "user_input",
68+
"data": "can you multiply 3 and 4?"
69+
}
70+
"#
71+
}
72+
@@assert(intent, {{this.intent == "multiply"}})
73+
}
74+
75+
test LongMath {
76+
functions [DetermineNextStep]
77+
args {
78+
thread #"
79+
[
80+
{
81+
"type": "user_input",
82+
"data": "can you multiply 3 and 4, then divide the result by 2 and then add 12 to that result?"
83+
},
84+
{
85+
"type": "tool_call",
86+
"data": {
87+
"intent": "multiply",
88+
"a": 3,
89+
"b": 4
90+
}
91+
},
92+
{
93+
"type": "tool_response",
94+
"data": 12
95+
},
96+
{
97+
"type": "tool_call",
98+
"data": {
99+
"intent": "divide",
100+
"a": 12,
101+
"b": 2
102+
}
103+
},
104+
{
105+
"type": "tool_response",
106+
"data": 6
107+
},
108+
{
109+
"type": "tool_call",
110+
"data": {
111+
"intent": "add",
112+
"a": 6,
113+
"b": 12
114+
}
115+
},
116+
{
117+
"type": "tool_response",
118+
"data": 18
119+
}
120+
]
121+
"#
122+
}
123+
@@assert(intent, {{this.intent == "done_for_now"}})
124+
@@assert(answer, {{"18" in this.message}})
125+
}
126+
127+

0 commit comments

Comments
 (0)