athena-intelligence 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- athena/__init__.py +12 -3
- athena/client.py +342 -23
- athena/core/client_wrapper.py +6 -18
- athena/environment.py +1 -1
- athena/types/__init__.py +14 -1
- athena/types/http_validation_error.py +1 -1
- athena/types/message_out.py +28 -0
- athena/types/message_out_dto.py +33 -0
- athena/types/model.py +29 -0
- athena/types/tools.py +45 -0
- athena/types/validation_error.py +4 -3
- athena/{resources/__init__.py → types/validation_error_loc_item.py} +2 -2
- {athena_intelligence-0.1.4.dist-info → athena_intelligence-0.1.5.dist-info}/METADATA +1 -1
- athena_intelligence-0.1.5.dist-info/RECORD +25 -0
- athena/resources/message/__init__.py +0 -2
- athena/resources/message/client.py +0 -329
- athena_intelligence-0.1.4.dist-info/RECORD +0 -23
- {athena_intelligence-0.1.4.dist-info → athena_intelligence-0.1.5.dist-info}/WHEEL +0 -0
athena/__init__.py
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
-
from .types import HttpValidationError, ValidationError
|
3
|
+
from .types import HttpValidationError, MessageOut, MessageOutDto, Model, Tools, ValidationError, ValidationErrorLocItem
|
4
4
|
from .errors import UnprocessableEntityError
|
5
|
-
from .resources import message
|
6
5
|
from .environment import AthenaEnvironment
|
7
6
|
|
8
|
-
__all__ = [
|
7
|
+
__all__ = [
|
8
|
+
"AthenaEnvironment",
|
9
|
+
"HttpValidationError",
|
10
|
+
"MessageOut",
|
11
|
+
"MessageOutDto",
|
12
|
+
"Model",
|
13
|
+
"Tools",
|
14
|
+
"UnprocessableEntityError",
|
15
|
+
"ValidationError",
|
16
|
+
"ValidationErrorLocItem",
|
17
|
+
]
|
athena/client.py
CHANGED
@@ -1,12 +1,31 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
3
|
import typing
|
4
|
+
import urllib.parse
|
5
|
+
from json.decoder import JSONDecodeError
|
4
6
|
|
5
7
|
import httpx
|
6
8
|
|
9
|
+
from .core.api_error import ApiError
|
7
10
|
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
11
|
+
from .core.jsonable_encoder import jsonable_encoder
|
12
|
+
from .core.remove_none_from_dict import remove_none_from_dict
|
13
|
+
from .core.request_options import RequestOptions
|
8
14
|
from .environment import AthenaEnvironment
|
9
|
-
from .
|
15
|
+
from .errors.unprocessable_entity_error import UnprocessableEntityError
|
16
|
+
from .types.http_validation_error import HttpValidationError
|
17
|
+
from .types.message_out import MessageOut
|
18
|
+
from .types.message_out_dto import MessageOutDto
|
19
|
+
from .types.model import Model
|
20
|
+
from .types.tools import Tools
|
21
|
+
|
22
|
+
try:
|
23
|
+
import pydantic.v1 as pydantic # type: ignore
|
24
|
+
except ImportError:
|
25
|
+
import pydantic # type: ignore
|
26
|
+
|
27
|
+
# this is used as the default value for optional parameters
|
28
|
+
OMIT = typing.cast(typing.Any, ...)
|
10
29
|
|
11
30
|
|
12
31
|
class Athena:
|
@@ -18,9 +37,7 @@ class Athena:
|
|
18
37
|
|
19
38
|
- environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
|
20
39
|
|
21
|
-
Defaults to AthenaEnvironment.
|
22
|
-
|
23
|
-
- token: typing.Union[str, typing.Callable[[], str]].
|
40
|
+
Defaults to AthenaEnvironment.DEFAULT
|
24
41
|
|
25
42
|
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
|
26
43
|
|
@@ -28,26 +45,177 @@ class Athena:
|
|
28
45
|
---
|
29
46
|
from athena.client import Athena
|
30
47
|
|
31
|
-
client = Athena(
|
32
|
-
token="YOUR_TOKEN",
|
33
|
-
)
|
48
|
+
client = Athena()
|
34
49
|
"""
|
35
50
|
|
36
51
|
def __init__(
|
37
52
|
self,
|
38
53
|
*,
|
39
54
|
base_url: typing.Optional[str] = None,
|
40
|
-
environment: AthenaEnvironment = AthenaEnvironment.
|
41
|
-
token: typing.Union[str, typing.Callable[[], str]],
|
55
|
+
environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
|
42
56
|
timeout: typing.Optional[float] = 60,
|
43
|
-
httpx_client: typing.Optional[httpx.Client] = None
|
57
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
44
58
|
):
|
45
59
|
self._client_wrapper = SyncClientWrapper(
|
46
60
|
base_url=_get_base_url(base_url=base_url, environment=environment),
|
47
|
-
token=token,
|
48
61
|
httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
|
49
62
|
)
|
50
|
-
|
63
|
+
|
64
|
+
def health_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
|
65
|
+
"""
|
66
|
+
Checks the health of a project.
|
67
|
+
|
68
|
+
It returns 200 if the project is healthy.
|
69
|
+
|
70
|
+
Parameters:
|
71
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
72
|
+
---
|
73
|
+
from athena.client import Athena
|
74
|
+
|
75
|
+
client = Athena()
|
76
|
+
client.health_check()
|
77
|
+
"""
|
78
|
+
_response = self._client_wrapper.httpx_client.request(
|
79
|
+
"GET",
|
80
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/health"),
|
81
|
+
params=jsonable_encoder(
|
82
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
83
|
+
),
|
84
|
+
headers=jsonable_encoder(
|
85
|
+
remove_none_from_dict(
|
86
|
+
{
|
87
|
+
**self._client_wrapper.get_headers(),
|
88
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
89
|
+
}
|
90
|
+
)
|
91
|
+
),
|
92
|
+
timeout=request_options.get("timeout_in_seconds")
|
93
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
94
|
+
else 60,
|
95
|
+
)
|
96
|
+
if 200 <= _response.status_code < 300:
|
97
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
98
|
+
try:
|
99
|
+
_response_json = _response.json()
|
100
|
+
except JSONDecodeError:
|
101
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
102
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
103
|
+
|
104
|
+
def athena_get_message(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MessageOutDto:
|
105
|
+
"""
|
106
|
+
Parameters:
|
107
|
+
- id: str.
|
108
|
+
|
109
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
110
|
+
---
|
111
|
+
from athena.client import Athena
|
112
|
+
|
113
|
+
client = Athena()
|
114
|
+
client.athena_get_message(
|
115
|
+
id="id",
|
116
|
+
)
|
117
|
+
"""
|
118
|
+
_response = self._client_wrapper.httpx_client.request(
|
119
|
+
"GET",
|
120
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v0/message/{jsonable_encoder(id)}"),
|
121
|
+
params=jsonable_encoder(
|
122
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
123
|
+
),
|
124
|
+
headers=jsonable_encoder(
|
125
|
+
remove_none_from_dict(
|
126
|
+
{
|
127
|
+
**self._client_wrapper.get_headers(),
|
128
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
129
|
+
}
|
130
|
+
)
|
131
|
+
),
|
132
|
+
timeout=request_options.get("timeout_in_seconds")
|
133
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
134
|
+
else 60,
|
135
|
+
)
|
136
|
+
if 200 <= _response.status_code < 300:
|
137
|
+
return pydantic.parse_obj_as(MessageOutDto, _response.json()) # type: ignore
|
138
|
+
if _response.status_code == 422:
|
139
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
140
|
+
try:
|
141
|
+
_response_json = _response.json()
|
142
|
+
except JSONDecodeError:
|
143
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
144
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
145
|
+
|
146
|
+
def post_message(
|
147
|
+
self,
|
148
|
+
*,
|
149
|
+
content: str,
|
150
|
+
model: typing.Optional[Model] = OMIT,
|
151
|
+
tools: typing.Optional[typing.Sequence[Tools]] = OMIT,
|
152
|
+
conversation_id: typing.Optional[str] = OMIT,
|
153
|
+
conversation_name: typing.Optional[str] = OMIT,
|
154
|
+
request_options: typing.Optional[RequestOptions] = None,
|
155
|
+
) -> MessageOut:
|
156
|
+
"""
|
157
|
+
Parameters:
|
158
|
+
- content: str.
|
159
|
+
|
160
|
+
- model: typing.Optional[Model].
|
161
|
+
|
162
|
+
- tools: typing.Optional[typing.Sequence[Tools]].
|
163
|
+
|
164
|
+
- conversation_id: typing.Optional[str].
|
165
|
+
|
166
|
+
- conversation_name: typing.Optional[str].
|
167
|
+
|
168
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
169
|
+
---
|
170
|
+
from athena.client import Athena
|
171
|
+
|
172
|
+
client = Athena()
|
173
|
+
client.post_message(
|
174
|
+
content="content",
|
175
|
+
)
|
176
|
+
"""
|
177
|
+
_request: typing.Dict[str, typing.Any] = {"content": content}
|
178
|
+
if model is not OMIT:
|
179
|
+
_request["model"] = model.value if model is not None else None
|
180
|
+
if tools is not OMIT:
|
181
|
+
_request["tools"] = tools
|
182
|
+
if conversation_id is not OMIT:
|
183
|
+
_request["conversation_id"] = conversation_id
|
184
|
+
if conversation_name is not OMIT:
|
185
|
+
_request["conversation_name"] = conversation_name
|
186
|
+
_response = self._client_wrapper.httpx_client.request(
|
187
|
+
"POST",
|
188
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/message"),
|
189
|
+
params=jsonable_encoder(
|
190
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
191
|
+
),
|
192
|
+
json=jsonable_encoder(_request)
|
193
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
194
|
+
else {
|
195
|
+
**jsonable_encoder(_request),
|
196
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
197
|
+
},
|
198
|
+
headers=jsonable_encoder(
|
199
|
+
remove_none_from_dict(
|
200
|
+
{
|
201
|
+
**self._client_wrapper.get_headers(),
|
202
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
203
|
+
}
|
204
|
+
)
|
205
|
+
),
|
206
|
+
timeout=request_options.get("timeout_in_seconds")
|
207
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
208
|
+
else 60,
|
209
|
+
)
|
210
|
+
if 200 <= _response.status_code < 300:
|
211
|
+
return pydantic.parse_obj_as(MessageOut, _response.json()) # type: ignore
|
212
|
+
if _response.status_code == 422:
|
213
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
214
|
+
try:
|
215
|
+
_response_json = _response.json()
|
216
|
+
except JSONDecodeError:
|
217
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
218
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
51
219
|
|
52
220
|
|
53
221
|
class AsyncAthena:
|
@@ -59,9 +227,7 @@ class AsyncAthena:
|
|
59
227
|
|
60
228
|
- environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
|
61
229
|
|
62
|
-
Defaults to AthenaEnvironment.
|
63
|
-
|
64
|
-
- token: typing.Union[str, typing.Callable[[], str]].
|
230
|
+
Defaults to AthenaEnvironment.DEFAULT
|
65
231
|
|
66
232
|
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
|
67
233
|
|
@@ -69,26 +235,179 @@ class AsyncAthena:
|
|
69
235
|
---
|
70
236
|
from athena.client import AsyncAthena
|
71
237
|
|
72
|
-
client = AsyncAthena(
|
73
|
-
token="YOUR_TOKEN",
|
74
|
-
)
|
238
|
+
client = AsyncAthena()
|
75
239
|
"""
|
76
240
|
|
77
241
|
def __init__(
|
78
242
|
self,
|
79
243
|
*,
|
80
244
|
base_url: typing.Optional[str] = None,
|
81
|
-
environment: AthenaEnvironment = AthenaEnvironment.
|
82
|
-
token: typing.Union[str, typing.Callable[[], str]],
|
245
|
+
environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
|
83
246
|
timeout: typing.Optional[float] = 60,
|
84
|
-
httpx_client: typing.Optional[httpx.AsyncClient] = None
|
247
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
85
248
|
):
|
86
249
|
self._client_wrapper = AsyncClientWrapper(
|
87
250
|
base_url=_get_base_url(base_url=base_url, environment=environment),
|
88
|
-
token=token,
|
89
251
|
httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
|
90
252
|
)
|
91
|
-
|
253
|
+
|
254
|
+
async def health_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
|
255
|
+
"""
|
256
|
+
Checks the health of a project.
|
257
|
+
|
258
|
+
It returns 200 if the project is healthy.
|
259
|
+
|
260
|
+
Parameters:
|
261
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
262
|
+
---
|
263
|
+
from athena.client import AsyncAthena
|
264
|
+
|
265
|
+
client = AsyncAthena()
|
266
|
+
await client.health_check()
|
267
|
+
"""
|
268
|
+
_response = await self._client_wrapper.httpx_client.request(
|
269
|
+
"GET",
|
270
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/health"),
|
271
|
+
params=jsonable_encoder(
|
272
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
273
|
+
),
|
274
|
+
headers=jsonable_encoder(
|
275
|
+
remove_none_from_dict(
|
276
|
+
{
|
277
|
+
**self._client_wrapper.get_headers(),
|
278
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
279
|
+
}
|
280
|
+
)
|
281
|
+
),
|
282
|
+
timeout=request_options.get("timeout_in_seconds")
|
283
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
284
|
+
else 60,
|
285
|
+
)
|
286
|
+
if 200 <= _response.status_code < 300:
|
287
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
288
|
+
try:
|
289
|
+
_response_json = _response.json()
|
290
|
+
except JSONDecodeError:
|
291
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
292
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
293
|
+
|
294
|
+
async def athena_get_message(
|
295
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
296
|
+
) -> MessageOutDto:
|
297
|
+
"""
|
298
|
+
Parameters:
|
299
|
+
- id: str.
|
300
|
+
|
301
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
302
|
+
---
|
303
|
+
from athena.client import AsyncAthena
|
304
|
+
|
305
|
+
client = AsyncAthena()
|
306
|
+
await client.athena_get_message(
|
307
|
+
id="id",
|
308
|
+
)
|
309
|
+
"""
|
310
|
+
_response = await self._client_wrapper.httpx_client.request(
|
311
|
+
"GET",
|
312
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v0/message/{jsonable_encoder(id)}"),
|
313
|
+
params=jsonable_encoder(
|
314
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
315
|
+
),
|
316
|
+
headers=jsonable_encoder(
|
317
|
+
remove_none_from_dict(
|
318
|
+
{
|
319
|
+
**self._client_wrapper.get_headers(),
|
320
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
321
|
+
}
|
322
|
+
)
|
323
|
+
),
|
324
|
+
timeout=request_options.get("timeout_in_seconds")
|
325
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
326
|
+
else 60,
|
327
|
+
)
|
328
|
+
if 200 <= _response.status_code < 300:
|
329
|
+
return pydantic.parse_obj_as(MessageOutDto, _response.json()) # type: ignore
|
330
|
+
if _response.status_code == 422:
|
331
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
332
|
+
try:
|
333
|
+
_response_json = _response.json()
|
334
|
+
except JSONDecodeError:
|
335
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
336
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
337
|
+
|
338
|
+
async def post_message(
|
339
|
+
self,
|
340
|
+
*,
|
341
|
+
content: str,
|
342
|
+
model: typing.Optional[Model] = OMIT,
|
343
|
+
tools: typing.Optional[typing.Sequence[Tools]] = OMIT,
|
344
|
+
conversation_id: typing.Optional[str] = OMIT,
|
345
|
+
conversation_name: typing.Optional[str] = OMIT,
|
346
|
+
request_options: typing.Optional[RequestOptions] = None,
|
347
|
+
) -> MessageOut:
|
348
|
+
"""
|
349
|
+
Parameters:
|
350
|
+
- content: str.
|
351
|
+
|
352
|
+
- model: typing.Optional[Model].
|
353
|
+
|
354
|
+
- tools: typing.Optional[typing.Sequence[Tools]].
|
355
|
+
|
356
|
+
- conversation_id: typing.Optional[str].
|
357
|
+
|
358
|
+
- conversation_name: typing.Optional[str].
|
359
|
+
|
360
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
361
|
+
---
|
362
|
+
from athena.client import AsyncAthena
|
363
|
+
|
364
|
+
client = AsyncAthena()
|
365
|
+
await client.post_message(
|
366
|
+
content="content",
|
367
|
+
)
|
368
|
+
"""
|
369
|
+
_request: typing.Dict[str, typing.Any] = {"content": content}
|
370
|
+
if model is not OMIT:
|
371
|
+
_request["model"] = model.value if model is not None else None
|
372
|
+
if tools is not OMIT:
|
373
|
+
_request["tools"] = tools
|
374
|
+
if conversation_id is not OMIT:
|
375
|
+
_request["conversation_id"] = conversation_id
|
376
|
+
if conversation_name is not OMIT:
|
377
|
+
_request["conversation_name"] = conversation_name
|
378
|
+
_response = await self._client_wrapper.httpx_client.request(
|
379
|
+
"POST",
|
380
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/message"),
|
381
|
+
params=jsonable_encoder(
|
382
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
383
|
+
),
|
384
|
+
json=jsonable_encoder(_request)
|
385
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
386
|
+
else {
|
387
|
+
**jsonable_encoder(_request),
|
388
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
389
|
+
},
|
390
|
+
headers=jsonable_encoder(
|
391
|
+
remove_none_from_dict(
|
392
|
+
{
|
393
|
+
**self._client_wrapper.get_headers(),
|
394
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
395
|
+
}
|
396
|
+
)
|
397
|
+
),
|
398
|
+
timeout=request_options.get("timeout_in_seconds")
|
399
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
400
|
+
else 60,
|
401
|
+
)
|
402
|
+
if 200 <= _response.status_code < 300:
|
403
|
+
return pydantic.parse_obj_as(MessageOut, _response.json()) # type: ignore
|
404
|
+
if _response.status_code == 422:
|
405
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
406
|
+
try:
|
407
|
+
_response_json = _response.json()
|
408
|
+
except JSONDecodeError:
|
409
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
410
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
92
411
|
|
93
412
|
|
94
413
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
|
athena/core/client_wrapper.py
CHANGED
@@ -6,40 +6,28 @@ import httpx
|
|
6
6
|
|
7
7
|
|
8
8
|
class BaseClientWrapper:
|
9
|
-
def __init__(self, *,
|
10
|
-
self._token = token
|
9
|
+
def __init__(self, *, base_url: str):
|
11
10
|
self._base_url = base_url
|
12
11
|
|
13
12
|
def get_headers(self) -> typing.Dict[str, str]:
|
14
13
|
headers: typing.Dict[str, str] = {
|
15
14
|
"X-Fern-Language": "Python",
|
16
15
|
"X-Fern-SDK-Name": "athena-intelligence",
|
17
|
-
"X-Fern-SDK-Version": "0.1.
|
16
|
+
"X-Fern-SDK-Version": "0.1.5",
|
18
17
|
}
|
19
|
-
headers["Authorization"] = f"Bearer {self._get_token()}"
|
20
18
|
return headers
|
21
19
|
|
22
|
-
def _get_token(self) -> str:
|
23
|
-
if isinstance(self._token, str):
|
24
|
-
return self._token
|
25
|
-
else:
|
26
|
-
return self._token()
|
27
|
-
|
28
20
|
def get_base_url(self) -> str:
|
29
21
|
return self._base_url
|
30
22
|
|
31
23
|
|
32
24
|
class SyncClientWrapper(BaseClientWrapper):
|
33
|
-
def __init__(
|
34
|
-
|
35
|
-
):
|
36
|
-
super().__init__(token=token, base_url=base_url)
|
25
|
+
def __init__(self, *, base_url: str, httpx_client: httpx.Client):
|
26
|
+
super().__init__(base_url=base_url)
|
37
27
|
self.httpx_client = httpx_client
|
38
28
|
|
39
29
|
|
40
30
|
class AsyncClientWrapper(BaseClientWrapper):
|
41
|
-
def __init__(
|
42
|
-
|
43
|
-
):
|
44
|
-
super().__init__(token=token, base_url=base_url)
|
31
|
+
def __init__(self, *, base_url: str, httpx_client: httpx.AsyncClient):
|
32
|
+
super().__init__(base_url=base_url)
|
45
33
|
self.httpx_client = httpx_client
|
athena/environment.py
CHANGED
athena/types/__init__.py
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
3
|
from .http_validation_error import HttpValidationError
|
4
|
+
from .message_out import MessageOut
|
5
|
+
from .message_out_dto import MessageOutDto
|
6
|
+
from .model import Model
|
7
|
+
from .tools import Tools
|
4
8
|
from .validation_error import ValidationError
|
9
|
+
from .validation_error_loc_item import ValidationErrorLocItem
|
5
10
|
|
6
|
-
__all__ = [
|
11
|
+
__all__ = [
|
12
|
+
"HttpValidationError",
|
13
|
+
"MessageOut",
|
14
|
+
"MessageOutDto",
|
15
|
+
"Model",
|
16
|
+
"Tools",
|
17
|
+
"ValidationError",
|
18
|
+
"ValidationErrorLocItem",
|
19
|
+
]
|
@@ -13,7 +13,7 @@ except ImportError:
|
|
13
13
|
|
14
14
|
|
15
15
|
class HttpValidationError(pydantic.BaseModel):
|
16
|
-
detail: typing.List[ValidationError]
|
16
|
+
detail: typing.Optional[typing.List[ValidationError]] = None
|
17
17
|
|
18
18
|
def json(self, **kwargs: typing.Any) -> str:
|
19
19
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
from ..core.datetime_utils import serialize_datetime
|
7
|
+
|
8
|
+
try:
|
9
|
+
import pydantic.v1 as pydantic # type: ignore
|
10
|
+
except ImportError:
|
11
|
+
import pydantic # type: ignore
|
12
|
+
|
13
|
+
|
14
|
+
class MessageOut(pydantic.BaseModel):
|
15
|
+
id: str
|
16
|
+
|
17
|
+
def json(self, **kwargs: typing.Any) -> str:
|
18
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
19
|
+
return super().json(**kwargs_with_defaults)
|
20
|
+
|
21
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
22
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
23
|
+
return super().dict(**kwargs_with_defaults)
|
24
|
+
|
25
|
+
class Config:
|
26
|
+
frozen = True
|
27
|
+
smart_union = True
|
28
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
from ..core.datetime_utils import serialize_datetime
|
7
|
+
|
8
|
+
try:
|
9
|
+
import pydantic.v1 as pydantic # type: ignore
|
10
|
+
except ImportError:
|
11
|
+
import pydantic # type: ignore
|
12
|
+
|
13
|
+
|
14
|
+
class MessageOutDto(pydantic.BaseModel):
|
15
|
+
id: str
|
16
|
+
conversation_id: str
|
17
|
+
logs: typing.Optional[str] = None
|
18
|
+
content: typing.Optional[str] = None
|
19
|
+
created_at: str
|
20
|
+
status: str
|
21
|
+
|
22
|
+
def json(self, **kwargs: typing.Any) -> str:
|
23
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
24
|
+
return super().json(**kwargs_with_defaults)
|
25
|
+
|
26
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
27
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
28
|
+
return super().dict(**kwargs_with_defaults)
|
29
|
+
|
30
|
+
class Config:
|
31
|
+
frozen = True
|
32
|
+
smart_union = True
|
33
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
athena/types/model.py
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import enum
|
4
|
+
import typing
|
5
|
+
|
6
|
+
T_Result = typing.TypeVar("T_Result")
|
7
|
+
|
8
|
+
|
9
|
+
class Model(str, enum.Enum):
|
10
|
+
"""
|
11
|
+
An enumeration.
|
12
|
+
"""
|
13
|
+
|
14
|
+
GPT_4 = "gpt_4"
|
15
|
+
GPT_4_TURBO_PREVIEW = "gpt_4_turbo_preview"
|
16
|
+
GPT_3_5_TURBO = "gpt_3_5_turbo"
|
17
|
+
|
18
|
+
def visit(
|
19
|
+
self,
|
20
|
+
gpt_4: typing.Callable[[], T_Result],
|
21
|
+
gpt_4_turbo_preview: typing.Callable[[], T_Result],
|
22
|
+
gpt_3_5_turbo: typing.Callable[[], T_Result],
|
23
|
+
) -> T_Result:
|
24
|
+
if self is Model.GPT_4:
|
25
|
+
return gpt_4()
|
26
|
+
if self is Model.GPT_4_TURBO_PREVIEW:
|
27
|
+
return gpt_4_turbo_preview()
|
28
|
+
if self is Model.GPT_3_5_TURBO:
|
29
|
+
return gpt_3_5_turbo()
|
athena/types/tools.py
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import enum
|
4
|
+
import typing
|
5
|
+
|
6
|
+
T_Result = typing.TypeVar("T_Result")
|
7
|
+
|
8
|
+
|
9
|
+
class Tools(str, enum.Enum):
|
10
|
+
"""
|
11
|
+
An enumeration.
|
12
|
+
"""
|
13
|
+
|
14
|
+
SEARCH = "search"
|
15
|
+
BROWSE = "browse"
|
16
|
+
DATABASE_METADATA = "database_metadata"
|
17
|
+
QUERY = "query"
|
18
|
+
CHART = "chart"
|
19
|
+
ENRICH_PERSON = "enrich_person"
|
20
|
+
ENRICH_COMPANY = "enrich_company"
|
21
|
+
|
22
|
+
def visit(
|
23
|
+
self,
|
24
|
+
search: typing.Callable[[], T_Result],
|
25
|
+
browse: typing.Callable[[], T_Result],
|
26
|
+
database_metadata: typing.Callable[[], T_Result],
|
27
|
+
query: typing.Callable[[], T_Result],
|
28
|
+
chart: typing.Callable[[], T_Result],
|
29
|
+
enrich_person: typing.Callable[[], T_Result],
|
30
|
+
enrich_company: typing.Callable[[], T_Result],
|
31
|
+
) -> T_Result:
|
32
|
+
if self is Tools.SEARCH:
|
33
|
+
return search()
|
34
|
+
if self is Tools.BROWSE:
|
35
|
+
return browse()
|
36
|
+
if self is Tools.DATABASE_METADATA:
|
37
|
+
return database_metadata()
|
38
|
+
if self is Tools.QUERY:
|
39
|
+
return query()
|
40
|
+
if self is Tools.CHART:
|
41
|
+
return chart()
|
42
|
+
if self is Tools.ENRICH_PERSON:
|
43
|
+
return enrich_person()
|
44
|
+
if self is Tools.ENRICH_COMPANY:
|
45
|
+
return enrich_company()
|
athena/types/validation_error.py
CHANGED
@@ -4,6 +4,7 @@ import datetime as dt
|
|
4
4
|
import typing
|
5
5
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
7
|
+
from .validation_error_loc_item import ValidationErrorLocItem
|
7
8
|
|
8
9
|
try:
|
9
10
|
import pydantic.v1 as pydantic # type: ignore
|
@@ -12,9 +13,9 @@ except ImportError:
|
|
12
13
|
|
13
14
|
|
14
15
|
class ValidationError(pydantic.BaseModel):
|
15
|
-
loc: typing.
|
16
|
-
msg:
|
17
|
-
type:
|
16
|
+
loc: typing.List[ValidationErrorLocItem]
|
17
|
+
msg: str
|
18
|
+
type: str
|
18
19
|
|
19
20
|
def json(self, **kwargs: typing.Any) -> str:
|
20
21
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
athena/__init__.py,sha256=S4TY2NjQ19rPwYCWsw8-Cxrr51PjtSN2pma_ybgaUtQ,491
|
2
|
+
athena/client.py,sha256=diL-uLcWo2lhyxOXdZRdUn8DrhjII4yLYgdStelnkh8,17713
|
3
|
+
athena/core/__init__.py,sha256=95onSWXymaL0iV-nBsuKNgjh1LbsymAkRkx7POn1nc0,696
|
4
|
+
athena/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
5
|
+
athena/core/client_wrapper.py,sha256=sDd5yzNnq_9nIwN3MDMpVLv6dWB0hauTPxulICxMRt8,937
|
6
|
+
athena/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
7
|
+
athena/core/file.py,sha256=sy1RUGZ3aJYuw998bZytxxo6QdgKmlnlgBaMvwEKCGg,1480
|
8
|
+
athena/core/jsonable_encoder.py,sha256=MTYkDov2EryHgee4QM46uZiBOuOXK9KTHlBdBwU-CpU,3799
|
9
|
+
athena/core/remove_none_from_dict.py,sha256=8m91FC3YuVem0Gm9_sXhJ2tGvP33owJJdrqCLEdowGw,330
|
10
|
+
athena/core/request_options.py,sha256=9n3ZHWZkw60MGp7GbdjGEuGo73Pa-6JeusRGhS533aA,1297
|
11
|
+
athena/environment.py,sha256=D_CljQlUahhEi9smvMslj_5Y8gMFO6D0fRCL0ydRLuM,165
|
12
|
+
athena/errors/__init__.py,sha256=pbbVUFtB9LCocA1RMWMMF_RKjsy5YkOKX5BAuE49w6g,170
|
13
|
+
athena/errors/unprocessable_entity_error.py,sha256=FvR7XPlV3Xx5nu8HNlmLhBRdk4so_gCHjYT5PyZe6sM,313
|
14
|
+
athena/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
+
athena/types/__init__.py,sha256=sG74gyPktXegm01dMPmvxhq9um_3GdxMtF8kbSR9L4s,517
|
16
|
+
athena/types/http_validation_error.py,sha256=Fcv_CTMMrLvCeTHjF0n5xf5tskMDgt-J6H9gp654eQw,973
|
17
|
+
athena/types/message_out.py,sha256=uvZY_Podv2XccEk8CICug9I_S2hFJTSzCBwcHiauW7A,865
|
18
|
+
athena/types/message_out_dto.py,sha256=GZ30Lk4PS0opAJS24cC_VfpPVZ87lFW171YH82_dEaQ,1008
|
19
|
+
athena/types/model.py,sha256=SXpMQM_Dk-AIEbisBd4OGwLiqI1ePaDNEqXrs9ijuEY,732
|
20
|
+
athena/types/tools.py,sha256=Vfb-D9CYcPZH6MBATNODgfXjFyBpCs4qbkqpCMl7eBM,1277
|
21
|
+
athena/types/validation_error.py,sha256=2JhGNJouo8QpfrMBoT_JCwYSn1nFN2Nnq0p9uPLDH-U,992
|
22
|
+
athena/types/validation_error_loc_item.py,sha256=LAtjCHIllWRBFXvAZ5QZpp7CPXjdtN9EB7HrLVo6EP0,128
|
23
|
+
athena_intelligence-0.1.5.dist-info/METADATA,sha256=XXNAl8v11mjjc24OVqFUYEngibxbnUsjdsG2BmQUSc4,3741
|
24
|
+
athena_intelligence-0.1.5.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
25
|
+
athena_intelligence-0.1.5.dist-info/RECORD,,
|
@@ -1,329 +0,0 @@
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
2
|
-
|
3
|
-
import typing
|
4
|
-
import urllib.parse
|
5
|
-
from json.decoder import JSONDecodeError
|
6
|
-
|
7
|
-
from ...core.api_error import ApiError
|
8
|
-
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
10
|
-
from ...core.remove_none_from_dict import remove_none_from_dict
|
11
|
-
from ...core.request_options import RequestOptions
|
12
|
-
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
13
|
-
from ...types.http_validation_error import HttpValidationError
|
14
|
-
|
15
|
-
try:
|
16
|
-
import pydantic.v1 as pydantic # type: ignore
|
17
|
-
except ImportError:
|
18
|
-
import pydantic # type: ignore
|
19
|
-
|
20
|
-
# this is used as the default value for optional parameters
|
21
|
-
OMIT = typing.cast(typing.Any, ...)
|
22
|
-
|
23
|
-
|
24
|
-
class MessageClient:
|
25
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
26
|
-
self._client_wrapper = client_wrapper
|
27
|
-
|
28
|
-
def get(self, *, message_id: str, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
|
29
|
-
"""
|
30
|
-
Parameters:
|
31
|
-
- message_id: str. The ID of the message to retrieve
|
32
|
-
|
33
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
34
|
-
---
|
35
|
-
from athena.client import Athena
|
36
|
-
|
37
|
-
client = Athena(
|
38
|
-
token="YOUR_TOKEN",
|
39
|
-
)
|
40
|
-
client.message.get(
|
41
|
-
message_id="message_id",
|
42
|
-
)
|
43
|
-
"""
|
44
|
-
_response = self._client_wrapper.httpx_client.request(
|
45
|
-
"GET",
|
46
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/auth/athena-get-message"),
|
47
|
-
params=jsonable_encoder(
|
48
|
-
remove_none_from_dict(
|
49
|
-
{
|
50
|
-
"message_id": message_id,
|
51
|
-
**(
|
52
|
-
request_options.get("additional_query_parameters", {})
|
53
|
-
if request_options is not None
|
54
|
-
else {}
|
55
|
-
),
|
56
|
-
}
|
57
|
-
)
|
58
|
-
),
|
59
|
-
headers=jsonable_encoder(
|
60
|
-
remove_none_from_dict(
|
61
|
-
{
|
62
|
-
**self._client_wrapper.get_headers(),
|
63
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
64
|
-
}
|
65
|
-
)
|
66
|
-
),
|
67
|
-
timeout=request_options.get("timeout_in_seconds")
|
68
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
69
|
-
else 60,
|
70
|
-
)
|
71
|
-
if 200 <= _response.status_code < 300:
|
72
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
73
|
-
if _response.status_code == 422:
|
74
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
75
|
-
try:
|
76
|
-
_response_json = _response.json()
|
77
|
-
except JSONDecodeError:
|
78
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
79
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
80
|
-
|
81
|
-
def submit(
|
82
|
-
self,
|
83
|
-
*,
|
84
|
-
additional_context: typing.Optional[str] = OMIT,
|
85
|
-
config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
86
|
-
content: str,
|
87
|
-
conversation_id: typing.Optional[str] = OMIT,
|
88
|
-
conversation_name: typing.Optional[str] = OMIT,
|
89
|
-
documents: typing.Optional[typing.Sequence[str]] = OMIT,
|
90
|
-
model: typing.Optional[str] = OMIT,
|
91
|
-
sdataset_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
92
|
-
tools: typing.Optional[typing.Sequence[str]] = OMIT,
|
93
|
-
request_options: typing.Optional[RequestOptions] = None,
|
94
|
-
) -> typing.Any:
|
95
|
-
"""
|
96
|
-
Parameters:
|
97
|
-
- additional_context: typing.Optional[str].
|
98
|
-
|
99
|
-
- config: typing.Optional[typing.Dict[str, typing.Any]].
|
100
|
-
|
101
|
-
- content: str.
|
102
|
-
|
103
|
-
- conversation_id: typing.Optional[str].
|
104
|
-
|
105
|
-
- conversation_name: typing.Optional[str].
|
106
|
-
|
107
|
-
- documents: typing.Optional[typing.Sequence[str]].
|
108
|
-
|
109
|
-
- model: typing.Optional[str].
|
110
|
-
|
111
|
-
- sdataset_ids: typing.Optional[typing.Sequence[str]].
|
112
|
-
|
113
|
-
- tools: typing.Optional[typing.Sequence[str]].
|
114
|
-
|
115
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
116
|
-
---
|
117
|
-
from athena.client import Athena
|
118
|
-
|
119
|
-
client = Athena(
|
120
|
-
token="YOUR_TOKEN",
|
121
|
-
)
|
122
|
-
client.message.submit(
|
123
|
-
content="content",
|
124
|
-
)
|
125
|
-
"""
|
126
|
-
_request: typing.Dict[str, typing.Any] = {"content": content}
|
127
|
-
if additional_context is not OMIT:
|
128
|
-
_request["additional_context"] = additional_context
|
129
|
-
if config is not OMIT:
|
130
|
-
_request["config"] = config
|
131
|
-
if conversation_id is not OMIT:
|
132
|
-
_request["conversation_id"] = conversation_id
|
133
|
-
if conversation_name is not OMIT:
|
134
|
-
_request["conversation_name"] = conversation_name
|
135
|
-
if documents is not OMIT:
|
136
|
-
_request["documents"] = documents
|
137
|
-
if model is not OMIT:
|
138
|
-
_request["model"] = model
|
139
|
-
if sdataset_ids is not OMIT:
|
140
|
-
_request["sdataset_ids"] = sdataset_ids
|
141
|
-
if tools is not OMIT:
|
142
|
-
_request["tools"] = tools
|
143
|
-
_response = self._client_wrapper.httpx_client.request(
|
144
|
-
"POST",
|
145
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/auth/athena-submit-message"),
|
146
|
-
params=jsonable_encoder(
|
147
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
148
|
-
),
|
149
|
-
json=jsonable_encoder(_request)
|
150
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
151
|
-
else {
|
152
|
-
**jsonable_encoder(_request),
|
153
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
154
|
-
},
|
155
|
-
headers=jsonable_encoder(
|
156
|
-
remove_none_from_dict(
|
157
|
-
{
|
158
|
-
**self._client_wrapper.get_headers(),
|
159
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
160
|
-
}
|
161
|
-
)
|
162
|
-
),
|
163
|
-
timeout=request_options.get("timeout_in_seconds")
|
164
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
165
|
-
else 60,
|
166
|
-
)
|
167
|
-
if 200 <= _response.status_code < 300:
|
168
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
169
|
-
if _response.status_code == 422:
|
170
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
171
|
-
try:
|
172
|
-
_response_json = _response.json()
|
173
|
-
except JSONDecodeError:
|
174
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
175
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
176
|
-
|
177
|
-
|
178
|
-
class AsyncMessageClient:
|
179
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
180
|
-
self._client_wrapper = client_wrapper
|
181
|
-
|
182
|
-
async def get(self, *, message_id: str, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
|
183
|
-
"""
|
184
|
-
Parameters:
|
185
|
-
- message_id: str. The ID of the message to retrieve
|
186
|
-
|
187
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
188
|
-
---
|
189
|
-
from athena.client import AsyncAthena
|
190
|
-
|
191
|
-
client = AsyncAthena(
|
192
|
-
token="YOUR_TOKEN",
|
193
|
-
)
|
194
|
-
await client.message.get(
|
195
|
-
message_id="message_id",
|
196
|
-
)
|
197
|
-
"""
|
198
|
-
_response = await self._client_wrapper.httpx_client.request(
|
199
|
-
"GET",
|
200
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/auth/athena-get-message"),
|
201
|
-
params=jsonable_encoder(
|
202
|
-
remove_none_from_dict(
|
203
|
-
{
|
204
|
-
"message_id": message_id,
|
205
|
-
**(
|
206
|
-
request_options.get("additional_query_parameters", {})
|
207
|
-
if request_options is not None
|
208
|
-
else {}
|
209
|
-
),
|
210
|
-
}
|
211
|
-
)
|
212
|
-
),
|
213
|
-
headers=jsonable_encoder(
|
214
|
-
remove_none_from_dict(
|
215
|
-
{
|
216
|
-
**self._client_wrapper.get_headers(),
|
217
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
218
|
-
}
|
219
|
-
)
|
220
|
-
),
|
221
|
-
timeout=request_options.get("timeout_in_seconds")
|
222
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
223
|
-
else 60,
|
224
|
-
)
|
225
|
-
if 200 <= _response.status_code < 300:
|
226
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
227
|
-
if _response.status_code == 422:
|
228
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
229
|
-
try:
|
230
|
-
_response_json = _response.json()
|
231
|
-
except JSONDecodeError:
|
232
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
233
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
234
|
-
|
235
|
-
async def submit(
|
236
|
-
self,
|
237
|
-
*,
|
238
|
-
additional_context: typing.Optional[str] = OMIT,
|
239
|
-
config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
240
|
-
content: str,
|
241
|
-
conversation_id: typing.Optional[str] = OMIT,
|
242
|
-
conversation_name: typing.Optional[str] = OMIT,
|
243
|
-
documents: typing.Optional[typing.Sequence[str]] = OMIT,
|
244
|
-
model: typing.Optional[str] = OMIT,
|
245
|
-
sdataset_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
246
|
-
tools: typing.Optional[typing.Sequence[str]] = OMIT,
|
247
|
-
request_options: typing.Optional[RequestOptions] = None,
|
248
|
-
) -> typing.Any:
|
249
|
-
"""
|
250
|
-
Parameters:
|
251
|
-
- additional_context: typing.Optional[str].
|
252
|
-
|
253
|
-
- config: typing.Optional[typing.Dict[str, typing.Any]].
|
254
|
-
|
255
|
-
- content: str.
|
256
|
-
|
257
|
-
- conversation_id: typing.Optional[str].
|
258
|
-
|
259
|
-
- conversation_name: typing.Optional[str].
|
260
|
-
|
261
|
-
- documents: typing.Optional[typing.Sequence[str]].
|
262
|
-
|
263
|
-
- model: typing.Optional[str].
|
264
|
-
|
265
|
-
- sdataset_ids: typing.Optional[typing.Sequence[str]].
|
266
|
-
|
267
|
-
- tools: typing.Optional[typing.Sequence[str]].
|
268
|
-
|
269
|
-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
270
|
-
---
|
271
|
-
from athena.client import AsyncAthena
|
272
|
-
|
273
|
-
client = AsyncAthena(
|
274
|
-
token="YOUR_TOKEN",
|
275
|
-
)
|
276
|
-
await client.message.submit(
|
277
|
-
content="content",
|
278
|
-
)
|
279
|
-
"""
|
280
|
-
_request: typing.Dict[str, typing.Any] = {"content": content}
|
281
|
-
if additional_context is not OMIT:
|
282
|
-
_request["additional_context"] = additional_context
|
283
|
-
if config is not OMIT:
|
284
|
-
_request["config"] = config
|
285
|
-
if conversation_id is not OMIT:
|
286
|
-
_request["conversation_id"] = conversation_id
|
287
|
-
if conversation_name is not OMIT:
|
288
|
-
_request["conversation_name"] = conversation_name
|
289
|
-
if documents is not OMIT:
|
290
|
-
_request["documents"] = documents
|
291
|
-
if model is not OMIT:
|
292
|
-
_request["model"] = model
|
293
|
-
if sdataset_ids is not OMIT:
|
294
|
-
_request["sdataset_ids"] = sdataset_ids
|
295
|
-
if tools is not OMIT:
|
296
|
-
_request["tools"] = tools
|
297
|
-
_response = await self._client_wrapper.httpx_client.request(
|
298
|
-
"POST",
|
299
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/auth/athena-submit-message"),
|
300
|
-
params=jsonable_encoder(
|
301
|
-
request_options.get("additional_query_parameters") if request_options is not None else None
|
302
|
-
),
|
303
|
-
json=jsonable_encoder(_request)
|
304
|
-
if request_options is None or request_options.get("additional_body_parameters") is None
|
305
|
-
else {
|
306
|
-
**jsonable_encoder(_request),
|
307
|
-
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
308
|
-
},
|
309
|
-
headers=jsonable_encoder(
|
310
|
-
remove_none_from_dict(
|
311
|
-
{
|
312
|
-
**self._client_wrapper.get_headers(),
|
313
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
314
|
-
}
|
315
|
-
)
|
316
|
-
),
|
317
|
-
timeout=request_options.get("timeout_in_seconds")
|
318
|
-
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
319
|
-
else 60,
|
320
|
-
)
|
321
|
-
if 200 <= _response.status_code < 300:
|
322
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
323
|
-
if _response.status_code == 422:
|
324
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
325
|
-
try:
|
326
|
-
_response_json = _response.json()
|
327
|
-
except JSONDecodeError:
|
328
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
329
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
athena/__init__.py,sha256=mM2ORuc8lE5dQBWDvOVv4pYwGC9-v5BKks3LGTssVHY,354
|
2
|
-
athena/client.py,sha256=yZ1H80Vp8fSf1-0poxJCoK0cnjsQGIHM0C1ucKuQCPM,4117
|
3
|
-
athena/core/__init__.py,sha256=95onSWXymaL0iV-nBsuKNgjh1LbsymAkRkx7POn1nc0,696
|
4
|
-
athena/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
5
|
-
athena/core/client_wrapper.py,sha256=tQkKCpqMT4JcxxkLHSeLlt3NW2HRgMGcrJJv5iSqXW8,1393
|
6
|
-
athena/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
7
|
-
athena/core/file.py,sha256=sy1RUGZ3aJYuw998bZytxxo6QdgKmlnlgBaMvwEKCGg,1480
|
8
|
-
athena/core/jsonable_encoder.py,sha256=MTYkDov2EryHgee4QM46uZiBOuOXK9KTHlBdBwU-CpU,3799
|
9
|
-
athena/core/remove_none_from_dict.py,sha256=8m91FC3YuVem0Gm9_sXhJ2tGvP33owJJdrqCLEdowGw,330
|
10
|
-
athena/core/request_options.py,sha256=9n3ZHWZkw60MGp7GbdjGEuGo73Pa-6JeusRGhS533aA,1297
|
11
|
-
athena/environment.py,sha256=5-uIjSP-twha9NxudzbrBcoevnUcQmsG_JCe9pLAji4,168
|
12
|
-
athena/errors/__init__.py,sha256=pbbVUFtB9LCocA1RMWMMF_RKjsy5YkOKX5BAuE49w6g,170
|
13
|
-
athena/errors/unprocessable_entity_error.py,sha256=FvR7XPlV3Xx5nu8HNlmLhBRdk4so_gCHjYT5PyZe6sM,313
|
14
|
-
athena/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
athena/resources/__init__.py,sha256=H2Sg5QOlqjAbAl_ADBNYPqFArb-9plPdXDPVdeIkXDk,110
|
16
|
-
athena/resources/message/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
17
|
-
athena/resources/message/client.py,sha256=pZwHlwLyhOyYi2XLyBnf3z02YspFYAHnRx9ojqcwvAE,13485
|
18
|
-
athena/types/__init__.py,sha256=h85tlX9zfEuZsJZVvtfTV801zX-hNyahVmKx2rpKf28,220
|
19
|
-
athena/types/http_validation_error.py,sha256=jyYYic0XAUCV7cw-E8cqCysIbJ8citJ48Jk6UAR3Z18,949
|
20
|
-
athena/types/validation_error.py,sha256=U1eCkenyCs3oULwpUi3T2DGaXO7py0hyuY99H1Bh36Q,983
|
21
|
-
athena_intelligence-0.1.4.dist-info/METADATA,sha256=c4RgWOrKuVFFSs-Jr0gz5jxe46bonTsVmw0QZJr-OzE,3741
|
22
|
-
athena_intelligence-0.1.4.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
23
|
-
athena_intelligence-0.1.4.dist-info/RECORD,,
|
File without changes
|