athena-intelligence 0.1.6__tar.gz → 0.1.8__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 (29) hide show
  1. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/__init__.py +2 -0
  4. athena_intelligence-0.1.8/src/athena/client.py +110 -0
  5. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/client_wrapper.py +7 -11
  6. athena_intelligence-0.1.8/src/athena/resources/__init__.py +5 -0
  7. athena_intelligence-0.1.8/src/athena/resources/message/__init__.py +2 -0
  8. {athena_intelligence-0.1.6/src/athena → athena_intelligence-0.1.8/src/athena/resources/message}/client.py +33 -207
  9. athena_intelligence-0.1.8/src/athena/types/model.py +29 -0
  10. athena_intelligence-0.1.6/src/athena/types/model.py +0 -29
  11. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/README.md +0 -0
  12. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/__init__.py +0 -0
  13. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/api_error.py +0 -0
  14. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/datetime_utils.py +0 -0
  15. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/file.py +0 -0
  16. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/jsonable_encoder.py +0 -0
  17. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/remove_none_from_dict.py +0 -0
  18. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/core/request_options.py +0 -0
  19. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/environment.py +0 -0
  20. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/errors/__init__.py +0 -0
  21. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/errors/unprocessable_entity_error.py +0 -0
  22. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/py.typed +0 -0
  23. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/types/__init__.py +0 -0
  24. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/types/http_validation_error.py +0 -0
  25. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/types/message_out.py +0 -0
  26. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/types/message_out_dto.py +0 -0
  27. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/types/tools.py +0 -0
  28. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/types/validation_error.py +0 -0
  29. {athena_intelligence-0.1.6 → athena_intelligence-0.1.8}/src/athena/types/validation_error_loc_item.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.6
3
+ Version: 0.1.8
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.6"
3
+ version = "0.1.8"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  authors = []
@@ -2,6 +2,7 @@
2
2
 
3
3
  from .types import HttpValidationError, MessageOut, MessageOutDto, Model, Tools, ValidationError, ValidationErrorLocItem
4
4
  from .errors import UnprocessableEntityError
5
+ from .resources import message
5
6
  from .environment import AthenaEnvironment
6
7
 
