|  | 
|  | 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | 
|  | 2 | + | 
|  | 3 | +from __future__ import annotations | 
|  | 4 | + | 
|  | 5 | +from ...._compat import cached_property | 
|  | 6 | +from .completions import ( | 
|  | 7 | +    CompletionsResource, | 
|  | 8 | +    AsyncCompletionsResource, | 
|  | 9 | +    CompletionsResourceWithRawResponse, | 
|  | 10 | +    AsyncCompletionsResourceWithRawResponse, | 
|  | 11 | +    CompletionsResourceWithStreamingResponse, | 
|  | 12 | +    AsyncCompletionsResourceWithStreamingResponse, | 
|  | 13 | +) | 
|  | 14 | +from ...._resource import SyncAPIResource, AsyncAPIResource | 
|  | 15 | + | 
|  | 16 | +__all__ = ["ChatResource", "AsyncChatResource"] | 
|  | 17 | + | 
|  | 18 | + | 
|  | 19 | +class ChatResource(SyncAPIResource): | 
|  | 20 | +    @cached_property | 
|  | 21 | +    def completions(self) -> CompletionsResource: | 
|  | 22 | +        return CompletionsResource(self._client) | 
|  | 23 | + | 
|  | 24 | +    @cached_property | 
|  | 25 | +    def with_raw_response(self) -> ChatResourceWithRawResponse: | 
|  | 26 | +        """ | 
|  | 27 | +        This property can be used as a prefix for any HTTP method call to return | 
|  | 28 | +        the raw response object instead of the parsed content. | 
|  | 29 | +
 | 
|  | 30 | +        For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers | 
|  | 31 | +        """ | 
|  | 32 | +        return ChatResourceWithRawResponse(self) | 
|  | 33 | + | 
|  | 34 | +    @cached_property | 
|  | 35 | +    def with_streaming_response(self) -> ChatResourceWithStreamingResponse: | 
|  | 36 | +        """ | 
|  | 37 | +        An alternative to `.with_raw_response` that doesn't eagerly read the response body. | 
|  | 38 | +
 | 
|  | 39 | +        For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response | 
|  | 40 | +        """ | 
|  | 41 | +        return ChatResourceWithStreamingResponse(self) | 
|  | 42 | + | 
|  | 43 | + | 
|  | 44 | +class AsyncChatResource(AsyncAPIResource): | 
|  | 45 | +    @cached_property | 
|  | 46 | +    def completions(self) -> AsyncCompletionsResource: | 
|  | 47 | +        return AsyncCompletionsResource(self._client) | 
|  | 48 | + | 
|  | 49 | +    @cached_property | 
|  | 50 | +    def with_raw_response(self) -> AsyncChatResourceWithRawResponse: | 
|  | 51 | +        """ | 
|  | 52 | +        This property can be used as a prefix for any HTTP method call to return | 
|  | 53 | +        the raw response object instead of the parsed content. | 
|  | 54 | +
 | 
|  | 55 | +        For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers | 
|  | 56 | +        """ | 
|  | 57 | +        return AsyncChatResourceWithRawResponse(self) | 
|  | 58 | + | 
|  | 59 | +    @cached_property | 
|  | 60 | +    def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse: | 
|  | 61 | +        """ | 
|  | 62 | +        An alternative to `.with_raw_response` that doesn't eagerly read the response body. | 
|  | 63 | +
 | 
|  | 64 | +        For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response | 
|  | 65 | +        """ | 
|  | 66 | +        return AsyncChatResourceWithStreamingResponse(self) | 
|  | 67 | + | 
|  | 68 | + | 
|  | 69 | +class ChatResourceWithRawResponse: | 
|  | 70 | +    def __init__(self, chat: ChatResource) -> None: | 
|  | 71 | +        self._chat = chat | 
|  | 72 | + | 
|  | 73 | +    @cached_property | 
|  | 74 | +    def completions(self) -> CompletionsResourceWithRawResponse: | 
|  | 75 | +        return CompletionsResourceWithRawResponse(self._chat.completions) | 
|  | 76 | + | 
|  | 77 | + | 
|  | 78 | +class AsyncChatResourceWithRawResponse: | 
|  | 79 | +    def __init__(self, chat: AsyncChatResource) -> None: | 
|  | 80 | +        self._chat = chat | 
|  | 81 | + | 
|  | 82 | +    @cached_property | 
|  | 83 | +    def completions(self) -> AsyncCompletionsResourceWithRawResponse: | 
|  | 84 | +        return AsyncCompletionsResourceWithRawResponse(self._chat.completions) | 
|  | 85 | + | 
|  | 86 | + | 
|  | 87 | +class ChatResourceWithStreamingResponse: | 
|  | 88 | +    def __init__(self, chat: ChatResource) -> None: | 
|  | 89 | +        self._chat = chat | 
|  | 90 | + | 
|  | 91 | +    @cached_property | 
|  | 92 | +    def completions(self) -> CompletionsResourceWithStreamingResponse: | 
|  | 93 | +        return CompletionsResourceWithStreamingResponse(self._chat.completions) | 
|  | 94 | + | 
|  | 95 | + | 
|  | 96 | +class AsyncChatResourceWithStreamingResponse: | 
|  | 97 | +    def __init__(self, chat: AsyncChatResource) -> None: | 
|  | 98 | +        self._chat = chat | 
|  | 99 | + | 
|  | 100 | +    @cached_property | 
|  | 101 | +    def completions(self) -> AsyncCompletionsResourceWithStreamingResponse: | 
|  | 102 | +        return AsyncCompletionsResourceWithStreamingResponse(self._chat.completions) | 
0 commit comments