llama-cloud 0.1.41__py3-none-any.whl → 0.1.42__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.
Potentially problematic release.
This version of llama-cloud might be problematic. Click here for more details.
- llama_cloud/__init__.py +6 -0
- llama_cloud/resources/alpha/client.py +14 -30
- llama_cloud/resources/beta/client.py +455 -24
- llama_cloud/resources/organizations/client.py +18 -4
- llama_cloud/resources/parsing/client.py +56 -0
- llama_cloud/resources/pipelines/client.py +164 -0
- llama_cloud/types/__init__.py +6 -0
- llama_cloud/types/agent_data.py +1 -1
- llama_cloud/types/agent_deployment_summary.py +1 -2
- llama_cloud/types/api_key.py +43 -0
- llama_cloud/types/api_key_query_response.py +38 -0
- llama_cloud/types/api_key_type.py +17 -0
- llama_cloud/types/legacy_parse_job_config.py +3 -0
- llama_cloud/types/llama_parse_parameters.py +7 -0
- llama_cloud/types/organization.py +1 -0
- llama_cloud/types/parse_job_config.py +7 -0
- llama_cloud/types/quota_configuration_configuration_type.py +4 -0
- {llama_cloud-0.1.41.dist-info → llama_cloud-0.1.42.dist-info}/METADATA +1 -1
- {llama_cloud-0.1.41.dist-info → llama_cloud-0.1.42.dist-info}/RECORD +21 -18
- {llama_cloud-0.1.41.dist-info → llama_cloud-0.1.42.dist-info}/LICENSE +0 -0
- {llama_cloud-0.1.41.dist-info → llama_cloud-0.1.42.dist-info}/WHEEL +0 -0
|
@@ -12,6 +12,9 @@ from ...core.jsonable_encoder import jsonable_encoder
|
|
|
12
12
|
from ...core.remove_none_from_dict import remove_none_from_dict
|
|
13
13
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
14
14
|
from ...types.agent_data import AgentData
|
|
15
|
+
from ...types.api_key import ApiKey
|
|
16
|
+
from ...types.api_key_query_response import ApiKeyQueryResponse
|
|
17
|
+
from ...types.api_key_type import ApiKeyType
|
|
15
18
|
from ...types.batch import Batch
|
|
16
19
|
from ...types.batch_paginated_list import BatchPaginatedList
|
|
17
20
|
from ...types.batch_public_output import BatchPublicOutput
|
|
@@ -46,6 +49,220 @@ class BetaClient:
|
|
|
46
49
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
47
50
|
self._client_wrapper = client_wrapper
|
|
48
51
|
|
|
52
|
+
def list_api_keys(
|
|
53
|
+
self,
|
|
54
|
+
*,
|
|
55
|
+
page_size: typing.Optional[int] = None,
|
|
56
|
+
page_token: typing.Optional[str] = None,
|
|
57
|
+
name: typing.Optional[str] = None,
|
|
58
|
+
project_id: typing.Optional[str] = None,
|
|
59
|
+
key_type: typing.Optional[ApiKeyType] = None,
|
|
60
|
+
) -> ApiKeyQueryResponse:
|
|
61
|
+
"""
|
|
62
|
+
List API keys.
|
|
63
|
+
|
|
64
|
+
If project_id is provided, validates user has access to that project.
|
|
65
|
+
If project_id is not provided, scopes results to the current user.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
user: Current user
|
|
69
|
+
db: Database session
|
|
70
|
+
page_size: Number of items per page
|
|
71
|
+
page_token: Token for pagination
|
|
72
|
+
name: Filter by API key name
|
|
73
|
+
project_id: Filter by project ID
|
|
74
|
+
key_type: Filter by key type
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
Paginated response with API keys
|
|
78
|
+
|
|
79
|
+
Parameters:
|
|
80
|
+
- page_size: typing.Optional[int].
|
|
81
|
+
|
|
82
|
+
- page_token: typing.Optional[str].
|
|
83
|
+
|
|
84
|
+
- name: typing.Optional[str].
|
|
85
|
+
|
|
86
|
+
- project_id: typing.Optional[str].
|
|
87
|
+
|
|
88
|
+
- key_type: typing.Optional[ApiKeyType].
|
|
89
|
+
---
|
|
90
|
+
from llama_cloud import ApiKeyType
|
|
91
|
+
from llama_cloud.client import LlamaCloud
|
|
92
|
+
|
|
93
|
+
client = LlamaCloud(
|
|
94
|
+
token="YOUR_TOKEN",
|
|
95
|
+
)
|
|
96
|
+
client.beta.list_api_keys(
|
|
97
|
+
key_type=ApiKeyType.USER,
|
|
98
|
+
)
|
|
99
|
+
"""
|
|
100
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
101
|
+
"GET",
|
|
102
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/beta/api-keys"),
|
|
103
|
+
params=remove_none_from_dict(
|
|
104
|
+
{
|
|
105
|
+
"page_size": page_size,
|
|
106
|
+
"page_token": page_token,
|
|
107
|
+
"name": name,
|
|
108
|
+
"project_id": project_id,
|
|
109
|
+
"key_type": key_type,
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
headers=self._client_wrapper.get_headers(),
|
|
113
|
+
timeout=60,
|
|
114
|
+
)
|
|
115
|
+
if 200 <= _response.status_code < 300:
|
|
116
|
+
return pydantic.parse_obj_as(ApiKeyQueryResponse, _response.json()) # type: ignore
|
|
117
|
+
if _response.status_code == 422:
|
|
118
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
119
|
+
try:
|
|
120
|
+
_response_json = _response.json()
|
|
121
|
+
except JSONDecodeError:
|
|
122
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
123
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
124
|
+
|
|
125
|
+
def create_api_key(
|
|
126
|
+
self,
|
|
127
|
+
*,
|
|
128
|
+
name: typing.Optional[str] = OMIT,
|
|
129
|
+
project_id: typing.Optional[str] = OMIT,
|
|
130
|
+
key_type: typing.Optional[ApiKeyType] = OMIT,
|
|
131
|
+
) -> ApiKey:
|
|
132
|
+
"""
|
|
133
|
+
Create a new API key.
|
|
134
|
+
|
|
135
|
+
If project_id is specified, validates user has admin permissions for that project.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
api_key_create: API key creation data
|
|
139
|
+
user: Current user
|
|
140
|
+
db: Database session
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
The created API key with the secret key visible in redacted_api_key field
|
|
144
|
+
|
|
145
|
+
Parameters:
|
|
146
|
+
- name: typing.Optional[str].
|
|
147
|
+
|
|
148
|
+
- project_id: typing.Optional[str].
|
|
149
|
+
|
|
150
|
+
- key_type: typing.Optional[ApiKeyType].
|
|
151
|
+
---
|
|
152
|
+
from llama_cloud import ApiKeyType
|
|
153
|
+
from llama_cloud.client import LlamaCloud
|
|
154
|
+
|
|
155
|
+
client = LlamaCloud(
|
|
156
|
+
token="YOUR_TOKEN",
|
|
157
|
+
)
|
|
158
|
+
client.beta.create_api_key(
|
|
159
|
+
key_type=ApiKeyType.USER,
|
|
160
|
+
)
|
|
161
|
+
"""
|
|
162
|
+
_request: typing.Dict[str, typing.Any] = {}
|
|
163
|
+
if name is not OMIT:
|
|
164
|
+
_request["name"] = name
|
|
165
|
+
if project_id is not OMIT:
|
|
166
|
+
_request["project_id"] = project_id
|
|
167
|
+
if key_type is not OMIT:
|
|
168
|
+
_request["key_type"] = key_type
|
|
169
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
170
|
+
"POST",
|
|
171
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/beta/api-keys"),
|
|
172
|
+
json=jsonable_encoder(_request),
|
|
173
|
+
headers=self._client_wrapper.get_headers(),
|
|
174
|
+
timeout=60,
|
|
175
|
+
)
|
|
176
|
+
if 200 <= _response.status_code < 300:
|
|
177
|
+
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
178
|
+
if _response.status_code == 422:
|
|
179
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
180
|
+
try:
|
|
181
|
+
_response_json = _response.json()
|
|
182
|
+
except JSONDecodeError:
|
|
183
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
184
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
185
|
+
|
|
186
|
+
def get_api_key(self, api_key_id: str) -> ApiKey:
|
|
187
|
+
"""
|
|
188
|
+
Get an API key by ID.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
api_key_id: The ID of the API key
|
|
192
|
+
user: Current user
|
|
193
|
+
db: Database session
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
The API key
|
|
197
|
+
|
|
198
|
+
Parameters:
|
|
199
|
+
- api_key_id: str.
|
|
200
|
+
---
|
|
201
|
+
from llama_cloud.client import LlamaCloud
|
|
202
|
+
|
|
203
|
+
client = LlamaCloud(
|
|
204
|
+
token="YOUR_TOKEN",
|
|
205
|
+
)
|
|
206
|
+
client.beta.get_api_key(
|
|
207
|
+
api_key_id="string",
|
|
208
|
+
)
|
|
209
|
+
"""
|
|
210
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
211
|
+
"GET",
|
|
212
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/beta/api-keys/{api_key_id}"),
|
|
213
|
+
headers=self._client_wrapper.get_headers(),
|
|
214
|
+
timeout=60,
|
|
215
|
+
)
|
|
216
|
+
if 200 <= _response.status_code < 300:
|
|
217
|
+
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
218
|
+
if _response.status_code == 422:
|
|
219
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
220
|
+
try:
|
|
221
|
+
_response_json = _response.json()
|
|
222
|
+
except JSONDecodeError:
|
|
223
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
224
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
225
|
+
|
|
226
|
+
def delete_api_key(self, api_key_id: str) -> None:
|
|
227
|
+
"""
|
|
228
|
+
Delete an API key.
|
|
229
|
+
|
|
230
|
+
If the API key belongs to a project, validates user has admin permissions for that project.
|
|
231
|
+
If the API key has no project, validates it belongs to the current user.
|
|
232
|
+
|
|
233
|
+
Args:
|
|
234
|
+
api_key_id: The ID of the API key to delete
|
|
235
|
+
user: Current user
|
|
236
|
+
db: Database session
|
|
237
|
+
|
|
238
|
+
Parameters:
|
|
239
|
+
- api_key_id: str.
|
|
240
|
+
---
|
|
241
|
+
from llama_cloud.client import LlamaCloud
|
|
242
|
+
|
|
243
|
+
client = LlamaCloud(
|
|
244
|
+
token="YOUR_TOKEN",
|
|
245
|
+
)
|
|
246
|
+
client.beta.delete_api_key(
|
|
247
|
+
api_key_id="string",
|
|
248
|
+
)
|
|
249
|
+
"""
|
|
250
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
251
|
+
"DELETE",
|
|
252
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/beta/api-keys/{api_key_id}"),
|
|
253
|
+
headers=self._client_wrapper.get_headers(),
|
|
254
|
+
timeout=60,
|
|
255
|
+
)
|
|
256
|
+
if 200 <= _response.status_code < 300:
|
|
257
|
+
return
|
|
258
|
+
if _response.status_code == 422:
|
|
259
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
260
|
+
try:
|
|
261
|
+
_response_json = _response.json()
|
|
262
|
+
except JSONDecodeError:
|
|
263
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
264
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
265
|
+
|
|
49
266
|
def list_batches(
|
|
50
267
|
self,
|
|
51
268
|
*,
|
|
@@ -350,7 +567,7 @@ class BetaClient:
|
|
|
350
567
|
*,
|
|
351
568
|
project_id: typing.Optional[str] = None,
|
|
352
569
|
organization_id: typing.Optional[str] = None,
|
|
353
|
-
|
|
570
|
+
deployment_name: str,
|
|
354
571
|
collection: typing.Optional[str] = OMIT,
|
|
355
572
|
data: typing.Dict[str, typing.Any],
|
|
356
573
|
) -> AgentData:
|
|
@@ -362,7 +579,7 @@ class BetaClient:
|
|
|
362
579
|
|
|
363
580
|
- organization_id: typing.Optional[str].
|
|
364
581
|
|
|
365
|
-
-
|
|
582
|
+
- deployment_name: str.
|
|
366
583
|
|
|
367
584
|
- collection: typing.Optional[str].
|
|
368
585
|
|
|
@@ -374,11 +591,11 @@ class BetaClient:
|
|
|
374
591
|
token="YOUR_TOKEN",
|
|
375
592
|
)
|
|
376
593
|
client.beta.create_agent_data(
|
|
377
|
-
|
|
594
|
+
deployment_name="string",
|
|
378
595
|
data={"string": {}},
|
|
379
596
|
)
|
|
380
597
|
"""
|
|
381
|
-
_request: typing.Dict[str, typing.Any] = {"
|
|
598
|
+
_request: typing.Dict[str, typing.Any] = {"deployment_name": deployment_name, "data": data}
|
|
382
599
|
if collection is not OMIT:
|
|
383
600
|
_request["collection"] = collection
|
|
384
601
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -408,7 +625,7 @@ class BetaClient:
|
|
|
408
625
|
page_token: typing.Optional[str] = OMIT,
|
|
409
626
|
filter: typing.Optional[typing.Dict[str, typing.Optional[FilterOperation]]] = OMIT,
|
|
410
627
|
order_by: typing.Optional[str] = OMIT,
|
|
411
|
-
|
|
628
|
+
deployment_name: str,
|
|
412
629
|
collection: typing.Optional[str] = OMIT,
|
|
413
630
|
include_total: typing.Optional[bool] = OMIT,
|
|
414
631
|
offset: typing.Optional[int] = OMIT,
|
|
@@ -429,7 +646,7 @@ class BetaClient:
|
|
|
429
646
|
|
|
430
647
|
- order_by: typing.Optional[str].
|
|
431
648
|
|
|
432
|
-
-
|
|
649
|
+
- deployment_name: str. The agent deployment's name to search within
|
|
433
650
|
|
|
434
651
|
- collection: typing.Optional[str]. The logical agent data collection to search within
|
|
435
652
|
|
|
@@ -443,10 +660,10 @@ class BetaClient:
|
|
|
443
660
|
token="YOUR_TOKEN",
|
|
444
661
|
)
|
|
445
662
|
client.beta.search_agent_data_api_v_1_beta_agent_data_search_post(
|
|
446
|
-
|
|
663
|
+
deployment_name="string",
|
|
447
664
|
)
|
|
448
665
|
"""
|
|
449
|
-
_request: typing.Dict[str, typing.Any] = {"
|
|
666
|
+
_request: typing.Dict[str, typing.Any] = {"deployment_name": deployment_name}
|
|
450
667
|
if page_size is not OMIT:
|
|
451
668
|
_request["page_size"] = page_size
|
|
452
669
|
if page_token is not OMIT:
|
|
@@ -488,7 +705,7 @@ class BetaClient:
|
|
|
488
705
|
page_token: typing.Optional[str] = OMIT,
|
|
489
706
|
filter: typing.Optional[typing.Dict[str, typing.Optional[FilterOperation]]] = OMIT,
|
|
490
707
|
order_by: typing.Optional[str] = OMIT,
|
|
491
|
-
|
|
708
|
+
deployment_name: str,
|
|
492
709
|
collection: typing.Optional[str] = OMIT,
|
|
493
710
|
group_by: typing.Optional[typing.List[str]] = OMIT,
|
|
494
711
|
count: typing.Optional[bool] = OMIT,
|
|
@@ -511,7 +728,7 @@ class BetaClient:
|
|
|
511
728
|
|
|
512
729
|
- order_by: typing.Optional[str].
|
|
513
730
|
|
|
514
|
-
-
|
|
731
|
+
- deployment_name: str. The agent deployment's name to aggregate data for
|
|
515
732
|
|
|
516
733
|
- collection: typing.Optional[str]. The logical agent data collection to aggregate data for
|
|
517
734
|
|
|
@@ -529,10 +746,10 @@ class BetaClient:
|
|
|
529
746
|
token="YOUR_TOKEN",
|
|
530
747
|
)
|
|
531
748
|
client.beta.aggregate_agent_data_api_v_1_beta_agent_data_aggregate_post(
|
|
532
|
-
|
|
749
|
+
deployment_name="string",
|
|
533
750
|
)
|
|
534
751
|
"""
|
|
535
|
-
_request: typing.Dict[str, typing.Any] = {"
|
|
752
|
+
_request: typing.Dict[str, typing.Any] = {"deployment_name": deployment_name}
|
|
536
753
|
if page_size is not OMIT:
|
|
537
754
|
_request["page_size"] = page_size
|
|
538
755
|
if page_token is not OMIT:
|
|
@@ -1357,6 +1574,220 @@ class AsyncBetaClient:
|
|
|
1357
1574
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1358
1575
|
self._client_wrapper = client_wrapper
|
|
1359
1576
|
|
|
1577
|
+
async def list_api_keys(
|
|
1578
|
+
self,
|
|
1579
|
+
*,
|
|
1580
|
+
page_size: typing.Optional[int] = None,
|
|
1581
|
+
page_token: typing.Optional[str] = None,
|
|
1582
|
+
name: typing.Optional[str] = None,
|
|
1583
|
+
project_id: typing.Optional[str] = None,
|
|
1584
|
+
key_type: typing.Optional[ApiKeyType] = None,
|
|
1585
|
+
) -> ApiKeyQueryResponse:
|
|
1586
|
+
"""
|
|
1587
|
+
List API keys.
|
|
1588
|
+
|
|
1589
|
+
If project_id is provided, validates user has access to that project.
|
|
1590
|
+
If project_id is not provided, scopes results to the current user.
|
|
1591
|
+
|
|
1592
|
+
Args:
|
|
1593
|
+
user: Current user
|
|
1594
|
+
db: Database session
|
|
1595
|
+
page_size: Number of items per page
|
|
1596
|
+
page_token: Token for pagination
|
|
1597
|
+
name: Filter by API key name
|
|
1598
|
+
project_id: Filter by project ID
|
|
1599
|
+
key_type: Filter by key type
|
|
1600
|
+
|
|
1601
|
+
Returns:
|
|
1602
|
+
Paginated response with API keys
|
|
1603
|
+
|
|
1604
|
+
Parameters:
|
|
1605
|
+
- page_size: typing.Optional[int].
|
|
1606
|
+
|
|
1607
|
+
- page_token: typing.Optional[str].
|
|
1608
|
+
|
|
1609
|
+
- name: typing.Optional[str].
|
|
1610
|
+
|
|
1611
|
+
- project_id: typing.Optional[str].
|
|
1612
|
+
|
|
1613
|
+
- key_type: typing.Optional[ApiKeyType].
|
|
1614
|
+
---
|
|
1615
|
+
from llama_cloud import ApiKeyType
|
|
1616
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1617
|
+
|
|
1618
|
+
client = AsyncLlamaCloud(
|
|
1619
|
+
token="YOUR_TOKEN",
|
|
1620
|
+
)
|
|
1621
|
+
await client.beta.list_api_keys(
|
|
1622
|
+
key_type=ApiKeyType.USER,
|
|
1623
|
+
)
|
|
1624
|
+
"""
|
|
1625
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1626
|
+
"GET",
|
|
1627
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/beta/api-keys"),
|
|
1628
|
+
params=remove_none_from_dict(
|
|
1629
|
+
{
|
|
1630
|
+
"page_size": page_size,
|
|
1631
|
+
"page_token": page_token,
|
|
1632
|
+
"name": name,
|
|
1633
|
+
"project_id": project_id,
|
|
1634
|
+
"key_type": key_type,
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1637
|
+
headers=self._client_wrapper.get_headers(),
|
|
1638
|
+
timeout=60,
|
|
1639
|
+
)
|
|
1640
|
+
if 200 <= _response.status_code < 300:
|
|
1641
|
+
return pydantic.parse_obj_as(ApiKeyQueryResponse, _response.json()) # type: ignore
|
|
1642
|
+
if _response.status_code == 422:
|
|
1643
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1644
|
+
try:
|
|
1645
|
+
_response_json = _response.json()
|
|
1646
|
+
except JSONDecodeError:
|
|
1647
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1648
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1649
|
+
|
|
1650
|
+
async def create_api_key(
|
|
1651
|
+
self,
|
|
1652
|
+
*,
|
|
1653
|
+
name: typing.Optional[str] = OMIT,
|
|
1654
|
+
project_id: typing.Optional[str] = OMIT,
|
|
1655
|
+
key_type: typing.Optional[ApiKeyType] = OMIT,
|
|
1656
|
+
) -> ApiKey:
|
|
1657
|
+
"""
|
|
1658
|
+
Create a new API key.
|
|
1659
|
+
|
|
1660
|
+
If project_id is specified, validates user has admin permissions for that project.
|
|
1661
|
+
|
|
1662
|
+
Args:
|
|
1663
|
+
api_key_create: API key creation data
|
|
1664
|
+
user: Current user
|
|
1665
|
+
db: Database session
|
|
1666
|
+
|
|
1667
|
+
Returns:
|
|
1668
|
+
The created API key with the secret key visible in redacted_api_key field
|
|
1669
|
+
|
|
1670
|
+
Parameters:
|
|
1671
|
+
- name: typing.Optional[str].
|
|
1672
|
+
|
|
1673
|
+
- project_id: typing.Optional[str].
|
|
1674
|
+
|
|
1675
|
+
- key_type: typing.Optional[ApiKeyType].
|
|
1676
|
+
---
|
|
1677
|
+
from llama_cloud import ApiKeyType
|
|
1678
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1679
|
+
|
|
1680
|
+
client = AsyncLlamaCloud(
|
|
1681
|
+
token="YOUR_TOKEN",
|
|
1682
|
+
)
|
|
1683
|
+
await client.beta.create_api_key(
|
|
1684
|
+
key_type=ApiKeyType.USER,
|
|
1685
|
+
)
|
|
1686
|
+
"""
|
|
1687
|
+
_request: typing.Dict[str, typing.Any] = {}
|
|
1688
|
+
if name is not OMIT:
|
|
1689
|
+
_request["name"] = name
|
|
1690
|
+
if project_id is not OMIT:
|
|
1691
|
+
_request["project_id"] = project_id
|
|
1692
|
+
if key_type is not OMIT:
|
|
1693
|
+
_request["key_type"] = key_type
|
|
1694
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1695
|
+
"POST",
|
|
1696
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/beta/api-keys"),
|
|
1697
|
+
json=jsonable_encoder(_request),
|
|
1698
|
+
headers=self._client_wrapper.get_headers(),
|
|
1699
|
+
timeout=60,
|
|
1700
|
+
)
|
|
1701
|
+
if 200 <= _response.status_code < 300:
|
|
1702
|
+
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
1703
|
+
if _response.status_code == 422:
|
|
1704
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1705
|
+
try:
|
|
1706
|
+
_response_json = _response.json()
|
|
1707
|
+
except JSONDecodeError:
|
|
1708
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1709
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1710
|
+
|
|
1711
|
+
async def get_api_key(self, api_key_id: str) -> ApiKey:
|
|
1712
|
+
"""
|
|
1713
|
+
Get an API key by ID.
|
|
1714
|
+
|
|
1715
|
+
Args:
|
|
1716
|
+
api_key_id: The ID of the API key
|
|
1717
|
+
user: Current user
|
|
1718
|
+
db: Database session
|
|
1719
|
+
|
|
1720
|
+
Returns:
|
|
1721
|
+
The API key
|
|
1722
|
+
|
|
1723
|
+
Parameters:
|
|
1724
|
+
- api_key_id: str.
|
|
1725
|
+
---
|
|
1726
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1727
|
+
|
|
1728
|
+
client = AsyncLlamaCloud(
|
|
1729
|
+
token="YOUR_TOKEN",
|
|
1730
|
+
)
|
|
1731
|
+
await client.beta.get_api_key(
|
|
1732
|
+
api_key_id="string",
|
|
1733
|
+
)
|
|
1734
|
+
"""
|
|
1735
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1736
|
+
"GET",
|
|
1737
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/beta/api-keys/{api_key_id}"),
|
|
1738
|
+
headers=self._client_wrapper.get_headers(),
|
|
1739
|
+
timeout=60,
|
|
1740
|
+
)
|
|
1741
|
+
if 200 <= _response.status_code < 300:
|
|
1742
|
+
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
1743
|
+
if _response.status_code == 422:
|
|
1744
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1745
|
+
try:
|
|
1746
|
+
_response_json = _response.json()
|
|
1747
|
+
except JSONDecodeError:
|
|
1748
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1749
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1750
|
+
|
|
1751
|
+
async def delete_api_key(self, api_key_id: str) -> None:
|
|
1752
|
+
"""
|
|
1753
|
+
Delete an API key.
|
|
1754
|
+
|
|
1755
|
+
If the API key belongs to a project, validates user has admin permissions for that project.
|
|
1756
|
+
If the API key has no project, validates it belongs to the current user.
|
|
1757
|
+
|
|
1758
|
+
Args:
|
|
1759
|
+
api_key_id: The ID of the API key to delete
|
|
1760
|
+
user: Current user
|
|
1761
|
+
db: Database session
|
|
1762
|
+
|
|
1763
|
+
Parameters:
|
|
1764
|
+
- api_key_id: str.
|
|
1765
|
+
---
|
|
1766
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1767
|
+
|
|
1768
|
+
client = AsyncLlamaCloud(
|
|
1769
|
+
token="YOUR_TOKEN",
|
|
1770
|
+
)
|
|
1771
|
+
await client.beta.delete_api_key(
|
|
1772
|
+
api_key_id="string",
|
|
1773
|
+
)
|
|
1774
|
+
"""
|
|
1775
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1776
|
+
"DELETE",
|
|
1777
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/beta/api-keys/{api_key_id}"),
|
|
1778
|
+
headers=self._client_wrapper.get_headers(),
|
|
1779
|
+
timeout=60,
|
|
1780
|
+
)
|
|
1781
|
+
if 200 <= _response.status_code < 300:
|
|
1782
|
+
return
|
|
1783
|
+
if _response.status_code == 422:
|
|
1784
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1785
|
+
try:
|
|
1786
|
+
_response_json = _response.json()
|
|
1787
|
+
except JSONDecodeError:
|
|
1788
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1789
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1790
|
+
|
|
1360
1791
|
async def list_batches(
|
|
1361
1792
|
self,
|
|
1362
1793
|
*,
|
|
@@ -1661,7 +2092,7 @@ class AsyncBetaClient:
|
|
|
1661
2092
|
*,
|
|
1662
2093
|
project_id: typing.Optional[str] = None,
|
|
1663
2094
|
organization_id: typing.Optional[str] = None,
|
|
1664
|
-
|
|
2095
|
+
deployment_name: str,
|
|
1665
2096
|
collection: typing.Optional[str] = OMIT,
|
|
1666
2097
|
data: typing.Dict[str, typing.Any],
|
|
1667
2098
|
) -> AgentData:
|
|
@@ -1673,7 +2104,7 @@ class AsyncBetaClient:
|
|
|
1673
2104
|
|
|
1674
2105
|
- organization_id: typing.Optional[str].
|
|
1675
2106
|
|
|
1676
|
-
-
|
|
2107
|
+
- deployment_name: str.
|
|
1677
2108
|
|
|
1678
2109
|
- collection: typing.Optional[str].
|
|
1679
2110
|
|
|
@@ -1685,11 +2116,11 @@ class AsyncBetaClient:
|
|
|
1685
2116
|
token="YOUR_TOKEN",
|
|
1686
2117
|
)
|
|
1687
2118
|
await client.beta.create_agent_data(
|
|
1688
|
-
|
|
2119
|
+
deployment_name="string",
|
|
1689
2120
|
data={"string": {}},
|
|
1690
2121
|
)
|
|
1691
2122
|
"""
|
|
1692
|
-
_request: typing.Dict[str, typing.Any] = {"
|
|
2123
|
+
_request: typing.Dict[str, typing.Any] = {"deployment_name": deployment_name, "data": data}
|
|
1693
2124
|
if collection is not OMIT:
|
|
1694
2125
|
_request["collection"] = collection
|
|
1695
2126
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -1719,7 +2150,7 @@ class AsyncBetaClient:
|
|
|
1719
2150
|
page_token: typing.Optional[str] = OMIT,
|
|
1720
2151
|
filter: typing.Optional[typing.Dict[str, typing.Optional[FilterOperation]]] = OMIT,
|
|
1721
2152
|
order_by: typing.Optional[str] = OMIT,
|
|
1722
|
-
|
|
2153
|
+
deployment_name: str,
|
|
1723
2154
|
collection: typing.Optional[str] = OMIT,
|
|
1724
2155
|
include_total: typing.Optional[bool] = OMIT,
|
|
1725
2156
|
offset: typing.Optional[int] = OMIT,
|
|
@@ -1740,7 +2171,7 @@ class AsyncBetaClient:
|
|
|
1740
2171
|
|
|
1741
2172
|
- order_by: typing.Optional[str].
|
|
1742
2173
|
|
|
1743
|
-
-
|
|
2174
|
+
- deployment_name: str. The agent deployment's name to search within
|
|
1744
2175
|
|
|
1745
2176
|
- collection: typing.Optional[str]. The logical agent data collection to search within
|
|
1746
2177
|
|
|
@@ -1754,10 +2185,10 @@ class AsyncBetaClient:
|
|
|
1754
2185
|
token="YOUR_TOKEN",
|
|
1755
2186
|
)
|
|
1756
2187
|
await client.beta.search_agent_data_api_v_1_beta_agent_data_search_post(
|
|
1757
|
-
|
|
2188
|
+
deployment_name="string",
|
|
1758
2189
|
)
|
|
1759
2190
|
"""
|
|
1760
|
-
_request: typing.Dict[str, typing.Any] = {"
|
|
2191
|
+
_request: typing.Dict[str, typing.Any] = {"deployment_name": deployment_name}
|
|
1761
2192
|
if page_size is not OMIT:
|
|
1762
2193
|
_request["page_size"] = page_size
|
|
1763
2194
|
if page_token is not OMIT:
|
|
@@ -1799,7 +2230,7 @@ class AsyncBetaClient:
|
|
|
1799
2230
|
page_token: typing.Optional[str] = OMIT,
|
|
1800
2231
|
filter: typing.Optional[typing.Dict[str, typing.Optional[FilterOperation]]] = OMIT,
|
|
1801
2232
|
order_by: typing.Optional[str] = OMIT,
|
|
1802
|
-
|
|
2233
|
+
deployment_name: str,
|
|
1803
2234
|
collection: typing.Optional[str] = OMIT,
|
|
1804
2235
|
group_by: typing.Optional[typing.List[str]] = OMIT,
|
|
1805
2236
|
count: typing.Optional[bool] = OMIT,
|
|
@@ -1822,7 +2253,7 @@ class AsyncBetaClient:
|
|
|
1822
2253
|
|
|
1823
2254
|
- order_by: typing.Optional[str].
|
|
1824
2255
|
|
|
1825
|
-
-
|
|
2256
|
+
- deployment_name: str. The agent deployment's name to aggregate data for
|
|
1826
2257
|
|
|
1827
2258
|
- collection: typing.Optional[str]. The logical agent data collection to aggregate data for
|
|
1828
2259
|
|
|
@@ -1840,10 +2271,10 @@ class AsyncBetaClient:
|
|
|
1840
2271
|
token="YOUR_TOKEN",
|
|
1841
2272
|
)
|
|
1842
2273
|
await client.beta.aggregate_agent_data_api_v_1_beta_agent_data_aggregate_post(
|
|
1843
|
-
|
|
2274
|
+
deployment_name="string",
|
|
1844
2275
|
)
|
|
1845
2276
|
"""
|
|
1846
|
-
_request: typing.Dict[str, typing.Any] = {"
|
|
2277
|
+
_request: typing.Dict[str, typing.Any] = {"deployment_name": deployment_name}
|
|
1847
2278
|
if page_size is not OMIT:
|
|
1848
2279
|
_request["page_size"] = page_size
|
|
1849
2280
|
if page_token is not OMIT:
|
|
@@ -229,7 +229,9 @@ class OrganizationsClient:
|
|
|
229
229
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
230
230
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
231
231
|
|
|
232
|
-
def update_organization(
|
|
232
|
+
def update_organization(
|
|
233
|
+
self, organization_id: str, *, name: str, feature_flags: typing.Optional[typing.Dict[str, typing.Any]] = OMIT
|
|
234
|
+
) -> Organization:
|
|
233
235
|
"""
|
|
234
236
|
Update an existing organization.
|
|
235
237
|
|
|
@@ -237,6 +239,8 @@ class OrganizationsClient:
|
|
|
237
239
|
- organization_id: str.
|
|
238
240
|
|
|
239
241
|
- name: str. A name for the organization.
|
|
242
|
+
|
|
243
|
+
- feature_flags: typing.Optional[typing.Dict[str, typing.Any]].
|
|
240
244
|
---
|
|
241
245
|
from llama_cloud.client import LlamaCloud
|
|
242
246
|
|
|
@@ -248,10 +252,13 @@ class OrganizationsClient:
|
|
|
248
252
|
name="string",
|
|
249
253
|
)
|
|
250
254
|
"""
|
|
255
|
+
_request: typing.Dict[str, typing.Any] = {"name": name}
|
|
256
|
+
if feature_flags is not OMIT:
|
|
257
|
+
_request["feature_flags"] = feature_flags
|
|
251
258
|
_response = self._client_wrapper.httpx_client.request(
|
|
252
259
|
"PUT",
|
|
253
260
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/organizations/{organization_id}"),
|
|
254
|
-
json=jsonable_encoder(
|
|
261
|
+
json=jsonable_encoder(_request),
|
|
255
262
|
headers=self._client_wrapper.get_headers(),
|
|
256
263
|
timeout=60,
|
|
257
264
|
)
|
|
@@ -937,7 +944,9 @@ class AsyncOrganizationsClient:
|
|
|
937
944
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
938
945
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
939
946
|
|
|
940
|
-
async def update_organization(
|
|
947
|
+
async def update_organization(
|
|
948
|
+
self, organization_id: str, *, name: str, feature_flags: typing.Optional[typing.Dict[str, typing.Any]] = OMIT
|
|
949
|
+
) -> Organization:
|
|
941
950
|
"""
|
|
942
951
|
Update an existing organization.
|
|
943
952
|
|
|
@@ -945,6 +954,8 @@ class AsyncOrganizationsClient:
|
|
|
945
954
|
- organization_id: str.
|
|
946
955
|
|
|
947
956
|
- name: str. A name for the organization.
|
|
957
|
+
|
|
958
|
+
- feature_flags: typing.Optional[typing.Dict[str, typing.Any]].
|
|
948
959
|
---
|
|
949
960
|
from llama_cloud.client import AsyncLlamaCloud
|
|
950
961
|
|
|
@@ -956,10 +967,13 @@ class AsyncOrganizationsClient:
|
|
|
956
967
|
name="string",
|
|
957
968
|
)
|
|
958
969
|
"""
|
|
970
|
+
_request: typing.Dict[str, typing.Any] = {"name": name}
|
|
971
|
+
if feature_flags is not OMIT:
|
|
972
|
+
_request["feature_flags"] = feature_flags
|
|
959
973
|
_response = await self._client_wrapper.httpx_client.request(
|
|
960
974
|
"PUT",
|
|
961
975
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/organizations/{organization_id}"),
|
|
962
|
-
json=jsonable_encoder(
|
|
976
|
+
json=jsonable_encoder(_request),
|
|
963
977
|
headers=self._client_wrapper.get_headers(),
|
|
964
978
|
timeout=60,
|
|
965
979
|
)
|