openai/openai-python
Publicmirrored from https://github.com/openai/openai-pythonAvailable
tests/api_resources/beta/threads/test_runs.py
1355lines · 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 | |
4a0f0fa0Stainless Bot2 years ago | 13 | from openai.types.beta.threads import ( |
| 14 | Run, | |
| 15 | ) | |
baa9f07fRobert Craigie2 years ago | 16 | |
595f3b36Stainless Bot2 years ago | 17 | # pyright: reportDeprecated=false |
| 18 | | |
baa9f07fRobert Craigie2 years ago | 19 | base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") |
| 20 | | |
| 21 | | |
| 22 | class TestRuns: | |
98d779fbStainless Bot2 years ago | 23 | parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) |
baa9f07fRobert Craigie2 years ago | 24 | |
| 25 | @parametrize | |
5429f696Stainless Bot2 years ago | 26 | def test_method_create_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 27 | run = client.beta.threads.runs.create( |
| 28 | "string", | |
| 29 | assistant_id="string", | |
| 30 | ) | |
| 31 | assert_matches_type(Run, run, path=["response"]) | |
| 32 | | |
| 33 | @parametrize | |
5429f696Stainless Bot2 years ago | 34 | def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 35 | run = client.beta.threads.runs.create( |
5d3111a8Stainless Bot1 years ago | 36 | thread_id="thread_id", |
| 37 | assistant_id="assistant_id", | |
| 38 | include=["step_details.tool_calls[*].file_search.results[*].content"], | |
| 39 | additional_instructions="additional_instructions", | |
e2d65bf7Stainless Bot2 years ago | 40 | additional_messages=[ |
| 41 | { | |
79a0b401Stainless Bot2 years ago | 42 | "content": "string", |
092a8df7Stainless Bot1 years ago | 43 | "role": "user", |
5b20698dStainless Bot2 years ago | 44 | "attachments": [ |
| 45 | { | |
| 46 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 47 | "tools": [ |
| 48 | {"type": "code_interpreter"}, | |
| 49 | {"type": "code_interpreter"}, | |
| 50 | {"type": "code_interpreter"}, | |
| 51 | ], | |
5b20698dStainless Bot2 years ago | 52 | }, |
| 53 | { | |
| 54 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 55 | "tools": [ |
| 56 | {"type": "code_interpreter"}, | |
| 57 | {"type": "code_interpreter"}, | |
| 58 | {"type": "code_interpreter"}, | |
| 59 | ], | |
5b20698dStainless Bot2 years ago | 60 | }, |
| 61 | { | |
| 62 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 63 | "tools": [ |
| 64 | {"type": "code_interpreter"}, | |
| 65 | {"type": "code_interpreter"}, | |
| 66 | {"type": "code_interpreter"}, | |
| 67 | ], | |
5b20698dStainless Bot2 years ago | 68 | }, |
| 69 | ], | |
e2d65bf7Stainless Bot2 years ago | 70 | "metadata": {}, |
| 71 | }, | |
| 72 | { | |
79a0b401Stainless Bot2 years ago | 73 | "content": "string", |
092a8df7Stainless Bot1 years ago | 74 | "role": "user", |
5b20698dStainless Bot2 years ago | 75 | "attachments": [ |
| 76 | { | |
| 77 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 78 | "tools": [ |
| 79 | {"type": "code_interpreter"}, | |
| 80 | {"type": "code_interpreter"}, | |
| 81 | {"type": "code_interpreter"}, | |
| 82 | ], | |
5b20698dStainless Bot2 years ago | 83 | }, |
| 84 | { | |
| 85 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 86 | "tools": [ |
| 87 | {"type": "code_interpreter"}, | |
| 88 | {"type": "code_interpreter"}, | |
| 89 | {"type": "code_interpreter"}, | |
| 90 | ], | |
5b20698dStainless Bot2 years ago | 91 | }, |
| 92 | { | |
| 93 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 94 | "tools": [ |
| 95 | {"type": "code_interpreter"}, | |
| 96 | {"type": "code_interpreter"}, | |
| 97 | {"type": "code_interpreter"}, | |
| 98 | ], | |
5b20698dStainless Bot2 years ago | 99 | }, |
| 100 | ], | |
e2d65bf7Stainless Bot2 years ago | 101 | "metadata": {}, |
| 102 | }, | |
| 103 | { | |
79a0b401Stainless Bot2 years ago | 104 | "content": "string", |
092a8df7Stainless Bot1 years ago | 105 | "role": "user", |
5b20698dStainless Bot2 years ago | 106 | "attachments": [ |
| 107 | { | |
| 108 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 109 | "tools": [ |
| 110 | {"type": "code_interpreter"}, | |
| 111 | {"type": "code_interpreter"}, | |
| 112 | {"type": "code_interpreter"}, | |
| 113 | ], | |
5b20698dStainless Bot2 years ago | 114 | }, |
| 115 | { | |
| 116 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 117 | "tools": [ |
| 118 | {"type": "code_interpreter"}, | |
| 119 | {"type": "code_interpreter"}, | |
| 120 | {"type": "code_interpreter"}, | |
| 121 | ], | |
5b20698dStainless Bot2 years ago | 122 | }, |
| 123 | { | |
| 124 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 125 | "tools": [ |
| 126 | {"type": "code_interpreter"}, | |
| 127 | {"type": "code_interpreter"}, | |
| 128 | {"type": "code_interpreter"}, | |
| 129 | ], | |
5b20698dStainless Bot2 years ago | 130 | }, |
| 131 | ], | |
e2d65bf7Stainless Bot2 years ago | 132 | "metadata": {}, |
| 133 | }, | |
| 134 | ], | |
baa9f07fRobert Craigie2 years ago | 135 | instructions="string", |
f5247e30Stainless Bot2 years ago | 136 | max_completion_tokens=256, |
| 137 | max_prompt_tokens=256, | |
baa9f07fRobert Craigie2 years ago | 138 | metadata={}, |
bf1ca86cRobert Craigie1 years ago | 139 | model="gpt-4o", |
7399ffc8Stainless Bot2 years ago | 140 | parallel_tool_calls=True, |
bf1ca86cRobert Craigie1 years ago | 141 | response_format="auto", |
5429f696Stainless Bot2 years ago | 142 | stream=False, |
27a4626aStainless Bot2 years ago | 143 | temperature=1, |
f5247e30Stainless Bot2 years ago | 144 | tool_choice="none", |
baa9f07fRobert Craigie2 years ago | 145 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
5b20698dStainless Bot2 years ago | 146 | top_p=1, |
f5247e30Stainless Bot2 years ago | 147 | truncation_strategy={ |
| 148 | "type": "auto", | |
| 149 | "last_messages": 1, | |
| 150 | }, | |
baa9f07fRobert Craigie2 years ago | 151 | ) |
| 152 | assert_matches_type(Run, run, path=["response"]) | |
| 153 | | |
| 154 | @parametrize | |
5429f696Stainless Bot2 years ago | 155 | def test_raw_response_create_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 156 | response = client.beta.threads.runs.with_raw_response.create( |
| 157 | "string", | |
| 158 | assistant_id="string", | |
| 159 | ) | |
86379b44Stainless Bot2 years ago | 160 | |
| 161 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 162 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 163 | run = response.parse() | |
| 164 | assert_matches_type(Run, run, path=["response"]) | |
| 165 | | |
86379b44Stainless Bot2 years ago | 166 | @parametrize |
5429f696Stainless Bot2 years ago | 167 | def test_streaming_response_create_overload_1(self, client: OpenAI) -> None: |
86379b44Stainless Bot2 years ago | 168 | with client.beta.threads.runs.with_streaming_response.create( |
| 169 | "string", | |
| 170 | assistant_id="string", | |
| 171 | ) as response: | |
| 172 | assert not response.is_closed | |
| 173 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 174 | | |
| 175 | run = response.parse() | |
| 176 | assert_matches_type(Run, run, path=["response"]) | |
| 177 | | |
| 178 | assert cast(Any, response.is_closed) is True | |
| 179 | | |
023a4e66Stainless Bot2 years ago | 180 | @parametrize |
5429f696Stainless Bot2 years ago | 181 | def test_path_params_create_overload_1(self, client: OpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 182 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 183 | client.beta.threads.runs.with_raw_response.create( | |
| 184 | "", | |
| 185 | assistant_id="string", | |
| 186 | ) | |
| 187 | | |
5429f696Stainless Bot2 years ago | 188 | @parametrize |
| 189 | def test_method_create_overload_2(self, client: OpenAI) -> None: | |
| 190 | run_stream = client.beta.threads.runs.create( | |
| 191 | "string", | |
| 192 | assistant_id="string", | |
| 193 | stream=True, | |
| 194 | ) | |
| 195 | run_stream.response.close() | |
| 196 | | |
| 197 | @parametrize | |
| 198 | def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None: | |
| 199 | run_stream = client.beta.threads.runs.create( | |
| 200 | "string", | |
| 201 | assistant_id="string", | |
| 202 | stream=True, | |
5d3111a8Stainless Bot1 years ago | 203 | include=["step_details.tool_calls[*].file_search.results[*].content"], |
| 204 | additional_instructions="additional_instructions", | |
e2d65bf7Stainless Bot2 years ago | 205 | additional_messages=[ |
| 206 | { | |
79a0b401Stainless Bot2 years ago | 207 | "content": "string", |
092a8df7Stainless Bot1 years ago | 208 | "role": "user", |
5b20698dStainless Bot2 years ago | 209 | "attachments": [ |
| 210 | { | |
| 211 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 212 | "tools": [ |
| 213 | {"type": "code_interpreter"}, | |
| 214 | {"type": "code_interpreter"}, | |
| 215 | {"type": "code_interpreter"}, | |
| 216 | ], | |
5b20698dStainless Bot2 years ago | 217 | }, |
| 218 | { | |
| 219 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 220 | "tools": [ |
| 221 | {"type": "code_interpreter"}, | |
| 222 | {"type": "code_interpreter"}, | |
| 223 | {"type": "code_interpreter"}, | |
| 224 | ], | |
5b20698dStainless Bot2 years ago | 225 | }, |
| 226 | { | |
| 227 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 228 | "tools": [ |
| 229 | {"type": "code_interpreter"}, | |
| 230 | {"type": "code_interpreter"}, | |
| 231 | {"type": "code_interpreter"}, | |
| 232 | ], | |
5b20698dStainless Bot2 years ago | 233 | }, |
| 234 | ], | |
e2d65bf7Stainless Bot2 years ago | 235 | "metadata": {}, |
| 236 | }, | |
| 237 | { | |
79a0b401Stainless Bot2 years ago | 238 | "content": "string", |
092a8df7Stainless Bot1 years ago | 239 | "role": "user", |
5b20698dStainless Bot2 years ago | 240 | "attachments": [ |
| 241 | { | |
| 242 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 243 | "tools": [ |
| 244 | {"type": "code_interpreter"}, | |
| 245 | {"type": "code_interpreter"}, | |
| 246 | {"type": "code_interpreter"}, | |
| 247 | ], | |
5b20698dStainless Bot2 years ago | 248 | }, |
| 249 | { | |
| 250 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 251 | "tools": [ |
| 252 | {"type": "code_interpreter"}, | |
| 253 | {"type": "code_interpreter"}, | |
| 254 | {"type": "code_interpreter"}, | |
| 255 | ], | |
5b20698dStainless Bot2 years ago | 256 | }, |
| 257 | { | |
| 258 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 259 | "tools": [ |
| 260 | {"type": "code_interpreter"}, | |
| 261 | {"type": "code_interpreter"}, | |
| 262 | {"type": "code_interpreter"}, | |
| 263 | ], | |
5b20698dStainless Bot2 years ago | 264 | }, |
| 265 | ], | |
e2d65bf7Stainless Bot2 years ago | 266 | "metadata": {}, |
| 267 | }, | |
| 268 | { | |
79a0b401Stainless Bot2 years ago | 269 | "content": "string", |
092a8df7Stainless Bot1 years ago | 270 | "role": "user", |
5b20698dStainless Bot2 years ago | 271 | "attachments": [ |
| 272 | { | |
| 273 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 274 | "tools": [ |
| 275 | {"type": "code_interpreter"}, | |
| 276 | {"type": "code_interpreter"}, | |
| 277 | {"type": "code_interpreter"}, | |
| 278 | ], | |
5b20698dStainless Bot2 years ago | 279 | }, |
| 280 | { | |
| 281 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 282 | "tools": [ |
| 283 | {"type": "code_interpreter"}, | |
| 284 | {"type": "code_interpreter"}, | |
| 285 | {"type": "code_interpreter"}, | |
| 286 | ], | |
5b20698dStainless Bot2 years ago | 287 | }, |
| 288 | { | |
| 289 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 290 | "tools": [ |
| 291 | {"type": "code_interpreter"}, | |
| 292 | {"type": "code_interpreter"}, | |
| 293 | {"type": "code_interpreter"}, | |
| 294 | ], | |
5b20698dStainless Bot2 years ago | 295 | }, |
| 296 | ], | |
e2d65bf7Stainless Bot2 years ago | 297 | "metadata": {}, |
| 298 | }, | |
| 299 | ], | |
5429f696Stainless Bot2 years ago | 300 | instructions="string", |
f5247e30Stainless Bot2 years ago | 301 | max_completion_tokens=256, |
| 302 | max_prompt_tokens=256, | |
5429f696Stainless Bot2 years ago | 303 | metadata={}, |
bf1ca86cRobert Craigie1 years ago | 304 | model="gpt-4o", |
7399ffc8Stainless Bot2 years ago | 305 | parallel_tool_calls=True, |
bf1ca86cRobert Craigie1 years ago | 306 | response_format="auto", |
27a4626aStainless Bot2 years ago | 307 | temperature=1, |
f5247e30Stainless Bot2 years ago | 308 | tool_choice="none", |
5429f696Stainless Bot2 years ago | 309 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
5b20698dStainless Bot2 years ago | 310 | top_p=1, |
f5247e30Stainless Bot2 years ago | 311 | truncation_strategy={ |
| 312 | "type": "auto", | |
| 313 | "last_messages": 1, | |
| 314 | }, | |
5429f696Stainless Bot2 years ago | 315 | ) |
| 316 | run_stream.response.close() | |
| 317 | | |
| 318 | @parametrize | |
| 319 | def test_raw_response_create_overload_2(self, client: OpenAI) -> None: | |
| 320 | response = client.beta.threads.runs.with_raw_response.create( | |
| 321 | "string", | |
| 322 | assistant_id="string", | |
| 323 | stream=True, | |
| 324 | ) | |
| 325 | | |
| 326 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 327 | stream = response.parse() | |
| 328 | stream.close() | |
| 329 | | |
| 330 | @parametrize | |
| 331 | def test_streaming_response_create_overload_2(self, client: OpenAI) -> None: | |
| 332 | with client.beta.threads.runs.with_streaming_response.create( | |
| 333 | "string", | |
| 334 | assistant_id="string", | |
| 335 | stream=True, | |
| 336 | ) as response: | |
| 337 | assert not response.is_closed | |
| 338 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 339 | | |
| 340 | stream = response.parse() | |
| 341 | stream.close() | |
| 342 | | |
| 343 | assert cast(Any, response.is_closed) is True | |
| 344 | | |
| 345 | @parametrize | |
| 346 | def test_path_params_create_overload_2(self, client: OpenAI) -> None: | |
| 347 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 348 | client.beta.threads.runs.with_raw_response.create( | |
| 349 | "", | |
| 350 | assistant_id="string", | |
| 351 | stream=True, | |
| 352 | ) | |
| 353 | | |
baa9f07fRobert Craigie2 years ago | 354 | @parametrize |
| 355 | def test_method_retrieve(self, client: OpenAI) -> None: | |
| 356 | run = client.beta.threads.runs.retrieve( | |
| 357 | "string", | |
| 358 | thread_id="string", | |
| 359 | ) | |
| 360 | assert_matches_type(Run, run, path=["response"]) | |
| 361 | | |
| 362 | @parametrize | |
| 363 | def test_raw_response_retrieve(self, client: OpenAI) -> None: | |
| 364 | response = client.beta.threads.runs.with_raw_response.retrieve( | |
| 365 | "string", | |
| 366 | thread_id="string", | |
| 367 | ) | |
86379b44Stainless Bot2 years ago | 368 | |
| 369 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 370 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 371 | run = response.parse() | |
| 372 | assert_matches_type(Run, run, path=["response"]) | |
| 373 | | |
86379b44Stainless Bot2 years ago | 374 | @parametrize |
| 375 | def test_streaming_response_retrieve(self, client: OpenAI) -> None: | |
| 376 | with client.beta.threads.runs.with_streaming_response.retrieve( | |
| 377 | "string", | |
| 378 | thread_id="string", | |
| 379 | ) as response: | |
| 380 | assert not response.is_closed | |
| 381 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 382 | | |
| 383 | run = response.parse() | |
| 384 | assert_matches_type(Run, run, path=["response"]) | |
| 385 | | |
| 386 | assert cast(Any, response.is_closed) is True | |
| 387 | | |
023a4e66Stainless Bot2 years ago | 388 | @parametrize |
| 389 | def test_path_params_retrieve(self, client: OpenAI) -> None: | |
| 390 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 391 | client.beta.threads.runs.with_raw_response.retrieve( | |
| 392 | "string", | |
| 393 | thread_id="", | |
| 394 | ) | |
| 395 | | |
| 396 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 397 | client.beta.threads.runs.with_raw_response.retrieve( | |
| 398 | "", | |
| 399 | thread_id="string", | |
| 400 | ) | |
| 401 | | |
baa9f07fRobert Craigie2 years ago | 402 | @parametrize |
| 403 | def test_method_update(self, client: OpenAI) -> None: | |
| 404 | run = client.beta.threads.runs.update( | |
| 405 | "string", | |
| 406 | thread_id="string", | |
| 407 | ) | |
| 408 | assert_matches_type(Run, run, path=["response"]) | |
| 409 | | |
| 410 | @parametrize | |
| 411 | def test_method_update_with_all_params(self, client: OpenAI) -> None: | |
| 412 | run = client.beta.threads.runs.update( | |
| 413 | "string", | |
| 414 | thread_id="string", | |
| 415 | metadata={}, | |
| 416 | ) | |
| 417 | assert_matches_type(Run, run, path=["response"]) | |
| 418 | | |
| 419 | @parametrize | |
| 420 | def test_raw_response_update(self, client: OpenAI) -> None: | |
| 421 | response = client.beta.threads.runs.with_raw_response.update( | |
| 422 | "string", | |
| 423 | thread_id="string", | |
| 424 | ) | |
86379b44Stainless Bot2 years ago | 425 | |
| 426 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 427 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 428 | run = response.parse() | |
| 429 | assert_matches_type(Run, run, path=["response"]) | |
| 430 | | |
86379b44Stainless Bot2 years ago | 431 | @parametrize |
| 432 | def test_streaming_response_update(self, client: OpenAI) -> None: | |
| 433 | with client.beta.threads.runs.with_streaming_response.update( | |
| 434 | "string", | |
| 435 | thread_id="string", | |
| 436 | ) as response: | |
| 437 | assert not response.is_closed | |
| 438 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 439 | | |
| 440 | run = response.parse() | |
| 441 | assert_matches_type(Run, run, path=["response"]) | |
| 442 | | |
| 443 | assert cast(Any, response.is_closed) is True | |
| 444 | | |
023a4e66Stainless Bot2 years ago | 445 | @parametrize |
| 446 | def test_path_params_update(self, client: OpenAI) -> None: | |
| 447 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 448 | client.beta.threads.runs.with_raw_response.update( | |
| 449 | "string", | |
| 450 | thread_id="", | |
| 451 | ) | |
| 452 | | |
| 453 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 454 | client.beta.threads.runs.with_raw_response.update( | |
| 455 | "", | |
| 456 | thread_id="string", | |
| 457 | ) | |
| 458 | | |
baa9f07fRobert Craigie2 years ago | 459 | @parametrize |
| 460 | def test_method_list(self, client: OpenAI) -> None: | |
| 461 | run = client.beta.threads.runs.list( | |
| 462 | "string", | |
| 463 | ) | |
| 464 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 465 | | |
| 466 | @parametrize | |
| 467 | def test_method_list_with_all_params(self, client: OpenAI) -> None: | |
| 468 | run = client.beta.threads.runs.list( | |
| 469 | "string", | |
| 470 | after="string", | |
| 471 | before="string", | |
| 472 | limit=0, | |
| 473 | order="asc", | |
| 474 | ) | |
| 475 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 476 | | |
| 477 | @parametrize | |
| 478 | def test_raw_response_list(self, client: OpenAI) -> None: | |
| 479 | response = client.beta.threads.runs.with_raw_response.list( | |
| 480 | "string", | |
| 481 | ) | |
86379b44Stainless Bot2 years ago | 482 | |
| 483 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 484 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 485 | run = response.parse() | |
| 486 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 487 | | |
86379b44Stainless Bot2 years ago | 488 | @parametrize |
| 489 | def test_streaming_response_list(self, client: OpenAI) -> None: | |
| 490 | with client.beta.threads.runs.with_streaming_response.list( | |
| 491 | "string", | |
| 492 | ) as response: | |
| 493 | assert not response.is_closed | |
| 494 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 495 | | |
| 496 | run = response.parse() | |
| 497 | assert_matches_type(SyncCursorPage[Run], run, path=["response"]) | |
| 498 | | |
| 499 | assert cast(Any, response.is_closed) is True | |
| 500 | | |
023a4e66Stainless Bot2 years ago | 501 | @parametrize |
| 502 | def test_path_params_list(self, client: OpenAI) -> None: | |
| 503 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 504 | client.beta.threads.runs.with_raw_response.list( | |
| 505 | "", | |
| 506 | ) | |
| 507 | | |
baa9f07fRobert Craigie2 years ago | 508 | @parametrize |
| 509 | def test_method_cancel(self, client: OpenAI) -> None: | |
| 510 | run = client.beta.threads.runs.cancel( | |
| 511 | "string", | |
| 512 | thread_id="string", | |
| 513 | ) | |
| 514 | assert_matches_type(Run, run, path=["response"]) | |
| 515 | | |
| 516 | @parametrize | |
| 517 | def test_raw_response_cancel(self, client: OpenAI) -> None: | |
| 518 | response = client.beta.threads.runs.with_raw_response.cancel( | |
| 519 | "string", | |
| 520 | thread_id="string", | |
| 521 | ) | |
86379b44Stainless Bot2 years ago | 522 | |
| 523 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 524 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 525 | run = response.parse() | |
| 526 | assert_matches_type(Run, run, path=["response"]) | |
| 527 | | |
86379b44Stainless Bot2 years ago | 528 | @parametrize |
| 529 | def test_streaming_response_cancel(self, client: OpenAI) -> None: | |
| 530 | with client.beta.threads.runs.with_streaming_response.cancel( | |
| 531 | "string", | |
| 532 | thread_id="string", | |
| 533 | ) as response: | |
| 534 | assert not response.is_closed | |
| 535 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 536 | | |
| 537 | run = response.parse() | |
| 538 | assert_matches_type(Run, run, path=["response"]) | |
| 539 | | |
| 540 | assert cast(Any, response.is_closed) is True | |
| 541 | | |
023a4e66Stainless Bot2 years ago | 542 | @parametrize |
| 543 | def test_path_params_cancel(self, client: OpenAI) -> None: | |
| 544 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 545 | client.beta.threads.runs.with_raw_response.cancel( | |
| 546 | "string", | |
| 547 | thread_id="", | |
| 548 | ) | |
| 549 | | |
| 550 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 551 | client.beta.threads.runs.with_raw_response.cancel( | |
| 552 | "", | |
| 553 | thread_id="string", | |
| 554 | ) | |
| 555 | | |
baa9f07fRobert Craigie2 years ago | 556 | @parametrize |
5429f696Stainless Bot2 years ago | 557 | def test_method_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: |
baa9f07fRobert Craigie2 years ago | 558 | run = client.beta.threads.runs.submit_tool_outputs( |
| 559 | "string", | |
| 560 | thread_id="string", | |
| 561 | tool_outputs=[{}, {}, {}], | |
| 562 | ) | |
| 563 | assert_matches_type(Run, run, path=["response"]) | |
| 564 | | |
| 565 | @parametrize | |
5429f696Stainless Bot2 years ago | 566 | def test_method_submit_tool_outputs_with_all_params_overload_1(self, client: OpenAI) -> None: |
| 567 | run = client.beta.threads.runs.submit_tool_outputs( | |
| 568 | "string", | |
| 569 | thread_id="string", | |
| 570 | tool_outputs=[ | |
| 571 | { | |
092a8df7Stainless Bot1 years ago | 572 | "output": "output", |
| 573 | "tool_call_id": "tool_call_id", | |
5429f696Stainless Bot2 years ago | 574 | }, |
| 575 | { | |
092a8df7Stainless Bot1 years ago | 576 | "output": "output", |
| 577 | "tool_call_id": "tool_call_id", | |
5429f696Stainless Bot2 years ago | 578 | }, |
| 579 | { | |
092a8df7Stainless Bot1 years ago | 580 | "output": "output", |
| 581 | "tool_call_id": "tool_call_id", | |
5429f696Stainless Bot2 years ago | 582 | }, |
| 583 | ], | |
| 584 | stream=False, | |
| 585 | ) | |
| 586 | assert_matches_type(Run, run, path=["response"]) | |
| 587 | | |
| 588 | @parametrize | |
| 589 | def test_raw_response_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: | |
baa9f07fRobert Craigie2 years ago | 590 | response = client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
| 591 | "string", | |
| 592 | thread_id="string", | |
| 593 | tool_outputs=[{}, {}, {}], | |
| 594 | ) | |
86379b44Stainless Bot2 years ago | 595 | |
| 596 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 597 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 598 | run = response.parse() | |
| 599 | assert_matches_type(Run, run, path=["response"]) | |
| 600 | | |
86379b44Stainless Bot2 years ago | 601 | @parametrize |
5429f696Stainless Bot2 years ago | 602 | def test_streaming_response_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: |
86379b44Stainless Bot2 years ago | 603 | with client.beta.threads.runs.with_streaming_response.submit_tool_outputs( |
| 604 | "string", | |
| 605 | thread_id="string", | |
| 606 | tool_outputs=[{}, {}, {}], | |
| 607 | ) as response: | |
| 608 | assert not response.is_closed | |
| 609 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 610 | | |
| 611 | run = response.parse() | |
| 612 | assert_matches_type(Run, run, path=["response"]) | |
| 613 | | |
| 614 | assert cast(Any, response.is_closed) is True | |
| 615 | | |
023a4e66Stainless Bot2 years ago | 616 | @parametrize |
5429f696Stainless Bot2 years ago | 617 | def test_path_params_submit_tool_outputs_overload_1(self, client: OpenAI) -> None: |
| 618 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 619 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 620 | "string", | |
| 621 | thread_id="", | |
| 622 | tool_outputs=[{}, {}, {}], | |
| 623 | ) | |
| 624 | | |
| 625 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 626 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 627 | "", | |
| 628 | thread_id="string", | |
| 629 | tool_outputs=[{}, {}, {}], | |
| 630 | ) | |
| 631 | | |
| 632 | @parametrize | |
| 633 | def test_method_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
| 634 | run_stream = client.beta.threads.runs.submit_tool_outputs( | |
| 635 | "string", | |
| 636 | thread_id="string", | |
| 637 | stream=True, | |
| 638 | tool_outputs=[{}, {}, {}], | |
| 639 | ) | |
| 640 | run_stream.response.close() | |
| 641 | | |
| 642 | @parametrize | |
| 643 | def test_raw_response_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
| 644 | response = client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 645 | "string", | |
| 646 | thread_id="string", | |
| 647 | stream=True, | |
| 648 | tool_outputs=[{}, {}, {}], | |
| 649 | ) | |
| 650 | | |
| 651 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 652 | stream = response.parse() | |
| 653 | stream.close() | |
| 654 | | |
| 655 | @parametrize | |
| 656 | def test_streaming_response_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
| 657 | with client.beta.threads.runs.with_streaming_response.submit_tool_outputs( | |
| 658 | "string", | |
| 659 | thread_id="string", | |
| 660 | stream=True, | |
| 661 | tool_outputs=[{}, {}, {}], | |
| 662 | ) as response: | |
| 663 | assert not response.is_closed | |
| 664 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 665 | | |
| 666 | stream = response.parse() | |
| 667 | stream.close() | |
| 668 | | |
| 669 | assert cast(Any, response.is_closed) is True | |
| 670 | | |
| 671 | @parametrize | |
| 672 | def test_path_params_submit_tool_outputs_overload_2(self, client: OpenAI) -> None: | |
023a4e66Stainless Bot2 years ago | 673 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 674 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 675 | "string", | |
| 676 | thread_id="", | |
5429f696Stainless Bot2 years ago | 677 | stream=True, |
023a4e66Stainless Bot2 years ago | 678 | tool_outputs=[{}, {}, {}], |
| 679 | ) | |
| 680 | | |
| 681 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 682 | client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 683 | "", | |
| 684 | thread_id="string", | |
5429f696Stainless Bot2 years ago | 685 | stream=True, |
023a4e66Stainless Bot2 years ago | 686 | tool_outputs=[{}, {}, {}], |
| 687 | ) | |
| 688 | | |
baa9f07fRobert Craigie2 years ago | 689 | |
| 690 | class TestAsyncRuns: | |
98d779fbStainless Bot2 years ago | 691 | parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) |
baa9f07fRobert Craigie2 years ago | 692 | |
| 693 | @parametrize | |
5429f696Stainless Bot2 years ago | 694 | async def test_method_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 695 | run = await async_client.beta.threads.runs.create( |
baa9f07fRobert Craigie2 years ago | 696 | "string", |
| 697 | assistant_id="string", | |
| 698 | ) | |
| 699 | assert_matches_type(Run, run, path=["response"]) | |
| 700 | | |
| 701 | @parametrize | |
5429f696Stainless Bot2 years ago | 702 | async def test_method_create_with_all_params_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 703 | run = await async_client.beta.threads.runs.create( |
5d3111a8Stainless Bot1 years ago | 704 | thread_id="thread_id", |
| 705 | assistant_id="assistant_id", | |
| 706 | include=["step_details.tool_calls[*].file_search.results[*].content"], | |
| 707 | additional_instructions="additional_instructions", | |
e2d65bf7Stainless Bot2 years ago | 708 | additional_messages=[ |
| 709 | { | |
79a0b401Stainless Bot2 years ago | 710 | "content": "string", |
092a8df7Stainless Bot1 years ago | 711 | "role": "user", |
5b20698dStainless Bot2 years ago | 712 | "attachments": [ |
| 713 | { | |
| 714 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 715 | "tools": [ |
| 716 | {"type": "code_interpreter"}, | |
| 717 | {"type": "code_interpreter"}, | |
| 718 | {"type": "code_interpreter"}, | |
| 719 | ], | |
5b20698dStainless Bot2 years ago | 720 | }, |
| 721 | { | |
| 722 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 723 | "tools": [ |
| 724 | {"type": "code_interpreter"}, | |
| 725 | {"type": "code_interpreter"}, | |
| 726 | {"type": "code_interpreter"}, | |
| 727 | ], | |
5b20698dStainless Bot2 years ago | 728 | }, |
| 729 | { | |
| 730 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 731 | "tools": [ |
| 732 | {"type": "code_interpreter"}, | |
| 733 | {"type": "code_interpreter"}, | |
| 734 | {"type": "code_interpreter"}, | |
| 735 | ], | |
5b20698dStainless Bot2 years ago | 736 | }, |
| 737 | ], | |
e2d65bf7Stainless Bot2 years ago | 738 | "metadata": {}, |
| 739 | }, | |
| 740 | { | |
79a0b401Stainless Bot2 years ago | 741 | "content": "string", |
092a8df7Stainless Bot1 years ago | 742 | "role": "user", |
5b20698dStainless Bot2 years ago | 743 | "attachments": [ |
| 744 | { | |
| 745 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 746 | "tools": [ |
| 747 | {"type": "code_interpreter"}, | |
| 748 | {"type": "code_interpreter"}, | |
| 749 | {"type": "code_interpreter"}, | |
| 750 | ], | |
5b20698dStainless Bot2 years ago | 751 | }, |
| 752 | { | |
| 753 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 754 | "tools": [ |
| 755 | {"type": "code_interpreter"}, | |
| 756 | {"type": "code_interpreter"}, | |
| 757 | {"type": "code_interpreter"}, | |
| 758 | ], | |
5b20698dStainless Bot2 years ago | 759 | }, |
| 760 | { | |
| 761 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 762 | "tools": [ |
| 763 | {"type": "code_interpreter"}, | |
| 764 | {"type": "code_interpreter"}, | |
| 765 | {"type": "code_interpreter"}, | |
| 766 | ], | |
5b20698dStainless Bot2 years ago | 767 | }, |
| 768 | ], | |
e2d65bf7Stainless Bot2 years ago | 769 | "metadata": {}, |
| 770 | }, | |
| 771 | { | |
79a0b401Stainless Bot2 years ago | 772 | "content": "string", |
092a8df7Stainless Bot1 years ago | 773 | "role": "user", |
5b20698dStainless Bot2 years ago | 774 | "attachments": [ |
| 775 | { | |
| 776 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 777 | "tools": [ |
| 778 | {"type": "code_interpreter"}, | |
| 779 | {"type": "code_interpreter"}, | |
| 780 | {"type": "code_interpreter"}, | |
| 781 | ], | |
5b20698dStainless Bot2 years ago | 782 | }, |
| 783 | { | |
| 784 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 785 | "tools": [ |
| 786 | {"type": "code_interpreter"}, | |
| 787 | {"type": "code_interpreter"}, | |
| 788 | {"type": "code_interpreter"}, | |
| 789 | ], | |
5b20698dStainless Bot2 years ago | 790 | }, |
| 791 | { | |
| 792 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 793 | "tools": [ |
| 794 | {"type": "code_interpreter"}, | |
| 795 | {"type": "code_interpreter"}, | |
| 796 | {"type": "code_interpreter"}, | |
| 797 | ], | |
5b20698dStainless Bot2 years ago | 798 | }, |
| 799 | ], | |
e2d65bf7Stainless Bot2 years ago | 800 | "metadata": {}, |
| 801 | }, | |
| 802 | ], | |
baa9f07fRobert Craigie2 years ago | 803 | instructions="string", |
f5247e30Stainless Bot2 years ago | 804 | max_completion_tokens=256, |
| 805 | max_prompt_tokens=256, | |
baa9f07fRobert Craigie2 years ago | 806 | metadata={}, |
bf1ca86cRobert Craigie1 years ago | 807 | model="gpt-4o", |
7399ffc8Stainless Bot2 years ago | 808 | parallel_tool_calls=True, |
bf1ca86cRobert Craigie1 years ago | 809 | response_format="auto", |
5429f696Stainless Bot2 years ago | 810 | stream=False, |
27a4626aStainless Bot2 years ago | 811 | temperature=1, |
f5247e30Stainless Bot2 years ago | 812 | tool_choice="none", |
baa9f07fRobert Craigie2 years ago | 813 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
5b20698dStainless Bot2 years ago | 814 | top_p=1, |
f5247e30Stainless Bot2 years ago | 815 | truncation_strategy={ |
| 816 | "type": "auto", | |
| 817 | "last_messages": 1, | |
| 818 | }, | |
baa9f07fRobert Craigie2 years ago | 819 | ) |
| 820 | assert_matches_type(Run, run, path=["response"]) | |
| 821 | | |
| 822 | @parametrize | |
5429f696Stainless Bot2 years ago | 823 | async def test_raw_response_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 824 | response = await async_client.beta.threads.runs.with_raw_response.create( |
baa9f07fRobert Craigie2 years ago | 825 | "string", |
| 826 | assistant_id="string", | |
| 827 | ) | |
86379b44Stainless Bot2 years ago | 828 | |
| 829 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 830 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 831 | run = response.parse() | |
| 832 | assert_matches_type(Run, run, path=["response"]) | |
| 833 | | |
86379b44Stainless Bot2 years ago | 834 | @parametrize |
5429f696Stainless Bot2 years ago | 835 | async def test_streaming_response_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 836 | async with async_client.beta.threads.runs.with_streaming_response.create( |
86379b44Stainless Bot2 years ago | 837 | "string", |
| 838 | assistant_id="string", | |
| 839 | ) as response: | |
| 840 | assert not response.is_closed | |
| 841 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 842 | | |
| 843 | run = await response.parse() | |
| 844 | assert_matches_type(Run, run, path=["response"]) | |
| 845 | | |
| 846 | assert cast(Any, response.is_closed) is True | |
| 847 | | |
023a4e66Stainless Bot2 years ago | 848 | @parametrize |
5429f696Stainless Bot2 years ago | 849 | async def test_path_params_create_overload_1(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 850 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 851 | await async_client.beta.threads.runs.with_raw_response.create( |
023a4e66Stainless Bot2 years ago | 852 | "", |
| 853 | assistant_id="string", | |
| 854 | ) | |
| 855 | | |
5429f696Stainless Bot2 years ago | 856 | @parametrize |
| 857 | async def test_method_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 858 | run_stream = await async_client.beta.threads.runs.create( | |
| 859 | "string", | |
| 860 | assistant_id="string", | |
| 861 | stream=True, | |
| 862 | ) | |
| 863 | await run_stream.response.aclose() | |
| 864 | | |
| 865 | @parametrize | |
| 866 | async def test_method_create_with_all_params_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 867 | run_stream = await async_client.beta.threads.runs.create( | |
| 868 | "string", | |
| 869 | assistant_id="string", | |
| 870 | stream=True, | |
5d3111a8Stainless Bot1 years ago | 871 | include=["step_details.tool_calls[*].file_search.results[*].content"], |
| 872 | additional_instructions="additional_instructions", | |
e2d65bf7Stainless Bot2 years ago | 873 | additional_messages=[ |
| 874 | { | |
79a0b401Stainless Bot2 years ago | 875 | "content": "string", |
092a8df7Stainless Bot1 years ago | 876 | "role": "user", |
5b20698dStainless Bot2 years ago | 877 | "attachments": [ |
| 878 | { | |
| 879 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 880 | "tools": [ |
| 881 | {"type": "code_interpreter"}, | |
| 882 | {"type": "code_interpreter"}, | |
| 883 | {"type": "code_interpreter"}, | |
| 884 | ], | |
5b20698dStainless Bot2 years ago | 885 | }, |
| 886 | { | |
| 887 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 888 | "tools": [ |
| 889 | {"type": "code_interpreter"}, | |
| 890 | {"type": "code_interpreter"}, | |
| 891 | {"type": "code_interpreter"}, | |
| 892 | ], | |
5b20698dStainless Bot2 years ago | 893 | }, |
| 894 | { | |
| 895 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 896 | "tools": [ |
| 897 | {"type": "code_interpreter"}, | |
| 898 | {"type": "code_interpreter"}, | |
| 899 | {"type": "code_interpreter"}, | |
| 900 | ], | |
5b20698dStainless Bot2 years ago | 901 | }, |
| 902 | ], | |
e2d65bf7Stainless Bot2 years ago | 903 | "metadata": {}, |
| 904 | }, | |
| 905 | { | |
79a0b401Stainless Bot2 years ago | 906 | "content": "string", |
092a8df7Stainless Bot1 years ago | 907 | "role": "user", |
5b20698dStainless Bot2 years ago | 908 | "attachments": [ |
| 909 | { | |
| 910 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 911 | "tools": [ |
| 912 | {"type": "code_interpreter"}, | |
| 913 | {"type": "code_interpreter"}, | |
| 914 | {"type": "code_interpreter"}, | |
| 915 | ], | |
5b20698dStainless Bot2 years ago | 916 | }, |
| 917 | { | |
| 918 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 919 | "tools": [ |
| 920 | {"type": "code_interpreter"}, | |
| 921 | {"type": "code_interpreter"}, | |
| 922 | {"type": "code_interpreter"}, | |
| 923 | ], | |
5b20698dStainless Bot2 years ago | 924 | }, |
| 925 | { | |
| 926 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 927 | "tools": [ |
| 928 | {"type": "code_interpreter"}, | |
| 929 | {"type": "code_interpreter"}, | |
| 930 | {"type": "code_interpreter"}, | |
| 931 | ], | |
5b20698dStainless Bot2 years ago | 932 | }, |
| 933 | ], | |
e2d65bf7Stainless Bot2 years ago | 934 | "metadata": {}, |
| 935 | }, | |
| 936 | { | |
79a0b401Stainless Bot2 years ago | 937 | "content": "string", |
092a8df7Stainless Bot1 years ago | 938 | "role": "user", |
5b20698dStainless Bot2 years ago | 939 | "attachments": [ |
| 940 | { | |
| 941 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 942 | "tools": [ |
| 943 | {"type": "code_interpreter"}, | |
| 944 | {"type": "code_interpreter"}, | |
| 945 | {"type": "code_interpreter"}, | |
| 946 | ], | |
5b20698dStainless Bot2 years ago | 947 | }, |
| 948 | { | |
| 949 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 950 | "tools": [ |
| 951 | {"type": "code_interpreter"}, | |
| 952 | {"type": "code_interpreter"}, | |
| 953 | {"type": "code_interpreter"}, | |
| 954 | ], | |
5b20698dStainless Bot2 years ago | 955 | }, |
| 956 | { | |
| 957 | "file_id": "string", | |
f73996b7Stainless Bot2 years ago | 958 | "tools": [ |
| 959 | {"type": "code_interpreter"}, | |
| 960 | {"type": "code_interpreter"}, | |
| 961 | {"type": "code_interpreter"}, | |
| 962 | ], | |
5b20698dStainless Bot2 years ago | 963 | }, |
| 964 | ], | |
e2d65bf7Stainless Bot2 years ago | 965 | "metadata": {}, |
| 966 | }, | |
| 967 | ], | |
5429f696Stainless Bot2 years ago | 968 | instructions="string", |
f5247e30Stainless Bot2 years ago | 969 | max_completion_tokens=256, |
| 970 | max_prompt_tokens=256, | |
5429f696Stainless Bot2 years ago | 971 | metadata={}, |
bf1ca86cRobert Craigie1 years ago | 972 | model="gpt-4o", |
7399ffc8Stainless Bot2 years ago | 973 | parallel_tool_calls=True, |
bf1ca86cRobert Craigie1 years ago | 974 | response_format="auto", |
27a4626aStainless Bot2 years ago | 975 | temperature=1, |
f5247e30Stainless Bot2 years ago | 976 | tool_choice="none", |
5429f696Stainless Bot2 years ago | 977 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
5b20698dStainless Bot2 years ago | 978 | top_p=1, |
f5247e30Stainless Bot2 years ago | 979 | truncation_strategy={ |
| 980 | "type": "auto", | |
| 981 | "last_messages": 1, | |
| 982 | }, | |
5429f696Stainless Bot2 years ago | 983 | ) |
| 984 | await run_stream.response.aclose() | |
| 985 | | |
| 986 | @parametrize | |
| 987 | async def test_raw_response_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 988 | response = await async_client.beta.threads.runs.with_raw_response.create( | |
| 989 | "string", | |
| 990 | assistant_id="string", | |
| 991 | stream=True, | |
| 992 | ) | |
| 993 | | |
| 994 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 995 | stream = response.parse() | |
| 996 | await stream.close() | |
| 997 | | |
| 998 | @parametrize | |
| 999 | async def test_streaming_response_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 1000 | async with async_client.beta.threads.runs.with_streaming_response.create( | |
| 1001 | "string", | |
| 1002 | assistant_id="string", | |
| 1003 | stream=True, | |
| 1004 | ) as response: | |
| 1005 | assert not response.is_closed | |
| 1006 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1007 | | |
| 1008 | stream = await response.parse() | |
| 1009 | await stream.close() | |
| 1010 | | |
| 1011 | assert cast(Any, response.is_closed) is True | |
| 1012 | | |
| 1013 | @parametrize | |
| 1014 | async def test_path_params_create_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 1015 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 1016 | await async_client.beta.threads.runs.with_raw_response.create( | |
| 1017 | "", | |
| 1018 | assistant_id="string", | |
| 1019 | stream=True, | |
| 1020 | ) | |
| 1021 | | |
baa9f07fRobert Craigie2 years ago | 1022 | @parametrize |
98d779fbStainless Bot2 years ago | 1023 | async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 1024 | run = await async_client.beta.threads.runs.retrieve( | |
baa9f07fRobert Craigie2 years ago | 1025 | "string", |
| 1026 | thread_id="string", | |
| 1027 | ) | |
| 1028 | assert_matches_type(Run, run, path=["response"]) | |
| 1029 | | |
| 1030 | @parametrize | |
98d779fbStainless Bot2 years ago | 1031 | async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 1032 | response = await async_client.beta.threads.runs.with_raw_response.retrieve( | |
baa9f07fRobert Craigie2 years ago | 1033 | "string", |
| 1034 | thread_id="string", | |
| 1035 | ) | |
86379b44Stainless Bot2 years ago | 1036 | |
| 1037 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 1038 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1039 | run = response.parse() | |
| 1040 | assert_matches_type(Run, run, path=["response"]) | |
| 1041 | | |
86379b44Stainless Bot2 years ago | 1042 | @parametrize |
98d779fbStainless Bot2 years ago | 1043 | async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 1044 | async with async_client.beta.threads.runs.with_streaming_response.retrieve( | |
86379b44Stainless Bot2 years ago | 1045 | "string", |
| 1046 | thread_id="string", | |
| 1047 | ) as response: | |
| 1048 | assert not response.is_closed | |
| 1049 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1050 | | |
| 1051 | run = await response.parse() | |
| 1052 | assert_matches_type(Run, run, path=["response"]) | |
| 1053 | | |
| 1054 | assert cast(Any, response.is_closed) is True | |
| 1055 | | |
023a4e66Stainless Bot2 years ago | 1056 | @parametrize |
98d779fbStainless Bot2 years ago | 1057 | async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 1058 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 1059 | await async_client.beta.threads.runs.with_raw_response.retrieve( |
023a4e66Stainless Bot2 years ago | 1060 | "string", |
| 1061 | thread_id="", | |
| 1062 | ) | |
| 1063 | | |
| 1064 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 1065 | await async_client.beta.threads.runs.with_raw_response.retrieve( |
023a4e66Stainless Bot2 years ago | 1066 | "", |
| 1067 | thread_id="string", | |
| 1068 | ) | |
| 1069 | | |
baa9f07fRobert Craigie2 years ago | 1070 | @parametrize |
98d779fbStainless Bot2 years ago | 1071 | async def test_method_update(self, async_client: AsyncOpenAI) -> None: |
| 1072 | run = await async_client.beta.threads.runs.update( | |
baa9f07fRobert Craigie2 years ago | 1073 | "string", |
| 1074 | thread_id="string", | |
| 1075 | ) | |
| 1076 | assert_matches_type(Run, run, path=["response"]) | |
| 1077 | | |
| 1078 | @parametrize | |
98d779fbStainless Bot2 years ago | 1079 | async def test_method_update_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 1080 | run = await async_client.beta.threads.runs.update( | |
baa9f07fRobert Craigie2 years ago | 1081 | "string", |
| 1082 | thread_id="string", | |
| 1083 | metadata={}, | |
| 1084 | ) | |
| 1085 | assert_matches_type(Run, run, path=["response"]) | |
| 1086 | | |
| 1087 | @parametrize | |
98d779fbStainless Bot2 years ago | 1088 | async def test_raw_response_update(self, async_client: AsyncOpenAI) -> None: |
| 1089 | response = await async_client.beta.threads.runs.with_raw_response.update( | |
baa9f07fRobert Craigie2 years ago | 1090 | "string", |
| 1091 | thread_id="string", | |
| 1092 | ) | |
86379b44Stainless Bot2 years ago | 1093 | |
| 1094 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 1095 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1096 | run = response.parse() | |
| 1097 | assert_matches_type(Run, run, path=["response"]) | |
| 1098 | | |
86379b44Stainless Bot2 years ago | 1099 | @parametrize |
98d779fbStainless Bot2 years ago | 1100 | async def test_streaming_response_update(self, async_client: AsyncOpenAI) -> None: |
| 1101 | async with async_client.beta.threads.runs.with_streaming_response.update( | |
86379b44Stainless Bot2 years ago | 1102 | "string", |
| 1103 | thread_id="string", | |
| 1104 | ) as response: | |
| 1105 | assert not response.is_closed | |
| 1106 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1107 | | |
| 1108 | run = await response.parse() | |
| 1109 | assert_matches_type(Run, run, path=["response"]) | |
| 1110 | | |
| 1111 | assert cast(Any, response.is_closed) is True | |
| 1112 | | |
023a4e66Stainless Bot2 years ago | 1113 | @parametrize |
98d779fbStainless Bot2 years ago | 1114 | async def test_path_params_update(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 1115 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 1116 | await async_client.beta.threads.runs.with_raw_response.update( |
023a4e66Stainless Bot2 years ago | 1117 | "string", |
| 1118 | thread_id="", | |
| 1119 | ) | |
| 1120 | | |
| 1121 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 1122 | await async_client.beta.threads.runs.with_raw_response.update( |
023a4e66Stainless Bot2 years ago | 1123 | "", |
| 1124 | thread_id="string", | |
| 1125 | ) | |
| 1126 | | |
baa9f07fRobert Craigie2 years ago | 1127 | @parametrize |
98d779fbStainless Bot2 years ago | 1128 | async def test_method_list(self, async_client: AsyncOpenAI) -> None: |
| 1129 | run = await async_client.beta.threads.runs.list( | |
baa9f07fRobert Craigie2 years ago | 1130 | "string", |
| 1131 | ) | |
| 1132 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 1133 | | |
| 1134 | @parametrize | |
98d779fbStainless Bot2 years ago | 1135 | async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 1136 | run = await async_client.beta.threads.runs.list( | |
baa9f07fRobert Craigie2 years ago | 1137 | "string", |
| 1138 | after="string", | |
| 1139 | before="string", | |
| 1140 | limit=0, | |
| 1141 | order="asc", | |
| 1142 | ) | |
| 1143 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 1144 | | |
| 1145 | @parametrize | |
98d779fbStainless Bot2 years ago | 1146 | async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: |
| 1147 | response = await async_client.beta.threads.runs.with_raw_response.list( | |
baa9f07fRobert Craigie2 years ago | 1148 | "string", |
| 1149 | ) | |
86379b44Stainless Bot2 years ago | 1150 | |
| 1151 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 1152 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1153 | run = response.parse() | |
| 1154 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 1155 | | |
86379b44Stainless Bot2 years ago | 1156 | @parametrize |
98d779fbStainless Bot2 years ago | 1157 | async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None: |
| 1158 | async with async_client.beta.threads.runs.with_streaming_response.list( | |
86379b44Stainless Bot2 years ago | 1159 | "string", |
| 1160 | ) as response: | |
| 1161 | assert not response.is_closed | |
| 1162 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1163 | | |
| 1164 | run = await response.parse() | |
| 1165 | assert_matches_type(AsyncCursorPage[Run], run, path=["response"]) | |
| 1166 | | |
| 1167 | assert cast(Any, response.is_closed) is True | |
| 1168 | | |
023a4e66Stainless Bot2 years ago | 1169 | @parametrize |
98d779fbStainless Bot2 years ago | 1170 | async def test_path_params_list(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 1171 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 1172 | await async_client.beta.threads.runs.with_raw_response.list( |
023a4e66Stainless Bot2 years ago | 1173 | "", |
| 1174 | ) | |
| 1175 | | |
baa9f07fRobert Craigie2 years ago | 1176 | @parametrize |
98d779fbStainless Bot2 years ago | 1177 | async def test_method_cancel(self, async_client: AsyncOpenAI) -> None: |
| 1178 | run = await async_client.beta.threads.runs.cancel( | |
baa9f07fRobert Craigie2 years ago | 1179 | "string", |
| 1180 | thread_id="string", | |
| 1181 | ) | |
| 1182 | assert_matches_type(Run, run, path=["response"]) | |
| 1183 | | |
| 1184 | @parametrize | |
98d779fbStainless Bot2 years ago | 1185 | async def test_raw_response_cancel(self, async_client: AsyncOpenAI) -> None: |
| 1186 | response = await async_client.beta.threads.runs.with_raw_response.cancel( | |
baa9f07fRobert Craigie2 years ago | 1187 | "string", |
| 1188 | thread_id="string", | |
| 1189 | ) | |
86379b44Stainless Bot2 years ago | 1190 | |
| 1191 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 1192 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1193 | run = response.parse() | |
| 1194 | assert_matches_type(Run, run, path=["response"]) | |
| 1195 | | |
86379b44Stainless Bot2 years ago | 1196 | @parametrize |
98d779fbStainless Bot2 years ago | 1197 | async def test_streaming_response_cancel(self, async_client: AsyncOpenAI) -> None: |
| 1198 | async with async_client.beta.threads.runs.with_streaming_response.cancel( | |
86379b44Stainless Bot2 years ago | 1199 | "string", |
| 1200 | thread_id="string", | |
| 1201 | ) as response: | |
| 1202 | assert not response.is_closed | |
| 1203 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1204 | | |
| 1205 | run = await response.parse() | |
| 1206 | assert_matches_type(Run, run, path=["response"]) | |
| 1207 | | |
| 1208 | assert cast(Any, response.is_closed) is True | |
| 1209 | | |
023a4e66Stainless Bot2 years ago | 1210 | @parametrize |
98d779fbStainless Bot2 years ago | 1211 | async def test_path_params_cancel(self, async_client: AsyncOpenAI) -> None: |
023a4e66Stainless Bot2 years ago | 1212 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 1213 | await async_client.beta.threads.runs.with_raw_response.cancel( |
023a4e66Stainless Bot2 years ago | 1214 | "string", |
| 1215 | thread_id="", | |
| 1216 | ) | |
| 1217 | | |
| 1218 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 1219 | await async_client.beta.threads.runs.with_raw_response.cancel( |
023a4e66Stainless Bot2 years ago | 1220 | "", |
| 1221 | thread_id="string", | |
| 1222 | ) | |
| 1223 | | |
baa9f07fRobert Craigie2 years ago | 1224 | @parametrize |
5429f696Stainless Bot2 years ago | 1225 | async def test_method_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 1226 | run = await async_client.beta.threads.runs.submit_tool_outputs( |
baa9f07fRobert Craigie2 years ago | 1227 | "string", |
| 1228 | thread_id="string", | |
| 1229 | tool_outputs=[{}, {}, {}], | |
| 1230 | ) | |
| 1231 | assert_matches_type(Run, run, path=["response"]) | |
| 1232 | | |
| 1233 | @parametrize | |
5429f696Stainless Bot2 years ago | 1234 | async def test_method_submit_tool_outputs_with_all_params_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 1235 | run = await async_client.beta.threads.runs.submit_tool_outputs( | |
| 1236 | "string", | |
| 1237 | thread_id="string", | |
| 1238 | tool_outputs=[ | |
| 1239 | { | |
092a8df7Stainless Bot1 years ago | 1240 | "output": "output", |
| 1241 | "tool_call_id": "tool_call_id", | |
5429f696Stainless Bot2 years ago | 1242 | }, |
| 1243 | { | |
092a8df7Stainless Bot1 years ago | 1244 | "output": "output", |
| 1245 | "tool_call_id": "tool_call_id", | |
5429f696Stainless Bot2 years ago | 1246 | }, |
| 1247 | { | |
092a8df7Stainless Bot1 years ago | 1248 | "output": "output", |
| 1249 | "tool_call_id": "tool_call_id", | |
5429f696Stainless Bot2 years ago | 1250 | }, |
| 1251 | ], | |
| 1252 | stream=False, | |
| 1253 | ) | |
| 1254 | assert_matches_type(Run, run, path=["response"]) | |
| 1255 | | |
| 1256 | @parametrize | |
| 1257 | async def test_raw_response_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: | |
98d779fbStainless Bot2 years ago | 1258 | response = await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
baa9f07fRobert Craigie2 years ago | 1259 | "string", |
| 1260 | thread_id="string", | |
| 1261 | tool_outputs=[{}, {}, {}], | |
| 1262 | ) | |
86379b44Stainless Bot2 years ago | 1263 | |
| 1264 | assert response.is_closed is True | |
baa9f07fRobert Craigie2 years ago | 1265 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1266 | run = response.parse() | |
| 1267 | assert_matches_type(Run, run, path=["response"]) | |
86379b44Stainless Bot2 years ago | 1268 | |
| 1269 | @parametrize | |
5429f696Stainless Bot2 years ago | 1270 | async def test_streaming_response_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: |
98d779fbStainless Bot2 years ago | 1271 | async with async_client.beta.threads.runs.with_streaming_response.submit_tool_outputs( |
86379b44Stainless Bot2 years ago | 1272 | "string", |
| 1273 | thread_id="string", | |
| 1274 | tool_outputs=[{}, {}, {}], | |
| 1275 | ) as response: | |
| 1276 | assert not response.is_closed | |
| 1277 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1278 | | |
| 1279 | run = await response.parse() | |
| 1280 | assert_matches_type(Run, run, path=["response"]) | |
| 1281 | | |
| 1282 | assert cast(Any, response.is_closed) is True | |
023a4e66Stainless Bot2 years ago | 1283 | |
| 1284 | @parametrize | |
5429f696Stainless Bot2 years ago | 1285 | async def test_path_params_submit_tool_outputs_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 1286 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): | |
| 1287 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 1288 | "string", | |
| 1289 | thread_id="", | |
| 1290 | tool_outputs=[{}, {}, {}], | |
| 1291 | ) | |
| 1292 | | |
| 1293 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
| 1294 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 1295 | "", | |
| 1296 | thread_id="string", | |
| 1297 | tool_outputs=[{}, {}, {}], | |
| 1298 | ) | |
| 1299 | | |
| 1300 | @parametrize | |
| 1301 | async def test_method_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 1302 | run_stream = await async_client.beta.threads.runs.submit_tool_outputs( | |
| 1303 | "string", | |
| 1304 | thread_id="string", | |
| 1305 | stream=True, | |
| 1306 | tool_outputs=[{}, {}, {}], | |
| 1307 | ) | |
| 1308 | await run_stream.response.aclose() | |
| 1309 | | |
| 1310 | @parametrize | |
| 1311 | async def test_raw_response_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 1312 | response = await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( | |
| 1313 | "string", | |
| 1314 | thread_id="string", | |
| 1315 | stream=True, | |
| 1316 | tool_outputs=[{}, {}, {}], | |
| 1317 | ) | |
| 1318 | | |
| 1319 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1320 | stream = response.parse() | |
| 1321 | await stream.close() | |
| 1322 | | |
| 1323 | @parametrize | |
| 1324 | async def test_streaming_response_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
| 1325 | async with async_client.beta.threads.runs.with_streaming_response.submit_tool_outputs( | |
| 1326 | "string", | |
| 1327 | thread_id="string", | |
| 1328 | stream=True, | |
| 1329 | tool_outputs=[{}, {}, {}], | |
| 1330 | ) as response: | |
| 1331 | assert not response.is_closed | |
| 1332 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" | |
| 1333 | | |
| 1334 | stream = await response.parse() | |
| 1335 | await stream.close() | |
| 1336 | | |
| 1337 | assert cast(Any, response.is_closed) is True | |
| 1338 | | |
| 1339 | @parametrize | |
| 1340 | async def test_path_params_submit_tool_outputs_overload_2(self, async_client: AsyncOpenAI) -> None: | |
023a4e66Stainless Bot2 years ago | 1341 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
98d779fbStainless Bot2 years ago | 1342 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
023a4e66Stainless Bot2 years ago | 1343 | "string", |
| 1344 | thread_id="", | |
5429f696Stainless Bot2 years ago | 1345 | stream=True, |
023a4e66Stainless Bot2 years ago | 1346 | tool_outputs=[{}, {}, {}], |
| 1347 | ) | |
| 1348 | | |
| 1349 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): | |
98d779fbStainless Bot2 years ago | 1350 | await async_client.beta.threads.runs.with_raw_response.submit_tool_outputs( |
023a4e66Stainless Bot2 years ago | 1351 | "", |
| 1352 | thread_id="string", | |
5429f696Stainless Bot2 years ago | 1353 | stream=True, |
023a4e66Stainless Bot2 years ago | 1354 | tool_outputs=[{}, {}, {}], |
| 1355 | ) |