main
1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3from __future__ import annotations
4
5from .threads import (
6 Threads,
7 AsyncThreads,
8 ThreadsWithRawResponse,
9 AsyncThreadsWithRawResponse,
10 ThreadsWithStreamingResponse,
11 AsyncThreadsWithStreamingResponse,
12)
13from .sessions import (
14 Sessions,
15 AsyncSessions,
16 SessionsWithRawResponse,
17 AsyncSessionsWithRawResponse,
18 SessionsWithStreamingResponse,
19 AsyncSessionsWithStreamingResponse,
20)
21from ...._compat import cached_property
22from ...._resource import SyncAPIResource, AsyncAPIResource
23
24__all__ = ["ChatKit", "AsyncChatKit"]
25
26
27class ChatKit(SyncAPIResource):
28 @cached_property
29 def sessions(self) -> Sessions:
30 return Sessions(self._client)
31
32 @cached_property
33 def threads(self) -> Threads:
34 return Threads(self._client)
35
36 @cached_property
37 def with_raw_response(self) -> ChatKitWithRawResponse:
38 """
39 This property can be used as a prefix for any HTTP method call to return
40 the raw response object instead of the parsed content.
41
42 For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
43 """
44 return ChatKitWithRawResponse(self)
45
46 @cached_property
47 def with_streaming_response(self) -> ChatKitWithStreamingResponse:
48 """
49 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
50
51 For more information, see https://www.github.com/openai/openai-python#with_streaming_response
52 """
53 return ChatKitWithStreamingResponse(self)
54
55
56class AsyncChatKit(AsyncAPIResource):
57 @cached_property
58 def sessions(self) -> AsyncSessions:
59 return AsyncSessions(self._client)
60
61 @cached_property
62 def threads(self) -> AsyncThreads:
63 return AsyncThreads(self._client)
64
65 @cached_property
66 def with_raw_response(self) -> AsyncChatKitWithRawResponse:
67 """
68 This property can be used as a prefix for any HTTP method call to return
69 the raw response object instead of the parsed content.
70
71 For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
72 """
73 return AsyncChatKitWithRawResponse(self)
74
75 @cached_property
76 def with_streaming_response(self) -> AsyncChatKitWithStreamingResponse:
77 """
78 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
79
80 For more information, see https://www.github.com/openai/openai-python#with_streaming_response
81 """
82 return AsyncChatKitWithStreamingResponse(self)
83
84
85class ChatKitWithRawResponse:
86 def __init__(self, chatkit: ChatKit) -> None:
87 self._chatkit = chatkit
88
89 @cached_property
90 def sessions(self) -> SessionsWithRawResponse:
91 return SessionsWithRawResponse(self._chatkit.sessions)
92
93 @cached_property
94 def threads(self) -> ThreadsWithRawResponse:
95 return ThreadsWithRawResponse(self._chatkit.threads)
96
97
98class AsyncChatKitWithRawResponse:
99 def __init__(self, chatkit: AsyncChatKit) -> None:
100 self._chatkit = chatkit
101
102 @cached_property
103 def sessions(self) -> AsyncSessionsWithRawResponse:
104 return AsyncSessionsWithRawResponse(self._chatkit.sessions)
105
106 @cached_property
107 def threads(self) -> AsyncThreadsWithRawResponse:
108 return AsyncThreadsWithRawResponse(self._chatkit.threads)
109
110
111class ChatKitWithStreamingResponse:
112 def __init__(self, chatkit: ChatKit) -> None:
113 self._chatkit = chatkit
114
115 @cached_property
116 def sessions(self) -> SessionsWithStreamingResponse:
117 return SessionsWithStreamingResponse(self._chatkit.sessions)
118
119 @cached_property
120 def threads(self) -> ThreadsWithStreamingResponse:
121 return ThreadsWithStreamingResponse(self._chatkit.threads)
122
123
124class AsyncChatKitWithStreamingResponse:
125 def __init__(self, chatkit: AsyncChatKit) -> None:
126 self._chatkit = chatkit
127
128 @cached_property
129 def sessions(self) -> AsyncSessionsWithStreamingResponse:
130 return AsyncSessionsWithStreamingResponse(self._chatkit.sessions)
131
132 @cached_property
133 def threads(self) -> AsyncThreadsWithStreamingResponse:
134 return AsyncThreadsWithStreamingResponse(self._chatkit.threads)