athena-intelligence 0.1.3__tar.gz → 0.1.5__tar.gz

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.
Files changed (31) hide show
  1. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/pyproject.toml +1 -1
  3. athena_intelligence-0.1.5/src/athena/__init__.py +17 -0
  4. athena_intelligence-0.1.5/src/athena/client.py +419 -0
  5. athena_intelligence-0.1.5/src/athena/core/client_wrapper.py +33 -0
  6. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/environment.py +1 -1
  7. athena_intelligence-0.1.5/src/athena/errors/__init__.py +5 -0
  8. athena_intelligence-0.1.5/src/athena/errors/unprocessable_entity_error.py +9 -0
  9. athena_intelligence-0.1.5/src/athena/types/__init__.py +19 -0
  10. athena_intelligence-0.1.5/src/athena/types/http_validation_error.py +29 -0
  11. athena_intelligence-0.1.5/src/athena/types/message_out.py +28 -0
  12. athena_intelligence-0.1.3/src/athena/resources/message/types/message.py → athena_intelligence-0.1.5/src/athena/types/message_out_dto.py +6 -8
  13. athena_intelligence-0.1.5/src/athena/types/model.py +29 -0
  14. athena_intelligence-0.1.5/src/athena/types/tools.py +45 -0
  15. athena_intelligence-0.1.5/src/athena/types/validation_error.py +31 -0
  16. athena_intelligence-0.1.3/src/athena/resources/message/__init__.py → athena_intelligence-0.1.5/src/athena/types/validation_error_loc_item.py +2 -2
  17. athena_intelligence-0.1.3/src/athena/__init__.py +0 -6
  18. athena_intelligence-0.1.3/src/athena/client.py +0 -110
  19. athena_intelligence-0.1.3/src/athena/core/client_wrapper.py +0 -45
  20. athena_intelligence-0.1.3/src/athena/resources/__init__.py +0 -6
  21. athena_intelligence-0.1.3/src/athena/resources/message/client.py +0 -292
  22. athena_intelligence-0.1.3/src/athena/resources/message/types/__init__.py +0 -5
  23. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/README.md +0 -0
  24. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/core/__init__.py +0 -0
  25. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/core/api_error.py +0 -0
  26. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/core/datetime_utils.py +0 -0
  27. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/core/file.py +0 -0
  28. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/core/jsonable_encoder.py +0 -0
  29. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/core/remove_none_from_dict.py +0 -0
  30. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/core/request_options.py +0 -0
  31. {athena_intelligence-0.1.3 → athena_intelligence-0.1.5}/src/athena/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "athena-intelligence"
