llama-cloud 0.0.4__py3-none-any.whl → 0.0.6__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 +4 -10
- llama_cloud/client.py +0 -9
- llama_cloud/resources/__init__.py +1 -16
- llama_cloud/resources/pipelines/client.py +98 -22
- llama_cloud/types/__init__.py +4 -4
- llama_cloud/types/{api_key.py → llama_parse_parameters.py} +15 -8
- llama_cloud/types/{pipeline_file_status_response.py → managed_ingestion_status_response.py} +2 -8
- llama_cloud/types/pipeline.py +4 -0
- llama_cloud/types/pipeline_create.py +4 -0
- llama_cloud/types/project.py +0 -2
- {llama_cloud-0.0.4.dist-info → llama_cloud-0.0.6.dist-info}/METADATA +1 -1
- {llama_cloud-0.0.4.dist-info → llama_cloud-0.0.6.dist-info}/RECORD +14 -20
- {llama_cloud-0.0.4.dist-info → llama_cloud-0.0.6.dist-info}/WHEEL +1 -1
- llama_cloud/resources/api_keys/__init__.py +0 -2
- llama_cloud/resources/api_keys/client.py +0 -297
- llama_cloud/resources/billing/__init__.py +0 -2
- llama_cloud/resources/billing/client.py +0 -231
- llama_cloud/resources/deprecated/__init__.py +0 -2
- llama_cloud/resources/deprecated/client.py +0 -961
- {llama_cloud-0.0.4.dist-info → llama_cloud-0.0.6.dist-info}/LICENSE +0 -0
|
@@ -7,6 +7,7 @@ from ..core.datetime_utils import serialize_datetime
|
|
|
7
7
|
from .configured_transformation_item import ConfiguredTransformationItem
|
|
8
8
|
from .data_sink_create import DataSinkCreate
|
|
9
9
|
from .eval_execution_params import EvalExecutionParams
|
|
10
|
+
from .llama_parse_parameters import LlamaParseParameters
|
|
10
11
|
from .pipeline_type import PipelineType
|
|
11
12
|
from .preset_retrieval_params import PresetRetrievalParams
|
|
12
13
|
|
|
@@ -42,6 +43,9 @@ class PipelineCreate(pydantic.BaseModel):
|
|
|
42
43
|
llama_parse_enabled: typing.Optional[bool] = pydantic.Field(
|
|
43
44
|
description="Whether to use LlamaParse during pipeline execution."
|
|
44
45
|
)
|
|
46
|
+
llama_parse_parameters: typing.Optional[LlamaParseParameters] = pydantic.Field(
|
|
47
|
+
description="Settings that can be configured for how to use LlamaParse to parse files within a LlamaCloud pipeline."
|
|
48
|
+
)
|
|
45
49
|
name: str
|
|
46
50
|
pipeline_type: typing.Optional[PipelineType] = pydantic.Field(
|
|
47
51
|
description="Type of pipeline. Either PLAYGROUND or MANAGED."
|
llama_cloud/types/project.py
CHANGED
|
@@ -4,7 +4,6 @@ import datetime as dt
|
|
|
4
4
|
import typing
|
|
5
5
|
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
|
7
|
-
from .pipeline import Pipeline
|
|
8
7
|
|
|
9
8
|
try:
|
|
10
9
|
import pydantic
|
|
@@ -24,7 +23,6 @@ class Project(pydantic.BaseModel):
|
|
|
24
23
|
id: str = pydantic.Field(description="Unique identifier")
|
|
25
24
|
created_at: typing.Optional[dt.datetime] = pydantic.Field(description="Creation datetime")
|
|
26
25
|
updated_at: typing.Optional[dt.datetime] = pydantic.Field(description="Update datetime")
|
|
27
|
-
pipelines: typing.List[Pipeline]
|
|
28
26
|
ad_hoc_eval_dataset_id: typing.Optional[str]
|
|
29
27
|
user_id: str = pydantic.Field(description="The user ID of the project owner.")
|
|
30
28
|
is_default: typing.Optional[bool] = pydantic.Field(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
llama_cloud/__init__.py,sha256=
|
|
2
|
-
llama_cloud/client.py,sha256=
|
|
1
|
+
llama_cloud/__init__.py,sha256=kw-9ebdu7WbO7zDdlEW2X1qhoAiPwb90AJtm-X849-I,7581
|
|
2
|
+
llama_cloud/client.py,sha256=zteEQ5dmzOW5mgEqQ-i9PBh01Ocx0LIN6jxHPy9CBlI,3786
|
|
3
3
|
llama_cloud/core/__init__.py,sha256=QJS3CJ2TYP2E1Tge0CS6Z7r8LTNzJHQVX1hD3558eP0,519
|
|
4
4
|
llama_cloud/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
|
5
5
|
llama_cloud/core/client_wrapper.py,sha256=xmj0jCdQ0ySzbSqHUWOkpRRy069y74I_HuXkWltcsVM,1507
|
|
@@ -9,11 +9,7 @@ llama_cloud/core/remove_none_from_dict.py,sha256=8m91FC3YuVem0Gm9_sXhJ2tGvP33owJ
|
|
|
9
9
|
llama_cloud/environment.py,sha256=q4q-uY5WgcSlzfHwEANOqFQPu0lstqvMnVOsSfifMKo,168
|
|
10
10
|
llama_cloud/errors/__init__.py,sha256=pbbVUFtB9LCocA1RMWMMF_RKjsy5YkOKX5BAuE49w6g,170
|
|
11
11
|
llama_cloud/errors/unprocessable_entity_error.py,sha256=FvR7XPlV3Xx5nu8HNlmLhBRdk4so_gCHjYT5PyZe6sM,313
|
|
12
|
-
llama_cloud/resources/__init__.py,sha256=
|
|
13
|
-
llama_cloud/resources/api_keys/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
14
|
-
llama_cloud/resources/api_keys/client.py,sha256=dkljKgBir4voTeesRNL_fgSjRplLTx2hianMVRdoDNM,11324
|
|
15
|
-
llama_cloud/resources/billing/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
16
|
-
llama_cloud/resources/billing/client.py,sha256=a_OLt7rkyRbPT1ruhgdVaMN_jDEq1zlP1oNgj6pZcQg,9214
|
|
12
|
+
llama_cloud/resources/__init__.py,sha256=CZM0cBk0JjOYkzt1OIl9iQzVBQmD4KuWJsIhrf6BMW0,887
|
|
17
13
|
llama_cloud/resources/component_definitions/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
18
14
|
llama_cloud/resources/component_definitions/client.py,sha256=-Hv7W64P59flEf8osaG6L8CoyuJWDfUQh6zPR-nFvmI,7649
|
|
19
15
|
llama_cloud/resources/data_sinks/__init__.py,sha256=nsMEyxkVilxvQGSdJi0Z0yKZoTaTWewZIGJNoMwNDsw,205
|
|
@@ -27,8 +23,6 @@ llama_cloud/resources/data_sources/types/__init__.py,sha256=iOdDXvAM6w80PR62JCsc
|
|
|
27
23
|
llama_cloud/resources/data_sources/types/data_source_update_component.py,sha256=8MoJgdjYmN5WqntDpMXX34WJsf-Wsn0gYw_0t9SOTTA,257
|
|
28
24
|
llama_cloud/resources/data_sources/types/data_source_update_component_one.py,sha256=jfHjlwkUonW0Z73XhJ3w0BZpmptuXU205FWXS1Ucf44,742
|
|
29
25
|
llama_cloud/resources/data_sources/types/data_source_update_custom_metadata_value.py,sha256=3aFC-p8MSxjhOu2nFtqk0pixj6RqNqcFnbOYngUdZUk,215
|
|
30
|
-
llama_cloud/resources/deprecated/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
31
|
-
llama_cloud/resources/deprecated/client.py,sha256=MFw6I2CDLOVg2TQslkXHQ-vx3WKMt5s7sNkIWrOtuvE,36084
|
|
32
26
|
llama_cloud/resources/evals/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
33
27
|
llama_cloud/resources/evals/client.py,sha256=mIgyzUj74Ia1YYEenGtpFEAJuFrgm6g_c3JfoJg4Zuk,27607
|
|
34
28
|
llama_cloud/resources/files/__init__.py,sha256=aZpyTj6KpZvA5XVwmuo1sIlRs7ba98btxVBZ6j5vIsI,155
|
|
@@ -38,13 +32,12 @@ llama_cloud/resources/files/types/file_create_resource_info_value.py,sha256=R7Y-
|
|
|
38
32
|
llama_cloud/resources/parsing/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
39
33
|
llama_cloud/resources/parsing/client.py,sha256=lm02dcjE6U1BpMMIrLaJZ3Yzji-gRX4jPgZrxgN_t50,36084
|
|
40
34
|
llama_cloud/resources/pipelines/__init__.py,sha256=H7yaFIN62vjuhU3TOKzzuf8qpxZRgw1xVa-eyig-2YU,175
|
|
41
|
-
llama_cloud/resources/pipelines/client.py,sha256=
|
|
35
|
+
llama_cloud/resources/pipelines/client.py,sha256=4_6o20jUBMfSDRUExN_LAtbc-w_qA7LdroLNMBqr49w,106966
|
|
42
36
|
llama_cloud/resources/pipelines/types/__init__.py,sha256=xuT4OBPLrRfEe-E3UVdJvRjl9jTp7tNBK_YzZBb6Kj8,212
|
|
43
37
|
llama_cloud/resources/pipelines/types/pipeline_file_update_custom_metadata_value.py,sha256=trI48WLxPcAqV9207Q6-3cj1nl4EGlZpw7En56ZsPgg,217
|
|
44
38
|
llama_cloud/resources/projects/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
45
39
|
llama_cloud/resources/projects/client.py,sha256=gqjSRfpNK8rxECpHGluiTLxF8qGX2LvNIPJNujfNQ9E,46742
|
|
46
|
-
llama_cloud/types/__init__.py,sha256=
|
|
47
|
-
llama_cloud/types/api_key.py,sha256=QGEPX-kwPh9n4OU4ujUvTWzItdqbeUa9Wu8XhDE0sXY,1309
|
|
40
|
+
llama_cloud/types/__init__.py,sha256=UtfkKO9KZ03jpjMHHsW1y-VB8C3f0zKtXcLtbFZSqEI,10402
|
|
48
41
|
llama_cloud/types/azure_open_ai_embedding.py,sha256=Ne7DkOTpdwGsH2DUVIGdT5T8Nmk6J61lHGbmgG90LuY,3438
|
|
49
42
|
llama_cloud/types/base.py,sha256=cn_Zn61yLMDCMm1iZTPvKILSRlqRzOqZtSYyYBY5dIE,938
|
|
50
43
|
llama_cloud/types/base_prompt_template.py,sha256=GO9k4EDVMf3gRQIA4bVfXqgIMKnKTXhi1JlGvhqXDRY,1576
|
|
@@ -107,12 +100,14 @@ llama_cloud/types/http_validation_error.py,sha256=iOSKYv0dJGjyIq8DAeLVKNJY-GiM1b
|
|
|
107
100
|
llama_cloud/types/hugging_face_inference_api_embedding.py,sha256=_nXn3KkPnnQiuspEUsBASHJOjeGYHuDUq1eBfXr6xwg,3315
|
|
108
101
|
llama_cloud/types/hugging_face_inference_api_embedding_token.py,sha256=A7-_YryBcsP4G5uRyJ9acao3XwX5-YC3NRndTeDAPj4,144
|
|
109
102
|
llama_cloud/types/json_node_parser.py,sha256=w7U_HbyxIDTEyJCdrk4j_8IUaqVsqEkpOJ6cq-0xz0A,1577
|
|
103
|
+
llama_cloud/types/llama_parse_parameters.py,sha256=KiLSFyCAgxV9Ebk6TGYamwCWlsizj_MtFgAjQcnZENs,1732
|
|
110
104
|
llama_cloud/types/llama_parse_supported_file_extensions.py,sha256=wapP4esgu0fSNjQ-Qs5NkZcuUwYEn4YFHKV_HH_yc_M,5519
|
|
111
105
|
llama_cloud/types/llm.py,sha256=T-Uv5OO0E6Rscpn841302jx3c7G1uo9LJkdrGlNGk30,2238
|
|
112
106
|
llama_cloud/types/local_eval.py,sha256=77NY_rq4zr0V3iB-PXE7Om6LcjRrytLbQ55f_ovAF-M,2050
|
|
113
107
|
llama_cloud/types/local_eval_results.py,sha256=G1rLE6vO2lEziHQ6bAbZvpJMTrkSYWFvsS1iyZZ44Jw,1449
|
|
114
108
|
llama_cloud/types/local_eval_sets.py,sha256=XJSSriwRvkma889pPiBQrpRakKejKOX3tWPu1TGb1ug,1181
|
|
115
109
|
llama_cloud/types/managed_ingestion_status.py,sha256=IW5WpBSofGlJfypFrl3mp4yx9Lq4eHFs-1IOl1R33dI,1128
|
|
110
|
+
llama_cloud/types/managed_ingestion_status_response.py,sha256=oqpY5Iw08offH-0xlEj-F4YN7BUJgP3gSw0EBWmjFGg,1118
|
|
116
111
|
llama_cloud/types/markdown_element_node_parser.py,sha256=N3HKe8ZVVzJvley9UxATSbXhNkgVafhJgtnyMePjMBU,2121
|
|
117
112
|
llama_cloud/types/markdown_node_parser.py,sha256=T4VNqkKmwQtItpdIC2uwfBnIGEfGQ8s6F9vR9ChW64M,1589
|
|
118
113
|
llama_cloud/types/message_role.py,sha256=38ES71HMWfKesfFqSkTBxDcqdNqJHlNYQr1pPKlxSXs,1208
|
|
@@ -131,8 +126,8 @@ llama_cloud/types/parsing_job_json_result.py,sha256=vC0FNMklitCgcB0esthMfv_RbbyF
|
|
|
131
126
|
llama_cloud/types/parsing_job_markdown_result.py,sha256=E3-CVNFH1IMyuGs_xzYfYdNgq9AdnDshA_CxOTXz_dQ,1094
|
|
132
127
|
llama_cloud/types/parsing_job_text_result.py,sha256=1QZielAWXuzPFOgr_DWshXPjmbExAAgAHKAEYVQVtJ8,1082
|
|
133
128
|
llama_cloud/types/parsing_usage.py,sha256=Wy_c-kAFADDBZgDwqNglsJv_t7vcjOm-8EY32oZEYzU,995
|
|
134
|
-
llama_cloud/types/pipeline.py,sha256=
|
|
135
|
-
llama_cloud/types/pipeline_create.py,sha256=
|
|
129
|
+
llama_cloud/types/pipeline.py,sha256=wZ68MphMPSw_tNLEErphPGnkX3te8RsxR0YbfnulwcE,3013
|
|
130
|
+
llama_cloud/types/pipeline_create.py,sha256=_8qO8PVbD6zHW4xsYEHD4TQ-LhD5YE0iWK2x8BIALs0,2833
|
|
136
131
|
llama_cloud/types/pipeline_data_source.py,sha256=A3AlRzTD7zr1y-u5O5LFESqIupbbG-fqUndQgeYj77w,2062
|
|
137
132
|
llama_cloud/types/pipeline_data_source_component.py,sha256=Pk_K0Gv7xSWe5BKCdxz82EFd6AQDvZGN-6t3zg9h8NY,265
|
|
138
133
|
llama_cloud/types/pipeline_data_source_component_one.py,sha256=9j6n_Mhp3_nGg1O-V8Xeb46vLRTRH7hJzVPShFYOMfM,690
|
|
@@ -144,12 +139,11 @@ llama_cloud/types/pipeline_file_create.py,sha256=2h7EVJk2Hez8FJ5AVqynWUpWDOkLmTO
|
|
|
144
139
|
llama_cloud/types/pipeline_file_create_custom_metadata_value.py,sha256=olVj5yhQFx1QqWO1Wv9d6AtL-YyYO9_OYtOfcD2ZeGY,217
|
|
145
140
|
llama_cloud/types/pipeline_file_custom_metadata_value.py,sha256=ClFphYDNlHxeyLF5BWxIUhs2rooS0Xtqxr_Ae8dn8zE,211
|
|
146
141
|
llama_cloud/types/pipeline_file_resource_info_value.py,sha256=s3uFGQNwlUEr-X4TJZkW_kMBvX3h1sXRJoYlJRvHSDc,209
|
|
147
|
-
llama_cloud/types/pipeline_file_status_response.py,sha256=lVFL9CdsFo_TV-vsrhrrVwnPqJzVX5nCuG71aM2qVD8,1328
|
|
148
142
|
llama_cloud/types/pipeline_type.py,sha256=tTqrhxHP5xd7W2dQGD0e5FOv886nwJssyaVlXpWrtRo,551
|
|
149
143
|
llama_cloud/types/pooling.py,sha256=5Fr6c8rx9SDWwWzEvD78suob2d79ktodUtLUAUHMbP8,651
|
|
150
144
|
llama_cloud/types/preset_retrieval_params.py,sha256=y63ynv_SUYSq2vfYHNvw7LhiUtuVkvRDVmu1Xn8RY90,1907
|
|
151
145
|
llama_cloud/types/presigned_url.py,sha256=pUOIs2hFESZCuiqMsnn7pB6dgh_XO6w7vAV4OhKrq94,1345
|
|
152
|
-
llama_cloud/types/project.py,sha256
|
|
146
|
+
llama_cloud/types/project.py,sha256=-EWRwtaBs6rPeEVH8T-3eWvM3VrGNCL4zkr3-loMiik,1523
|
|
153
147
|
llama_cloud/types/project_create.py,sha256=GxGmsXGJM-cHrvPFLktEkj9JtNsSdFae7-HPZFB4er0,1014
|
|
154
148
|
llama_cloud/types/prompt_mixin_prompts.py,sha256=HRJlfFXFDOaGjqkB4prCDuz2fgwXhUi5I5roGykjRmU,1381
|
|
155
149
|
llama_cloud/types/prompt_spec.py,sha256=dCJOp3Gn5Y7EmC3iDIH4mM_fBtCMCwCPwPRgzyDY-q0,1516
|
|
@@ -168,7 +162,7 @@ llama_cloud/types/token_text_splitter.py,sha256=Mv8xBCvMXyYuQq1KInPe65O0YYCLWxs6
|
|
|
168
162
|
llama_cloud/types/transformation_category_names.py,sha256=0xjYe-mDW9OKbTGqL5fSbTvqsfrG4LDu_stW_ubVLl4,582
|
|
169
163
|
llama_cloud/types/validation_error.py,sha256=yZDLtjUHDY5w82Ra6CW0H9sLAr18R0RY1UNgJKR72DQ,1084
|
|
170
164
|
llama_cloud/types/validation_error_loc_item.py,sha256=LAtjCHIllWRBFXvAZ5QZpp7CPXjdtN9EB7HrLVo6EP0,128
|
|
171
|
-
llama_cloud-0.0.
|
|
172
|
-
llama_cloud-0.0.
|
|
173
|
-
llama_cloud-0.0.
|
|
174
|
-
llama_cloud-0.0.
|
|
165
|
+
llama_cloud-0.0.6.dist-info/LICENSE,sha256=_iNqtPcw1Ue7dZKwOwgPtbegMUkWVy15hC7bffAdNmY,1067
|
|
166
|
+
llama_cloud-0.0.6.dist-info/METADATA,sha256=mgK5dEdoILzh7V9_WLp2E2Wbie57LovcqDNXpq3Dmis,750
|
|
167
|
+
llama_cloud-0.0.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
168
|
+
llama_cloud-0.0.6.dist-info/RECORD,,
|
|
@@ -1,297 +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 ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
11
|
-
from ...types.api_key import ApiKey
|
|
12
|
-
from ...types.http_validation_error import HttpValidationError
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
import pydantic
|
|
16
|
-
if pydantic.__version__.startswith("1."):
|
|
17
|
-
raise ImportError
|
|
18
|
-
import pydantic.v1 as pydantic # type: ignore
|
|
19
|
-
except ImportError:
|
|
20
|
-
import pydantic # type: ignore
|
|
21
|
-
|
|
22
|
-
# this is used as the default value for optional parameters
|
|
23
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class ApiKeysClient:
|
|
27
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
28
|
-
self._client_wrapper = client_wrapper
|
|
29
|
-
|
|
30
|
-
def get_keys(self) -> typing.List[ApiKey]:
|
|
31
|
-
"""
|
|
32
|
-
Get all API Keys for a user.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
from llama_cloud.client import LlamaCloud
|
|
36
|
-
|
|
37
|
-
client = LlamaCloud(
|
|
38
|
-
token="YOUR_TOKEN",
|
|
39
|
-
)
|
|
40
|
-
client.api_keys.get_keys()
|
|
41
|
-
"""
|
|
42
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
43
|
-
"GET",
|
|
44
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"),
|
|
45
|
-
headers=self._client_wrapper.get_headers(),
|
|
46
|
-
timeout=60,
|
|
47
|
-
)
|
|
48
|
-
if 200 <= _response.status_code < 300:
|
|
49
|
-
return pydantic.parse_obj_as(typing.List[ApiKey], _response.json()) # type: ignore
|
|
50
|
-
if _response.status_code == 422:
|
|
51
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
52
|
-
try:
|
|
53
|
-
_response_json = _response.json()
|
|
54
|
-
except JSONDecodeError:
|
|
55
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
56
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
57
|
-
|
|
58
|
-
def generate_key(self, *, name: typing.Optional[str] = OMIT) -> ApiKey:
|
|
59
|
-
"""
|
|
60
|
-
Generate a new API Key.
|
|
61
|
-
|
|
62
|
-
Parameters:
|
|
63
|
-
- name: typing.Optional[str].
|
|
64
|
-
---
|
|
65
|
-
from llama_cloud.client import LlamaCloud
|
|
66
|
-
|
|
67
|
-
client = LlamaCloud(
|
|
68
|
-
token="YOUR_TOKEN",
|
|
69
|
-
)
|
|
70
|
-
client.api_keys.generate_key()
|
|
71
|
-
"""
|
|
72
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
73
|
-
if name is not OMIT:
|
|
74
|
-
_request["name"] = name
|
|
75
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
76
|
-
"POST",
|
|
77
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"),
|
|
78
|
-
json=jsonable_encoder(_request),
|
|
79
|
-
headers=self._client_wrapper.get_headers(),
|
|
80
|
-
timeout=60,
|
|
81
|
-
)
|
|
82
|
-
if 200 <= _response.status_code < 300:
|
|
83
|
-
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
84
|
-
if _response.status_code == 422:
|
|
85
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
86
|
-
try:
|
|
87
|
-
_response_json = _response.json()
|
|
88
|
-
except JSONDecodeError:
|
|
89
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
90
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
91
|
-
|
|
92
|
-
def update_existing_api_key(self, api_key_id: str, *, name: typing.Optional[str] = OMIT) -> ApiKey:
|
|
93
|
-
"""
|
|
94
|
-
Update name of an existing API Key.
|
|
95
|
-
|
|
96
|
-
Parameters:
|
|
97
|
-
- api_key_id: str.
|
|
98
|
-
|
|
99
|
-
- name: typing.Optional[str].
|
|
100
|
-
---
|
|
101
|
-
from llama_cloud.client import LlamaCloud
|
|
102
|
-
|
|
103
|
-
client = LlamaCloud(
|
|
104
|
-
token="YOUR_TOKEN",
|
|
105
|
-
)
|
|
106
|
-
client.api_keys.update_existing_api_key(
|
|
107
|
-
api_key_id="string",
|
|
108
|
-
)
|
|
109
|
-
"""
|
|
110
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
111
|
-
if name is not OMIT:
|
|
112
|
-
_request["name"] = name
|
|
113
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
114
|
-
"PUT",
|
|
115
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{api_key_id}"),
|
|
116
|
-
json=jsonable_encoder(_request),
|
|
117
|
-
headers=self._client_wrapper.get_headers(),
|
|
118
|
-
timeout=60,
|
|
119
|
-
)
|
|
120
|
-
if 200 <= _response.status_code < 300:
|
|
121
|
-
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
122
|
-
if _response.status_code == 422:
|
|
123
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
124
|
-
try:
|
|
125
|
-
_response_json = _response.json()
|
|
126
|
-
except JSONDecodeError:
|
|
127
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
128
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
129
|
-
|
|
130
|
-
def delete_api_key(self, api_key_id: str) -> None:
|
|
131
|
-
"""
|
|
132
|
-
Delete an API Key by ID.
|
|
133
|
-
|
|
134
|
-
Parameters:
|
|
135
|
-
- api_key_id: str.
|
|
136
|
-
---
|
|
137
|
-
from llama_cloud.client import LlamaCloud
|
|
138
|
-
|
|
139
|
-
client = LlamaCloud(
|
|
140
|
-
token="YOUR_TOKEN",
|
|
141
|
-
)
|
|
142
|
-
client.api_keys.delete_api_key(
|
|
143
|
-
api_key_id="string",
|
|
144
|
-
)
|
|
145
|
-
"""
|
|
146
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
147
|
-
"DELETE",
|
|
148
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{api_key_id}"),
|
|
149
|
-
headers=self._client_wrapper.get_headers(),
|
|
150
|
-
timeout=60,
|
|
151
|
-
)
|
|
152
|
-
if 200 <= _response.status_code < 300:
|
|
153
|
-
return
|
|
154
|
-
if _response.status_code == 422:
|
|
155
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
156
|
-
try:
|
|
157
|
-
_response_json = _response.json()
|
|
158
|
-
except JSONDecodeError:
|
|
159
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
160
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
class AsyncApiKeysClient:
|
|
164
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
165
|
-
self._client_wrapper = client_wrapper
|
|
166
|
-
|
|
167
|
-
async def get_keys(self) -> typing.List[ApiKey]:
|
|
168
|
-
"""
|
|
169
|
-
Get all API Keys for a user.
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
from llama_cloud.client import AsyncLlamaCloud
|
|
173
|
-
|
|
174
|
-
client = AsyncLlamaCloud(
|
|
175
|
-
token="YOUR_TOKEN",
|
|
176
|
-
)
|
|
177
|
-
await client.api_keys.get_keys()
|
|
178
|
-
"""
|
|
179
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
180
|
-
"GET",
|
|
181
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"),
|
|
182
|
-
headers=self._client_wrapper.get_headers(),
|
|
183
|
-
timeout=60,
|
|
184
|
-
)
|
|
185
|
-
if 200 <= _response.status_code < 300:
|
|
186
|
-
return pydantic.parse_obj_as(typing.List[ApiKey], _response.json()) # type: ignore
|
|
187
|
-
if _response.status_code == 422:
|
|
188
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
189
|
-
try:
|
|
190
|
-
_response_json = _response.json()
|
|
191
|
-
except JSONDecodeError:
|
|
192
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
193
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
194
|
-
|
|
195
|
-
async def generate_key(self, *, name: typing.Optional[str] = OMIT) -> ApiKey:
|
|
196
|
-
"""
|
|
197
|
-
Generate a new API Key.
|
|
198
|
-
|
|
199
|
-
Parameters:
|
|
200
|
-
- name: typing.Optional[str].
|
|
201
|
-
---
|
|
202
|
-
from llama_cloud.client import AsyncLlamaCloud
|
|
203
|
-
|
|
204
|
-
client = AsyncLlamaCloud(
|
|
205
|
-
token="YOUR_TOKEN",
|
|
206
|
-
)
|
|
207
|
-
await client.api_keys.generate_key()
|
|
208
|
-
"""
|
|
209
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
210
|
-
if name is not OMIT:
|
|
211
|
-
_request["name"] = name
|
|
212
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
213
|
-
"POST",
|
|
214
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"),
|
|
215
|
-
json=jsonable_encoder(_request),
|
|
216
|
-
headers=self._client_wrapper.get_headers(),
|
|
217
|
-
timeout=60,
|
|
218
|
-
)
|
|
219
|
-
if 200 <= _response.status_code < 300:
|
|
220
|
-
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
221
|
-
if _response.status_code == 422:
|
|
222
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
223
|
-
try:
|
|
224
|
-
_response_json = _response.json()
|
|
225
|
-
except JSONDecodeError:
|
|
226
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
227
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
228
|
-
|
|
229
|
-
async def update_existing_api_key(self, api_key_id: str, *, name: typing.Optional[str] = OMIT) -> ApiKey:
|
|
230
|
-
"""
|
|
231
|
-
Update name of an existing API Key.
|
|
232
|
-
|
|
233
|
-
Parameters:
|
|
234
|
-
- api_key_id: str.
|
|
235
|
-
|
|
236
|
-
- name: typing.Optional[str].
|
|
237
|
-
---
|
|
238
|
-
from llama_cloud.client import AsyncLlamaCloud
|
|
239
|
-
|
|
240
|
-
client = AsyncLlamaCloud(
|
|
241
|
-
token="YOUR_TOKEN",
|
|
242
|
-
)
|
|
243
|
-
await client.api_keys.update_existing_api_key(
|
|
244
|
-
api_key_id="string",
|
|
245
|
-
)
|
|
246
|
-
"""
|
|
247
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
248
|
-
if name is not OMIT:
|
|
249
|
-
_request["name"] = name
|
|
250
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
251
|
-
"PUT",
|
|
252
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{api_key_id}"),
|
|
253
|
-
json=jsonable_encoder(_request),
|
|
254
|
-
headers=self._client_wrapper.get_headers(),
|
|
255
|
-
timeout=60,
|
|
256
|
-
)
|
|
257
|
-
if 200 <= _response.status_code < 300:
|
|
258
|
-
return pydantic.parse_obj_as(ApiKey, _response.json()) # type: ignore
|
|
259
|
-
if _response.status_code == 422:
|
|
260
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
261
|
-
try:
|
|
262
|
-
_response_json = _response.json()
|
|
263
|
-
except JSONDecodeError:
|
|
264
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
265
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
266
|
-
|
|
267
|
-
async def delete_api_key(self, api_key_id: str) -> None:
|
|
268
|
-
"""
|
|
269
|
-
Delete an API Key by ID.
|
|
270
|
-
|
|
271
|
-
Parameters:
|
|
272
|
-
- api_key_id: str.
|
|
273
|
-
---
|
|
274
|
-
from llama_cloud.client import AsyncLlamaCloud
|
|
275
|
-
|
|
276
|
-
client = AsyncLlamaCloud(
|
|
277
|
-
token="YOUR_TOKEN",
|
|
278
|
-
)
|
|
279
|
-
await client.api_keys.delete_api_key(
|
|
280
|
-
api_key_id="string",
|
|
281
|
-
)
|
|
282
|
-
"""
|
|
283
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
284
|
-
"DELETE",
|
|
285
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{api_key_id}"),
|
|
286
|
-
headers=self._client_wrapper.get_headers(),
|
|
287
|
-
timeout=60,
|
|
288
|
-
)
|
|
289
|
-
if 200 <= _response.status_code < 300:
|
|
290
|
-
return
|
|
291
|
-
if _response.status_code == 422:
|
|
292
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
293
|
-
try:
|
|
294
|
-
_response_json = _response.json()
|
|
295
|
-
except JSONDecodeError:
|
|
296
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
297
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|