openai/openai-python
Publicmirrored fromhttps://github.com/openai/openai-pythonAvailable
tests/api_resources/beta/test_assistants.py
548lines · modecode
| 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import os |
| 6 | from typing import Any, cast |
| 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 |
| 13 | from openai.types.beta import ( |
| 14 | Assistant, |
| 15 | AssistantDeleted, |
| 16 | ) |
| 17 | |
| 18 | # pyright: reportDeprecated=false |
| 19 | |
| 20 | base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") |
| 21 | |
| 22 | |
| 23 | class TestAssistants: |
| 24 | parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) |
| 25 | |
| 26 | @parametrize |
| 27 | def test_method_create(self, client: OpenAI) -> None: |
| 28 | with pytest.warns(DeprecationWarning): |
| 29 | assistant = client.beta.assistants.create( |
| 30 | model="gpt-4o", |
| 31 | ) |
| 32 | |
| 33 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 34 | |
| 35 | @parametrize |
| 36 | def test_method_create_with_all_params(self, client: OpenAI) -> None: |
| 37 | with pytest.warns(DeprecationWarning): |
| 38 | assistant = client.beta.assistants.create( |
| 39 | model="gpt-4o", |
| 40 | description="description", |
| 41 | instructions="instructions", |
| 42 | metadata={"foo": "string"}, |
| 43 | name="name", |
| 44 | reasoning_effort="none", |
| 45 | response_format="auto", |
| 46 | temperature=1, |
| 47 | tool_resources={ |
| 48 | "code_interpreter": {"file_ids": ["string"]}, |
| 49 | "file_search": { |
| 50 | "vector_store_ids": ["string"], |
| 51 | "vector_stores": [ |
| 52 | { |
| 53 | "chunking_strategy": {"type": "auto"}, |
| 54 | "file_ids": ["string"], |
| 55 | "metadata": {"foo": "string"}, |
| 56 | } |
| 57 | ], |
| 58 | }, |
| 59 | }, |
| 60 | tools=[{"type": "code_interpreter"}], |
| 61 | top_p=1, |
| 62 | ) |
| 63 | |
| 64 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 65 | |
| 66 | @parametrize |
| 67 | def test_raw_response_create(self, client: OpenAI) -> None: |
| 68 | with pytest.warns(DeprecationWarning): |
| 69 | response = client.beta.assistants.with_raw_response.create( |
| 70 | model="gpt-4o", |
| 71 | ) |
| 72 | |
| 73 | assert response.is_closed is True |
| 74 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 75 | assistant = response.parse() |
| 76 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 77 | |
| 78 | @parametrize |
| 79 | def test_streaming_response_create(self, client: OpenAI) -> None: |
| 80 | with pytest.warns(DeprecationWarning): |
| 81 | with client.beta.assistants.with_streaming_response.create( |
| 82 | model="gpt-4o", |
| 83 | ) as response: |
| 84 | assert not response.is_closed |
| 85 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 86 | |
| 87 | assistant = response.parse() |
| 88 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 89 | |
| 90 | assert cast(Any, response.is_closed) is True |
| 91 | |
| 92 | @parametrize |
| 93 | def test_method_retrieve(self, client: OpenAI) -> None: |
| 94 | with pytest.warns(DeprecationWarning): |
| 95 | assistant = client.beta.assistants.retrieve( |
| 96 | "assistant_id", |
| 97 | ) |
| 98 | |
| 99 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 100 | |
| 101 | @parametrize |
| 102 | def test_raw_response_retrieve(self, client: OpenAI) -> None: |
| 103 | with pytest.warns(DeprecationWarning): |
| 104 | response = client.beta.assistants.with_raw_response.retrieve( |
| 105 | "assistant_id", |
| 106 | ) |
| 107 | |
| 108 | assert response.is_closed is True |
| 109 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 110 | assistant = response.parse() |
| 111 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 112 | |
| 113 | @parametrize |
| 114 | def test_streaming_response_retrieve(self, client: OpenAI) -> None: |
| 115 | with pytest.warns(DeprecationWarning): |
| 116 | with client.beta.assistants.with_streaming_response.retrieve( |
| 117 | "assistant_id", |
| 118 | ) as response: |
| 119 | assert not response.is_closed |
| 120 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 121 | |
| 122 | assistant = response.parse() |
| 123 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 124 | |
| 125 | assert cast(Any, response.is_closed) is True |
| 126 | |
| 127 | @parametrize |
| 128 | def test_path_params_retrieve(self, client: OpenAI) -> None: |
| 129 | with pytest.warns(DeprecationWarning): |
| 130 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): |
| 131 | client.beta.assistants.with_raw_response.retrieve( |
| 132 | "", |
| 133 | ) |
| 134 | |
| 135 | @parametrize |
| 136 | def test_method_update(self, client: OpenAI) -> None: |
| 137 | with pytest.warns(DeprecationWarning): |
| 138 | assistant = client.beta.assistants.update( |
| 139 | assistant_id="assistant_id", |
| 140 | ) |
| 141 | |
| 142 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 143 | |
| 144 | @parametrize |
| 145 | def test_method_update_with_all_params(self, client: OpenAI) -> None: |
| 146 | with pytest.warns(DeprecationWarning): |
| 147 | assistant = client.beta.assistants.update( |
| 148 | assistant_id="assistant_id", |
| 149 | description="description", |
| 150 | instructions="instructions", |
| 151 | metadata={"foo": "string"}, |
| 152 | model="gpt-5", |
| 153 | name="name", |
| 154 | reasoning_effort="none", |
| 155 | response_format="auto", |
| 156 | temperature=1, |
| 157 | tool_resources={ |
| 158 | "code_interpreter": {"file_ids": ["string"]}, |
| 159 | "file_search": {"vector_store_ids": ["string"]}, |
| 160 | }, |
| 161 | tools=[{"type": "code_interpreter"}], |
| 162 | top_p=1, |
| 163 | ) |
| 164 | |
| 165 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 166 | |
| 167 | @parametrize |
| 168 | def test_raw_response_update(self, client: OpenAI) -> None: |
| 169 | with pytest.warns(DeprecationWarning): |
| 170 | response = client.beta.assistants.with_raw_response.update( |
| 171 | assistant_id="assistant_id", |
| 172 | ) |
| 173 | |
| 174 | assert response.is_closed is True |
| 175 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 176 | assistant = response.parse() |
| 177 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 178 | |
| 179 | @parametrize |
| 180 | def test_streaming_response_update(self, client: OpenAI) -> None: |
| 181 | with pytest.warns(DeprecationWarning): |
| 182 | with client.beta.assistants.with_streaming_response.update( |
| 183 | assistant_id="assistant_id", |
| 184 | ) as response: |
| 185 | assert not response.is_closed |
| 186 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 187 | |
| 188 | assistant = response.parse() |
| 189 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 190 | |
| 191 | assert cast(Any, response.is_closed) is True |
| 192 | |
| 193 | @parametrize |
| 194 | def test_path_params_update(self, client: OpenAI) -> None: |
| 195 | with pytest.warns(DeprecationWarning): |
| 196 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): |
| 197 | client.beta.assistants.with_raw_response.update( |
| 198 | assistant_id="", |
| 199 | ) |
| 200 | |
| 201 | @parametrize |
| 202 | def test_method_list(self, client: OpenAI) -> None: |
| 203 | with pytest.warns(DeprecationWarning): |
| 204 | assistant = client.beta.assistants.list() |
| 205 | |
| 206 | assert_matches_type(SyncCursorPage[Assistant], assistant, path=["response"]) |
| 207 | |
| 208 | @parametrize |
| 209 | def test_method_list_with_all_params(self, client: OpenAI) -> None: |
| 210 | with pytest.warns(DeprecationWarning): |
| 211 | assistant = client.beta.assistants.list( |
| 212 | after="after", |
| 213 | before="before", |
| 214 | limit=0, |
| 215 | order="asc", |
| 216 | ) |
| 217 | |
| 218 | assert_matches_type(SyncCursorPage[Assistant], assistant, path=["response"]) |
| 219 | |
| 220 | @parametrize |
| 221 | def test_raw_response_list(self, client: OpenAI) -> None: |
| 222 | with pytest.warns(DeprecationWarning): |
| 223 | response = client.beta.assistants.with_raw_response.list() |
| 224 | |
| 225 | assert response.is_closed is True |
| 226 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 227 | assistant = response.parse() |
| 228 | assert_matches_type(SyncCursorPage[Assistant], assistant, path=["response"]) |
| 229 | |
| 230 | @parametrize |
| 231 | def test_streaming_response_list(self, client: OpenAI) -> None: |
| 232 | with pytest.warns(DeprecationWarning): |
| 233 | with client.beta.assistants.with_streaming_response.list() as response: |
| 234 | assert not response.is_closed |
| 235 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 236 | |
| 237 | assistant = response.parse() |
| 238 | assert_matches_type(SyncCursorPage[Assistant], assistant, path=["response"]) |
| 239 | |
| 240 | assert cast(Any, response.is_closed) is True |
| 241 | |
| 242 | @parametrize |
| 243 | def test_method_delete(self, client: OpenAI) -> None: |
| 244 | with pytest.warns(DeprecationWarning): |
| 245 | assistant = client.beta.assistants.delete( |
| 246 | "assistant_id", |
| 247 | ) |
| 248 | |
| 249 | assert_matches_type(AssistantDeleted, assistant, path=["response"]) |
| 250 | |
| 251 | @parametrize |
| 252 | def test_raw_response_delete(self, client: OpenAI) -> None: |
| 253 | with pytest.warns(DeprecationWarning): |
| 254 | response = client.beta.assistants.with_raw_response.delete( |
| 255 | "assistant_id", |
| 256 | ) |
| 257 | |
| 258 | assert response.is_closed is True |
| 259 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 260 | assistant = response.parse() |
| 261 | assert_matches_type(AssistantDeleted, assistant, path=["response"]) |
| 262 | |
| 263 | @parametrize |
| 264 | def test_streaming_response_delete(self, client: OpenAI) -> None: |
| 265 | with pytest.warns(DeprecationWarning): |
| 266 | with client.beta.assistants.with_streaming_response.delete( |
| 267 | "assistant_id", |
| 268 | ) as response: |
| 269 | assert not response.is_closed |
| 270 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 271 | |
| 272 | assistant = response.parse() |
| 273 | assert_matches_type(AssistantDeleted, assistant, path=["response"]) |
| 274 | |
| 275 | assert cast(Any, response.is_closed) is True |
| 276 | |
| 277 | @parametrize |
| 278 | def test_path_params_delete(self, client: OpenAI) -> None: |
| 279 | with pytest.warns(DeprecationWarning): |
| 280 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): |
| 281 | client.beta.assistants.with_raw_response.delete( |
| 282 | "", |
| 283 | ) |
| 284 | |
| 285 | |
| 286 | class TestAsyncAssistants: |
| 287 | parametrize = pytest.mark.parametrize( |
| 288 | "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] |
| 289 | ) |
| 290 | |
| 291 | @parametrize |
| 292 | async def test_method_create(self, async_client: AsyncOpenAI) -> None: |
| 293 | with pytest.warns(DeprecationWarning): |
| 294 | assistant = await async_client.beta.assistants.create( |
| 295 | model="gpt-4o", |
| 296 | ) |
| 297 | |
| 298 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 299 | |
| 300 | @parametrize |
| 301 | async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 302 | with pytest.warns(DeprecationWarning): |
| 303 | assistant = await async_client.beta.assistants.create( |
| 304 | model="gpt-4o", |
| 305 | description="description", |
| 306 | instructions="instructions", |
| 307 | metadata={"foo": "string"}, |
| 308 | name="name", |
| 309 | reasoning_effort="none", |
| 310 | response_format="auto", |
| 311 | temperature=1, |
| 312 | tool_resources={ |
| 313 | "code_interpreter": {"file_ids": ["string"]}, |
| 314 | "file_search": { |
| 315 | "vector_store_ids": ["string"], |
| 316 | "vector_stores": [ |
| 317 | { |
| 318 | "chunking_strategy": {"type": "auto"}, |
| 319 | "file_ids": ["string"], |
| 320 | "metadata": {"foo": "string"}, |
| 321 | } |
| 322 | ], |
| 323 | }, |
| 324 | }, |
| 325 | tools=[{"type": "code_interpreter"}], |
| 326 | top_p=1, |
| 327 | ) |
| 328 | |
| 329 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 330 | |
| 331 | @parametrize |
| 332 | async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: |
| 333 | with pytest.warns(DeprecationWarning): |
| 334 | response = await async_client.beta.assistants.with_raw_response.create( |
| 335 | model="gpt-4o", |
| 336 | ) |
| 337 | |
| 338 | assert response.is_closed is True |
| 339 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 340 | assistant = response.parse() |
| 341 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 342 | |
| 343 | @parametrize |
| 344 | async def test_streaming_response_create(self, async_client: AsyncOpenAI) -> None: |
| 345 | with pytest.warns(DeprecationWarning): |
| 346 | async with async_client.beta.assistants.with_streaming_response.create( |
| 347 | model="gpt-4o", |
| 348 | ) as response: |
| 349 | assert not response.is_closed |
| 350 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 351 | |
| 352 | assistant = await response.parse() |
| 353 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 354 | |
| 355 | assert cast(Any, response.is_closed) is True |
| 356 | |
| 357 | @parametrize |
| 358 | async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 359 | with pytest.warns(DeprecationWarning): |
| 360 | assistant = await async_client.beta.assistants.retrieve( |
| 361 | "assistant_id", |
| 362 | ) |
| 363 | |
| 364 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 365 | |
| 366 | @parametrize |
| 367 | async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 368 | with pytest.warns(DeprecationWarning): |
| 369 | response = await async_client.beta.assistants.with_raw_response.retrieve( |
| 370 | "assistant_id", |
| 371 | ) |
| 372 | |
| 373 | assert response.is_closed is True |
| 374 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 375 | assistant = response.parse() |
| 376 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 377 | |
| 378 | @parametrize |
| 379 | async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 380 | with pytest.warns(DeprecationWarning): |
| 381 | async with async_client.beta.assistants.with_streaming_response.retrieve( |
| 382 | "assistant_id", |
| 383 | ) as response: |
| 384 | assert not response.is_closed |
| 385 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 386 | |
| 387 | assistant = await response.parse() |
| 388 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 389 | |
| 390 | assert cast(Any, response.is_closed) is True |
| 391 | |
| 392 | @parametrize |
| 393 | async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 394 | with pytest.warns(DeprecationWarning): |
| 395 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): |
| 396 | await async_client.beta.assistants.with_raw_response.retrieve( |
| 397 | "", |
| 398 | ) |
| 399 | |
| 400 | @parametrize |
| 401 | async def test_method_update(self, async_client: AsyncOpenAI) -> None: |
| 402 | with pytest.warns(DeprecationWarning): |
| 403 | assistant = await async_client.beta.assistants.update( |
| 404 | assistant_id="assistant_id", |
| 405 | ) |
| 406 | |
| 407 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 408 | |
| 409 | @parametrize |
| 410 | async def test_method_update_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 411 | with pytest.warns(DeprecationWarning): |
| 412 | assistant = await async_client.beta.assistants.update( |
| 413 | assistant_id="assistant_id", |
| 414 | description="description", |
| 415 | instructions="instructions", |
| 416 | metadata={"foo": "string"}, |
| 417 | model="gpt-5", |
| 418 | name="name", |
| 419 | reasoning_effort="none", |
| 420 | response_format="auto", |
| 421 | temperature=1, |
| 422 | tool_resources={ |
| 423 | "code_interpreter": {"file_ids": ["string"]}, |
| 424 | "file_search": {"vector_store_ids": ["string"]}, |
| 425 | }, |
| 426 | tools=[{"type": "code_interpreter"}], |
| 427 | top_p=1, |
| 428 | ) |
| 429 | |
| 430 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 431 | |
| 432 | @parametrize |
| 433 | async def test_raw_response_update(self, async_client: AsyncOpenAI) -> None: |
| 434 | with pytest.warns(DeprecationWarning): |
| 435 | response = await async_client.beta.assistants.with_raw_response.update( |
| 436 | assistant_id="assistant_id", |
| 437 | ) |
| 438 | |
| 439 | assert response.is_closed is True |
| 440 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 441 | assistant = response.parse() |
| 442 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 443 | |
| 444 | @parametrize |
| 445 | async def test_streaming_response_update(self, async_client: AsyncOpenAI) -> None: |
| 446 | with pytest.warns(DeprecationWarning): |
| 447 | async with async_client.beta.assistants.with_streaming_response.update( |
| 448 | assistant_id="assistant_id", |
| 449 | ) as response: |
| 450 | assert not response.is_closed |
| 451 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 452 | |
| 453 | assistant = await response.parse() |
| 454 | assert_matches_type(Assistant, assistant, path=["response"]) |
| 455 | |
| 456 | assert cast(Any, response.is_closed) is True |
| 457 | |
| 458 | @parametrize |
| 459 | async def test_path_params_update(self, async_client: AsyncOpenAI) -> None: |
| 460 | with pytest.warns(DeprecationWarning): |
| 461 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): |
| 462 | await async_client.beta.assistants.with_raw_response.update( |
| 463 | assistant_id="", |
| 464 | ) |
| 465 | |
| 466 | @parametrize |
| 467 | async def test_method_list(self, async_client: AsyncOpenAI) -> None: |
| 468 | with pytest.warns(DeprecationWarning): |
| 469 | assistant = await async_client.beta.assistants.list() |
| 470 | |
| 471 | assert_matches_type(AsyncCursorPage[Assistant], assistant, path=["response"]) |
| 472 | |
| 473 | @parametrize |
| 474 | async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 475 | with pytest.warns(DeprecationWarning): |
| 476 | assistant = await async_client.beta.assistants.list( |
| 477 | after="after", |
| 478 | before="before", |
| 479 | limit=0, |
| 480 | order="asc", |
| 481 | ) |
| 482 | |
| 483 | assert_matches_type(AsyncCursorPage[Assistant], assistant, path=["response"]) |
| 484 | |
| 485 | @parametrize |
| 486 | async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: |
| 487 | with pytest.warns(DeprecationWarning): |
| 488 | response = await async_client.beta.assistants.with_raw_response.list() |
| 489 | |
| 490 | assert response.is_closed is True |
| 491 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 492 | assistant = response.parse() |
| 493 | assert_matches_type(AsyncCursorPage[Assistant], assistant, path=["response"]) |
| 494 | |
| 495 | @parametrize |
| 496 | async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None: |
| 497 | with pytest.warns(DeprecationWarning): |
| 498 | async with async_client.beta.assistants.with_streaming_response.list() as response: |
| 499 | assert not response.is_closed |
| 500 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 501 | |
| 502 | assistant = await response.parse() |
| 503 | assert_matches_type(AsyncCursorPage[Assistant], assistant, path=["response"]) |
| 504 | |
| 505 | assert cast(Any, response.is_closed) is True |
| 506 | |
| 507 | @parametrize |
| 508 | async def test_method_delete(self, async_client: AsyncOpenAI) -> None: |
| 509 | with pytest.warns(DeprecationWarning): |
| 510 | assistant = await async_client.beta.assistants.delete( |
| 511 | "assistant_id", |
| 512 | ) |
| 513 | |
| 514 | assert_matches_type(AssistantDeleted, assistant, path=["response"]) |
| 515 | |
| 516 | @parametrize |
| 517 | async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: |
| 518 | with pytest.warns(DeprecationWarning): |
| 519 | response = await async_client.beta.assistants.with_raw_response.delete( |
| 520 | "assistant_id", |
| 521 | ) |
| 522 | |
| 523 | assert response.is_closed is True |
| 524 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 525 | assistant = response.parse() |
| 526 | assert_matches_type(AssistantDeleted, assistant, path=["response"]) |
| 527 | |
| 528 | @parametrize |
| 529 | async def test_streaming_response_delete(self, async_client: AsyncOpenAI) -> None: |
| 530 | with pytest.warns(DeprecationWarning): |
| 531 | async with async_client.beta.assistants.with_streaming_response.delete( |
| 532 | "assistant_id", |
| 533 | ) as response: |
| 534 | assert not response.is_closed |
| 535 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 536 | |
| 537 | assistant = await response.parse() |
| 538 | assert_matches_type(AssistantDeleted, assistant, path=["response"]) |
| 539 | |
| 540 | assert cast(Any, response.is_closed) is True |
| 541 | |
| 542 | @parametrize |
| 543 | async def test_path_params_delete(self, async_client: AsyncOpenAI) -> None: |
| 544 | with pytest.warns(DeprecationWarning): |
| 545 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): |
| 546 | await async_client.beta.assistants.with_raw_response.delete( |
| 547 | "", |
| 548 | ) |
| 549 | |