llama-cloud 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of llama-cloud might be problematic. Click here for more details.
- llama_cloud-0.0.1/LICENSE +21 -0
- llama_cloud-0.0.1/PKG-INFO +25 -0
- llama_cloud-0.0.1/README.md +7 -0
- llama_cloud-0.0.1/llama_cloud/__init__.py +295 -0
- llama_cloud-0.0.1/llama_cloud/client.py +72 -0
- llama_cloud-0.0.1/llama_cloud/core/__init__.py +17 -0
- llama_cloud-0.0.1/llama_cloud/core/api_error.py +15 -0
- llama_cloud-0.0.1/llama_cloud/core/client_wrapper.py +51 -0
- llama_cloud-0.0.1/llama_cloud/core/datetime_utils.py +28 -0
- llama_cloud-0.0.1/llama_cloud/core/jsonable_encoder.py +103 -0
- llama_cloud-0.0.1/llama_cloud/core/remove_none_from_dict.py +11 -0
- llama_cloud-0.0.1/llama_cloud/errors/__init__.py +5 -0
- llama_cloud-0.0.1/llama_cloud/errors/unprocessable_entity_error.py +9 -0
- llama_cloud-0.0.1/llama_cloud/resources/__init__.py +40 -0
- llama_cloud-0.0.1/llama_cloud/resources/api_keys/__init__.py +2 -0
- llama_cloud-0.0.1/llama_cloud/resources/api_keys/client.py +302 -0
- llama_cloud-0.0.1/llama_cloud/resources/billing/__init__.py +2 -0
- llama_cloud-0.0.1/llama_cloud/resources/billing/client.py +234 -0
- llama_cloud-0.0.1/llama_cloud/resources/component_definitions/__init__.py +2 -0
- llama_cloud-0.0.1/llama_cloud/resources/component_definitions/client.py +192 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sinks/__init__.py +5 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sinks/client.py +506 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sinks/types/__init__.py +6 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sinks/types/data_sink_update_component.py +7 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sinks/types/data_sink_update_component_one.py +17 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sources/__init__.py +5 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sources/client.py +521 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sources/types/__init__.py +7 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sources/types/data_source_update_component.py +7 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sources/types/data_source_update_component_one.py +19 -0
- llama_cloud-0.0.1/llama_cloud/resources/data_sources/types/data_source_update_custom_metadata_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/resources/deprecated/__init__.py +2 -0
- llama_cloud-0.0.1/llama_cloud/resources/deprecated/client.py +982 -0
- llama_cloud-0.0.1/llama_cloud/resources/evals/__init__.py +2 -0
- llama_cloud-0.0.1/llama_cloud/resources/evals/client.py +745 -0
- llama_cloud-0.0.1/llama_cloud/resources/files/__init__.py +5 -0
- llama_cloud-0.0.1/llama_cloud/resources/files/client.py +560 -0
- llama_cloud-0.0.1/llama_cloud/resources/files/types/__init__.py +5 -0
- llama_cloud-0.0.1/llama_cloud/resources/files/types/file_create_resource_info_value.py +5 -0
- llama_cloud-0.0.1/llama_cloud/resources/parsing/__init__.py +2 -0
- llama_cloud-0.0.1/llama_cloud/resources/parsing/client.py +982 -0
- llama_cloud-0.0.1/llama_cloud/resources/pipelines/__init__.py +5 -0
- llama_cloud-0.0.1/llama_cloud/resources/pipelines/client.py +2599 -0
- llama_cloud-0.0.1/llama_cloud/resources/pipelines/types/__init__.py +5 -0
- llama_cloud-0.0.1/llama_cloud/resources/pipelines/types/pipeline_file_update_custom_metadata_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/resources/projects/__init__.py +2 -0
- llama_cloud-0.0.1/llama_cloud/resources/projects/client.py +1231 -0
- llama_cloud-0.0.1/llama_cloud/types/__init__.py +253 -0
- llama_cloud-0.0.1/llama_cloud/types/api_key.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/azure_open_ai_embedding.py +75 -0
- llama_cloud-0.0.1/llama_cloud/types/base.py +26 -0
- llama_cloud-0.0.1/llama_cloud/types/base_prompt_template.py +44 -0
- llama_cloud-0.0.1/llama_cloud/types/bedrock_embedding.py +56 -0
- llama_cloud-0.0.1/llama_cloud/types/chat_message.py +35 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_az_storage_blob_data_source.py +40 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_chroma_vector_store.py +40 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_document.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_document_create.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_gcs_data_source.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_google_drive_data_source.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_one_drive_data_source.py +38 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_pinecone_vector_store.py +46 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_postgres_vector_store.py +44 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_qdrant_vector_store.py +48 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_s_3_data_source.py +42 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_sharepoint_data_source.py +38 -0
- llama_cloud-0.0.1/llama_cloud/types/cloud_weaviate_vector_store.py +38 -0
- llama_cloud-0.0.1/llama_cloud/types/code_splitter.py +46 -0
- llama_cloud-0.0.1/llama_cloud/types/cohere_embedding.py +46 -0
- llama_cloud-0.0.1/llama_cloud/types/configurable_data_sink_names.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/configurable_data_source_names.py +41 -0
- llama_cloud-0.0.1/llama_cloud/types/configurable_transformation_definition.py +45 -0
- llama_cloud-0.0.1/llama_cloud/types/configurable_transformation_names.py +73 -0
- llama_cloud-0.0.1/llama_cloud/types/configured_transformation_item.py +43 -0
- llama_cloud-0.0.1/llama_cloud/types/configured_transformation_item_component.py +9 -0
- llama_cloud-0.0.1/llama_cloud/types/configured_transformation_item_component_one.py +35 -0
- llama_cloud-0.0.1/llama_cloud/types/data_sink.py +40 -0
- llama_cloud-0.0.1/llama_cloud/types/data_sink_component.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/data_sink_component_one.py +17 -0
- llama_cloud-0.0.1/llama_cloud/types/data_sink_create.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/data_sink_create_component.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/data_sink_create_component_one.py +17 -0
- llama_cloud-0.0.1/llama_cloud/types/data_sink_definition.py +41 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source.py +44 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_component.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_component_one.py +19 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_create.py +40 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_create_component.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_create_component_one.py +19 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_create_custom_metadata_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_custom_metadata_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/data_source_definition.py +41 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_dataset.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_dataset_job_params.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_dataset_job_record.py +59 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_execution_params.py +38 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_execution_params_override.py +38 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_llm_model_data.py +33 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_question.py +39 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_question_create.py +28 -0
- llama_cloud-0.0.1/llama_cloud/types/eval_question_result.py +49 -0
- llama_cloud-0.0.1/llama_cloud/types/file.py +46 -0
- llama_cloud-0.0.1/llama_cloud/types/file_resource_info_value.py +5 -0
- llama_cloud-0.0.1/llama_cloud/types/filter_condition.py +21 -0
- llama_cloud-0.0.1/llama_cloud/types/filter_operator.py +65 -0
- llama_cloud-0.0.1/llama_cloud/types/gemini_embedding.py +51 -0
- llama_cloud-0.0.1/llama_cloud/types/html_node_parser.py +44 -0
- llama_cloud-0.0.1/llama_cloud/types/http_validation_error.py +29 -0
- llama_cloud-0.0.1/llama_cloud/types/hugging_face_inference_api_embedding.py +68 -0
- llama_cloud-0.0.1/llama_cloud/types/hugging_face_inference_api_embedding_token.py +5 -0
- llama_cloud-0.0.1/llama_cloud/types/json_node_parser.py +43 -0
- llama_cloud-0.0.1/llama_cloud/types/llama_parse_supported_file_extensions.py +161 -0
- llama_cloud-0.0.1/llama_cloud/types/llm.py +55 -0
- llama_cloud-0.0.1/llama_cloud/types/local_eval.py +46 -0
- llama_cloud-0.0.1/llama_cloud/types/local_eval_results.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/local_eval_sets.py +30 -0
- llama_cloud-0.0.1/llama_cloud/types/managed_ingestion_status.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/markdown_element_node_parser.py +49 -0
- llama_cloud-0.0.1/llama_cloud/types/markdown_node_parser.py +43 -0
- llama_cloud-0.0.1/llama_cloud/types/message_role.py +45 -0
- llama_cloud-0.0.1/llama_cloud/types/metadata_filter.py +41 -0
- llama_cloud-0.0.1/llama_cloud/types/metadata_filter_value.py +5 -0
- llama_cloud-0.0.1/llama_cloud/types/metadata_filters.py +41 -0
- llama_cloud-0.0.1/llama_cloud/types/metadata_filters_filters_item.py +8 -0
- llama_cloud-0.0.1/llama_cloud/types/metric_result.py +30 -0
- llama_cloud-0.0.1/llama_cloud/types/node_parser.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/object_type.py +33 -0
- llama_cloud-0.0.1/llama_cloud/types/open_ai_embedding.py +73 -0
- llama_cloud-0.0.1/llama_cloud/types/parser_languages.py +361 -0
- llama_cloud-0.0.1/llama_cloud/types/parsing_history_item.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/parsing_job.py +30 -0
- llama_cloud-0.0.1/llama_cloud/types/parsing_job_json_result.py +29 -0
- llama_cloud-0.0.1/llama_cloud/types/parsing_job_markdown_result.py +29 -0
- llama_cloud-0.0.1/llama_cloud/types/parsing_job_text_result.py +29 -0
- llama_cloud-0.0.1/llama_cloud/types/parsing_usage.py +29 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline.py +64 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_create.py +61 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_data_source.py +46 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_data_source_component.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_data_source_component_one.py +19 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_data_source_create.py +32 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_data_source_custom_metadata_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_deployment.py +38 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_file.py +52 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_file_create.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_file_create_custom_metadata_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_file_custom_metadata_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_file_resource_info_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_file_status_response.py +35 -0
- llama_cloud-0.0.1/llama_cloud/types/pipeline_type.py +21 -0
- llama_cloud-0.0.1/llama_cloud/types/pooling.py +29 -0
- llama_cloud-0.0.1/llama_cloud/types/preset_retrieval_params.py +40 -0
- llama_cloud-0.0.1/llama_cloud/types/presigned_url.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/project.py +42 -0
- llama_cloud-0.0.1/llama_cloud/types/project_create.py +32 -0
- llama_cloud-0.0.1/llama_cloud/types/prompt_mixin_prompts.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/prompt_spec.py +35 -0
- llama_cloud-0.0.1/llama_cloud/types/pydantic_program_mode.py +41 -0
- llama_cloud-0.0.1/llama_cloud/types/related_node_info.py +37 -0
- llama_cloud-0.0.1/llama_cloud/types/retrieve_results.py +40 -0
- llama_cloud-0.0.1/llama_cloud/types/sentence_splitter.py +48 -0
- llama_cloud-0.0.1/llama_cloud/types/simple_file_node_parser.py +44 -0
- llama_cloud-0.0.1/llama_cloud/types/status_enum.py +33 -0
- llama_cloud-0.0.1/llama_cloud/types/supported_eval_llm_model.py +35 -0
- llama_cloud-0.0.1/llama_cloud/types/supported_eval_llm_model_names.py +29 -0
- llama_cloud-0.0.1/llama_cloud/types/text_node.py +62 -0
- llama_cloud-0.0.1/llama_cloud/types/text_node_relationships_value.py +7 -0
- llama_cloud-0.0.1/llama_cloud/types/text_node_with_score.py +36 -0
- llama_cloud-0.0.1/llama_cloud/types/token_text_splitter.py +43 -0
- llama_cloud-0.0.1/llama_cloud/types/transformation_category_names.py +21 -0
- llama_cloud-0.0.1/llama_cloud/types/validation_error.py +31 -0
- llama_cloud-0.0.1/llama_cloud/types/validation_error_loc_item.py +5 -0
- llama_cloud-0.0.1/pyproject.toml +16 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 LlamaIndex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: llama-cloud
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Logan Markewich
|
|
6
|
+
Author-email: logan@runllama.ai
|
|
7
|
+
Requires-Python: >=3.8,<4
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Dist: httpx (>=0.20.0)
|
|
15
|
+
Requires-Dist: pydantic (>=1.10)
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# LlamaIndex Python Client
|
|
19
|
+
|
|
20
|
+
This client is auto-generated using [Fern](https://buildwithfern.com/docs/intro)
|
|
21
|
+
|
|
22
|
+
To publish:
|
|
23
|
+
- update the version in `pyproject.toml`
|
|
24
|
+
- run `poetry publish --build`
|
|
25
|
+
|
|
@@ -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
|
+
]
|
|
@@ -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,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)
|