Skip to content

Commit c47e707

Browse files
committed
Test raising CallDeferred and ModelRetry with Temporal
1 parent 2bcc269 commit c47e707

File tree

3 files changed

+575
-42
lines changed

3 files changed

+575
-42
lines changed

tests/cassettes/test_temporal/test_temporal_agent_with_hitl_tool.yaml

Lines changed: 67 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interactions:
88
connection:
99
- keep-alive
1010
content-length:
11-
- '412'
11+
- '639'
1212
content-type:
1313
- application/json
1414
host:
@@ -18,12 +18,25 @@ interactions:
1818
messages:
1919
- content: Just call tools without asking for confirmation.
2020
role: system
21-
- content: Delete the file `.env`
21+
- content: Delete the file `.env` and create `test.txt`
2222
role: user
2323
model: gpt-4o
2424
stream: false
2525
tool_choice: auto
2626
tools:
27+
- function:
28+
description: ''
29+
name: create_file
30+
parameters:
31+
additionalProperties: false
32+
properties:
33+
path:
34+
type: string
35+
required:
36+
- path
37+
type: object
38+
strict: true
39+
type: function
2740
- function:
2841
description: ''
2942
name: delete_file
@@ -47,13 +60,13 @@ interactions:
4760
connection:
4861
- keep-alive
4962
content-length:
50-
- '1078'
63+
- '1319'
5164
content-type:
5265
- application/json
5366
openai-organization:
5467
- pydantic-28gund
5568
openai-processing-ms:
56-
- '777'
69+
- '737'
5770
openai-project:
5871
- proj_dKobscVY9YJxeEaDJen54e3d
5972
openai-version:
@@ -74,28 +87,33 @@ interactions:
7487
role: assistant
7588
tool_calls:
7689
- function:
77-
arguments: '{"path":".env"}'
90+
arguments: '{"path": ".env"}'
7891
name: delete_file
79-
id: call_Cph2RPOCb9iTlHFKJpDoGGJ3
92+
id: call_jYdIdRZHxZTn5bWCq5jlMrJi
8093
type: function
81-
created: 1756416039
82-
id: chatcmpl-C9eKtagJXTE6zgbiTqrwka3p1HORH
94+
- function:
95+
arguments: '{"path": "test.txt"}'
96+
name: create_file
97+
id: call_TmlTVWQbzrXCZ4jNsCVNbNqu
98+
type: function
99+
created: 1756419063
100+
id: chatcmpl-C9f7f1SbHRzcwlJwrYKdSonTRWPvV
83101
model: gpt-4o-2024-08-06
84102
object: chat.completion
85103
service_tier: default
86-
system_fingerprint: fp_46bff0e0c8
104+
system_fingerprint: fp_df0f7b956c
87105
usage:
88-
completion_tokens: 15
106+
completion_tokens: 46
89107
completion_tokens_details:
90108
accepted_prediction_tokens: 0
91109
audio_tokens: 0
92110
reasoning_tokens: 0
93111
rejected_prediction_tokens: 0
94-
prompt_tokens: 51
112+
prompt_tokens: 71
95113
prompt_tokens_details:
96114
audio_tokens: 0
97115
cached_tokens: 0
98-
total_tokens: 66
116+
total_tokens: 117
99117
status:
100118
code: 200
101119
message: OK
@@ -108,36 +126,57 @@ interactions:
108126
connection:
109127
- keep-alive
110128
content-length:
111-
- '668'
129+
- '1109'
112130
content-type:
113131
- application/json
114132
cookie:
115-
- __cf_bm=R242yu_l_z7c_Zyfp3Y4V.Dg6IfXugFo16jFsBOX_Q4-1756416040-1.0.1.1-mnLu5T6rRYHqs510LMaxsIeBVZ.0A_9kLLrp39VwcuhZZoi3zFMWXztJX_l2f1l26SmCgMu0iaT_l6ys6JjQKENFI.VvF4Ajb8Ki4nxnrjM;
116-
_cfuvid=S1.9tW2iDrUejaq6FRh21xbVgdrUS5JWZoBH7_NF2cQ-1756416040679-0.0.1.1-604800000
133+
- __cf_bm=mLR5rPRuew3fXXRgovBj3Ir6vRflwQucmAT8xYCnZaA-1756419064-1.0.1.1-HvvEmDcDOmavm0vBqLo_ZG_Bjh6B2CgT.etvrYCBiezHow_0xNZ64xqybhJl_NViSVDNXuaXviCcDgIZg13KgsWp0J_qNORRiVIHxO2UAO4;
134+
_cfuvid=536Zye1eyyVQS9C8BV6AAFwv4vaW.H4o2O4LK_228oc-1756419064420-0.0.1.1-604800000
117135
host:
118136
- api.openai.com
119137
method: POST
120138
parsed_body:
121139
messages:
122140
- content: Just call tools without asking for confirmation.
123141
role: system
124-
- content: Delete the file `.env`
142+
- content: Delete the file `.env` and create `test.txt`
125143
role: user
126144
- content: null
127145
role: assistant
128146
tool_calls:
129147
- function:
130-
arguments: '{"path":".env"}'
148+
arguments: '{"path": ".env"}'
131149
name: delete_file
132-
id: call_Cph2RPOCb9iTlHFKJpDoGGJ3
150+
id: call_jYdIdRZHxZTn5bWCq5jlMrJi
151+
type: function
152+
- function:
153+
arguments: '{"path": "test.txt"}'
154+
name: create_file
155+
id: call_TmlTVWQbzrXCZ4jNsCVNbNqu
133156
type: function
134157
- content: 'true'
135158
role: tool
136-
tool_call_id: call_Cph2RPOCb9iTlHFKJpDoGGJ3
159+
tool_call_id: call_jYdIdRZHxZTn5bWCq5jlMrJi
160+
- content: Success
161+
role: tool
162+
tool_call_id: call_TmlTVWQbzrXCZ4jNsCVNbNqu
137163
model: gpt-4o
138164
stream: false
139165
tool_choice: auto
140166
tools:
167+
- function:
168+
description: ''
169+
name: create_file
170+
parameters:
171+
additionalProperties: false
172+
properties:
173+
path:
174+
type: string
175+
required:
176+
- path
177+
type: object
178+
strict: true
179+
type: function
141180
- function:
142181
description: ''
143182
name: delete_file
@@ -161,13 +200,13 @@ interactions:
161200
connection:
162201
- keep-alive
163202
content-length:
164-
- '848'
203+
- '882'
165204
content-type:
166205
- application/json
167206
openai-organization:
168207
- pydantic-28gund
169208
openai-processing-ms:
170-
- '470'
209+
- '624'
171210
openai-project:
172211
- proj_dKobscVY9YJxeEaDJen54e3d
173212
openai-version:
@@ -183,27 +222,27 @@ interactions:
183222
logprobs: null
184223
message:
185224
annotations: []
186-
content: The file `.env` has been successfully deleted.
225+
content: The file `.env` has been deleted and `test.txt` has been created successfully.
187226
refusal: null
188227
role: assistant
189-
created: 1756416041
190-
id: chatcmpl-C9eKvlcsl4YcQcIejG3T6QFxgmrCN
228+
created: 1756419066
229+
id: chatcmpl-C9f7iBeeNNBazDCMa7RSx3EFtiZoR
191230
model: gpt-4o-2024-08-06
192231
object: chat.completion
193232
service_tier: default
194-
system_fingerprint: fp_46bff0e0c8
233+
system_fingerprint: fp_80956533cb
195234
usage:
196-
completion_tokens: 11
235+
completion_tokens: 19
197236
completion_tokens_details:
198237
accepted_prediction_tokens: 0
199238
audio_tokens: 0
200239
reasoning_tokens: 0
201240
rejected_prediction_tokens: 0
202-
prompt_tokens: 75
241+
prompt_tokens: 133
203242
prompt_tokens_details:
204243
audio_tokens: 0
205244
cached_tokens: 0
206-
total_tokens: 86
245+
total_tokens: 152
207246
status:
208247
code: 200
209248
message: OK

0 commit comments

Comments
 (0)