7
8
  __all__ = [
@@ -14,4 +15,5 @@ __all__ = [
14
15
  "UnprocessableEntityError",
15
16
  "ValidationError",
16
17
  "ValidationErrorLocItem",
18
+ "message",
17
19
  ]
@@ -0,0 +1,110 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+
7
+ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from .environment import AthenaEnvironment
9
+ from .resources.message.client import AsyncMessageClient, MessageClient
10
+
11
+
12
+ class Athena:
13
+ """
14
+ 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.
15
+
16
+ Parameters:
17
+ - base_url: typing.Optional[str]. The base url to use for requests from the client.
18
+
19
+ - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
20
+
21
+ Defaults to AthenaEnvironment.DEFAULT
22
+
23
+ - api_key: str.
24
+
25
+ - token: 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
+ token="YOUR_TOKEN",
36
+ )
37
+ """
38
+
39
+ def __init__(
40
+ self,
41
+ *,
42
+ base_url: typing.Optional[str] = None,
43
+ environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
44
+ api_key: str,
45
+ token: typing.Union[str, typing.Callable[[], str]],
46
+ timeout: typing.Optional[float] = 60,
47
+ httpx_client: typing.Optional[httpx.Client] = None
48
+ ):
49
+ self._client_wrapper = SyncClientWrapper(
50
+ base_url=_get_base_url(base_url=base_url, environment=environment),
51
+ api_key=api_key,
52
+ token=token,
53
+ httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
54
+ )
55
+ self.message = MessageClient(client_wrapper=self._client_wrapper)
56
+
57
+
58
+ class AsyncAthena:
59
+ """
60
+ 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.
61
+
62
+ Parameters:
63
+ - base_url: typing.Optional[str]. The base url to use for requests from the client.
64
+
65
+ - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
66
+
67
+ Defaults to AthenaEnvironment.DEFAULT
68
+
69
+ - api_key: str.
70
+
71
+ - token: typing.Union[str, typing.Callable[[], str]].
72
+
73
+ - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
74
+
75
+ - 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.
76
+ ---
77
+ from athena.client import AsyncAthena
78
+
79
+ client = AsyncAthena(
80
+ api_key="YOUR_API_KEY",
81
+ token="YOUR_TOKEN",
82
+ )
83
+ """
84
+
85
+ def __init__(
86
+ self,
87
+ *,
88
+ base_url: typing.Optional[str] = None,
89
+ environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
90
+ api_key: str,
91
+ token: typing.Union[str, typing.Callable[[], str]],
92
+ timeout: typing.Optional[float] = 60,
93
+ httpx_client: typing.Optional[httpx.AsyncClient] = None
94
+ ):
95
+ self._client_wrapper = AsyncClientWrapper(
96
+ base_url=_get_base_url(base_url=base_url, environment=environment),
97
+ api_key=api_key,
98
+ token=token,
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")
@@ -6,9 +6,7 @@ import httpx
6
6
 
7
7
 
8
8
  class BaseClientWrapper:
9
- def __init__(
10
- self, *, api_key: str, token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, base_url: str
11
- ):
9
+ def __init__(self, *, api_key: str, token: typing.Union[str, typing.Callable[[], str]], base_url: str):
12
10
  self._api_key = api_key
13
11
  self._token = token
14
12
  self._base_url = base_url
@@ -17,16 +15,14 @@ class BaseClientWrapper:
17
15
  headers: typing.Dict[str, str] = {
18
16
  "X-Fern-Language": "Python",
19
17
  "X-Fern-SDK-Name": "athena-intelligence",
20
- "X-Fern-SDK-Version": "0.1.6",
18
+ "X-Fern-SDK-Version": "0.1.8",
21
19
  }
22
20
  headers["X-API-KEY"] = self._api_key
23
- token = self._get_token()
24
- if token is not None:
25
- headers["Authorization"] = f"Bearer {token}"
21
+ headers["Authorization"] = f"Bearer {self._get_token()}"
26
22
  return headers
27
23
 
28
- def _get_token(self) -> typing.Optional[str]:
29
- if isinstance(self._token, str) or self._token is None:
24
+ def _get_token(self) -> str:
25
+ if isinstance(self._token, str):
30
26
  return self._token
31
27
  else:
32
28
  return self._token()
@@ -40,7 +36,7 @@ class SyncClientWrapper(BaseClientWrapper):
40
36
  self,
41
37
  *,
42
38
  api_key: str,
43
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
39
+ token: typing.Union[str, typing.Callable[[], str]],
44
40
  base_url: str,
45
41
  httpx_client: httpx.Client,
46
42
  ):
@@ -53,7 +49,7 @@ class AsyncClientWrapper(BaseClientWrapper):
53
49
  self,
54
50
  *,
55
51
  api_key: str,
56
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
52
+ token: typing.Union[str, typing.Callable[[], str]],
57
53
  base_url: str,
58
54
  httpx_client: httpx.AsyncClient,
59
55
  ):
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from . import message
4
+
5
+ __all__ = ["message"]
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -4,20 +4,17 @@ import typing
4
4
  import urllib.parse
5
5
  from json.decoder import JSONDecodeError
6
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
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
+ from ...types.message_out import MessageOut
15
+ from ...types.message_out_dto import MessageOutDto
16
+ from ...types.model import Model
17
+ from ...types.tools import Tools
21
18
 
22
19
  try:
23
20
  import pydantic.v1 as pydantic # type: ignore
@@ -28,51 +25,11 @@ except ImportError:
28
25
  OMIT = typing.cast(typing.Any, ...)
29
26
 
30
27
 
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
- - api_key: str.
43
-
44
- - token: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
45
-
46
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
47
-
48
- - 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.
49
- ---
50
- from athena.client import Athena
51
-
52
- client = Athena(
53
- api_key="YOUR_API_KEY",
54
- token="YOUR_TOKEN",
55
- )
56
- """
57
-
58
- def __init__(
59
- self,
60
- *,
61
- base_url: typing.Optional[str] = None,
62
- environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
63
- api_key: str,
64
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
65
- timeout: typing.Optional[float] = 60,
66
- httpx_client: typing.Optional[httpx.Client] = None,
67
- ):
68
- self._client_wrapper = SyncClientWrapper(
69
- base_url=_get_base_url(base_url=base_url, environment=environment),
70
- api_key=api_key,
71
- token=token,
72
- httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
73
- )
28
+ class MessageClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._client_wrapper = client_wrapper
74
31
 
75
- def post_message(
32
+ def submit(
76
33
  self,
77
34
  *,
78
35
  content: str,
@@ -96,14 +53,17 @@ class Athena:
96
53
 
97
54
  - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
98
55
  ---
56
+ from athena import Model, Tools
99
57
  from athena.client import Athena
100
58
 
101
59
  client = Athena(
102
60
  api_key="YOUR_API_KEY",
103
61
  token="YOUR_TOKEN",
104
62
  )
105
- client.post_message(
106
- content="content",
63
+ client.message.submit(
64
+ content="visit www.athenaintelligence.ai and summarize the website in one paragraph",
65
+ model=Model.GPT_4_TURBO_PREVIEW,
66
+ tools=[Tools.SEARCH, Tools.BROWSE, Tools.SEARCH],
107
67
  )
108
68
  """