3
- version = "0.1.3"
3
+ version = "0.1.5"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  authors = []
@@ -0,0 +1,17 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import HttpValidationError, MessageOut, MessageOutDto, Model, Tools, ValidationError, ValidationErrorLocItem
4
+ from .errors import UnprocessableEntityError
5
+ from .environment import AthenaEnvironment
6
+
7
+ __all__ = [
8
+ "AthenaEnvironment",
9
+ "HttpValidationError",
10
+ "MessageOut",
11
+ "MessageOutDto",
12
+ "Model",
13
+ "Tools",
14
+ "UnprocessableEntityError",
15
+ "ValidationError",
16
+ "ValidationErrorLocItem",
17
+ ]
@@ -0,0 +1,419 @@
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
+ import httpx
8
+
9
+ from .core.api_error import ApiError
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
14
+ from .environment import AthenaEnvironment
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, ...)
29
+
30
+
31
+ class Athena:
32
+ """
33
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
34
+
35
+ Parameters:
36
+ - base_url: typing.Optional[str]. The base url to use for requests from the client.
37
+
38
+ - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
39
+
40
+ Defaults to AthenaEnvironment.DEFAULT
41
+
42
+ - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
43
+
44
+ - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
45
+ ---
46
+ from athena.client import Athena
47
+
48
+ client = Athena()
49
+ """
50
+
51
+ def __init__(
52
+ self,
53
+ *,
54
+ base_url: typing.Optional[str] = None,
55
+ environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
56
+ timeout: typing.Optional[float] = 60,
57
+ httpx_client: typing.Optional[httpx.Client] = None,
58
+ ):
59
+ self._client_wrapper = SyncClientWrapper(
60
+ base_url=_get_base_url(base_url=base_url, environment=environment),
61
+ httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
62
+ )
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)
219
+
220
+
221
+ class AsyncAthena:
222
+ """
223
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
224
+
225
+ Parameters:
226
+ - base_url: typing.Optional[str]. The base url to use for requests from the client.
227
+
228
+ - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
229
+
230
+ Defaults to AthenaEnvironment.DEFAULT
231
+
232
+ - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
233
+
234
+ - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
235
+ ---
236
+ from athena.client import AsyncAthena
237
+
238
+ client = AsyncAthena()
239
+ """
240
+
241
+ def __init__(
242
+ self,
243
+ *,
244
+ base_url: typing.Optional[str] = None,
245
+ environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
246
+ timeout: typing.Optional[float] = 60,
247
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
248
+ ):
249
+ self._client_wrapper = AsyncClientWrapper(
250
+ base_url=_get_base_url(base_url=base_url, environment=environment),
251
+ httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
252
+ )
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)
411
+
412
+
413
+ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
414
+ if base_url is not None:
415
+ return base_url
416
+ elif environment is not None:
417
+ return environment.value
418
+ else:
419
+ raise Exception("Please pass in either base_url or environment to construct the client")
@@ -0,0 +1,33 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+
7
+
8
+ class BaseClientWrapper:
9
+ def __init__(self, *, base_url: str):
10
+ self._base_url = base_url
11
+
12
+ def get_headers(self) -> typing.Dict[str, str]:
13
+ headers: typing.Dict[str, str] = {
14
+ "X-Fern-Language": "Python",
15
+ "X-Fern-SDK-Name": "athena-intelligence",
16
+ "X-Fern-SDK-Version": "0.1.5",
17
+ }
18
+ return headers
19
+
20
+ def get_base_url(self) -> str:
21
+ return self._base_url
22
+
23
+
24
+ class SyncClientWrapper(BaseClientWrapper):
25
+ def __init__(self, *, base_url: str, httpx_client: httpx.Client):
26
+ super().__init__(base_url=base_url)
27
+ self.httpx_client = httpx_client
28
+
29
+
30
+ class AsyncClientWrapper(BaseClientWrapper):
31
+ def __init__(self, *, base_url: str, httpx_client: httpx.AsyncClient):
32
+ super().__init__(base_url=base_url)
33
+ self.httpx_client = httpx_client
@@ -4,4 +4,4 @@ import enum
4
4
 
5
5
 
6
6
  class AthenaEnvironment(enum.Enum):
7
- PRODUCTION = "https://app.athenaintelligence.ai"
7
+ DEFAULT = "https://api.athenaintelligence.ai"
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .unprocessable_entity_error import UnprocessableEntityError
4
+
5
+ __all__ = ["UnprocessableEntityError"]
@@ -0,0 +1,9 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.api_error import ApiError
4
+ from ..types.http_validation_error import HttpValidationError
5
+
6
+
7
+ class UnprocessableEntityError(ApiError):
8
+ def __init__(self, body: HttpValidationError):
9
+ super().__init__(status_code=422, body=body)
@@ -0,0 +1,19 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
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
8
+ from .validation_error import ValidationError
9
+ from .validation_error_loc_item import ValidationErrorLocItem
10
+
11
+ __all__ = [
12
+ "HttpValidationError",
13
+ "MessageOut",
14
+ "MessageOutDto",
15
+ "Model",
16
+ "Tools",
17
+ "ValidationError",
18
+ "ValidationErrorLocItem",
19
+ ]
@@ -0,0 +1,29 @@
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
+ from .validation_error import ValidationError
8
+
9
+ try:
10
+ import pydantic.v1 as pydantic # type: ignore
11
+ except ImportError:
12
+ import pydantic # type: ignore
13
+
14
+
15
+ class HttpValidationError(pydantic.BaseModel):
16
+ detail: typing.Optional[typing.List[ValidationError]] = None
17
+
18
+ def json(self, **kwargs: typing.Any) -> str:
19
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
20
+ return super().json(**kwargs_with_defaults)
21
+
22
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
23
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
24
+ return super().dict(**kwargs_with_defaults)
25
+
26
+ class Config:
27
+ frozen = True
28
+ smart_union = True
29
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -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}
@@ -3,7 +3,7 @@
3
3
  import datetime as dt
