main
1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3from __future__ import annotations
4
5import typing_extensions
6from typing import Union, Iterable, Optional
7from typing_extensions import Literal
8
9import httpx
10
11from .... import _legacy_response
12from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
13from ...._utils import maybe_transform, async_maybe_transform
14from ...._compat import cached_property
15from ...._resource import SyncAPIResource, AsyncAPIResource
16from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
17from ....pagination import SyncCursorPage, AsyncCursorPage
18from ...._base_client import (
19 AsyncPaginator,
20 make_request_options,
21)
22from ....types.beta.threads import message_list_params, message_create_params, message_update_params
23from ....types.beta.threads.message import Message
24from ....types.shared_params.metadata import Metadata
25from ....types.beta.threads.message_deleted import MessageDeleted
26from ....types.beta.threads.message_content_part_param import MessageContentPartParam
27
28__all__ = ["Messages", "AsyncMessages"]
29
30
31class Messages(SyncAPIResource):
32 @cached_property
33 def with_raw_response(self) -> MessagesWithRawResponse:
34 """
35 This property can be used as a prefix for any HTTP method call to return
36 the raw response object instead of the parsed content.
37
38 For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
39 """
40 return MessagesWithRawResponse(self)
41
42 @cached_property
43 def with_streaming_response(self) -> MessagesWithStreamingResponse:
44 """
45 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46
47 For more information, see https://www.github.com/openai/openai-python#with_streaming_response
48 """
49 return MessagesWithStreamingResponse(self)
50
51 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
52 def create(
53 self,
54 thread_id: str,
55 *,
56 content: Union[str, Iterable[MessageContentPartParam]],
57 role: Literal["user", "assistant"],
58 attachments: Optional[Iterable[message_create_params.Attachment]] | Omit = omit,
59 metadata: Optional[Metadata] | Omit = omit,
60 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61 # The extra values given here take precedence over values defined on the client or passed to this method.
62 extra_headers: Headers | None = None,
63 extra_query: Query | None = None,
64 extra_body: Body | None = None,
65 timeout: float | httpx.Timeout | None | NotGiven = not_given,
66 ) -> Message:
67 """
68 Create a message.
69
70 Args:
71 content: The text contents of the message.
72
73 role:
74 The role of the entity that is creating the message. Allowed values include:
75
76 - `user`: Indicates the message is sent by an actual user and should be used in
77 most cases to represent user-generated messages.
78 - `assistant`: Indicates the message is generated by the assistant. Use this
79 value to insert messages from the assistant into the conversation.
80
81 attachments: A list of files attached to the message, and the tools they should be added to.
82
83 metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
84 for storing additional information about the object in a structured format, and
85 querying for objects via API or the dashboard.
86
87 Keys are strings with a maximum length of 64 characters. Values are strings with
88 a maximum length of 512 characters.
89
90 extra_headers: Send extra headers
91
92 extra_query: Add additional query parameters to the request
93
94 extra_body: Add additional JSON properties to the request
95
96 timeout: Override the client-level default timeout for this request, in seconds
97 """
98 if not thread_id:
99 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
100 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
101 return self._post(
102 f"/threads/{thread_id}/messages",
103 body=maybe_transform(
104 {
105 "content": content,
106 "role": role,
107 "attachments": attachments,
108 "metadata": metadata,
109 },
110 message_create_params.MessageCreateParams,
111 ),
112 options=make_request_options(
113 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
114 ),
115 cast_to=Message,
116 )
117
118 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
119 def retrieve(
120 self,
121 message_id: str,
122 *,
123 thread_id: str,
124 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
125 # The extra values given here take precedence over values defined on the client or passed to this method.
126 extra_headers: Headers | None = None,
127 extra_query: Query | None = None,
128 extra_body: Body | None = None,
129 timeout: float | httpx.Timeout | None | NotGiven = not_given,
130 ) -> Message:
131 """
132 Retrieve a message.
133
134 Args:
135 extra_headers: Send extra headers
136
137 extra_query: Add additional query parameters to the request
138
139 extra_body: Add additional JSON properties to the request
140
141 timeout: Override the client-level default timeout for this request, in seconds
142 """
143 if not thread_id:
144 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
145 if not message_id:
146 raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
147 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
148 return self._get(
149 f"/threads/{thread_id}/messages/{message_id}",
150 options=make_request_options(
151 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
152 ),
153 cast_to=Message,
154 )
155
156 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
157 def update(
158 self,
159 message_id: str,
160 *,
161 thread_id: str,
162 metadata: Optional[Metadata] | Omit = omit,
163 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
164 # The extra values given here take precedence over values defined on the client or passed to this method.
165 extra_headers: Headers | None = None,
166 extra_query: Query | None = None,
167 extra_body: Body | None = None,
168 timeout: float | httpx.Timeout | None | NotGiven = not_given,
169 ) -> Message:
170 """
171 Modifies a message.
172
173 Args:
174 metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
175 for storing additional information about the object in a structured format, and
176 querying for objects via API or the dashboard.
177
178 Keys are strings with a maximum length of 64 characters. Values are strings with
179 a maximum length of 512 characters.
180
181 extra_headers: Send extra headers
182
183 extra_query: Add additional query parameters to the request
184
185 extra_body: Add additional JSON properties to the request
186
187 timeout: Override the client-level default timeout for this request, in seconds
188 """
189 if not thread_id:
190 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
191 if not message_id:
192 raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
193 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
194 return self._post(
195 f"/threads/{thread_id}/messages/{message_id}",
196 body=maybe_transform({"metadata": metadata}, message_update_params.MessageUpdateParams),
197 options=make_request_options(
198 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
199 ),
200 cast_to=Message,
201 )
202
203 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
204 def list(
205 self,
206 thread_id: str,
207 *,
208 after: str | Omit = omit,
209 before: str | Omit = omit,
210 limit: int | Omit = omit,
211 order: Literal["asc", "desc"] | Omit = omit,
212 run_id: str | Omit = omit,
213 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
214 # The extra values given here take precedence over values defined on the client or passed to this method.
215 extra_headers: Headers | None = None,
216 extra_query: Query | None = None,
217 extra_body: Body | None = None,
218 timeout: float | httpx.Timeout | None | NotGiven = not_given,
219 ) -> SyncCursorPage[Message]:
220 """
221 Returns a list of messages for a given thread.
222
223 Args:
224 after: A cursor for use in pagination. `after` is an object ID that defines your place
225 in the list. For instance, if you make a list request and receive 100 objects,
226 ending with obj_foo, your subsequent call can include after=obj_foo in order to
227 fetch the next page of the list.
228
229 before: A cursor for use in pagination. `before` is an object ID that defines your place
230 in the list. For instance, if you make a list request and receive 100 objects,
231 starting with obj_foo, your subsequent call can include before=obj_foo in order
232 to fetch the previous page of the list.
233
234 limit: A limit on the number of objects to be returned. Limit can range between 1 and
235 100, and the default is 20.
236
237 order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
238 order and `desc` for descending order.
239
240 run_id: Filter messages by the run ID that generated them.
241
242 extra_headers: Send extra headers
243
244 extra_query: Add additional query parameters to the request
245
246 extra_body: Add additional JSON properties to the request
247
248 timeout: Override the client-level default timeout for this request, in seconds
249 """
250 if not thread_id:
251 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
252 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
253 return self._get_api_list(
254 f"/threads/{thread_id}/messages",
255 page=SyncCursorPage[Message],
256 options=make_request_options(
257 extra_headers=extra_headers,
258 extra_query=extra_query,
259 extra_body=extra_body,
260 timeout=timeout,
261 query=maybe_transform(
262 {
263 "after": after,
264 "before": before,
265 "limit": limit,
266 "order": order,
267 "run_id": run_id,
268 },
269 message_list_params.MessageListParams,
270 ),
271 ),
272 model=Message,
273 )
274
275 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
276 def delete(
277 self,
278 message_id: str,
279 *,
280 thread_id: str,
281 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
282 # The extra values given here take precedence over values defined on the client or passed to this method.
283 extra_headers: Headers | None = None,
284 extra_query: Query | None = None,
285 extra_body: Body | None = None,
286 timeout: float | httpx.Timeout | None | NotGiven = not_given,
287 ) -> MessageDeleted:
288 """
289 Deletes a message.
290
291 Args:
292 extra_headers: Send extra headers
293
294 extra_query: Add additional query parameters to the request
295
296 extra_body: Add additional JSON properties to the request
297
298 timeout: Override the client-level default timeout for this request, in seconds
299 """
300 if not thread_id:
301 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
302 if not message_id:
303 raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
304 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
305 return self._delete(
306 f"/threads/{thread_id}/messages/{message_id}",
307 options=make_request_options(
308 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
309 ),
310 cast_to=MessageDeleted,
311 )
312
313
314class AsyncMessages(AsyncAPIResource):
315 @cached_property
316 def with_raw_response(self) -> AsyncMessagesWithRawResponse:
317 """
318 This property can be used as a prefix for any HTTP method call to return
319 the raw response object instead of the parsed content.
320
321 For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
322 """
323 return AsyncMessagesWithRawResponse(self)
324
325 @cached_property
326 def with_streaming_response(self) -> AsyncMessagesWithStreamingResponse:
327 """
328 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
329
330 For more information, see https://www.github.com/openai/openai-python#with_streaming_response
331 """
332 return AsyncMessagesWithStreamingResponse(self)
333
334 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
335 async def create(
336 self,
337 thread_id: str,
338 *,
339 content: Union[str, Iterable[MessageContentPartParam]],
340 role: Literal["user", "assistant"],
341 attachments: Optional[Iterable[message_create_params.Attachment]] | Omit = omit,
342 metadata: Optional[Metadata] | Omit = omit,
343 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
344 # The extra values given here take precedence over values defined on the client or passed to this method.
345 extra_headers: Headers | None = None,
346 extra_query: Query | None = None,
347 extra_body: Body | None = None,
348 timeout: float | httpx.Timeout | None | NotGiven = not_given,
349 ) -> Message:
350 """
351 Create a message.
352
353 Args:
354 content: The text contents of the message.
355
356 role:
357 The role of the entity that is creating the message. Allowed values include:
358
359 - `user`: Indicates the message is sent by an actual user and should be used in
360 most cases to represent user-generated messages.
361 - `assistant`: Indicates the message is generated by the assistant. Use this
362 value to insert messages from the assistant into the conversation.
363
364 attachments: A list of files attached to the message, and the tools they should be added to.
365
366 metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
367 for storing additional information about the object in a structured format, and
368 querying for objects via API or the dashboard.
369
370 Keys are strings with a maximum length of 64 characters. Values are strings with
371 a maximum length of 512 characters.
372
373 extra_headers: Send extra headers
374
375 extra_query: Add additional query parameters to the request
376
377 extra_body: Add additional JSON properties to the request
378
379 timeout: Override the client-level default timeout for this request, in seconds
380 """
381 if not thread_id:
382 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
383 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
384 return await self._post(
385 f"/threads/{thread_id}/messages",
386 body=await async_maybe_transform(
387 {
388 "content": content,
389 "role": role,
390 "attachments": attachments,
391 "metadata": metadata,
392 },
393 message_create_params.MessageCreateParams,
394 ),
395 options=make_request_options(
396 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
397 ),
398 cast_to=Message,
399 )
400
401 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
402 async def retrieve(
403 self,
404 message_id: str,
405 *,
406 thread_id: str,
407 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
408 # The extra values given here take precedence over values defined on the client or passed to this method.
409 extra_headers: Headers | None = None,
410 extra_query: Query | None = None,
411 extra_body: Body | None = None,
412 timeout: float | httpx.Timeout | None | NotGiven = not_given,
413 ) -> Message:
414 """
415 Retrieve a message.
416
417 Args:
418 extra_headers: Send extra headers
419
420 extra_query: Add additional query parameters to the request
421
422 extra_body: Add additional JSON properties to the request
423
424 timeout: Override the client-level default timeout for this request, in seconds
425 """
426 if not thread_id:
427 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
428 if not message_id:
429 raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
430 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
431 return await self._get(
432 f"/threads/{thread_id}/messages/{message_id}",
433 options=make_request_options(
434 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
435 ),
436 cast_to=Message,
437 )
438
439 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
440 async def update(
441 self,
442 message_id: str,
443 *,
444 thread_id: str,
445 metadata: Optional[Metadata] | Omit = omit,
446 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
447 # The extra values given here take precedence over values defined on the client or passed to this method.
448 extra_headers: Headers | None = None,
449 extra_query: Query | None = None,
450 extra_body: Body | None = None,
451 timeout: float | httpx.Timeout | None | NotGiven = not_given,
452 ) -> Message:
453 """
454 Modifies a message.
455
456 Args:
457 metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
458 for storing additional information about the object in a structured format, and
459 querying for objects via API or the dashboard.
460
461 Keys are strings with a maximum length of 64 characters. Values are strings with
462 a maximum length of 512 characters.
463
464 extra_headers: Send extra headers
465
466 extra_query: Add additional query parameters to the request
467
468 extra_body: Add additional JSON properties to the request
469
470 timeout: Override the client-level default timeout for this request, in seconds
471 """
472 if not thread_id:
473 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
474 if not message_id:
475 raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
476 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
477 return await self._post(
478 f"/threads/{thread_id}/messages/{message_id}",
479 body=await async_maybe_transform({"metadata": metadata}, message_update_params.MessageUpdateParams),
480 options=make_request_options(
481 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
482 ),
483 cast_to=Message,
484 )
485
486 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
487 def list(
488 self,
489 thread_id: str,
490 *,
491 after: str | Omit = omit,
492 before: str | Omit = omit,
493 limit: int | Omit = omit,
494 order: Literal["asc", "desc"] | Omit = omit,
495 run_id: str | Omit = omit,
496 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
497 # The extra values given here take precedence over values defined on the client or passed to this method.
498 extra_headers: Headers | None = None,
499 extra_query: Query | None = None,
500 extra_body: Body | None = None,
501 timeout: float | httpx.Timeout | None | NotGiven = not_given,
502 ) -> AsyncPaginator[Message, AsyncCursorPage[Message]]:
503 """
504 Returns a list of messages for a given thread.
505
506 Args:
507 after: A cursor for use in pagination. `after` is an object ID that defines your place
508 in the list. For instance, if you make a list request and receive 100 objects,
509 ending with obj_foo, your subsequent call can include after=obj_foo in order to
510 fetch the next page of the list.
511
512 before: A cursor for use in pagination. `before` is an object ID that defines your place
513 in the list. For instance, if you make a list request and receive 100 objects,
514 starting with obj_foo, your subsequent call can include before=obj_foo in order
515 to fetch the previous page of the list.
516
517 limit: A limit on the number of objects to be returned. Limit can range between 1 and
518 100, and the default is 20.
519
520 order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
521 order and `desc` for descending order.
522
523 run_id: Filter messages by the run ID that generated them.
524
525 extra_headers: Send extra headers
526
527 extra_query: Add additional query parameters to the request
528
529 extra_body: Add additional JSON properties to the request
530
531 timeout: Override the client-level default timeout for this request, in seconds
532 """
533 if not thread_id:
534 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
535 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
536 return self._get_api_list(
537 f"/threads/{thread_id}/messages",
538 page=AsyncCursorPage[Message],
539 options=make_request_options(
540 extra_headers=extra_headers,
541 extra_query=extra_query,
542 extra_body=extra_body,
543 timeout=timeout,
544 query=maybe_transform(
545 {
546 "after": after,
547 "before": before,
548 "limit": limit,
549 "order": order,
550 "run_id": run_id,
551 },
552 message_list_params.MessageListParams,
553 ),
554 ),
555 model=Message,
556 )
557
558 @typing_extensions.deprecated("The Assistants API is deprecated in favor of the Responses API")
559 async def delete(
560 self,
561 message_id: str,
562 *,
563 thread_id: str,
564 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
565 # The extra values given here take precedence over values defined on the client or passed to this method.
566 extra_headers: Headers | None = None,
567 extra_query: Query | None = None,
568 extra_body: Body | None = None,
569 timeout: float | httpx.Timeout | None | NotGiven = not_given,
570 ) -> MessageDeleted:
571 """
572 Deletes a message.
573
574 Args:
575 extra_headers: Send extra headers
576
577 extra_query: Add additional query parameters to the request
578
579 extra_body: Add additional JSON properties to the request
580
581 timeout: Override the client-level default timeout for this request, in seconds
582 """
583 if not thread_id:
584 raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
585 if not message_id:
586 raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
587 extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
588 return await self._delete(
589 f"/threads/{thread_id}/messages/{message_id}",
590 options=make_request_options(
591 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
592 ),
593 cast_to=MessageDeleted,
594 )
595
596
597class MessagesWithRawResponse:
598 def __init__(self, messages: Messages) -> None:
599 self._messages = messages
600
601 self.create = ( # pyright: ignore[reportDeprecated]
602 _legacy_response.to_raw_response_wrapper(
603 messages.create, # pyright: ignore[reportDeprecated],
604 )
605 )
606 self.retrieve = ( # pyright: ignore[reportDeprecated]
607 _legacy_response.to_raw_response_wrapper(
608 messages.retrieve, # pyright: ignore[reportDeprecated],
609 )
610 )
611 self.update = ( # pyright: ignore[reportDeprecated]
612 _legacy_response.to_raw_response_wrapper(
613 messages.update, # pyright: ignore[reportDeprecated],
614 )
615 )
616 self.list = ( # pyright: ignore[reportDeprecated]
617 _legacy_response.to_raw_response_wrapper(
618 messages.list, # pyright: ignore[reportDeprecated],
619 )
620 )
621 self.delete = ( # pyright: ignore[reportDeprecated]
622 _legacy_response.to_raw_response_wrapper(
623 messages.delete, # pyright: ignore[reportDeprecated],
624 )
625 )
626
627
628class AsyncMessagesWithRawResponse:
629 def __init__(self, messages: AsyncMessages) -> None:
630 self._messages = messages
631
632 self.create = ( # pyright: ignore[reportDeprecated]
633 _legacy_response.async_to_raw_response_wrapper(
634 messages.create, # pyright: ignore[reportDeprecated],
635 )
636 )
637 self.retrieve = ( # pyright: ignore[reportDeprecated]
638 _legacy_response.async_to_raw_response_wrapper(
639 messages.retrieve, # pyright: ignore[reportDeprecated],
640 )
641 )
642 self.update = ( # pyright: ignore[reportDeprecated]
643 _legacy_response.async_to_raw_response_wrapper(
644 messages.update, # pyright: ignore[reportDeprecated],
645 )
646 )
647 self.list = ( # pyright: ignore[reportDeprecated]
648 _legacy_response.async_to_raw_response_wrapper(
649 messages.list, # pyright: ignore[reportDeprecated],
650 )
651 )
652 self.delete = ( # pyright: ignore[reportDeprecated]
653 _legacy_response.async_to_raw_response_wrapper(
654 messages.delete, # pyright: ignore[reportDeprecated],
655 )
656 )
657
658
659class MessagesWithStreamingResponse:
660 def __init__(self, messages: Messages) -> None:
661 self._messages = messages
662
663 self.create = ( # pyright: ignore[reportDeprecated]
664 to_streamed_response_wrapper(
665 messages.create, # pyright: ignore[reportDeprecated],
666 )
667 )
668 self.retrieve = ( # pyright: ignore[reportDeprecated]
669 to_streamed_response_wrapper(
670 messages.retrieve, # pyright: ignore[reportDeprecated],
671 )
672 )
673 self.update = ( # pyright: ignore[reportDeprecated]
674 to_streamed_response_wrapper(
675 messages.update, # pyright: ignore[reportDeprecated],
676 )
677 )
678 self.list = ( # pyright: ignore[reportDeprecated]
679 to_streamed_response_wrapper(
680 messages.list, # pyright: ignore[reportDeprecated],
681 )
682 )
683 self.delete = ( # pyright: ignore[reportDeprecated]
684 to_streamed_response_wrapper(
685 messages.delete, # pyright: ignore[reportDeprecated],
686 )
687 )
688
689
690class AsyncMessagesWithStreamingResponse:
691 def __init__(self, messages: AsyncMessages) -> None:
692 self._messages = messages
693
694 self.create = ( # pyright: ignore[reportDeprecated]
695 async_to_streamed_response_wrapper(
696 messages.create, # pyright: ignore[reportDeprecated],
697 )
698 )
699 self.retrieve = ( # pyright: ignore[reportDeprecated]
700 async_to_streamed_response_wrapper(
701 messages.retrieve, # pyright: ignore[reportDeprecated],
702 )
703 )
704 self.update = ( # pyright: ignore[reportDeprecated]
705 async_to_streamed_response_wrapper(
706 messages.update, # pyright: ignore[reportDeprecated],
707 )
708 )
709 self.list = ( # pyright: ignore[reportDeprecated]
710 async_to_streamed_response_wrapper(
711 messages.list, # pyright: ignore[reportDeprecated],
712 )
713 )
714 self.delete = ( # pyright: ignore[reportDeprecated]
715 async_to_streamed_response_wrapper(
716 messages.delete, # pyright: ignore[reportDeprecated],
717 )
718 )