c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python 0.1.0a6__py3-none-any.whl → 0.1.0a7__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.
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/METADATA +5 -5
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/RECORD +23 -16
- gradientai/_client.py +12 -0
- gradientai/_version.py +1 -1
- gradientai/resources/agents/__init__.py +14 -0
- gradientai/resources/agents/agents.py +32 -0
- gradientai/resources/agents/chat/__init__.py +33 -0
- gradientai/resources/agents/chat/chat.py +102 -0
- gradientai/resources/agents/chat/completions.py +385 -0
- gradientai/resources/models.py +105 -77
- gradientai/types/__init__.py +3 -2
- gradientai/types/agents/chat/__init__.py +6 -0
- gradientai/types/agents/chat/completion_create_params.py +185 -0
- gradientai/types/agents/chat/completion_create_response.py +81 -0
- gradientai/types/api_model.py +32 -0
- gradientai/types/chat/__init__.py +0 -1
- gradientai/types/chat/completion_create_response.py +1 -1
- gradientai/types/model_list_params.py +42 -0
- gradientai/types/model_list_response.py +8 -5
- gradientai/types/shared/__init__.py +1 -0
- gradientai/types/model.py +0 -21
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/WHEEL +0 -0
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/licenses/LICENSE +0 -0
- /gradientai/types/{chat → shared}/chat_completion_token_logprob.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.0a7
|
4
4
|
Summary: The official Python library for GradientAI
|
5
5
|
Project-URL: Homepage, https://github.com/digitalocean/gradientai-python
|
6
6
|
Project-URL: Repository, https://github.com/digitalocean/gradientai-python
|
@@ -65,7 +65,7 @@ client = GradientAI(
|
|
65
65
|
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
|
66
66
|
)
|
67
67
|
|
68
|
-
completion = client.chat.completions.create(
|
68
|
+
completion = client.agents.chat.completions.create(
|
69
69
|
messages=[
|
70
70
|
{
|
71
71
|
"content": "string",
|
@@ -97,7 +97,7 @@ client = AsyncGradientAI(
|
|
97
97
|
|
98
98
|
|
99
99
|
async def main() -> None:
|
100
|
-
completion = await client.chat.completions.create(
|
100
|
+
completion = await client.agents.chat.completions.create(
|
101
101
|
messages=[
|
102
102
|
{
|
103
103
|
"content": "string",
|
@@ -139,7 +139,7 @@ async def main() -> None:
|
|
139
139
|
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
|
140
140
|
http_client=DefaultAioHttpClient(),
|
141
141
|
) as client:
|
142
|
-
completion = await client.chat.completions.create(
|
142
|
+
completion = await client.agents.chat.completions.create(
|
143
143
|
messages=[
|
144
144
|
{
|
145
145
|
"content": "string",
|
@@ -172,7 +172,7 @@ from gradientai import GradientAI
|
|
172
172
|
|
173
173
|
client = GradientAI()
|
174
174
|
|
175
|
-
completion = client.chat.completions.create(
|
175
|
+
completion = client.agents.chat.completions.create(
|
176
176
|
messages=[
|
177
177
|
{
|
178
178
|
"content": "string",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
gradientai/__init__.py,sha256=yqy3yZnX0JVUS-H01MAvroChzqS67Qf072OrPfNckjI,2655
|
2
2
|
gradientai/_base_client.py,sha256=TADFnPHK7WpsNuJUY76SxMFf2IVoOdz_tlloQEXkutk,66719
|
3
|
-
gradientai/_client.py,sha256=
|
3
|
+
gradientai/_client.py,sha256=eKRTIA1SXYoAA28P6LyDc49IOxCB4hUI2YWrszXqXdY,27334
|
4
4
|
gradientai/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
5
5
|
gradientai/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
6
6
|
gradientai/_exceptions.py,sha256=o1GvaW36c7_LMj5WasVKUBOpae8tzETBJsfbVphb3Vk,3228
|
@@ -11,7 +11,7 @@ gradientai/_resource.py,sha256=4NZbH2h8dQ-t-DQPida4VANJ_oZJNA7qxV84mwJT8oM,1124
|
|
11
11
|
gradientai/_response.py,sha256=RhlDdupxTcKNyDDj045MZD3-a_lsEc3yjiOzxWg0cDc,28842
|
12
12
|
gradientai/_streaming.py,sha256=AWqY4cmmmTplZperXnkkMkeQ11gmpqYbt6TIXByqCv8,10116
|
13
13
|
gradientai/_types.py,sha256=22gBoIuoGJ1R6l5nPwquWCRzJodKhO-3e7k22-h37JQ,6201
|
14
|
-
gradientai/_version.py,sha256=
|
14
|
+
gradientai/_version.py,sha256=3OiJuEV2eKbtW9ToIU93cLhPFrPrdnFJrulaUojrGfE,170
|
15
15
|
gradientai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
gradientai/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
|
17
17
|
gradientai/_utils/_logs.py,sha256=1QuZcxzSKHcqNFbPoz_pvfLD5eDfOMBzGMyanAm_2gw,787
|
@@ -25,10 +25,10 @@ gradientai/_utils/_typing.py,sha256=D0DbbNu8GnYQTSICnTSHDGsYXj8TcAKyhejb0XcnjtY,
|
|
25
25
|
gradientai/_utils/_utils.py,sha256=ts4CiiuNpFiGB6YMdkQRh2SZvYvsl7mAF-JWHCcLDf4,12312
|
26
26
|
gradientai/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
27
27
|
gradientai/resources/__init__.py,sha256=Sej63-wOANl_4F78LH6m2Zx2Qu_-wGPHirIiq_20gwk,3488
|
28
|
-
gradientai/resources/models.py,sha256=
|
28
|
+
gradientai/resources/models.py,sha256=SKdBMKr6NP1ldD_xzbr-gUL8hdo33omUAz5UPAJ0KWQ,9434
|
29
29
|
gradientai/resources/regions.py,sha256=c4KX_qFTu83Svil1CO8CP4XdkEIfNQD3zwU_E6w734A,7172
|
30
|
-
gradientai/resources/agents/__init__.py,sha256=
|
31
|
-
gradientai/resources/agents/agents.py,sha256=
|
30
|
+
gradientai/resources/agents/__init__.py,sha256=2LkcBGQQJzBhZhVaeAy_IiqAPu28nV-d3_S-b__lTmk,5787
|
31
|
+
gradientai/resources/agents/agents.py,sha256=8hp-HMwlAH9VO-TBbTQMUpkkhRDFYzpc47VN9URJY_0,46177
|
32
32
|
gradientai/resources/agents/api_keys.py,sha256=1Uh77vhUD0WYUkvX0RD4VcLCOWFG6vL6Lz1EQRDx-t4,24632
|
33
33
|
gradientai/resources/agents/evaluation_datasets.py,sha256=mhs9lTIIZHfUFgN93jBdJYQZ0iGHQwN_EQlTFk2IiDU,12594
|
34
34
|
gradientai/resources/agents/evaluation_runs.py,sha256=LDaEWVWUjrPcLMqQ6TQldzoc1a1ydz2rzpAcP1KNpxI,19483
|
@@ -37,6 +37,9 @@ gradientai/resources/agents/functions.py,sha256=ZAOelsCnOl8lRuF5RpZDVGMN-E0yTG4V
|
|
37
37
|
gradientai/resources/agents/knowledge_bases.py,sha256=rFIrqsT7nXFJ_Sy4OWpUc8QmBGKSN_PhYpFpWvYHTfg,15191
|
38
38
|
gradientai/resources/agents/routes.py,sha256=pDoK5hUgluhz5awJ9FR_krF8DIbkRzLX__MTYYQa2bA,21957
|
39
39
|
gradientai/resources/agents/versions.py,sha256=hmHDaawFkpqoUEYI4Vi5jckH3mamkPKupXO3cZccyKE,11546
|
40
|
+
gradientai/resources/agents/chat/__init__.py,sha256=BVAfz9TM3DT5W9f_mt0P9YRxL_MsUxKCWAH6u1iogmA,1041
|
41
|
+
gradientai/resources/agents/chat/chat.py,sha256=nt97777qa-xM71JQBKDFG_x7fUDJRvy6rF5LoBiMOKE,3698
|
42
|
+
gradientai/resources/agents/chat/completions.py,sha256=bkaLCAXB9RkTg_D56XbnCIsJl_gKwwaoFhCDDDYT040,18230
|
40
43
|
gradientai/resources/agents/evaluation_metrics/__init__.py,sha256=qUCsT_vI2TrZrUBPe8h-VMNBE4ytcoe0RXshDctV0g0,1198
|
41
44
|
gradientai/resources/agents/evaluation_metrics/evaluation_metrics.py,sha256=BueqcWT0lqbElo-lgntkr1s7J0-qi2KqEZV2qzc7dcI,7089
|
42
45
|
gradientai/resources/agents/evaluation_metrics/workspaces/__init__.py,sha256=Zf3wa7WSVOKyG1x9Fppny38_ewQCbdghxbptqGFVfOM,1054
|
@@ -60,7 +63,7 @@ gradientai/resources/model_providers/anthropic/keys.py,sha256=WyRqOn51jfb3Iuu8ml
|
|
60
63
|
gradientai/resources/model_providers/openai/__init__.py,sha256=77LFIe5ko8imMJR7pkAn3E9r4rzw7j2fF9ZSpBaLZyo,976
|
61
64
|
gradientai/resources/model_providers/openai/keys.py,sha256=HAwxE3WVrBLPZnn799iHL9LRzMWTCdldZ5-PNeWhQrs,26388
|
62
65
|
gradientai/resources/model_providers/openai/openai.py,sha256=MfV9fB4EJVa6RYIfVS2QJW_BSkShLKCscDuxDV8wCBE,3567
|
63
|
-
gradientai/types/__init__.py,sha256=
|
66
|
+
gradientai/types/__init__.py,sha256=U5bsYUOgm6miO6k6D6oMl_dbFfzP5UsJT_L8QSyj7Bc,2918
|
64
67
|
gradientai/types/agent_create_params.py,sha256=nvLpM8V64762cwAn7ggyvbSzQ0mgjwOopOUZ_bVL1-I,912
|
65
68
|
gradientai/types/agent_create_response.py,sha256=frBMp76xLUzznVzWP70fb49drn3r3-2l4kX1xpQrNmg,332
|
66
69
|
gradientai/types/agent_delete_response.py,sha256=_1ciIOuRDvbeuaBvbCOpLV7QF6TufMX5MXNsBZv6H4s,332
|
@@ -78,6 +81,7 @@ gradientai/types/api_agreement.py,sha256=hMeoGBF2HySVHDm4dFTyamq19BexwhezL6Y1e_R
|
|
78
81
|
gradientai/types/api_anthropic_api_key_info.py,sha256=Ii_1zvwZselJjf9XwUGDFWq-fT7VlgC_l-cfXQfpc-s,489
|
79
82
|
gradientai/types/api_deployment_visibility.py,sha256=WT2fj4lgBorEOB9EirE50Xn0-J56a5v1zXuNpKCrzf0,340
|
80
83
|
gradientai/types/api_knowledge_base.py,sha256=LoZAFXubzOBaV3edIYCr8-N7cwwf4BEyzKudw1hQjZQ,839
|
84
|
+
gradientai/types/api_model.py,sha256=cTBrApG2za1_mR6Cca9vL254XczcxZM0lVMfXEqhFnE,718
|
81
85
|
gradientai/types/api_model_version.py,sha256=heTuejUUfP0GVFThpYEhwPqBc331hrMBGF_8Uq2qcME,313
|
82
86
|
gradientai/types/api_openai_api_key_info.py,sha256=_vfDX_fAIwHB1BXqNk7dUeA7meSU5GVTLbdDblSK5rY,582
|
83
87
|
gradientai/types/api_retrieval_method.py,sha256=hbD5272cHgAqDCwPv7tqIUlqNnDAOIjkwDUTciglitE,377
|
@@ -90,8 +94,8 @@ gradientai/types/knowledge_base_list_response.py,sha256=z8mUZAd328EEvs_3YnHZVcbT
|
|
90
94
|
gradientai/types/knowledge_base_retrieve_response.py,sha256=zwsKaL1KEfgFbglBriT4XorDz6PUwmvgkIrnD0mzWpI,758
|
91
95
|
gradientai/types/knowledge_base_update_params.py,sha256=8TRWSRY6c1tRTKPwBNkjwdw_1FbJ1Jmy7vX3covlj64,681
|
92
96
|
gradientai/types/knowledge_base_update_response.py,sha256=hNxnfwd-eyRIAuy7KxcQfG-dEK3TZITMYmAv7VH7AyE,342
|
93
|
-
gradientai/types/
|
94
|
-
gradientai/types/model_list_response.py,sha256=
|
97
|
+
gradientai/types/model_list_params.py,sha256=RGl48iwa2txemByFNe1EypUyE3CjPgsyr_bOu2mKesY,1335
|
98
|
+
gradientai/types/model_list_response.py,sha256=TK6-R0XAWZH2LPrgJMVsjaFO317n5TfdSeBXOAc5B1U,451
|
95
99
|
gradientai/types/region_list_params.py,sha256=_oeMCCqhoSpB4rb3BvQw97w-Zo6eblgye3iuIoTjMHs,418
|
96
100
|
gradientai/types/region_list_response.py,sha256=JyPfcqxMTafktlkuq5S2Vog77rMQ1RJ6_3cCa-gi0yA,515
|
97
101
|
gradientai/types/agents/__init__.py,sha256=h0Uk85a9xEa8HmelfaLVLHmB82wRmIZxj4eVXO4GR28,5117
|
@@ -146,6 +150,9 @@ gradientai/types/agents/version_list_params.py,sha256=0_3DhUbFDRyjUnn2G4saFOvuot
|
|
146
150
|
gradientai/types/agents/version_list_response.py,sha256=Y0Y8CSPUPVHKRA3zTRRfQ8gC2aFyBacSCaGz-D5k8nk,2725
|
147
151
|
gradientai/types/agents/version_update_params.py,sha256=j9tOda5wXmSOHsmcxQONo2mM-hEtrYi5-19HfGU_XnI,379
|
148
152
|
gradientai/types/agents/version_update_response.py,sha256=nspPIkxQskT82tcW0JyG7bBVlXq_KU6CZzodTd9jfkQ,709
|
153
|
+
gradientai/types/agents/chat/__init__.py,sha256=A5VCUPqJZydjjOqEXC01GXmcDkKM3bq6zuCu9lmi5Es,303
|
154
|
+
gradientai/types/agents/chat/completion_create_params.py,sha256=F4Dcrt5aYC_GEWUSN2OA3Zm5ImevZ7tFuTxBH7RyooM,6635
|
155
|
+
gradientai/types/agents/chat/completion_create_response.py,sha256=9uKS3memEoV0_Xd1CZwI0jQGsQyfVkhXRPGlRO3rUIc,2415
|
149
156
|
gradientai/types/agents/evaluation_metrics/__init__.py,sha256=XWH_utxMx-JwArRpr-rHQfmoxQRGK6GciKOllbkqg40,894
|
150
157
|
gradientai/types/agents/evaluation_metrics/workspace_create_params.py,sha256=LrccBST52BUMlIidiba8K_7vU9HLZW8TTQ2E227UF8Y,343
|
151
158
|
gradientai/types/agents/evaluation_metrics/workspace_create_response.py,sha256=jCVs2l3APGqA7gTetoepZS0Fkf7XJdK4e9pspgI3zpo,360
|
@@ -160,10 +167,9 @@ gradientai/types/agents/evaluation_metrics/workspaces/agent_list_params.py,sha25
|
|
160
167
|
gradientai/types/agents/evaluation_metrics/workspaces/agent_list_response.py,sha256=W4O5v1LoWh2hQJTpUm5SfQCYcv6Q9Yz1Id5Pm1sPQNA,503
|
161
168
|
gradientai/types/agents/evaluation_metrics/workspaces/agent_move_params.py,sha256=4INiLEvgT9UDqFbrGwp3nuWOzFhwv7sX_YCr1Um1RaQ,422
|
162
169
|
gradientai/types/agents/evaluation_metrics/workspaces/agent_move_response.py,sha256=j2uoTmFwnLNU7kGI5LZdPpMUxWmUk-HdQIVVDOwSy4Y,350
|
163
|
-
gradientai/types/chat/__init__.py,sha256=
|
164
|
-
gradientai/types/chat/chat_completion_token_logprob.py,sha256=6-ipUFfsXMf5L7FDFi127NaVkDtmEooVgGBF6Ts965A,1769
|
170
|
+
gradientai/types/chat/__init__.py,sha256=A5VCUPqJZydjjOqEXC01GXmcDkKM3bq6zuCu9lmi5Es,303
|
165
171
|
gradientai/types/chat/completion_create_params.py,sha256=F4Dcrt5aYC_GEWUSN2OA3Zm5ImevZ7tFuTxBH7RyooM,6635
|
166
|
-
gradientai/types/chat/completion_create_response.py,sha256=
|
172
|
+
gradientai/types/chat/completion_create_response.py,sha256=nNPWSXZYbyYLjT_ikVvDcjRw3f9eRGHFsUrLKtQHYGI,2413
|
167
173
|
gradientai/types/inference/__init__.py,sha256=4Dt7-03NeP9ehdHLkLsZMiL_YLQwZsl92D0mMoDQ5g0,857
|
168
174
|
gradientai/types/inference/api_key_create_params.py,sha256=MOy5Bdr1wNBqCvqzyZ0FLfFY2a97q6eXCzgCR1wcLAE,263
|
169
175
|
gradientai/types/inference/api_key_create_response.py,sha256=HjTGC3rpPKqYPE-D6Z9jIE8fqrmo2hTTGBrt00cMwIU,335
|
@@ -221,10 +227,11 @@ gradientai/types/model_providers/openai/key_retrieve_agents_response.py,sha256=I
|
|
221
227
|
gradientai/types/model_providers/openai/key_retrieve_response.py,sha256=96ZitCFjLlTzk8UhB2Q1ekmLYF2fer_9TGZ1kzhT2Ck,339
|
222
228
|
gradientai/types/model_providers/openai/key_update_params.py,sha256=Y3soYvQEpYbnofgxQoLdeZFolk-NcUSnlUg8BQ2BliU,398
|
223
229
|
gradientai/types/model_providers/openai/key_update_response.py,sha256=918Y7yxffOe0DmFci54fq0-zTO_1Lc6jruSok8WsBX4,335
|
224
|
-
gradientai/types/shared/__init__.py,sha256=
|
230
|
+
gradientai/types/shared/__init__.py,sha256=YA2_qLkZLySOac1HrqOfCTEz6GeipnjIJh1mK_QYwYU,272
|
225
231
|
gradientai/types/shared/api_links.py,sha256=Iq5iQwOkRYuwLcuDLk54dUfrq0f2ZVEOXSpF744gYgA,403
|
226
232
|
gradientai/types/shared/api_meta.py,sha256=-KyinzQqM5GSjD7E5xm7A4UALXAvLOyVNR1SYVOUFJM,297
|
227
|
-
|
228
|
-
c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.
|
229
|
-
c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.
|
230
|
-
c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.
|
233
|
+
gradientai/types/shared/chat_completion_token_logprob.py,sha256=6-ipUFfsXMf5L7FDFi127NaVkDtmEooVgGBF6Ts965A,1769
|
234
|
+
c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info/METADATA,sha256=g-NQEA3bos3YcRy4U0sil0jrvchjE0S8ufrQpio2jv4,15049
|
235
|
+
c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
236
|
+
c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info/licenses/LICENSE,sha256=AzxEF8mEks6hu5V_87CXF8gLdL875WeO8FmQtEZTFok,11341
|
237
|
+
c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info/RECORD,,
|
gradientai/_client.py
CHANGED
@@ -57,12 +57,14 @@ class GradientAI(SyncAPIClient):
|
|
57
57
|
# client options
|
58
58
|
api_key: str | None
|
59
59
|
inference_key: str | None
|
60
|
+
agent_domain: str | None
|
60
61
|
|
61
62
|
def __init__(
|
62
63
|
self,
|
63
64
|
*,
|
64
65
|
api_key: str | None = None,
|
65
66
|
inference_key: str | None = None,
|
67
|
+
agent_domain: str | None = None,
|
66
68
|
base_url: str | httpx.URL | None = None,
|
67
69
|
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
68
70
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
@@ -96,6 +98,8 @@ class GradientAI(SyncAPIClient):
|
|
96
98
|
inference_key = os.environ.get("GRADIENTAI_INFERENCE_KEY")
|
97
99
|
self.inference_key = inference_key
|
98
100
|
|
101
|
+
self.agent_domain = agent_domain
|
102
|
+
|
99
103
|
if base_url is None:
|
100
104
|
base_url = os.environ.get("GRADIENT_AI_BASE_URL")
|
101
105
|
self._base_url_overridden = base_url is not None
|
@@ -201,6 +205,7 @@ class GradientAI(SyncAPIClient):
|
|
201
205
|
*,
|
202
206
|
api_key: str | None = None,
|
203
207
|
inference_key: str | None = None,
|
208
|
+
agent_domain: str | None = None,
|
204
209
|
base_url: str | httpx.URL | None = None,
|
205
210
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
206
211
|
http_client: httpx.Client | None = None,
|
@@ -236,6 +241,7 @@ class GradientAI(SyncAPIClient):
|
|
236
241
|
client = self.__class__(
|
237
242
|
api_key=api_key or self.api_key,
|
238
243
|
inference_key=inference_key or self.inference_key,
|
244
|
+
agent_domain=agent_domain or self.agent_domain,
|
239
245
|
base_url=base_url or self.base_url,
|
240
246
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
241
247
|
http_client=http_client,
|
@@ -289,12 +295,14 @@ class AsyncGradientAI(AsyncAPIClient):
|
|
289
295
|
# client options
|
290
296
|
api_key: str | None
|
291
297
|
inference_key: str | None
|
298
|
+
agent_domain: str | None
|
292
299
|
|
293
300
|
def __init__(
|
294
301
|
self,
|
295
302
|
*,
|
296
303
|
api_key: str | None = None,
|
297
304
|
inference_key: str | None = None,
|
305
|
+
agent_domain: str | None = None,
|
298
306
|
base_url: str | httpx.URL | None = None,
|
299
307
|
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
|
300
308
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
@@ -328,6 +336,8 @@ class AsyncGradientAI(AsyncAPIClient):
|
|
328
336
|
inference_key = os.environ.get("GRADIENTAI_INFERENCE_KEY")
|
329
337
|
self.inference_key = inference_key
|
330
338
|
|
339
|
+
self.agent_domain = agent_domain
|
340
|
+
|
331
341
|
if base_url is None:
|
332
342
|
base_url = os.environ.get("GRADIENT_AI_BASE_URL")
|
333
343
|
self._base_url_overridden = base_url is not None
|
@@ -433,6 +443,7 @@ class AsyncGradientAI(AsyncAPIClient):
|
|
433
443
|
*,
|
434
444
|
api_key: str | None = None,
|
435
445
|
inference_key: str | None = None,
|
446
|
+
agent_domain: str | None = None,
|
436
447
|
base_url: str | httpx.URL | None = None,
|
437
448
|
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
|
438
449
|
http_client: httpx.AsyncClient | None = None,
|
@@ -468,6 +479,7 @@ class AsyncGradientAI(AsyncAPIClient):
|
|
468
479
|
client = self.__class__(
|
469
480
|
api_key=api_key or self.api_key,
|
470
481
|
inference_key=inference_key or self.inference_key,
|
482
|
+
agent_domain=agent_domain or self.agent_domain,
|
471
483
|
base_url=base_url or self.base_url,
|
472
484
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
473
485
|
http_client=http_client,
|
gradientai/_version.py
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
+
from .chat import (
|
4
|
+
ChatResource,
|
5
|
+
AsyncChatResource,
|
6
|
+
ChatResourceWithRawResponse,
|
7
|
+
AsyncChatResourceWithRawResponse,
|
8
|
+
ChatResourceWithStreamingResponse,
|
9
|
+
AsyncChatResourceWithStreamingResponse,
|
10
|
+
)
|
3
11
|
from .agents import (
|
4
12
|
AgentsResource,
|
5
13
|
AsyncAgentsResource,
|
@@ -88,6 +96,12 @@ __all__ = [
|
|
88
96
|
"AsyncAPIKeysResourceWithRawResponse",
|
89
97
|
"APIKeysResourceWithStreamingResponse",
|
90
98
|
"AsyncAPIKeysResourceWithStreamingResponse",
|
99
|
+
"ChatResource",
|
100
|
+
"AsyncChatResource",
|
101
|
+
"ChatResourceWithRawResponse",
|
102
|
+
"AsyncChatResourceWithRawResponse",
|
103
|
+
"ChatResourceWithStreamingResponse",
|
104
|
+
"AsyncChatResourceWithStreamingResponse",
|
91
105
|
"EvaluationMetricsResource",
|
92
106
|
"AsyncEvaluationMetricsResource",
|
93
107
|
"EvaluationMetricsResourceWithRawResponse",
|
@@ -41,6 +41,14 @@ from .versions import (
|
|
41
41
|
AsyncVersionsResourceWithStreamingResponse,
|
42
42
|
)
|
43
43
|
from ..._compat import cached_property
|
44
|
+
from .chat.chat import (
|
45
|
+
ChatResource,
|
46
|
+
AsyncChatResource,
|
47
|
+
ChatResourceWithRawResponse,
|
48
|
+
AsyncChatResourceWithRawResponse,
|
49
|
+
ChatResourceWithStreamingResponse,
|
50
|
+
AsyncChatResourceWithStreamingResponse,
|
51
|
+
)
|
44
52
|
from .functions import (
|
45
53
|
FunctionsResource,
|
46
54
|
AsyncFunctionsResource,
|
@@ -114,6 +122,10 @@ class AgentsResource(SyncAPIResource):
|
|
114
122
|
def api_keys(self) -> APIKeysResource:
|
115
123
|
return APIKeysResource(self._client)
|
116
124
|
|
125
|
+
@cached_property
|
126
|
+
def chat(self) -> ChatResource:
|
127
|
+
return ChatResource(self._client)
|
128
|
+
|
117
129
|
@cached_property
|
118
130
|
def evaluation_metrics(self) -> EvaluationMetricsResource:
|
119
131
|
return EvaluationMetricsResource(self._client)
|
@@ -498,6 +510,10 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
498
510
|
def api_keys(self) -> AsyncAPIKeysResource:
|
499
511
|
return AsyncAPIKeysResource(self._client)
|
500
512
|
|
513
|
+
@cached_property
|
514
|
+
def chat(self) -> AsyncChatResource:
|
515
|
+
return AsyncChatResource(self._client)
|
516
|
+
|
501
517
|
@cached_property
|
502
518
|
def evaluation_metrics(self) -> AsyncEvaluationMetricsResource:
|
503
519
|
return AsyncEvaluationMetricsResource(self._client)
|
@@ -904,6 +920,10 @@ class AgentsResourceWithRawResponse:
|
|
904
920
|
def api_keys(self) -> APIKeysResourceWithRawResponse:
|
905
921
|
return APIKeysResourceWithRawResponse(self._agents.api_keys)
|
906
922
|
|
923
|
+
@cached_property
|
924
|
+
def chat(self) -> ChatResourceWithRawResponse:
|
925
|
+
return ChatResourceWithRawResponse(self._agents.chat)
|
926
|
+
|
907
927
|
@cached_property
|
908
928
|
def evaluation_metrics(self) -> EvaluationMetricsResourceWithRawResponse:
|
909
929
|
return EvaluationMetricsResourceWithRawResponse(self._agents.evaluation_metrics)
|
@@ -964,6 +984,10 @@ class AsyncAgentsResourceWithRawResponse:
|
|
964
984
|
def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse:
|
965
985
|
return AsyncAPIKeysResourceWithRawResponse(self._agents.api_keys)
|
966
986
|
|
987
|
+
@cached_property
|
988
|
+
def chat(self) -> AsyncChatResourceWithRawResponse:
|
989
|
+
return AsyncChatResourceWithRawResponse(self._agents.chat)
|
990
|
+
|
967
991
|
@cached_property
|
968
992
|
def evaluation_metrics(self) -> AsyncEvaluationMetricsResourceWithRawResponse:
|
969
993
|
return AsyncEvaluationMetricsResourceWithRawResponse(self._agents.evaluation_metrics)
|
@@ -1024,6 +1048,10 @@ class AgentsResourceWithStreamingResponse:
|
|
1024
1048
|
def api_keys(self) -> APIKeysResourceWithStreamingResponse:
|
1025
1049
|
return APIKeysResourceWithStreamingResponse(self._agents.api_keys)
|
1026
1050
|
|
1051
|
+
@cached_property
|
1052
|
+
def chat(self) -> ChatResourceWithStreamingResponse:
|
1053
|
+
return ChatResourceWithStreamingResponse(self._agents.chat)
|
1054
|
+
|
1027
1055
|
@cached_property
|
1028
1056
|
def evaluation_metrics(self) -> EvaluationMetricsResourceWithStreamingResponse:
|
1029
1057
|
return EvaluationMetricsResourceWithStreamingResponse(self._agents.evaluation_metrics)
|
@@ -1084,6 +1112,10 @@ class AsyncAgentsResourceWithStreamingResponse:
|
|
1084
1112
|
def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse:
|
1085
1113
|
return AsyncAPIKeysResourceWithStreamingResponse(self._agents.api_keys)
|
1086
1114
|
|
1115
|
+
@cached_property
|
1116
|
+
def chat(self) -> AsyncChatResourceWithStreamingResponse:
|
1117
|
+
return AsyncChatResourceWithStreamingResponse(self._agents.chat)
|
1118
|
+
|
1087
1119
|
@cached_property
|
1088
1120
|
def evaluation_metrics(self) -> AsyncEvaluationMetricsResourceWithStreamingResponse:
|
1089
1121
|
return AsyncEvaluationMetricsResourceWithStreamingResponse(self._agents.evaluation_metrics)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from .chat import (
|
4
|
+
ChatResource,
|
5
|
+
AsyncChatResource,
|
6
|
+
ChatResourceWithRawResponse,
|
7
|
+
AsyncChatResourceWithRawResponse,
|
8
|
+
ChatResourceWithStreamingResponse,
|
9
|
+
AsyncChatResourceWithStreamingResponse,
|
10
|
+
)
|
11
|
+
from .completions import (
|
12
|
+
CompletionsResource,
|
13
|
+
AsyncCompletionsResource,
|
14
|
+
CompletionsResourceWithRawResponse,
|
15
|
+
AsyncCompletionsResourceWithRawResponse,
|
16
|
+
CompletionsResourceWithStreamingResponse,
|
17
|
+
AsyncCompletionsResourceWithStreamingResponse,
|
18
|
+
)
|
19
|
+
|
20
|
+
__all__ = [
|
21
|
+
"CompletionsResource",
|
22
|
+
"AsyncCompletionsResource",
|
23
|
+
"CompletionsResourceWithRawResponse",
|
24
|
+
"AsyncCompletionsResourceWithRawResponse",
|
25
|
+
"CompletionsResourceWithStreamingResponse",
|
26
|
+
"AsyncCompletionsResourceWithStreamingResponse",
|
27
|
+
"ChatResource",
|
28
|
+
"AsyncChatResource",
|
29
|
+
"ChatResourceWithRawResponse",
|
30
|
+
"AsyncChatResourceWithRawResponse",
|
31
|
+
"ChatResourceWithStreamingResponse",
|
32
|
+
"AsyncChatResourceWithStreamingResponse",
|
33
|
+
]
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from ...._compat import cached_property
|
6
|
+
from .completions import (
|
7
|
+
CompletionsResource,
|
8
|
+
AsyncCompletionsResource,
|
9
|
+
CompletionsResourceWithRawResponse,
|
10
|
+
AsyncCompletionsResourceWithRawResponse,
|
11
|
+
CompletionsResourceWithStreamingResponse,
|
12
|
+
AsyncCompletionsResourceWithStreamingResponse,
|
13
|
+
)
|
14
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
15
|
+
|
16
|
+
__all__ = ["ChatResource", "AsyncChatResource"]
|
17
|
+
|
18
|
+
|
19
|
+
class ChatResource(SyncAPIResource):
|
20
|
+
@cached_property
|
21
|
+
def completions(self) -> CompletionsResource:
|
22
|
+
return CompletionsResource(self._client)
|
23
|
+
|
24
|
+
@cached_property
|
25
|
+
def with_raw_response(self) -> ChatResourceWithRawResponse:
|
26
|
+
"""
|
27
|
+
This property can be used as a prefix for any HTTP method call to return
|
28
|
+
the raw response object instead of the parsed content.
|
29
|
+
|
30
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers
|
31
|
+
"""
|
32
|
+
return ChatResourceWithRawResponse(self)
|
33
|
+
|
34
|
+
@cached_property
|
35
|
+
def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
|
36
|
+
"""
|
37
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
38
|
+
|
39
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response
|
40
|
+
"""
|
41
|
+
return ChatResourceWithStreamingResponse(self)
|
42
|
+
|
43
|
+
|
44
|
+
class AsyncChatResource(AsyncAPIResource):
|
45
|
+
@cached_property
|
46
|
+
def completions(self) -> AsyncCompletionsResource:
|
47
|
+
return AsyncCompletionsResource(self._client)
|
48
|
+
|
49
|
+
@cached_property
|
50
|
+
def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
|
51
|
+
"""
|
52
|
+
This property can be used as a prefix for any HTTP method call to return
|
53
|
+
the raw response object instead of the parsed content.
|
54
|
+
|
55
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers
|
56
|
+
"""
|
57
|
+
return AsyncChatResourceWithRawResponse(self)
|
58
|
+
|
59
|
+
@cached_property
|
60
|
+
def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
|
61
|
+
"""
|
62
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
63
|
+
|
64
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response
|
65
|
+
"""
|
66
|
+
return AsyncChatResourceWithStreamingResponse(self)
|
67
|
+
|
68
|
+
|
69
|
+
class ChatResourceWithRawResponse:
|
70
|
+
def __init__(self, chat: ChatResource) -> None:
|
71
|
+
self._chat = chat
|
72
|
+
|
73
|
+
@cached_property
|
74
|
+
def completions(self) -> CompletionsResourceWithRawResponse:
|
75
|
+
return CompletionsResourceWithRawResponse(self._chat.completions)
|
76
|
+
|
77
|
+
|
78
|
+
class AsyncChatResourceWithRawResponse:
|
79
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
80
|
+
self._chat = chat
|
81
|
+
|
82
|
+
@cached_property
|
83
|
+
def completions(self) -> AsyncCompletionsResourceWithRawResponse:
|
84
|
+
return AsyncCompletionsResourceWithRawResponse(self._chat.completions)
|
85
|
+
|
86
|
+
|
87
|
+
class ChatResourceWithStreamingResponse:
|
88
|
+
def __init__(self, chat: ChatResource) -> None:
|
89
|
+
self._chat = chat
|
90
|
+
|
91
|
+
@cached_property
|
92
|
+
def completions(self) -> CompletionsResourceWithStreamingResponse:
|
93
|
+
return CompletionsResourceWithStreamingResponse(self._chat.completions)
|
94
|
+
|
95
|
+
|
96
|
+
class AsyncChatResourceWithStreamingResponse:
|
97
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
98
|
+
self._chat = chat
|
99
|
+
|
100
|
+
@cached_property
|
101
|
+
def completions(self) -> AsyncCompletionsResourceWithStreamingResponse:
|
102
|
+
return AsyncCompletionsResourceWithStreamingResponse(self._chat.completions)
|