4
4
  import typing
5
5
 
6
- from ....core.datetime_utils import serialize_datetime
6
+ from ..core.datetime_utils import serialize_datetime
7
7
 
8
8
  try:
9
9
  import pydantic.v1 as pydantic # type: ignore
@@ -11,15 +11,13 @@ except ImportError:
11
11
  import pydantic # type: ignore
12
12
 
13
13
 
14
- class Message(pydantic.BaseModel):
15
- message_id: str
14
+ class MessageOutDto(pydantic.BaseModel):
15
+ id: str
16
16
  conversation_id: str
17
- sender: str
18
- content: str
17
+ logs: typing.Optional[str] = None
18
+ content: typing.Optional[str] = None
19
+ created_at: str
19
20
  status: str
20
- created_at: dt.datetime
21
- config: typing.Dict[str, typing.Any]
22
- final_output: str
23
21
 
24
22
  def json(self, **kwargs: typing.Any) -> str:
25
23
  kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
@@ -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()
@@ -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()
@@ -0,0 +1,31 @@
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
+ from .validation_error_loc_item import ValidationErrorLocItem
8
+
9
+ try:
10
+ import pydantic.v1 as pydantic # type: ignore
11
+ except ImportError:
12
+ import pydantic # type: ignore
13
+
14
+
15
+ class ValidationError(pydantic.BaseModel):
16
+ loc: typing.List[ValidationErrorLocItem]
17
+ msg: str
18
+ type: str
19
+
20
+ def json(self, **kwargs: typing.Any) -> str:
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
+ return super().json(**kwargs_with_defaults)
23
+
24
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
25
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
+ return super().dict(**kwargs_with_defaults)
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -1,5 +1,5 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from .types import Message
3
+ import typing
4
4
 
