openai/openai-python
Publicmirrored from https://github.com/openai/openai-pythonAvailable
tests/api_resources/beta/threads/test_runs.py
925lines · modeblame
5cfb125aStainless Bot2 years ago | 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
baa9f07fRobert Craigie2 years ago | 2 | |
| 3 | from __future__ import annotations | |
| 4 | | |
| 5 | import os | |
86379b44Stainless Bot2 years ago | 6 | from typing import Any, cast |
baa9f07fRobert Craigie2 years ago | 7 | |
| 8 | import pytest | |
| 9 | | |
| 10 | from openai import OpenAI, AsyncOpenAI | |
| 11 | from tests.utils import assert_matches_type | |
| 12 | from openai.pagination import SyncCursorPage, AsyncCursorPage | |
a47375b7Stainless Bot2 years ago | 13 | from openai.types.beta.threads import ( |
| 14 | Run, | |
| 15 | ) | |
baa9f07fRobert Craigie2 years ago | 16 | |
| 17 | base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") | |
| 18 | | |
| 19 | | |
| 20 | class TestRuns: | |
98d779fbStainless Bot2 years ago | 21 | parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) |
baa9f07fRobert Craigie2 years ago | 22 | |
| 23 | @parametrize | |
5429f696Stainless Bot2 years ago | 24 | def test_method_create_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 25 | run = client.beta.threads.runs.create( |
| 26 | "string", | |
| 27 | assistant_id="string", | |
| 28 | ) | |
| 29 | assert_matches_type(Run, run, path=["response"]) | |
| 30 | | |
| 31 | @parametrize | |
5429f696Stainless Bot2 years ago | 32 | def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 33 | run = client.beta.threads.runs.create( |
| 34 | "string", | |
| 35 | assistant_id="string", | |
53bca49eStainless Bot2 years ago | 36 | additional_instructions="string", |
baa9f07fRobert Craigie2 years ago | 37 | instructions="string", |
| 38 | metadata={}, | |
| 39 | model="string", | |
5429f696Stainless Bot2 years ago | 40 | stream=False, |
baa9f07fRobert Craigie2 years ago | 41 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
| 42 | ) | |
| 43 | assert_matches_type(Run, run, path=["response"]) | |
| 44 | | |
| 45 | @parametrize | |
5429f696Stainless Bot2 years ago | 46 | def test_raw_response_create_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 47 | response = client.beta.threads.runs.with_raw_response.create( |
| 48 | "string", | |
| 49 | assistant_id="string", | |
| 50 | ) | |
86379b44Stainless Bot2 years ago | 51 | |
| 52 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 53 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 54 | run = response.parse() | |
| 55 | assert_matches_type(Run, run, path=["response"]) | |
| 56 | | |
86379b44Stainless Bot2 years ago | 57 | @parametrize |
5429f696Stainless Bot2 years ago | 58 | def test_streaming_response_create_overload_1(self, client: OpenAI) -> None: |
86379b44Stainless Bot2 years ago | 59 | with client.beta.threads.runs.with_streaming_response.create( |
| 60 | "string", | |
| 61 | assistant_id="string", | |
| 62 | ) as response: | |
| 63 | assert not response.is_closed | |
| 64 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 65 | | |
| 66 | run = response.parse() | |
| 67 | assert_matches_type(Run, run, path=["response"]) | |
| 68 | | |
| 69 | assert cast(Any, response.is_closed) is True | |
| 70 | | |
023a4e66Stainless Bot2 years ago | 71 | @parametrize |
5429f696Stainless Bot2 years ago | 72 | def test_path_params_create_overload_1(self, client: OpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 73 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 74 | client.beta.threads.runs.with_raw_response.create( | |
| 75 | "", | |
| 76 | assistant_id="string", | |
| 77 | ) | |
| 78 | | |
5429f696Stainless Bot2 years ago | 79 | @parametrize |
| 80 | def test_method_create_overload_2(self, client: OpenAI) -> None: | |
| 81 | run_stream = client.beta.threads.runs.create( | |
| 82 | "string", | |
| 83 | assistant_id="string", | |
| 84 | stream=True, | |
| 85 | ) | |
| 86 | run_stream.response.close() | |
| 87 | | |
| 88 | @parametrize | |
| 89 | def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None: | |
| 90 | run_stream = client.beta.threads.runs.create( | |
| 91 | "string", | |
| 92 | assistant_id="string", | |
| 93 | stream=True, | |
| 94 | additional_instructions="string", | |
| 95 | instructions="string", | |
| 96 | metadata={}, | |
| 97 | model="string", | |
| 98 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], | |
| 99 | ) | |
| 100 | run_stream.response.close() | |
| 101 | | |
| 102 | @parametrize | |
| 103 | def test_raw_response_create_overload_2(self, client: OpenAI) -> None: | |
| 104 | response = client.beta.threads.runs.with_raw_response.create( | |
| 105 | "string", | |
| 106 | assistant_id="string", | |
| 107 | stream=True, | |
| 108 | ) | |
| 109 | | |
| 110 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 111 | stream = response.parse() | |
| 112 | stream.close() | |
| 113 | | |
| 114 | @parametrize | |
| 115 | def test_streaming_response_create_overload_2(self, client: OpenAI) -> None: | |
| 116 | with client.beta.threads.runs.with_streaming_response.create( | |
| 117 | "string", | |
| 118 | assistant_id="string", | |
| 119 | stream=True, | |
| 120 | ) as response: | |
| 121 | assert not response.is_closed | |
| 122 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 123 | | |
| 124 | stream = response.parse() | |
| 125 | stream.close() | |
| 126 | | |
| 127 | assert cast(Any, response.is_closed) is True | |
| 128 | | |
| 129 | @parametrize | |
| 130 | def test_path_params_create_overload_2(self, client: OpenAI) -> None: | |
| 131 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 132 | client.beta.threads.runs.with_raw_response.create( | |
| 133 | "", | |
| 134 | assistant_id="string", | |
| 135 | stream=True, | |
| 136 | ) | |
| 137 | | |
baa9f07fRobert Craigie2 years ago | 138 | @parametrize |
| 139 | def test_method_retrieve(self, client: OpenAI) -> None: | |
| 140 | run = client.beta.threads.runs.retrieve( | |
| 141 | "string", | |
| 142 | thread_id="string", | |
| 143 | ) | |
| 144 | assert_matches_type(Run, run, path=["response"]) | |
| 145 | | |
| 146 | @parametrize | |
| 147 | def test_raw_response_retrieve(self, client: OpenAI) -> None: | |
| 148 | response = client.beta.threads.runs.with_raw_response.retrieve( | |
| 149 | "string", | |
| 150 | thread_id="string", | |
| 151 | ) | |
86379b44Stainless Bot2 years ago | 152 | |
| 153 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 154 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 155 | run = response.parse() | |
| 156 | assert_matches_type(Run, run, path=["response"]) | |
| 157 | | |
86379b44Stainless Bot2 years ago | 158 | @parametrize |
| 159 | def test_streaming_response_retrieve(self, client: OpenAI) -> None: | |
| 160 | with client.beta.threads.runs.with_streaming_response.retrieve( | |
| 161 | "string", | |
| 162 | thread_id="string", | |
| 163 | ) as response: | |
| 164 | assert not response.is_closed | |
| 165 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 166 | | |
| 167 | run = response.parse() | |
| 168 | assert_matches_type(Run, run, path=["response"]) | |
| 169 | | |
| 170 | assert cast(Any, response.is_closed) is True | |
| 171 | | |
023a4e66Stainless Bot2 years ago | 172 | @parametrize |
| 173 | def test_path_params_retrieve(self, client: OpenAI) -> None: | |
| 174 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 175 | client.beta.threads.runs.with_raw_response.retrieve( | |
| 176 | "string", | |
| 177 | thread_id="", | |
| 178 | ) | |
| 179 | | |
| 180 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 181 | client.beta.threads.runs.with_raw_response.retrieve( | |
| 182 | "", | |
| 183 | thread_id="string", | |
| 184 | ) | |
| 185 | | |
baa9f07fRobert Craigie2 years ago | 186 | @parametrize |
| 187 | def test_method_update(self, client: OpenAI) -> None: | |
| 188 | run = client.beta.threads.runs.update( | |
| 189 | "string", | |
| 190 | thread_id="string", | |
| 191 | ) | |
| 192 | assert_matches_type(Run, run, path=["response"]) | |
| 193 | | |
| 194 | @parametrize | |
| 195 | def test_method_update_with_all_params(self, client: OpenAI) -> None: | |
| 196 | run = client.beta.threads.runs.update( | |
| 197 | "string", | |
| 198 | thread_id="string", | |
| 199 | metadata={}, | |
| 200 | ) | |
| 201 | assert_matches_type(Run, run, path=["response"]) | |
| 202 | | |
| 203 | @parametrize | |
| 204 | def test_raw_response_update(self, client: OpenAI) -> None: | |
| 205 | response = client.beta.threads.runs.with_raw_response.update( | |
| 206 | "string", | |
| 207 | thread_id="string", | |
| 208 | ) | |
86379b44Stainless Bot2 years ago | 209 | |
| 210 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 211 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 212 | run = response.parse() | |
| 213 | assert_matches_type(Run, run, path=["response"]) | |
| 214 | | |
86379b44Stainless Bot2 years ago | 215 | @parametrize |
| 216 | def test_streaming_response_update(self, client: OpenAI) -> None: | |
| 217 | with client.beta.threads.runs.with_streaming_response.update( | |
| 218 | "string", | |
| 219 | thread_id="string", | |
| 220 | ) as response: | |
| 221 | assert not response.is_closed | |
| 222 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 223 | | |
| 224 | run = response.parse() | |
| 225 | assert_matches_type(Run, run, path=["response"]) | |
| 226 | | |
| 227 | assert cast(Any, response.is_closed) is True | |
| 228 | | |
023a4e66Stainless Bot2 years ago | 229 | @parametrize |
| 230 | def test_path_params_update(self, client: OpenAI) -> None: | |
| 231 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 232 | client.beta.threads.runs.with_raw_response.update( | |
| 233 | "string", | |
| 234 | thread_id="", | |
| 235 | ) | |
| 236 | | |
| 237 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 238 | client.beta.threads.runs.with_raw_response.update( | |
| 239 | "", | |
| 240 | thread_id="string", | |
| 241 | ) | |
| 242 | | |
baa9f07fRobert Craigie2 years ago | 243 | @parametrize |
| 244 | def test_method_list(self, client: OpenAI) -> None: | |
| 245 | run = client.beta.threads.runs.list( | |
| 246 | "string", | |
| 247 | ) | |
| 248 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 249 | | |
| 250 | @parametrize | |
| 251 | def test_method_list_with_all_params(self, client: OpenAI) -> None: | |
| 252 | run = client.beta.threads.runs.list( | |
| 253 | "string", | |
| 254 | after="string", | |
| 255 | before="string", | |
| 256 | limit=0, | |
| 257 | order="asc", | |
| 258 | ) | |
| 259 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 260 | | |
| 261 | @parametrize | |
| 262 | def test_raw_response_list(self, client: OpenAI) -> None: | |
| 263 | response = client.beta.threads.runs.with_raw_response.list( | |
| 264 | "string", | |
| 265 | ) | |
86379b44Stainless Bot2 years ago | 266 | |
| 267 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 268 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 269 | run = response.parse() | |
| 270 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 271 | | |
86379b44Stainless Bot2 years ago | 272 | @parametrize |
| 273 | def test_streaming_response_list(self, client: OpenAI) -> None: | |
| 274 | with client.beta.threads.runs.with_streaming_response.list( | |
| 275 | "string", | |
| 276 | ) as response: | |
| 277 | assert not response.is_closed | |
| 278 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 279 | | |
| 280 | run = response.parse() | |
| 281 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 282 | | |
| 283 | assert cast(Any, response.is_closed) is True | |
| 284 | | |
023a4e66Stainless Bot2 years ago | 285 | @parametrize |
| 286 | def test_path_params_list(self, client: OpenAI) -> None: | |
| 287 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 288 | client.beta.threads.runs.with_raw_response.list( | |
| 289 | "", | |
| 290 | ) | |
| 291 | | |
baa9f07fRobert Craigie2 years ago | 292 | @parametrize |
| 293 | def test_method_cancel(self, client: OpenAI) -> None: | |
| 294 | run = client.beta.threads.runs.cancel( | |
| 295 | "string", | |
| 296 | thread_id="string", | |
| 297 | ) | |
| 298 | assert_matches_type(Run, run, path=["response"]) | |
| 299 | | |
| 300 | @parametrize | |
| 301 | def test_raw_response_cancel(self, client: OpenAI) -> None: | |
| 302 | response = client.beta.threads.runs.with_raw_response.cancel( | |
| 303 | "string", | |
| 304 | thread_id="string", | |
| 305 | ) | |
86379b44Stainless Bot2 years ago | 306 | |
| 307 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 308 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 309 | run = response.parse() | |
| 310 | assert_matches_type(Run, run, path=["response"]) | |
| 311 | | |
86379b44Stainless Bot2 years ago | 312 | @parametrize |
| 313 | def test_streaming_response_cancel(self, client: OpenAI) -> None: | |
| 314 | with client.beta.threads.runs.with_streaming_response.cancel( | |
| 315 | "string", | |
| 316 | thread_id="string", | |
| 317 | ) as response: | |
| 318 | assert not response.is_closed | |
| 319 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 320 | | |
| 321 | run = response.parse() | |
| 322 | assert_matches_type(Run, run, path=["response"]) | |
| 323 | | |
| 324 | assert cast(Any, response.is_closed) is True | |
| 325 | | |
023a4e66Stainless Bot2 years ago | 326 | @parametrize |
| 327 | def test_path_params_cancel(self, client: OpenAI) -> None: | |
| 328 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 329 | client.beta.threads.runs.with_raw_response.cancel( | |
| 330 | "string", | |
| 331 | thread_id="", | |
| 332 | ) | |
| 333 | | |
| 334 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 335 | client.beta.threads.runs.with_raw_response.cancel( | |
| 336 | "", | |
| 337 | thread_id="string", | |
| 338 | ) | |
| 339 | | |
baa9f07fRobert Craigie2 years ago | 340 | @parametrize |
5429f696Stainless Bot2 years ago | 341 | def test_method_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 342 | run = client.beta.threads.runs.submit_tool_outputs( |
| 343 | "string", | |
| 344 | thread_id="string", | |
| 345 | tool_outputs=[{}, {}, {}], | |
| 346 | ) | |
| 347 | assert_matches_type(Run, run, path=["response"]) | |
| 348 | | |
| 349 | @parametrize | |
5429f696Stainless Bot2 years ago | 350 | def test_method_submit_tool_outputs_with_all_params_overload_1(self, client: OpenAI) -> None: |
| 351 | run = client.beta.threads.runs.submit_tool_outputs( | |
| 352 | "string", | |
| 353 | thread_id="string", | |
| 354 | tool_outputs=[ | |
| 355 | { | |
| 356 | "tool_call_id": "string", | |
| 357 | "output": "string", | |
| 358 | }, | |
| 359 | { | |
| 360 | "tool_call_id": "string", | |
| 361 | "output": "string", | |
| 362 | }, | |
| 363 | { | |
| 364 | "tool_call_id": "string", | |
| 365 | "output": "string", | |
| 366 | }, | |
| 367 | ], | |
| 368 | stream=False, | |
| 369 | ) | |
| 370 | assert_matches_type(Run, run, path=["response"]) | |
| 371 | | |
| 372 | @parametrize | |
| 373 | def test_raw_response_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: | |
baa9f07fRobert Craigie2 years ago | 374 | response = client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
| 375 | "string", | |
| 376 | thread_id="string", | |
| 377 | tool_outputs=[{}, {}, {}], | |
| 378 | ) | |
86379b44Stainless Bot2 years ago | 379 | |
| 380 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 381 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 382 | run = response.parse() | |
| 383 | assert_matches_type(Run, run, path=["response"]) | |
| 384 | | |
86379b44Stainless Bot2 years ago | 385 | @parametrize |
5429f696Stainless Bot2 years ago | 386 | def test_streaming_response_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: |
86379b44Stainless Bot2 years ago | 387 | with client.beta.threads.runs.with_streaming_response.submit_tool_outputs( |
| 388 | "string", | |
| 389 | thread_id="string", | |
| 390 | tool_outputs=[{}, {}, {}], | |
| 391 | ) as response: | |
| 392 | assert not response.is_closed | |
| 393 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 394 | | |
| 395 | run = response.parse() | |
| 396 | assert_matches_type(Run, run, path=["response"]) | |
| 397 | | |
| 398 | assert cast(Any, response.is_closed) is True | |
| 399 | | |
023a4e66Stainless Bot2 years ago | 400 | @parametrize |
5429f696Stainless Bot2 years ago | 401 | def test_path_params_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: |
| 402 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 403 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 404 | "string", | |
| 405 | thread_id="", | |
| 406 | tool_outputs=[{}, {}, {}], | |
| 407 | ) | |
| 408 | | |
| 409 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 410 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 411 | "", | |
| 412 | thread_id="string", | |
| 413 | tool_outputs=[{}, {}, {}], | |
| 414 | ) | |
| 415 | | |
| 416 | @parametrize | |
| 417 | def test_method_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
| 418 | run_stream = client.beta.threads.runs.submit_tool_outputs( | |
| 419 | "string", | |
| 420 | thread_id="string", | |
| 421 | stream=True, | |
| 422 | tool_outputs=[{}, {}, {}], | |
| 423 | ) | |
| 424 | run_stream.response.close() | |
| 425 | | |
| 426 | @parametrize | |
| 427 | def test_raw_response_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
| 428 | response = client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 429 | "string", | |
| 430 | thread_id="string", | |
| 431 | stream=True, | |
| 432 | tool_outputs=[{}, {}, {}], | |
| 433 | ) | |
| 434 | | |
| 435 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 436 | stream = response.parse() | |
| 437 | stream.close() | |
| 438 | | |
| 439 | @parametrize | |
| 440 | def test_streaming_response_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
| 441 | with client.beta.threads.runs.with_streaming_response.submit_tool_outputs( | |
| 442 | "string", | |
| 443 | thread_id="string", | |
| 444 | stream=True, | |
| 445 | tool_outputs=[{}, {}, {}], | |
| 446 | ) as response: | |
| 447 | assert not response.is_closed | |
| 448 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 449 | | |
| 450 | stream = response.parse() | |
| 451 | stream.close() | |
| 452 | | |
| 453 | assert cast(Any, response.is_closed) is True | |
| 454 | | |
| 455 | @parametrize | |
| 456 | def test_path_params_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
023a4e66Stainless Bot2 years ago | 457 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 458 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 459 | "string", | |
| 460 | thread_id="", | |
5429f696Stainless Bot2 years ago | 461 | stream=True, |
023a4e66Stainless Bot2 years ago | 462 | tool_outputs=[{}, {}, {}], |
| 463 | ) | |
| 464 | | |
| 465 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 466 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 467 | "", | |
| 468 | thread_id="string", | |
5429f696Stainless Bot2 years ago | 469 | stream=True, |
023a4e66Stainless Bot2 years ago | 470 | tool_outputs=[{}, {}, {}], |
| 471 | ) | |
| 472 | | |
baa9f07fRobert Craigie2 years ago | 473 | |
| 474 | class TestAsyncRuns: | |
98d779fbStainless Bot2 years ago | 475 | parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) |
baa9f07fRobert Craigie2 years ago | 476 | |
| 477 | @parametrize | |
5429f696Stainless Bot2 years ago | 478 | async def test_method_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 479 | run = await async_client.beta.threads.runs.create( |
baa9f07fRobert Craigie2 years ago | 480 | "string", |
| 481 | assistant_id="string", | |
| 482 | ) | |
| 483 | assert_matches_type(Run, run, path=["response"]) | |
| 484 | | |
| 485 | @parametrize | |
5429f696Stainless Bot2 years ago | 486 | async def test_method_create_with_all_params_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 487 | run = await async_client.beta.threads.runs.create( |
baa9f07fRobert Craigie2 years ago | 488 | "string", |
| 489 | assistant_id="string", | |
53bca49eStainless Bot2 years ago | 490 | additional_instructions="string", |
baa9f07fRobert Craigie2 years ago | 491 | instructions="string", |
| 492 | metadata={}, | |
| 493 | model="string", | |
5429f696Stainless Bot2 years ago | 494 | stream=False, |
baa9f07fRobert Craigie2 years ago | 495 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
| 496 | ) | |
| 497 | assert_matches_type(Run, run, path=["response"]) | |
| 498 | | |
| 499 | @parametrize | |
5429f696Stainless Bot2 years ago | 500 | async def test_raw_response_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 501 | response = await async_client.beta.threads.runs.with_raw_response.create( |
baa9f07fRobert Craigie2 years ago | 502 | "string", |
| 503 | assistant_id="string", | |
| 504 | ) | |
86379b44Stainless Bot2 years ago | 505 | |
| 506 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 507 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 508 | run = response.parse() | |
| 509 | assert_matches_type(Run, run, path=["response"]) | |
| 510 | | |
86379b44Stainless Bot2 years ago | 511 | @parametrize |
5429f696Stainless Bot2 years ago | 512 | async def test_streaming_response_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 513 | async with async_client.beta.threads.runs.with_streaming_response.create( |
86379b44Stainless Bot2 years ago | 514 | "string", |
| 515 | assistant_id="string", | |
| 516 | ) as response: | |
| 517 | assert not response.is_closed | |
| 518 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 519 | | |
| 520 | run = await response.parse() | |
| 521 | assert_matches_type(Run, run, path=["response"]) | |
| 522 | | |
| 523 | assert cast(Any, response.is_closed) is True | |
| 524 | | |
023a4e66Stainless Bot2 years ago | 525 | @parametrize |
5429f696Stainless Bot2 years ago | 526 | async def test_path_params_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 527 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 528 | await async_client.beta.threads.runs.with_raw_response.create( |
023a4e66Stainless Bot2 years ago | 529 | "", |
| 530 | assistant_id="string", | |
| 531 | ) | |
| 532 | | |
5429f696Stainless Bot2 years ago | 533 | @parametrize |
| 534 | async def test_method_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 535 | run_stream = await async_client.beta.threads.runs.create( | |
| 536 | "string", | |
| 537 | assistant_id="string", | |
| 538 | stream=True, | |
| 539 | ) | |
| 540 | await run_stream.response.aclose() | |
| 541 | | |
| 542 | @parametrize | |
| 543 | async def test_method_create_with_all_params_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 544 | run_stream = await async_client.beta.threads.runs.create( | |
| 545 | "string", | |
| 546 | assistant_id="string", | |
| 547 | stream=True, | |
| 548 | additional_instructions="string", | |
| 549 | instructions="string", | |
| 550 | metadata={}, | |
| 551 | model="string", | |
| 552 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], | |
| 553 | ) | |
| 554 | await run_stream.response.aclose() | |
| 555 | | |
| 556 | @parametrize | |
| 557 | async def test_raw_response_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 558 | response = await async_client.beta.threads.runs.with_raw_response.create( | |
| 559 | "string", | |
| 560 | assistant_id="string", | |
| 561 | stream=True, | |
| 562 | ) | |
| 563 | | |
| 564 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 565 | stream = response.parse() | |
| 566 | await stream.close() | |
| 567 | | |
| 568 | @parametrize | |
| 569 | async def test_streaming_response_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 570 | async with async_client.beta.threads.runs.with_streaming_response.create( | |
| 571 | "string", | |
| 572 | assistant_id="string", | |
| 573 | stream=True, | |
| 574 | ) as response: | |
| 575 | assert not response.is_closed | |
| 576 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 577 | | |
| 578 | stream = await response.parse() | |
| 579 | await stream.close() | |
| 580 | | |
| 581 | assert cast(Any, response.is_closed) is True | |
| 582 | | |
| 583 | @parametrize | |
| 584 | async def test_path_params_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 585 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 586 | await async_client.beta.threads.runs.with_raw_response.create( | |
| 587 | "", | |
| 588 | assistant_id="string", | |
| 589 | stream=True, | |
| 590 | ) | |
| 591 | | |
baa9f07fRobert Craigie2 years ago | 592 | @parametrize |
98d779fbStainless Bot2 years ago | 593 | async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 594 | run = await async_client.beta.threads.runs.retrieve( | |
baa9f07fRobert Craigie2 years ago | 595 | "string", |
| 596 | thread_id="string", | |
| 597 | ) | |
| 598 | assert_matches_type(Run, run, path=["response"]) | |
| 599 | | |
| 600 | @parametrize | |
98d779fbStainless Bot2 years ago | 601 | async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 602 | response = await async_client.beta.threads.runs.with_raw_response.retrieve( | |
baa9f07fRobert Craigie2 years ago | 603 | "string", |
| 604 | thread_id="string", | |
| 605 | ) | |
86379b44Stainless Bot2 years ago | 606 | |
| 607 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 608 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 609 | run = response.parse() | |
| 610 | assert_matches_type(Run, run, path=["response"]) | |
| 611 | | |
86379b44Stainless Bot2 years ago | 612 | @parametrize |
98d779fbStainless Bot2 years ago | 613 | async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 614 | async with async_client.beta.threads.runs.with_streaming_response.retrieve( | |
86379b44Stainless Bot2 years ago | 615 | "string", |
| 616 | thread_id="string", | |
| 617 | ) as response: | |
| 618 | assert not response.is_closed | |
| 619 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 620 | | |
| 621 | run = await response.parse() | |
| 622 | assert_matches_type(Run, run, path=["response"]) | |
| 623 | | |
| 624 | assert cast(Any, response.is_closed) is True | |
| 625 | | |
023a4e66Stainless Bot2 years ago | 626 | @parametrize |
98d779fbStainless Bot2 years ago | 627 | async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 628 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 629 | await async_client.beta.threads.runs.with_raw_response.retrieve( |
023a4e66Stainless Bot2 years ago | 630 | "string", |
| 631 | thread_id="", | |
| 632 | ) | |
| 633 | | |
| 634 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 635 | await async_client.beta.threads.runs.with_raw_response.retrieve( |
023a4e66Stainless Bot2 years ago | 636 | "", |
| 637 | thread_id="string", | |
| 638 | ) | |
| 639 | | |
baa9f07fRobert Craigie2 years ago | 640 | @parametrize |
98d779fbStainless Bot2 years ago | 641 | async def test_method_update(self, async_client: AsyncOpenAI) -> None: |
| 642 | run = await async_client.beta.threads.runs.update( | |
baa9f07fRobert Craigie2 years ago | 643 | "string", |
| 644 | thread_id="string", | |
| 645 | ) | |
| 646 | assert_matches_type(Run, run, path=["response"]) | |
| 647 | | |
| 648 | @parametrize | |
98d779fbStainless Bot2 years ago | 649 | async def test_method_update_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 650 | run = await async_client.beta.threads.runs.update( | |
baa9f07fRobert Craigie2 years ago | 651 | "string", |
| 652 | thread_id="string", | |
| 653 | metadata={}, | |
| 654 | ) | |
| 655 | assert_matches_type(Run, run, path=["response"]) | |
| 656 | | |
| 657 | @parametrize | |
98d779fbStainless Bot2 years ago | 658 | async def test_raw_response_update(self, async_client: AsyncOpenAI) -> None: |
| 659 | response = await async_client.beta.threads.runs.with_raw_response.update( | |
baa9f07fRobert Craigie2 years ago | 660 | "string", |
| 661 | thread_id="string", | |
| 662 | ) | |
86379b44Stainless Bot2 years ago | 663 | |
| 664 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 665 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 666 | run = response.parse() | |
| 667 | assert_matches_type(Run, run, path=["response"]) | |
| 668 | | |
86379b44Stainless Bot2 years ago | 669 | @parametrize |
98d779fbStainless Bot2 years ago | 670 | async def test_streaming_response_update(self, async_client: AsyncOpenAI) -> None: |
| 671 | async with async_client.beta.threads.runs.with_streaming_response.update( | |
86379b44Stainless Bot2 years ago | 672 | "string", |
| 673 | thread_id="string", | |
| 674 | ) as response: | |
| 675 | assert not response.is_closed | |
| 676 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 677 | | |
| 678 | run = await response.parse() | |
| 679 | assert_matches_type(Run, run, path=["response"]) | |
| 680 | | |
| 681 | assert cast(Any, response.is_closed) is True | |
| 682 | | |
023a4e66Stainless Bot2 years ago | 683 | @parametrize |
98d779fbStainless Bot2 years ago | 684 | async def test_path_params_update(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 685 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 686 | await async_client.beta.threads.runs.with_raw_response.update( |
023a4e66Stainless Bot2 years ago | 687 | "string", |
| 688 | thread_id="", | |
| 689 | ) | |
| 690 | | |
| 691 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 692 | await async_client.beta.threads.runs.with_raw_response.update( |
023a4e66Stainless Bot2 years ago | 693 | "", |
| 694 | thread_id="string", | |
| 695 | ) | |
| 696 | | |
baa9f07fRobert Craigie2 years ago | 697 | @parametrize |
98d779fbStainless Bot2 years ago | 698 | async def test_method_list(self, async_client: AsyncOpenAI) -> None: |
| 699 | run = await async_client.beta.threads.runs.list( | |
baa9f07fRobert Craigie2 years ago | 700 | "string", |
| 701 | ) | |
| 702 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 703 | | |
| 704 | @parametrize | |
98d779fbStainless Bot2 years ago | 705 | async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 706 | run = await async_client.beta.threads.runs.list( | |
baa9f07fRobert Craigie2 years ago | 707 | "string", |
| 708 | after="string", | |
| 709 | before="string", | |
| 710 | limit=0, | |
| 711 | order="asc", | |
| 712 | ) | |
| 713 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 714 | | |
| 715 | @parametrize | |
98d779fbStainless Bot2 years ago | 716 | async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: |
| 717 | response = await async_client.beta.threads.runs.with_raw_response.list( | |
baa9f07fRobert Craigie2 years ago | 718 | "string", |
| 719 | ) | |
86379b44Stainless Bot2 years ago | 720 | |
| 721 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 722 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 723 | run = response.parse() | |
| 724 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 725 | | |
86379b44Stainless Bot2 years ago | 726 | @parametrize |
98d779fbStainless Bot2 years ago | 727 | async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None: |
| 728 | async with async_client.beta.threads.runs.with_streaming_response.list( | |
86379b44Stainless Bot2 years ago | 729 | "string", |
| 730 | ) as response: | |
| 731 | assert not response.is_closed | |
| 732 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 733 | | |
| 734 | run = await response.parse() | |
| 735 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 736 | | |
| 737 | assert cast(Any, response.is_closed) is True | |
| 738 | | |
023a4e66Stainless Bot2 years ago | 739 | @parametrize |
98d779fbStainless Bot2 years ago | 740 | async def test_path_params_list(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 741 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 742 | await async_client.beta.threads.runs.with_raw_response.list( |
023a4e66Stainless Bot2 years ago | 743 | "", |
| 744 | ) | |
| 745 | | |
baa9f07fRobert Craigie2 years ago | 746 | @parametrize |
98d779fbStainless Bot2 years ago | 747 | async def test_method_cancel(self, async_client: AsyncOpenAI) -> None: |
| 748 | run = await async_client.beta.threads.runs.cancel( | |
baa9f07fRobert Craigie2 years ago | 749 | "string", |
| 750 | thread_id="string", | |
| 751 | ) | |
| 752 | assert_matches_type(Run, run, path=["response"]) | |
| 753 | | |
| 754 | @parametrize | |
98d779fbStainless Bot2 years ago | 755 | async def test_raw_response_cancel(self, async_client: AsyncOpenAI) -> None: |
| 756 | response = await async_client.beta.threads.runs.with_raw_response.cancel( | |
baa9f07fRobert Craigie2 years ago | 757 | "string", |
| 758 | thread_id="string", | |
| 759 | ) | |
86379b44Stainless Bot2 years ago | 760 | |
| 761 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 762 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 763 | run = response.parse() | |
| 764 | assert_matches_type(Run, run, path=["response"]) | |
| 765 | | |
86379b44Stainless Bot2 years ago | 766 | @parametrize |
98d779fbStainless Bot2 years ago | 767 | async def test_streaming_response_cancel(self, async_client: AsyncOpenAI) -> None: |
| 768 | async with async_client.beta.threads.runs.with_streaming_response.cancel( | |
86379b44Stainless Bot2 years ago | 769 | "string", |
| 770 | thread_id="string", | |
| 771 | ) as response: | |
| 772 | assert not response.is_closed | |
| 773 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 774 | | |
| 775 | run = await response.parse() | |
| 776 | assert_matches_type(Run, run, path=["response"]) | |
| 777 | | |
| 778 | assert cast(Any, response.is_closed) is True | |
| 779 | | |
023a4e66Stainless Bot2 years ago | 780 | @parametrize |
98d779fbStainless Bot2 years ago | 781 | async def test_path_params_cancel(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 782 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 783 | await async_client.beta.threads.runs.with_raw_response.cancel( |
023a4e66Stainless Bot2 years ago | 784 | "string", |
| 785 | thread_id="", | |
| 786 | ) | |
| 787 | | |
| 788 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 789 | await async_client.beta.threads.runs.with_raw_response.cancel( |
023a4e66Stainless Bot2 years ago | 790 | "", |
| 791 | thread_id="string", | |
| 792 | ) | |
| 793 | | |
baa9f07fRobert Craigie2 years ago | 794 | @parametrize |
5429f696Stainless Bot2 years ago | 795 | async def test_method_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 796 | run = await async_client.beta.threads.runs.submit_tool_outputs( |
baa9f07fRobert Craigie2 years ago | 797 | "string", |
| 798 | thread_id="string", | |
| 799 | tool_outputs=[{}, {}, {}], | |
| 800 | ) | |
| 801 | assert_matches_type(Run, run, path=["response"]) | |
| 802 | | |
| 803 | @parametrize | |
5429f696Stainless Bot2 years ago | 804 | async def test_method_submit_tool_outputs_with_all_params_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 805 | run = await async_client.beta.threads.runs.submit_tool_outputs( | |
| 806 | "string", | |
| 807 | thread_id="string", | |
| 808 | tool_outputs=[ | |
| 809 | { | |
| 810 | "tool_call_id": "string", | |
| 811 | "output": "string", | |
| 812 | }, | |
| 813 | { | |
| 814 | "tool_call_id": "string", | |
| 815 | "output": "string", | |
| 816 | }, | |
| 817 | { | |
| 818 | "tool_call_id": "string", | |
| 819 | "output": "string", | |
| 820 | }, | |
| 821 | ], | |
| 822 | stream=False, | |
| 823 | ) | |
| 824 | assert_matches_type(Run, run, path=["response"]) | |
| 825 | | |
| 826 | @parametrize | |
| 827 | async def test_raw_response_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: | |
98d779fbStainless Bot2 years ago | 828 | response = await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
baa9f07fRobert Craigie2 years ago | 829 | "string", |
| 830 | thread_id="string", | |
| 831 | tool_outputs=[{}, {}, {}], | |
| 832 | ) | |
86379b44Stainless Bot2 years ago | 833 | |
| 834 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 835 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 836 | run = response.parse() | |
| 837 | assert_matches_type(Run, run, path=["response"]) | |
86379b44Stainless Bot2 years ago | 838 | |
| 839 | @parametrize | |
5429f696Stainless Bot2 years ago | 840 | async def test_streaming_response_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 841 | async with async_client.beta.threads.runs.with_streaming_response.submit_tool_outputs( |
86379b44Stainless Bot2 years ago | 842 | "string", |
| 843 | thread_id="string", | |
| 844 | tool_outputs=[{}, {}, {}], | |
| 845 | ) as response: | |
| 846 | assert not response.is_closed | |
| 847 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 848 | | |
| 849 | run = await response.parse() | |
| 850 | assert_matches_type(Run, run, path=["response"]) | |
| 851 | | |
| 852 | assert cast(Any, response.is_closed) is True | |
023a4e66Stainless Bot2 years ago | 853 | |
| 854 | @parametrize | |
5429f696Stainless Bot2 years ago | 855 | async def test_path_params_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 856 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 857 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 858 | "string", | |
| 859 | thread_id="", | |
| 860 | tool_outputs=[{}, {}, {}], | |
| 861 | ) | |
| 862 | | |
| 863 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 864 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 865 | "", | |
| 866 | thread_id="string", | |
| 867 | tool_outputs=[{}, {}, {}], | |
| 868 | ) | |
| 869 | | |
| 870 | @parametrize | |
| 871 | async def test_method_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 872 | run_stream = await async_client.beta.threads.runs.submit_tool_outputs( | |
| 873 | "string", | |
| 874 | thread_id="string", | |
| 875 | stream=True, | |
| 876 | tool_outputs=[{}, {}, {}], | |
| 877 | ) | |
| 878 | await run_stream.response.aclose() | |
| 879 | | |
| 880 | @parametrize | |
| 881 | async def test_raw_response_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 882 | response = await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 883 | "string", | |
| 884 | thread_id="string", | |
| 885 | stream=True, | |
| 886 | tool_outputs=[{}, {}, {}], | |
| 887 | ) | |
| 888 | | |
| 889 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 890 | stream = response.parse() | |
| 891 | await stream.close() | |
| 892 | | |
| 893 | @parametrize | |
| 894 | async def test_streaming_response_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 895 | async with async_client.beta.threads.runs.with_streaming_response.submit_tool_outputs( | |
| 896 | "string", | |
| 897 | thread_id="string", | |
| 898 | stream=True, | |
| 899 | tool_outputs=[{}, {}, {}], | |
| 900 | ) as response: | |
| 901 | assert not response.is_closed | |
| 902 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 903 | | |
| 904 | stream = await response.parse() | |
| 905 | await stream.close() | |
| 906 | | |
| 907 | assert cast(Any, response.is_closed) is True | |
| 908 | | |
| 909 | @parametrize | |
| 910 | async def test_path_params_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
023a4e66Stainless Bot2 years ago | 911 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 912 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
023a4e66Stainless Bot2 years ago | 913 | "string", |
| 914 | thread_id="", | |
5429f696Stainless Bot2 years ago | 915 | stream=True, |
023a4e66Stainless Bot2 years ago | 916 | tool_outputs=[{}, {}, {}], |
| 917 | ) | |
| 918 | | |
| 919 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 920 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
023a4e66Stainless Bot2 years ago | 921 | "", |
| 922 | thread_id="string", | |
5429f696Stainless Bot2 years ago | 923 | stream=True, |
023a4e66Stainless Bot2 years ago | 924 | tool_outputs=[{}, {}, {}], |
| 925 | ) |