109
69
  _request: typing.Dict[str, typing.Any] = {"content": content}
@@ -149,7 +109,7 @@ class Athena:
149
109
  raise ApiError(status_code=_response.status_code, body=_response.text)
150
110
  raise ApiError(status_code=_response.status_code, body=_response_json)
151
111
 
152
- def athena_get_message(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MessageOutDto:
112
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MessageOutDto:
153
113
  """
154
114
  Parameters:
155
115
  - id: str.
@@ -162,7 +122,7 @@ class Athena:
162
122
  api_key="YOUR_API_KEY",
163
123
  token="YOUR_TOKEN",
164
124
  )
165
- client.athena_get_message(
125
+ client.message.get(
166
126
  id="id",
167
127
  )
168
128
  """
@@ -194,95 +154,12 @@ class Athena:
194
154
  raise ApiError(status_code=_response.status_code, body=_response.text)
195
155
  raise ApiError(status_code=_response.status_code, body=_response_json)
196
156
 
197
- def health_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
198
- """
199
- Checks the health of a project.
200
-
201
- It returns 200 if the project is healthy.
202
-
203
- Parameters:
204
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
205
- ---
206
- from athena.client import Athena
207
-
208
- client = Athena(
209
- api_key="YOUR_API_KEY",
210
- token="YOUR_TOKEN",
211
- )
212
- client.health_check()
213
- """
214
- _response = self._client_wrapper.httpx_client.request(
215
- "GET",
216
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/health"),
217
- params=jsonable_encoder(
218
- request_options.get("additional_query_parameters") if request_options is not None else None
219
- ),
220
- headers=jsonable_encoder(
221
- remove_none_from_dict(
222
- {
223
- **self._client_wrapper.get_headers(),
224
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
225
- }
226
- )
227
- ),
228
- timeout=request_options.get("timeout_in_seconds")
229
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
230
- else 60,
231
- )
232
- if 200 <= _response.status_code < 300:
233
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
234
- try:
235
- _response_json = _response.json()
236
- except JSONDecodeError:
237
- raise ApiError(status_code=_response.status_code, body=_response.text)
238
- raise ApiError(status_code=_response.status_code, body=_response_json)
239
-
240
-
241
- class AsyncAthena:
242
- """
243
- 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.
244
157
 
245
- Parameters:
246
- - base_url: typing.Optional[str]. The base url to use for requests from the client.
158
+ class AsyncMessageClient:
159
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
160
+ self._client_wrapper = client_wrapper
247
161
 
248
- - environment: AthenaEnvironment. The environment to use for requests from the client. from .environment import AthenaEnvironment
249
-
250
- Defaults to AthenaEnvironment.DEFAULT
251
-
252
- - api_key: str.
253
-
254
- - token: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
255
-
256
- - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
257
-
258
- - 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.
259
- ---
260
- from athena.client import AsyncAthena
261
-
262
- client = AsyncAthena(
263
- api_key="YOUR_API_KEY",
264
- token="YOUR_TOKEN",
265
- )
266
- """
267
-
268
- def __init__(
269
- self,
270
- *,
271
- base_url: typing.Optional[str] = None,
272
- environment: AthenaEnvironment = AthenaEnvironment.DEFAULT,
273
- api_key: str,
274
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
275
- timeout: typing.Optional[float] = 60,
276
- httpx_client: typing.Optional[httpx.AsyncClient] = None,
277
- ):
278
- self._client_wrapper = AsyncClientWrapper(
279
- base_url=_get_base_url(base_url=base_url, environment=environment),
280
- api_key=api_key,
281
- token=token,
282
- httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
283
- )
284
-
285
- async def post_message(
162
+ async def submit(
286
163
  self,
287
164
  *,
288
165
  content: str,
@@ -306,14 +183,17 @@ class AsyncAthena:
306
183
 
307
184
  - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
308
185
  ---
186
+ from athena import Model, Tools
309
187
  from athena.client import AsyncAthena
310
188
 
311
189
  client = AsyncAthena(
312
190
  api_key="YOUR_API_KEY",
313
191
  token="YOUR_TOKEN",
314
192
  )
315
- await client.post_message(
316
- content="content",
193
+ await client.message.submit(
194
+ content="visit www.athenaintelligence.ai and summarize the website in one paragraph",
195
+ model=Model.GPT_4_TURBO_PREVIEW,
196
+ tools=[Tools.SEARCH, Tools.BROWSE, Tools.SEARCH],
317
197
  )
318
198
  """
319
199
  _request: typing.Dict[str, typing.Any] = {"content": content}
@@ -359,9 +239,7 @@ class AsyncAthena:
359
239
  raise ApiError(status_code=_response.status_code, body=_response.text)
360
240
  raise ApiError(status_code=_response.status_code, body=_response_json)
361
241
 
362
- async def athena_get_message(
363
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
364
- ) -> MessageOutDto:
242
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MessageOutDto:
365
243
  """
366
244
  Parameters:
367
245
  - id: str.
@@ -374,7 +252,7 @@ class AsyncAthena:
374
252
  api_key="YOUR_API_KEY",
375
253
  token="YOUR_TOKEN",
376
254
  )
377
- await client.athena_get_message(
255
+ await client.message.get(
378
256
  id="id",
379
257
  )
380
258
  """
@@ -405,55 +283,3 @@ class AsyncAthena:
405
283
  except JSONDecodeError:
406
284
  raise ApiError(status_code=_response.status_code, body=_response.text)
407
285
  raise ApiError(status_code=_response.status_code, body=_response_json)
408
-
409
- async def health_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
410
- """
411
- Checks the health of a project.
412
-
413
- It returns 200 if the project is healthy.
414
-
415
- Parameters:
416
- - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
417
- ---
418
- from athena.client import AsyncAthena
419
-
420
- client = AsyncAthena(
421
- api_key="YOUR_API_KEY",
422
- token="YOUR_TOKEN",
423
- )
424
- await client.health_check()
425
- """
426
- _response = await self._client_wrapper.httpx_client.request(
427
- "GET",
428
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/health"),
429
- params=jsonable_encoder(
430
- request_options.get("additional_query_parameters") if request_options is not None else None
431
- ),
432
- headers=jsonable_encoder(
433
- remove_none_from_dict(
434
- {
435
- **self._client_wrapper.get_headers(),
436
- **(request_options.get("additional_headers", {}) if request_options is not None else {}),
437
- }
438
- )
439
- ),
440
- timeout=request_options.get("timeout_in_seconds")
441
- if request_options is not None and request_options.get("timeout_in_seconds") is not None
442
- else 60,
443
- )
444
- if 200 <= _response.status_code < 300:
445
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
446
- try:
447
- _response_json = _response.json()
448
- except JSONDecodeError:
449
- raise ApiError(status_code=_response.status_code, body=_response.text)
450
- raise ApiError(status_code=_response.status_code, body=_response_json)
451
-
452
-
453
- def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AthenaEnvironment) -> str:
454
- if base_url is not None:
455
- return base_url
456
- elif environment is not None:
457
- return environment.value
458
- else:
459
- raise Exception("Please pass in either base_url or environment to construct the client")
@@ -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_35_TURBO = "gpt-3.5-turbo"
15
+ GPT_4_TURBO_PREVIEW = "gpt-4-turbo-preview"
16
+ MIXTRAL_SMALL_8_X_7_B_0211 = "mixtral-small-8x7b-0211"
17
+
18
+ def visit(
19
+ self,
20
+ gpt_35_turbo: typing.Callable[[], T_Result],
21
+ gpt_4_turbo_preview: typing.Callable[[], T_Result],
22
+ mixtral_small_8_x_7_b_0211: typing.Callable[[], T_Result],
23
+ ) -> T_Result:
24
+ if self is Model.GPT_35_TURBO:
25
+ return gpt_35_turbo()
26
+ if self is Model.GPT_4_TURBO_PREVIEW:
27
+ return gpt_4_turbo_preview()
28
+ if self is Model.MIXTRAL_SMALL_8_X_7_B_0211:
29
+ return mixtral_small_8_x_7_b_0211()
@@ -1,29 +0,0 @@
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()