5
- __all__ = ["Message"]
5
+ ValidationErrorLocItem = typing.Union[str, int]
@@ -1,6 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from .resources import Message, message
4
- from .environment import AthenaEnvironment
5
-
6
- __all__ = ["AthenaEnvironment", "Message", "message"]
@@ -1,110 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import os
4
- import typing
5
-
6
- import httpx
7
-
8
- from .core.api_error import ApiError
9
- from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10
- from .environment import AthenaEnvironment
11
- from .resources.message.client import AsyncMessageClient, MessageClient
12
-
13
-
14
- class Athena:
15
- """
16
- Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
17
-
18
- Parameters:
19
- - base_url: typing.Optional[str]. The base url to use for requests from the client.
20
-
21
- - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
22
-
23
- Defaults to AthenaEnvironment.PRODUCTION
24
-
25
- - api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
26
-
27
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
28
-
29
- - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
30
- ---
31
- from athena.client import Athena
32
-
33
- client = Athena(
34
- api_key="YOUR_API_KEY",
35
- )
36
- """
37
-
38
- def __init__(
39
- self,
40
- *,
41
- base_url: typing.Optional[str] = None,
42
- environment: AthenaEnvironment = AthenaEnvironment.PRODUCTION,
43
- api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("ATHENA_API_KEY"),
44
- timeout: typing.Optional[float] = 60,
45
- httpx_client: typing.Optional[httpx.Client] = None
46
- ):
47
- if api_key is None:
48
- raise ApiError(
49
- body="The client must be instantiated be either passing in api_key or setting ATHENA_API_KEY"
50
- )
51
- self._client_wrapper = SyncClientWrapper(
52
- base_url=_get_base_url(base_url=base_url, environment=environment),
53
- api_key=api_key,
54
- httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
55
- )
56
- self.message = MessageClient(client_wrapper=self._client_wrapper)
57
-
58
-
59
- class AsyncAthena:
60
- """
61
- Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
62
-
63
- Parameters:
64
- - base_url: typing.Optional[str]. The base url to use for requests from the client.
65
-
66
- - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
67
-
68
- Defaults to AthenaEnvironment.PRODUCTION
69
-
70
- - api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
71
-
72
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
73
-
74
- - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
75
- ---
76
- from athena.client import AsyncAthena
77
-
78
- client = AsyncAthena(
79
- api_key="YOUR_API_KEY",
80
- )
81
- """
82
-
83
- def __init__(
84
- self,
85
- *,
86
- base_url: typing.Optional[str] = None,
87
- environment: AthenaEnvironment = AthenaEnvironment.PRODUCTION,
88
- api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("ATHENA_API_KEY"),
89
- timeout: typing.Optional[float] = 60,
90
- httpx_client: typing.Optional[httpx.AsyncClient] = None
91
- ):
92
- if api_key is None:
93
- raise ApiError(
94
- body="The client must be instantiated be either passing in api_key or setting ATHENA_API_KEY"
95
- )
96
- self._client_wrapper = AsyncClientWrapper(
97
- base_url=_get_base_url(base_url=base_url, environment=environment),
98
- api_key=api_key,
99
- httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
100
- )
101
- self.message = AsyncMessageClient(client_wrapper=self._client_wrapper)
102
-
103
-
104
- def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
105
- if base_url is not None:
106
- return base_url
107
- elif environment is not None:
108
- return environment.value
109
- else:
110
- raise Exception("Please pass in either base_url or environment to construct the client")
@@ -1,45 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- import httpx
6
-
7
-
8
- class BaseClientWrapper:
9
- def __init__(self, *, api_key: typing.Union[str, typing.Callable[[], str]], base_url: str):
10
- self._api_key = api_key
11
- self._base_url = base_url
12
-
13
- def get_headers(self) -> typing.Dict[str, str]:
14
- headers: typing.Dict[str, str] = {
15
- "X-Fern-Language": "Python",
16
- "X-Fern-SDK-Name": "athena-intelligence",
17
- "X-Fern-SDK-Version": "0.1.3",
18
- }
19
- headers["Authorization"] = f"Bearer {self._get_api_key()}"
20
- return headers
21
-
22
- def _get_api_key(self) -> str:
23
- if isinstance(self._api_key, str):
24
- return self._api_key
25
- else:
26
- return self._api_key()
27
-
28
- def get_base_url(self) -> str:
29
- return self._base_url
30
-
31
-
32
- class SyncClientWrapper(BaseClientWrapper):
33
- def __init__(
34
- self, *, api_key: typing.Union[str, typing.Callable[[], str]], base_url: str, httpx_client: httpx.Client
35
- ):
36
- super().__init__(api_key=api_key, base_url=base_url)
37
- self.httpx_client = httpx_client
38
-
39
-
40
- class AsyncClientWrapper(BaseClientWrapper):
41
- def __init__(
42
- self, *, api_key: typing.Union[str, typing.Callable[[], str]], base_url: str, httpx_client: httpx.AsyncClient
43
- ):
44
- super().__init__(api_key=api_key, base_url=base_url)
45
- self.httpx_client = httpx_client
@@ -1,6 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from . import message
4
- from .message import Message
5
-
6
- __all__ = ["Message", "message"]
@@ -1,292 +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 .types.message import Message
13
-
14
- try:
15
- import pydantic.v1 as pydantic # type: ignore
16
- except ImportError:
17
- import pydantic # type: ignore
18
-
19
- # this is used as the default value for optional parameters
20
- OMIT = typing.cast(typing.Any, ...)
21
-
22
-
23
- class MessageClient:
24
- def __init__(self, *, client_wrapper: SyncClientWrapper):
25
- self._client_wrapper = client_wrapper
26
-
27
- def get(
28
- self, message_id: typing.Optional[str], *, request_options: typing.Optional[RequestOptions] = None
29
- ) -> Message:
30
- """
31
- Get an Athena message by ID.
32
- Returns an Athena message final output.
33
-
34
- Parameters:
35
- - message_id: typing.Optional[str].
36
-
37
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
38
- """
39
- _response = self._client_wrapper.httpx_client.request(
40
- "GET",
41
- urllib.parse.urljoin(
42
- f"{self._client_wrapper.get_base_url()}/", f"api/agent/{jsonable_encoder(message_id)}"
43
- ),
44
- params=jsonable_encoder(
45
- request_options.get("additional_query_parameters") if request_options is not None else None
46
- ),
47
- headers=jsonable_encoder(
48
- remove_none_from_dict(
49
- {
50
- **self._client_wrapper.get_headers(),
51
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
52
- }
53
- )
54
- ),
55
- timeout=request_options.get("timeout_in_seconds")
56
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
57
- else 60,
58
- )
59
- if 200 <= _response.status_code < 300:
60
- return pydantic.parse_obj_as(Message, _response.json()) # type: ignore
61
- try:
62
- _response_json = _response.json()
63
- except JSONDecodeError:
64
- raise ApiError(status_code=_response.status_code, body=_response.text)
65
- raise ApiError(status_code=_response.status_code, body=_response_json)
66
-
67
- def send(
68
- self,
69
- *,
70
- content: str,
71
- conversation_id: typing.Optional[str] = OMIT,
72
- user_id: typing.Optional[str] = OMIT,
73
- workspace_id: typing.Optional[str] = OMIT,
74
- sdataset_ids: typing.Optional[typing.Sequence[str]] = OMIT,
75
- tools: typing.Optional[typing.Sequence[str]] = OMIT,
76
- model: typing.Optional[str] = OMIT,
77
- documents: typing.Optional[typing.Sequence[str]] = OMIT,
78
- config: typing.Dict[str, typing.Any],
79
- additional_context: typing.Optional[str] = OMIT,
80
- request_options: typing.Optional[RequestOptions] = None,
81
- ) -> Message:
82
- """
83
- Send a message to Athena.
84
- Returns an Athena message with ID, content and final output.
85
-
86
- Parameters:
87
- - content: str.
88
-
89
- - conversation_id: typing.Optional[str].
90
-
91
- - user_id: typing.Optional[str].
92
-
93
- - workspace_id: typing.Optional[str].
94
-
95
- - sdataset_ids: typing.Optional[typing.Sequence[str]].
96
-
97
- - tools: typing.Optional[typing.Sequence[str]].
98
-
99
- - model: typing.Optional[str].
100
-
101
- - documents: typing.Optional[typing.Sequence[str]].
102
-
103
- - config: typing.Dict[str, typing.Any].
104
-
105
- - additional_context: typing.Optional[str].
106
-
107
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
108
- """
109
- _request: typing.Dict[str, typing.Any] = {"content": content, "config": config}
110
- if conversation_id is not OMIT:
111
- _request["conversation_id"] = conversation_id
112
- if user_id is not OMIT:
113
- _request["user_id"] = user_id
114
- if workspace_id is not OMIT:
115
- _request["workspace_id"] = workspace_id
116
- if sdataset_ids is not OMIT:
117
- _request["sdataset_ids"] = sdataset_ids
118
- if tools is not OMIT:
119
- _request["tools"] = tools
120
- if model is not OMIT:
121
- _request["model"] = model
122
- if documents is not OMIT:
123
- _request["documents"] = documents
124
- if additional_context is not OMIT:
125
- _request["additional_context"] = additional_context
126
- _response = self._client_wrapper.httpx_client.request(
127
- "POST",
128
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/agent"),
129
- params=jsonable_encoder(
130
- request_options.get("additional_query_parameters") if request_options is not None else None
131
- ),
132
- json=jsonable_encoder(_request)
133
- if request_options is None or request_options.get("additional_body_parameters") is None
134
- else {
135
- **jsonable_encoder(_request),
136
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
137
- },
138
- headers=jsonable_encoder(
139
- remove_none_from_dict(
140
- {
141
- **self._client_wrapper.get_headers(),
142
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
143
- }
144
- )
145
- ),
146
- timeout=request_options.get("timeout_in_seconds")
147
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
148
- else 60,
149
- )
150
- if 200 <= _response.status_code < 300:
151
- return pydantic.parse_obj_as(Message, _response.json()) # type: ignore
152
- try:
153
- _response_json = _response.json()
154
- except JSONDecodeError:
155
- raise ApiError(status_code=_response.status_code, body=_response.text)
156
- raise ApiError(status_code=_response.status_code, body=_response_json)
157
-
158
-
159
- class AsyncMessageClient:
160
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
161
- self._client_wrapper = client_wrapper
162
-
163
- async def get(
164
- self, message_id: typing.Optional[str], *, request_options: typing.Optional[RequestOptions] = None
165
- ) -> Message:
166
- """
167
- Get an Athena message by ID.
168
- Returns an Athena message final output.
169
-
170
- Parameters:
171
- - message_id: typing.Optional[str].
172
-
173
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
174
- """
175
- _response = await self._client_wrapper.httpx_client.request(
176
- "GET",
177
- urllib.parse.urljoin(
178
- f"{self._client_wrapper.get_base_url()}/", f"api/agent/{jsonable_encoder(message_id)}"
179
- ),
180
- params=jsonable_encoder(
181
- request_options.get("additional_query_parameters") if request_options is not None else None
182
- ),
183
- headers=jsonable_encoder(
184
- remove_none_from_dict(
185
- {
186
- **self._client_wrapper.get_headers(),
187
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
188
- }
189
- )
190
- ),
191
- timeout=request_options.get("timeout_in_seconds")
192
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
193
- else 60,
194
- )
195
- if 200 <= _response.status_code < 300:
196
- return pydantic.parse_obj_as(Message, _response.json()) # type: ignore
197
- try:
198
- _response_json = _response.json()
199
- except JSONDecodeError:
200
- raise ApiError(status_code=_response.status_code, body=_response.text)
201
- raise ApiError(status_code=_response.status_code, body=_response_json)
202
-
203
- async def send(
204
- self,
205
- *,
206
- content: str,
207
- conversation_id: typing.Optional[str] = OMIT,
208
- user_id: typing.Optional[str] = OMIT,
209
- workspace_id: typing.Optional[str] = OMIT,
210
- sdataset_ids: typing.Optional[typing.Sequence[str]] = OMIT,
211
- tools: typing.Optional[typing.Sequence[str]] = OMIT,
212
- model: typing.Optional[str] = OMIT,
213
- documents: typing.Optional[typing.Sequence[str]] = OMIT,
214
- config: typing.Dict[str, typing.Any],
215
- additional_context: typing.Optional[str] = OMIT,
216
- request_options: typing.Optional[RequestOptions] = None,
217
- ) -> Message:
218
- """
219
- Send a message to Athena.
220
- Returns an Athena message with ID, content and final output.
221
-
222
- Parameters:
223
- - content: str.
224
-
225
- - conversation_id: typing.Optional[str].
226
-
227
- - user_id: typing.Optional[str].
228
-
229
- - workspace_id: typing.Optional[str].
230
-
231
- - sdataset_ids: typing.Optional[typing.Sequence[str]].
232
-
233
- - tools: typing.Optional[typing.Sequence[str]].
234
-
235
- - model: typing.Optional[str].
236
-
237
- - documents: typing.Optional[typing.Sequence[str]].
238
-
239
- - config: typing.Dict[str, typing.Any].
240
-
241
- - additional_context: typing.Optional[str].
242
-
243
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
244
- """
245
- _request: typing.Dict[str, typing.Any] = {"content": content, "config": config}
246
- if conversation_id is not OMIT:
247
- _request["conversation_id"] = conversation_id
248
- if user_id is not OMIT:
249
- _request["user_id"] = user_id
250
- if workspace_id is not OMIT:
251
- _request["workspace_id"] = workspace_id
252
- if sdataset_ids is not OMIT:
253
- _request["sdataset_ids"] = sdataset_ids
254
- if tools is not OMIT:
255
- _request["tools"] = tools
256
- if model is not OMIT:
257
- _request["model"] = model
258
- if documents is not OMIT:
259
- _request["documents"] = documents
260
- if additional_context is not OMIT:
261
- _request["additional_context"] = additional_context
262
- _response = await self._client_wrapper.httpx_client.request(
263
- "POST",
264
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/agent"),
265
- params=jsonable_encoder(
266
- request_options.get("additional_query_parameters") if request_options is not None else None
267
- ),
268
- json=jsonable_encoder(_request)
269
- if request_options is None or request_options.get("additional_body_parameters") is None
270
- else {
271
- **jsonable_encoder(_request),
272
- **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
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(Message, _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)
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from .message import Message
4
-
5
- __all__ = ["Message"]