llama-cloud 0.0.1__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.

Files changed (173) hide show
  1. llama_cloud/__init__.py +295 -0
  2. llama_cloud/client.py +72 -0
  3. llama_cloud/core/__init__.py +17 -0
  4. llama_cloud/core/api_error.py +15 -0
  5. llama_cloud/core/client_wrapper.py +51 -0
  6. llama_cloud/core/datetime_utils.py +28 -0
  7. llama_cloud/core/jsonable_encoder.py +103 -0
  8. llama_cloud/core/remove_none_from_dict.py +11 -0
  9. llama_cloud/errors/__init__.py +5 -0
  10. llama_cloud/errors/unprocessable_entity_error.py +9 -0
  11. llama_cloud/resources/__init__.py +40 -0
  12. llama_cloud/resources/api_keys/__init__.py +2 -0
  13. llama_cloud/resources/api_keys/client.py +302 -0
  14. llama_cloud/resources/billing/__init__.py +2 -0
  15. llama_cloud/resources/billing/client.py +234 -0
  16. llama_cloud/resources/component_definitions/__init__.py +2 -0
  17. llama_cloud/resources/component_definitions/client.py +192 -0
  18. llama_cloud/resources/data_sinks/__init__.py +5 -0
  19. llama_cloud/resources/data_sinks/client.py +506 -0
  20. llama_cloud/resources/data_sinks/types/__init__.py +6 -0
  21. llama_cloud/resources/data_sinks/types/data_sink_update_component.py +7 -0
  22. llama_cloud/resources/data_sinks/types/data_sink_update_component_one.py +17 -0
  23. llama_cloud/resources/data_sources/__init__.py +5 -0
  24. llama_cloud/resources/data_sources/client.py +521 -0
  25. llama_cloud/resources/data_sources/types/__init__.py +7 -0
  26. llama_cloud/resources/data_sources/types/data_source_update_component.py +7 -0
  27. llama_cloud/resources/data_sources/types/data_source_update_component_one.py +19 -0
  28. llama_cloud/resources/data_sources/types/data_source_update_custom_metadata_value.py +7 -0
  29. llama_cloud/resources/deprecated/__init__.py +2 -0
  30. llama_cloud/resources/deprecated/client.py +982 -0
  31. llama_cloud/resources/evals/__init__.py +2 -0
  32. llama_cloud/resources/evals/client.py +745 -0
  33. llama_cloud/resources/files/__init__.py +5 -0
  34. llama_cloud/resources/files/client.py +560 -0
  35. llama_cloud/resources/files/types/__init__.py +5 -0
  36. llama_cloud/resources/files/types/file_create_resource_info_value.py +5 -0
  37. llama_cloud/resources/parsing/__init__.py +2 -0
  38. llama_cloud/resources/parsing/client.py +982 -0
  39. llama_cloud/resources/pipelines/__init__.py +5 -0
  40. llama_cloud/resources/pipelines/client.py +2599 -0
  41. llama_cloud/resources/pipelines/types/__init__.py +5 -0
  42. llama_cloud/resources/pipelines/types/pipeline_file_update_custom_metadata_value.py +7 -0
  43. llama_cloud/resources/projects/__init__.py +2 -0
  44. llama_cloud/resources/projects/client.py +1231 -0
  45. llama_cloud/types/__init__.py +253 -0
  46. llama_cloud/types/api_key.py +37 -0
  47. llama_cloud/types/azure_open_ai_embedding.py +75 -0
  48. llama_cloud/types/base.py +26 -0
  49. llama_cloud/types/base_prompt_template.py +44 -0
  50. llama_cloud/types/bedrock_embedding.py +56 -0
  51. llama_cloud/types/chat_message.py +35 -0
  52. llama_cloud/types/cloud_az_storage_blob_data_source.py +40 -0
  53. llama_cloud/types/cloud_chroma_vector_store.py +40 -0
  54. llama_cloud/types/cloud_document.py +36 -0
  55. llama_cloud/types/cloud_document_create.py +36 -0
  56. llama_cloud/types/cloud_gcs_data_source.py +37 -0
  57. llama_cloud/types/cloud_google_drive_data_source.py +36 -0
  58. llama_cloud/types/cloud_one_drive_data_source.py +38 -0
  59. llama_cloud/types/cloud_pinecone_vector_store.py +46 -0
  60. llama_cloud/types/cloud_postgres_vector_store.py +44 -0
  61. llama_cloud/types/cloud_qdrant_vector_store.py +48 -0
  62. llama_cloud/types/cloud_s_3_data_source.py +42 -0
  63. llama_cloud/types/cloud_sharepoint_data_source.py +38 -0
  64. llama_cloud/types/cloud_weaviate_vector_store.py +38 -0
  65. llama_cloud/types/code_splitter.py +46 -0
  66. llama_cloud/types/cohere_embedding.py +46 -0
  67. llama_cloud/types/configurable_data_sink_names.py +37 -0
  68. llama_cloud/types/configurable_data_source_names.py +41 -0
  69. llama_cloud/types/configurable_transformation_definition.py +45 -0
  70. llama_cloud/types/configurable_transformation_names.py +73 -0
  71. llama_cloud/types/configured_transformation_item.py +43 -0
  72. llama_cloud/types/configured_transformation_item_component.py +9 -0
  73. llama_cloud/types/configured_transformation_item_component_one.py +35 -0
  74. llama_cloud/types/data_sink.py +40 -0
  75. llama_cloud/types/data_sink_component.py +7 -0
  76. llama_cloud/types/data_sink_component_one.py +17 -0
  77. llama_cloud/types/data_sink_create.py +36 -0
  78. llama_cloud/types/data_sink_create_component.py +7 -0
  79. llama_cloud/types/data_sink_create_component_one.py +17 -0
  80. llama_cloud/types/data_sink_definition.py +41 -0
  81. llama_cloud/types/data_source.py +44 -0
  82. llama_cloud/types/data_source_component.py +7 -0
  83. llama_cloud/types/data_source_component_one.py +19 -0
  84. llama_cloud/types/data_source_create.py +40 -0
  85. llama_cloud/types/data_source_create_component.py +7 -0
  86. llama_cloud/types/data_source_create_component_one.py +19 -0
  87. llama_cloud/types/data_source_create_custom_metadata_value.py +7 -0
  88. llama_cloud/types/data_source_custom_metadata_value.py +7 -0
  89. llama_cloud/types/data_source_definition.py +41 -0
  90. llama_cloud/types/eval_dataset.py +37 -0
  91. llama_cloud/types/eval_dataset_job_params.py +36 -0
  92. llama_cloud/types/eval_dataset_job_record.py +59 -0
  93. llama_cloud/types/eval_execution_params.py +38 -0
  94. llama_cloud/types/eval_execution_params_override.py +38 -0
  95. llama_cloud/types/eval_llm_model_data.py +33 -0
  96. llama_cloud/types/eval_question.py +39 -0
  97. llama_cloud/types/eval_question_create.py +28 -0
  98. llama_cloud/types/eval_question_result.py +49 -0
  99. llama_cloud/types/file.py +46 -0
  100. llama_cloud/types/file_resource_info_value.py +5 -0
  101. llama_cloud/types/filter_condition.py +21 -0
  102. llama_cloud/types/filter_operator.py +65 -0
  103. llama_cloud/types/gemini_embedding.py +51 -0
  104. llama_cloud/types/html_node_parser.py +44 -0
  105. llama_cloud/types/http_validation_error.py +29 -0
  106. llama_cloud/types/hugging_face_inference_api_embedding.py +68 -0
  107. llama_cloud/types/hugging_face_inference_api_embedding_token.py +5 -0
  108. llama_cloud/types/json_node_parser.py +43 -0
  109. llama_cloud/types/llama_parse_supported_file_extensions.py +161 -0
  110. llama_cloud/types/llm.py +55 -0
  111. llama_cloud/types/local_eval.py +46 -0
  112. llama_cloud/types/local_eval_results.py +37 -0
  113. llama_cloud/types/local_eval_sets.py +30 -0
  114. llama_cloud/types/managed_ingestion_status.py +37 -0
  115. llama_cloud/types/markdown_element_node_parser.py +49 -0
  116. llama_cloud/types/markdown_node_parser.py +43 -0
  117. llama_cloud/types/message_role.py +45 -0
  118. llama_cloud/types/metadata_filter.py +41 -0
  119. llama_cloud/types/metadata_filter_value.py +5 -0
  120. llama_cloud/types/metadata_filters.py +41 -0
  121. llama_cloud/types/metadata_filters_filters_item.py +8 -0
  122. llama_cloud/types/metric_result.py +30 -0
  123. llama_cloud/types/node_parser.py +37 -0
  124. llama_cloud/types/object_type.py +33 -0
  125. llama_cloud/types/open_ai_embedding.py +73 -0
  126. llama_cloud/types/parser_languages.py +361 -0
  127. llama_cloud/types/parsing_history_item.py +36 -0
  128. llama_cloud/types/parsing_job.py +30 -0
  129. llama_cloud/types/parsing_job_json_result.py +29 -0
  130. llama_cloud/types/parsing_job_markdown_result.py +29 -0
  131. llama_cloud/types/parsing_job_text_result.py +29 -0
  132. llama_cloud/types/parsing_usage.py +29 -0
  133. llama_cloud/types/pipeline.py +64 -0
  134. llama_cloud/types/pipeline_create.py +61 -0
  135. llama_cloud/types/pipeline_data_source.py +46 -0
  136. llama_cloud/types/pipeline_data_source_component.py +7 -0
  137. llama_cloud/types/pipeline_data_source_component_one.py +19 -0
  138. llama_cloud/types/pipeline_data_source_create.py +32 -0
  139. llama_cloud/types/pipeline_data_source_custom_metadata_value.py +7 -0
  140. llama_cloud/types/pipeline_deployment.py +38 -0
  141. llama_cloud/types/pipeline_file.py +52 -0
  142. llama_cloud/types/pipeline_file_create.py +36 -0
  143. llama_cloud/types/pipeline_file_create_custom_metadata_value.py +7 -0
  144. llama_cloud/types/pipeline_file_custom_metadata_value.py +7 -0
  145. llama_cloud/types/pipeline_file_resource_info_value.py +7 -0
  146. llama_cloud/types/pipeline_file_status_response.py +35 -0
  147. llama_cloud/types/pipeline_type.py +21 -0
  148. llama_cloud/types/pooling.py +29 -0
  149. llama_cloud/types/preset_retrieval_params.py +40 -0
  150. llama_cloud/types/presigned_url.py +36 -0
  151. llama_cloud/types/project.py +42 -0
  152. llama_cloud/types/project_create.py +32 -0
  153. llama_cloud/types/prompt_mixin_prompts.py +36 -0
  154. llama_cloud/types/prompt_spec.py +35 -0
  155. llama_cloud/types/pydantic_program_mode.py +41 -0
  156. llama_cloud/types/related_node_info.py +37 -0
  157. llama_cloud/types/retrieve_results.py +40 -0
  158. llama_cloud/types/sentence_splitter.py +48 -0
  159. llama_cloud/types/simple_file_node_parser.py +44 -0
  160. llama_cloud/types/status_enum.py +33 -0
  161. llama_cloud/types/supported_eval_llm_model.py +35 -0
  162. llama_cloud/types/supported_eval_llm_model_names.py +29 -0
  163. llama_cloud/types/text_node.py +62 -0
  164. llama_cloud/types/text_node_relationships_value.py +7 -0
  165. llama_cloud/types/text_node_with_score.py +36 -0
  166. llama_cloud/types/token_text_splitter.py +43 -0
  167. llama_cloud/types/transformation_category_names.py +21 -0
  168. llama_cloud/types/validation_error.py +31 -0
  169. llama_cloud/types/validation_error_loc_item.py +5 -0
  170. llama_cloud-0.0.1.dist-info/LICENSE +21 -0
  171. llama_cloud-0.0.1.dist-info/METADATA +25 -0
  172. llama_cloud-0.0.1.dist-info/RECORD +173 -0
  173. llama_cloud-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,295 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import (
4
+ ApiKey,
5
+ AzureOpenAiEmbedding,
6
+ Base,
7
+ BasePromptTemplate,
8
+ BedrockEmbedding,
9
+ ChatMessage,
10
+ CloudAzStorageBlobDataSource,
11
+ CloudChromaVectorStore,
12
+ CloudDocument,
13
+ CloudDocumentCreate,
14
+ CloudGcsDataSource,
15
+ CloudGoogleDriveDataSource,
16
+ CloudOneDriveDataSource,
17
+ CloudPineconeVectorStore,
18
+ CloudPostgresVectorStore,
19
+ CloudQdrantVectorStore,
20
+ CloudS3DataSource,
21
+ CloudSharepointDataSource,
22
+ CloudWeaviateVectorStore,
23
+ CodeSplitter,
24
+ CohereEmbedding,
25
+ ConfigurableDataSinkNames,
26
+ ConfigurableDataSourceNames,
27
+ ConfigurableTransformationDefinition,
28
+ ConfigurableTransformationNames,
29
+ ConfiguredTransformationItem,
30
+ ConfiguredTransformationItemComponent,
31
+ ConfiguredTransformationItemComponentOne,
32
+ DataSink,
33
+ DataSinkComponent,
34
+ DataSinkComponentOne,
35
+ DataSinkCreate,
36
+ DataSinkCreateComponent,
37
+ DataSinkCreateComponentOne,
38
+ DataSinkDefinition,
39
+ DataSource,
40
+ DataSourceComponent,
41
+ DataSourceComponentOne,
42
+ DataSourceCreate,
43
+ DataSourceCreateComponent,
44
+ DataSourceCreateComponentOne,
45
+ DataSourceCreateCustomMetadataValue,
46
+ DataSourceCustomMetadataValue,
47
+ DataSourceDefinition,
48
+ EvalDataset,
49
+ EvalDatasetJobParams,
50
+ EvalDatasetJobRecord,
51
+ EvalExecutionParams,
52
+ EvalExecutionParamsOverride,
53
+ EvalLlmModelData,
54
+ EvalQuestion,
55
+ EvalQuestionCreate,
56
+ EvalQuestionResult,
57
+ File,
58
+ FileResourceInfoValue,
59
+ FilterCondition,
60
+ FilterOperator,
61
+ GeminiEmbedding,
62
+ HtmlNodeParser,
63
+ HttpValidationError,
64
+ HuggingFaceInferenceApiEmbedding,
65
+ HuggingFaceInferenceApiEmbeddingToken,
66
+ JsonNodeParser,
67
+ LlamaParseSupportedFileExtensions,
68
+ Llm,
69
+ LocalEval,
70
+ LocalEvalResults,
71
+ LocalEvalSets,
72
+ ManagedIngestionStatus,
73
+ MarkdownElementNodeParser,
74
+ MarkdownNodeParser,
75
+ MessageRole,
76
+ MetadataFilter,
77
+ MetadataFilterValue,
78
+ MetadataFilters,
79
+ MetadataFiltersFiltersItem,
80
+ MetricResult,
81
+ NodeParser,
82
+ ObjectType,
83
+ OpenAiEmbedding,
84
+ ParserLanguages,
85
+ ParsingHistoryItem,
86
+ ParsingJob,
87
+ ParsingJobJsonResult,
88
+ ParsingJobMarkdownResult,
89
+ ParsingJobTextResult,
90
+ ParsingUsage,
91
+ Pipeline,
92
+ PipelineCreate,
93
+ PipelineDataSource,
94
+ PipelineDataSourceComponent,
95
+ PipelineDataSourceComponentOne,
96
+ PipelineDataSourceCreate,
97
+ PipelineDataSourceCustomMetadataValue,
98
+ PipelineDeployment,
99
+ PipelineFile,
100
+ PipelineFileCreate,
101
+ PipelineFileCreateCustomMetadataValue,
102
+ PipelineFileCustomMetadataValue,
103
+ PipelineFileResourceInfoValue,
104
+ PipelineFileStatusResponse,
105
+ PipelineType,
106
+ Pooling,
107
+ PresetRetrievalParams,
108
+ PresignedUrl,
109
+ Project,
110
+ ProjectCreate,
111
+ PromptMixinPrompts,
112
+ PromptSpec,
113
+ PydanticProgramMode,
114
+ RelatedNodeInfo,
115
+ RetrieveResults,
116
+ SentenceSplitter,
117
+ SimpleFileNodeParser,
118
+ StatusEnum,
119
+ SupportedEvalLlmModel,
120
+ SupportedEvalLlmModelNames,
121
+ TextNode,
122
+ TextNodeRelationshipsValue,
123
+ TextNodeWithScore,
124
+ TokenTextSplitter,
125
+ TransformationCategoryNames,
126
+ ValidationError,
127
+ ValidationErrorLocItem,
128
+ )
129
+ from .errors import UnprocessableEntityError
130
+ from .resources import (
131
+ DataSinkUpdateComponent,
132
+ DataSinkUpdateComponentOne,
133
+ DataSourceUpdateComponent,
134
+ DataSourceUpdateComponentOne,
135
+ DataSourceUpdateCustomMetadataValue,
136
+ FileCreateResourceInfoValue,
137
+ PipelineFileUpdateCustomMetadataValue,
138
+ api_keys,
139
+ billing,
140
+ component_definitions,
141
+ data_sinks,
142
+ data_sources,
143
+ deprecated,
144
+ evals,
145
+ files,
146
+ parsing,
147
+ pipelines,
148
+ projects,
149
+ )
150
+
151
+ __all__ = [
152
+ "ApiKey",
153
+ "AzureOpenAiEmbedding",
154
+ "Base",
155
+ "BasePromptTemplate",
156
+ "BedrockEmbedding",
157
+ "ChatMessage",
158
+ "CloudAzStorageBlobDataSource",
159
+ "CloudChromaVectorStore",
160
+ "CloudDocument",
161
+ "CloudDocumentCreate",
162
+ "CloudGcsDataSource",
163
+ "CloudGoogleDriveDataSource",
164
+ "CloudOneDriveDataSource",
165
+ "CloudPineconeVectorStore",
166
+ "CloudPostgresVectorStore",
167
+ "CloudQdrantVectorStore",
168
+ "CloudS3DataSource",
169
+ "CloudSharepointDataSource",
170
+ "CloudWeaviateVectorStore",
171
+ "CodeSplitter",
172
+ "CohereEmbedding",
173
+ "ConfigurableDataSinkNames",
174
+ "ConfigurableDataSourceNames",
175
+ "ConfigurableTransformationDefinition",
176
+ "ConfigurableTransformationNames",
177
+ "ConfiguredTransformationItem",
178
+ "ConfiguredTransformationItemComponent",
179
+ "ConfiguredTransformationItemComponentOne",
180
+ "DataSink",
181
+ "DataSinkComponent",
182
+ "DataSinkComponentOne",
183
+ "DataSinkCreate",
184
+ "DataSinkCreateComponent",
185
+ "DataSinkCreateComponentOne",
186
+ "DataSinkDefinition",
187
+ "DataSinkUpdateComponent",
188
+ "DataSinkUpdateComponentOne",
189
+ "DataSource",
190
+ "DataSourceComponent",
191
+ "DataSourceComponentOne",
192
+ "DataSourceCreate",
193
+ "DataSourceCreateComponent",
194
+ "DataSourceCreateComponentOne",
195
+ "DataSourceCreateCustomMetadataValue",
196
+ "DataSourceCustomMetadataValue",
197
+ "DataSourceDefinition",
198
+ "DataSourceUpdateComponent",
199
+ "DataSourceUpdateComponentOne",
200
+ "DataSourceUpdateCustomMetadataValue",
201
+ "EvalDataset",
202
+ "EvalDatasetJobParams",
203
+ "EvalDatasetJobRecord",
204
+ "EvalExecutionParams",
205
+ "EvalExecutionParamsOverride",
206
+ "EvalLlmModelData",
207
+ "EvalQuestion",
208
+ "EvalQuestionCreate",
209
+ "EvalQuestionResult",
210
+ "File",
211
+ "FileCreateResourceInfoValue",
212
+ "FileResourceInfoValue",
213
+ "FilterCondition",
214
+ "FilterOperator",
215
+ "GeminiEmbedding",
216
+ "HtmlNodeParser",
217
+ "HttpValidationError",
218
+ "HuggingFaceInferenceApiEmbedding",
219
+ "HuggingFaceInferenceApiEmbeddingToken",
220
+ "JsonNodeParser",
221
+ "LlamaParseSupportedFileExtensions",
222
+ "Llm",
223
+ "LocalEval",
224
+ "LocalEvalResults",
225
+ "LocalEvalSets",
226
+ "ManagedIngestionStatus",
227
+ "MarkdownElementNodeParser",
228
+ "MarkdownNodeParser",
229
+ "MessageRole",
230
+ "MetadataFilter",
231
+ "MetadataFilterValue",
232
+ "MetadataFilters",
233
+ "MetadataFiltersFiltersItem",
234
+ "MetricResult",
235
+ "NodeParser",
236
+ "ObjectType",
237
+ "OpenAiEmbedding",
238
+ "ParserLanguages",
239
+ "ParsingHistoryItem",
240
+ "ParsingJob",
241
+ "ParsingJobJsonResult",
242
+ "ParsingJobMarkdownResult",
243
+ "ParsingJobTextResult",
244
+ "ParsingUsage",
245
+ "Pipeline",
246
+ "PipelineCreate",
247
+ "PipelineDataSource",
248
+ "PipelineDataSourceComponent",
249
+ "PipelineDataSourceComponentOne",
250
+ "PipelineDataSourceCreate",
251
+ "PipelineDataSourceCustomMetadataValue",
252
+ "PipelineDeployment",
253
+ "PipelineFile",
254
+ "PipelineFileCreate",
255
+ "PipelineFileCreateCustomMetadataValue",
256
+ "PipelineFileCustomMetadataValue",
257
+ "PipelineFileResourceInfoValue",
258
+ "PipelineFileStatusResponse",
259
+ "PipelineFileUpdateCustomMetadataValue",
260
+ "PipelineType",
261
+ "Pooling",
262
+ "PresetRetrievalParams",
263
+ "PresignedUrl",
264
+ "Project",
265
+ "ProjectCreate",
266
+ "PromptMixinPrompts",
267
+ "PromptSpec",
268
+ "PydanticProgramMode",
269
+ "RelatedNodeInfo",
270
+ "RetrieveResults",
271
+ "SentenceSplitter",
272
+ "SimpleFileNodeParser",
273
+ "StatusEnum",
274
+ "SupportedEvalLlmModel",
275
+ "SupportedEvalLlmModelNames",
276
+ "TextNode",
277
+ "TextNodeRelationshipsValue",
278
+ "TextNodeWithScore",
279
+ "TokenTextSplitter",
280
+ "TransformationCategoryNames",
281
+ "UnprocessableEntityError",
282
+ "ValidationError",
283
+ "ValidationErrorLocItem",
284
+ "api_keys",
285
+ "billing",
286
+ "component_definitions",
287
+ "data_sinks",
288
+ "data_sources",
289
+ "deprecated",
290
+ "evals",
291
+ "files",
292
+ "parsing",
293
+ "pipelines",
294
+ "projects",
295
+ ]
llama_cloud/client.py ADDED
@@ -0,0 +1,72 @@
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 .resources.api_keys.client import ApiKeysClient, AsyncApiKeysClient
9
+ from .resources.billing.client import AsyncBillingClient, BillingClient
10
+ from .resources.component_definitions.client import AsyncComponentDefinitionsClient, ComponentDefinitionsClient
11
+ from .resources.data_sinks.client import AsyncDataSinksClient, DataSinksClient
12
+ from .resources.data_sources.client import AsyncDataSourcesClient, DataSourcesClient
13
+ from .resources.deprecated.client import AsyncDeprecatedClient, DeprecatedClient
14
+ from .resources.evals.client import AsyncEvalsClient, EvalsClient
15
+ from .resources.files.client import AsyncFilesClient, FilesClient
16
+ from .resources.parsing.client import AsyncParsingClient, ParsingClient
17
+ from .resources.pipelines.client import AsyncPipelinesClient, PipelinesClient
18
+ from .resources.projects.client import AsyncProjectsClient, ProjectsClient
19
+
20
+
21
+ class PlatformApi:
22
+ def __init__(
23
+ self,
24
+ *,
25
+ base_url: str,
26
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
27
+ timeout: typing.Optional[float] = 60,
28
+ httpx_client: typing.Optional[httpx.Client] = None
29
+ ):
30
+ self._client_wrapper = SyncClientWrapper(
31
+ base_url=base_url,
32
+ token=token,
33
+ httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
34
+ )
35
+ self.api_keys = ApiKeysClient(client_wrapper=self._client_wrapper)
36
+ self.data_sinks = DataSinksClient(client_wrapper=self._client_wrapper)
37
+ self.data_sources = DataSourcesClient(client_wrapper=self._client_wrapper)
38
+ self.projects = ProjectsClient(client_wrapper=self._client_wrapper)
39
+ self.files = FilesClient(client_wrapper=self._client_wrapper)
40
+ self.pipelines = PipelinesClient(client_wrapper=self._client_wrapper)
41
+ self.evals = EvalsClient(client_wrapper=self._client_wrapper)
42
+ self.parsing = ParsingClient(client_wrapper=self._client_wrapper)
43
+ self.component_definitions = ComponentDefinitionsClient(client_wrapper=self._client_wrapper)
44
+ self.billing = BillingClient(client_wrapper=self._client_wrapper)
45
+ self.deprecated = DeprecatedClient(client_wrapper=self._client_wrapper)
46
+
47
+
48
+ class AsyncPlatformApi:
49
+ def __init__(
50
+ self,
51
+ *,
52
+ base_url: str,
53
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
54
+ timeout: typing.Optional[float] = 60,
55
+ httpx_client: typing.Optional[httpx.AsyncClient] = None
56
+ ):
57
+ self._client_wrapper = AsyncClientWrapper(
58
+ base_url=base_url,
59
+ token=token,
60
+ httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
61
+ )
62
+ self.api_keys = AsyncApiKeysClient(client_wrapper=self._client_wrapper)
63
+ self.data_sinks = AsyncDataSinksClient(client_wrapper=self._client_wrapper)
64
+ self.data_sources = AsyncDataSourcesClient(client_wrapper=self._client_wrapper)
65
+ self.projects = AsyncProjectsClient(client_wrapper=self._client_wrapper)
66
+ self.files = AsyncFilesClient(client_wrapper=self._client_wrapper)
67
+ self.pipelines = AsyncPipelinesClient(client_wrapper=self._client_wrapper)
68
+ self.evals = AsyncEvalsClient(client_wrapper=self._client_wrapper)
69
+ self.parsing = AsyncParsingClient(client_wrapper=self._client_wrapper)
70
+ self.component_definitions = AsyncComponentDefinitionsClient(client_wrapper=self._client_wrapper)
71
+ self.billing = AsyncBillingClient(client_wrapper=self._client_wrapper)
72
+ self.deprecated = AsyncDeprecatedClient(client_wrapper=self._client_wrapper)
@@ -0,0 +1,17 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .api_error import ApiError
4
+ from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
5
+ from .datetime_utils import serialize_datetime
6
+ from .jsonable_encoder import jsonable_encoder
7
+ from .remove_none_from_dict import remove_none_from_dict
8
+
9
+ __all__ = [
10
+ "ApiError",
11
+ "AsyncClientWrapper",
12
+ "BaseClientWrapper",
13
+ "SyncClientWrapper",
14
+ "jsonable_encoder",
15
+ "remove_none_from_dict",
16
+ "serialize_datetime",
17
+ ]
@@ -0,0 +1,15 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+
6
+ class ApiError(Exception):
7
+ status_code: typing.Optional[int]
8
+ body: typing.Any
9
+
10
+ def __init__(self, *, status_code: typing.Optional[int] = None, body: typing.Any = None):
11
+ self.status_code = status_code
12
+ self.body = body
13
+
14
+ def __str__(self) -> str:
15
+ return f"status_code: {self.status_code}, body: {self.body}"
@@ -0,0 +1,51 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+
7
+
8
+ class BaseClientWrapper:
9
+ def __init__(self, *, token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, base_url: str):
10
+ self._token = token
11
+ self._base_url = base_url
12
+
13
+ def get_headers(self) -> typing.Dict[str, str]:
14
+ headers: typing.Dict[str, str] = {"X-Fern-Language": "Python"}
15
+ token = self._get_token()
16
+ if token is not None:
17
+ headers["Authorization"] = f"Bearer {token}"
18
+ return headers
19
+
20
+ def _get_token(self) -> typing.Optional[str]:
21
+ if isinstance(self._token, str) or self._token is None:
22
+ return self._token
23
+ else:
24
+ return self._token()
25
+
26
+ def get_base_url(self) -> str:
27
+ return self._base_url
28
+
29
+
30
+ class SyncClientWrapper(BaseClientWrapper):
31
+ def __init__(
32
+ self,
33
+ *,
34
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
35
+ base_url: str,
36
+ httpx_client: httpx.Client,
37
+ ):
38
+ super().__init__(token=token, base_url=base_url)
39
+ self.httpx_client = httpx_client
40
+
41
+
42
+ class AsyncClientWrapper(BaseClientWrapper):
43
+ def __init__(
44
+ self,
45
+ *,
46
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
47
+ base_url: str,
48
+ httpx_client: httpx.AsyncClient,
49
+ ):
50
+ super().__init__(token=token, base_url=base_url)
51
+ self.httpx_client = httpx_client
@@ -0,0 +1,28 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+
5
+
6
+ def serialize_datetime(v: dt.datetime) -> str:
7
+ """
8
+ Serialize a datetime including timezone info.
9
+
10
+ Uses the timezone info provided if present, otherwise uses the current runtime's timezone info.
11
+
12
+ UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00.
13
+ """
14
+
15
+ def _serialize_zoned_datetime(v: dt.datetime) -> str:
16
+ if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None):
17
+ # UTC is a special case where we use "Z" at the end instead of "+00:00"
18
+ return v.isoformat().replace("+00:00", "Z")
19
+ else:
20
+ # Delegate to the typical +/- offset format
21
+ return v.isoformat()
22
+
23
+ if v.tzinfo is not None:
24
+ return _serialize_zoned_datetime(v)
25
+ else:
26
+ local_tz = dt.datetime.now().astimezone().tzinfo
27
+ localized_dt = v.replace(tzinfo=local_tz)
28
+ return _serialize_zoned_datetime(localized_dt)
@@ -0,0 +1,103 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ """
4
+ jsonable_encoder converts a Python object to a JSON-friendly dict
5
+ (e.g. datetimes to strings, Pydantic models to dicts).
6
+
7
+ Taken from FastAPI, and made a bit simpler
8
+ https://github.com/tiangolo/fastapi/blob/master/fastapi/encoders.py
9
+ """
10
+
11
+ import dataclasses
12
+ import datetime as dt
13
+ from collections import defaultdict
14
+ from enum import Enum
15
+ from pathlib import PurePath
16
+ from types import GeneratorType
17
+ from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
18
+
19
+ try:
20
+ import pydantic.v1 as pydantic # type: ignore
21
+ except ImportError:
22
+ import pydantic # type: ignore
23
+
24
+ from .datetime_utils import serialize_datetime
25
+
26
+ SetIntStr = Set[Union[int, str]]
27
+ DictIntStrAny = Dict[Union[int, str], Any]
28
+
29
+
30
+ def generate_encoders_by_class_tuples(
31
+ type_encoder_map: Dict[Any, Callable[[Any], Any]]
32
+ ) -> Dict[Callable[[Any], Any], Tuple[Any, ...]]:
33
+ encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(tuple)
34
+ for type_, encoder in type_encoder_map.items():
35
+ encoders_by_class_tuples[encoder] += (type_,)
36
+ return encoders_by_class_tuples
37
+
38
+
39
+ encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic.json.ENCODERS_BY_TYPE)
40
+
41
+
42
+ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any:
43
+ custom_encoder = custom_encoder or {}
44
+ if custom_encoder:
45
+ if type(obj) in custom_encoder:
46
+ return custom_encoder[type(obj)](obj)
47
+ else:
48
+ for encoder_type, encoder_instance in custom_encoder.items():
49
+ if isinstance(obj, encoder_type):
50
+ return encoder_instance(obj)
51
+ if isinstance(obj, pydantic.BaseModel):
52
+ encoder = getattr(obj.__config__, "json_encoders", {})
53
+ if custom_encoder:
54
+ encoder.update(custom_encoder)
55
+ obj_dict = obj.dict(by_alias=True)
56
+ if "__root__" in obj_dict:
57
+ obj_dict = obj_dict["__root__"]
58
+ return jsonable_encoder(obj_dict, custom_encoder=encoder)
59
+ if dataclasses.is_dataclass(obj):
60
+ obj_dict = dataclasses.asdict(obj)
61
+ return jsonable_encoder(obj_dict, custom_encoder=custom_encoder)
62
+ if isinstance(obj, Enum):
63
+ return obj.value
64
+ if isinstance(obj, PurePath):
65
+ return str(obj)
66
+ if isinstance(obj, (str, int, float, type(None))):
67
+ return obj
68
+ if isinstance(obj, dt.date):
69
+ return str(obj)
70
+ if isinstance(obj, dt.datetime):
71
+ return serialize_datetime(obj)
72
+ if isinstance(obj, dict):
73
+ encoded_dict = {}
74
+ allowed_keys = set(obj.keys())
75
+ for key, value in obj.items():
76
+ if key in allowed_keys:
77
+ encoded_key = jsonable_encoder(key, custom_encoder=custom_encoder)
78
+ encoded_value = jsonable_encoder(value, custom_encoder=custom_encoder)
79
+ encoded_dict[encoded_key] = encoded_value
80
+ return encoded_dict
81
+ if isinstance(obj, (list, set, frozenset, GeneratorType, tuple)):
82
+ encoded_list = []
83
+ for item in obj:
84
+ encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder))
85
+ return encoded_list
86
+
87
+ if type(obj) in pydantic.json.ENCODERS_BY_TYPE:
88
+ return pydantic.json.ENCODERS_BY_TYPE[type(obj)](obj)
89
+ for encoder, classes_tuple in encoders_by_class_tuples.items():
90
+ if isinstance(obj, classes_tuple):
91
+ return encoder(obj)
92
+
93
+ try:
94
+ data = dict(obj)
95
+ except Exception as e:
96
+ errors: List[Exception] = []
97
+ errors.append(e)
98
+ try:
99
+ data = vars(obj)
100
+ except Exception as e:
101
+ errors.append(e)
102
+ raise ValueError(errors) from e
103
+ return jsonable_encoder(data, custom_encoder=custom_encoder)
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from typing import Any, Dict, Optional
4
+
5
+
6
+ def remove_none_from_dict(original: Dict[str, Optional[Any]]) -> Dict[str, Any]:
7
+ new: Dict[str, Any] = {}
8
+ for key, value in original.items():
9
+ if value is not None:
10
+ new[key] = value
11
+ return new
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .unprocessable_entity_error import UnprocessableEntityError
4
+
5
+ __all__ = ["UnprocessableEntityError"]
@@ -0,0 +1,9 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.api_error import ApiError
4
+ from ..types.http_validation_error import HttpValidationError
5
+
6
+
7
+ class UnprocessableEntityError(ApiError):
8
+ def __init__(self, body: HttpValidationError):
9
+ super().__init__(status_code=422, body=body)
@@ -0,0 +1,40 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from . import (
4
+ api_keys,
5
+ billing,
6
+ component_definitions,
7
+ data_sinks,
8
+ data_sources,
9
+ deprecated,
10
+ evals,
11
+ files,
12
+ parsing,
13
+ pipelines,
14
+ projects,
15
+ )
16
+ from .data_sinks import DataSinkUpdateComponent, DataSinkUpdateComponentOne
17
+ from .data_sources import DataSourceUpdateComponent, DataSourceUpdateComponentOne, DataSourceUpdateCustomMetadataValue
18
+ from .files import FileCreateResourceInfoValue
19
+ from .pipelines import PipelineFileUpdateCustomMetadataValue
20
+
21
+ __all__ = [
22
+ "DataSinkUpdateComponent",
23
+ "DataSinkUpdateComponentOne",
24
+ "DataSourceUpdateComponent",
25
+ "DataSourceUpdateComponentOne",
26
+ "DataSourceUpdateCustomMetadataValue",
27
+ "FileCreateResourceInfoValue",
28
+ "PipelineFileUpdateCustomMetadataValue",
29
+ "api_keys",
30
+ "billing",
31
+ "component_definitions",
32
+ "data_sinks",
33
+ "data_sources",
34
+ "deprecated",
35
+ "evals",
36
+ "files",
37
+ "parsing",
38
+ "pipelines",
39
+ "projects",
40
+ ]
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+