From 881adc43f95ac08413df1e580a0831055e150eba Mon Sep 17 00:00:00 2001 From: Zhongpin Wang Date: Fri, 28 Aug 2026 18:03:09 +0800 Subject: [PATCH 1/6] Some vibe coded solution using openapi-generator --- .../document_grounding_generation/__init__.py | 418 ++ .../document_grounding_generation/client.py | 63 + .../generated/__init__.py | 454 ++ .../generated/api/__init__.py | 8 + .../api/metadata_configurations_api.py | 2054 +++++++ .../generated/api/pipelines_api.py | 4340 +++++++++++++++ .../generated/api/retrieval_api.py | 951 ++++ .../generated/api/vector_api.py | 4840 +++++++++++++++++ .../generated/api_client.py | 833 +++ .../generated/api_response.py | 21 + .../generated/configuration.py | 654 +++ .../generated/exceptions.py | 218 + .../generated/models/__init__.py | 216 + .../generated/models/api_error.py | 103 + .../generated/models/base_document.py | 104 + .../models/base_pipeline_minimal_response.py | 96 + .../models/base_pipeline_response.py | 96 + .../models/batch_update_document_success.py | 98 + .../batch_update_documents_response_inner.py | 137 + .../generated/models/binary_boolean_filter.py | 109 + .../boosting_score_computation_strategy.py | 37 + .../models/boosting_scoring_configuration.py | 117 + ...ng_scoring_configuration_metadata_inner.py | 105 + .../generated/models/chunk.py | 99 + .../generated/models/collection.py | 111 + .../models/collection_created_response.py | 90 + .../models/collection_deleted_response.py | 90 + .../models/collection_pending_response.py | 88 + .../generated/models/collection_request.py | 116 + .../models/collections_list_response.py | 97 + .../models/configuration_document.py | 121 + .../configuration_document_full_details.py | 120 + .../generated/models/create_pipeline.py | 224 + .../generated/models/data_repositories.py | 97 + .../generated/models/data_repository.py | 117 + ...ata_repository_per_filter_search_result.py | 97 + .../models/data_repository_search_result.py | 92 + .../models/data_repository_search_results.py | 95 + .../generated/models/data_repository_type.py | 38 + .../models/data_repository_with_documents.py | 123 + .../dense_retrieval_scoring_configuration.py | 100 + .../models/details_error_response.py | 90 + .../generated/models/document.py | 106 + .../models/document_bulk_delete_request.py | 90 + .../models/document_bulk_delete_response.py | 91 + .../models/document_create_request.py | 95 + .../generated/models/document_input.py | 107 + .../models/document_key_value_list_pair.py | 94 + .../generated/models/document_metadata.py | 112 + .../models/document_metadata_batch_request.py | 96 + .../models/document_metadata_update.py | 99 + .../models/document_metadata_update_error.py | 92 + .../generated/models/document_output.py | 107 + .../generated/models/document_response.py | 107 + .../generated/models/document_status.py | 42 + .../models/document_update_request.py | 95 + .../models/document_without_chunks.py | 98 + .../generated/models/documents.py | 97 + .../generated/models/documents_chunk.py | 109 + .../models/documents_list_response.py | 95 + .../models/documents_status_response.py | 97 + ...cuments_status_response_resources_inner.py | 135 + .../generated/models/embedding_config.py | 89 + .../generated/models/error_response.py | 88 + .../generated/models/filter.py | 140 + .../models/filter_match_mode_enum.py | 37 + .../generated/models/filters_inner.py | 134 + .../generated/models/generic_error.py | 88 + .../models/get_all_pipelines400_response.py | 92 + ..._collection_creation_status200_response.py | 137 + ..._collection_deletion_status200_response.py | 137 + .../generated/models/get_pipeline.py | 210 + .../models/get_pipeline_execution_by_id.py | 100 + .../models/get_pipeline_executions.py | 97 + .../generated/models/get_pipeline_status.py | 141 + .../generated/models/get_pipelines.py | 97 + .../generated/models/google_drive_config.py | 112 + .../google_drive_configuration_minimal.py | 92 + .../google_drive_configuration_struct.py | 111 + .../google_drive_pipeline_create_request.py | 107 + .../google_drive_pipeline_get_response.py | 109 + .../google_drive_pipeline_minimal_response.py | 113 + .../models/google_drive_resource_detail.py | 115 + .../generated/models/http_validation_error.py | 95 + .../generated/models/key_value_list_pair.py | 91 + ...ey_word_retrieval_scoring_configuration.py | 107 + .../generated/models/left.py | 136 + .../generated/models/left1.py | 136 + .../models/list_configuration_documents.py | 97 + ...st_configuration_documents_full_details.py | 97 + .../models/list_metadata_configurations.py | 97 + .../generated/models/location_inner.py | 138 + .../models/manual_pipeline_trigger.py | 90 + .../models/merge_strategy_reranker.py | 127 + .../merge_strategy_reranker_boosting_inner.py | 93 + .../models/merge_strategy_score_reuse.py | 89 + .../generated/models/merge_strategy_type.py | 39 + .../generated/models/message_response.py | 88 + .../generated/models/meta_data.py | 110 + ...eta_data_data_repository_metadata_inner.py | 91 + .../models/meta_data_key_value_pair_strict.py | 104 + .../models/metadata_configuration.py | 120 + .../models/metadata_configuration_metadata.py | 95 + .../models/metadata_configuration_request.py | 113 + ...data_configuration_request_labels_inner.py | 90 + .../models/metadata_configuration_response.py | 130 + .../models/metadata_configuration_struct.py | 104 + .../generated/models/metadata_item.py | 103 + .../generated/models/metadata_key_update.py | 103 + .../generated/models/metadata_operation.py | 96 + .../models/metadata_operation_enum.py | 39 + .../generated/models/metadata_response.py | 100 + .../generated/models/metadata_update_item.py | 98 + .../generated/models/metadata_updates.py | 95 + .../models/ms_share_point_configuration.py | 109 + ..._share_point_configuration_get_response.py | 94 + .../ms_share_point_configuration_minimal.py | 92 + .../ms_share_point_pipeline_create_request.py | 120 + .../ms_share_point_pipeline_get_response.py | 109 + ...s_share_point_pipeline_minimal_response.py | 113 + .../generated/models/patch_pipeline.py | 98 + .../models/patch_pipeline_configuration.py | 88 + .../models/patch_pipeline_metadata.py | 95 + .../models/per_filter_search_result.py | 97 + .../models/per_filter_search_result_error.py | 88 + .../per_filter_search_result_with_error.py | 94 + .../models/pipeline_document_response.py | 135 + .../models/pipeline_execution_data.py | 131 + .../models/pipeline_execution_status.py | 46 + .../generated/models/pipeline_id.py | 88 + .../models/pipeline_minimal_response.py | 210 + .../post_processing_object_reference.py | 93 + .../models/post_processing_operation.py | 118 + .../generated/models/results_inner.py | 119 + .../generated/models/results_inner1.py | 134 + .../generated/models/results_inner2.py | 134 + .../models/retrieval_binary_boolean_filter.py | 109 + .../generated/models/retrieval_chunk.py | 111 + ...retrieval_data_repository_search_result.py | 92 + .../retrieval_document_key_value_list_pair.py | 94 + .../models/retrieval_key_value_list_pair.py | 91 + .../retrieval_per_filter_search_result.py | 104 + ...etrieval_per_filter_search_result_error.py | 88 + ...val_per_filter_search_result_with_error.py | 94 + .../retrieval_scoped_key_value_list_pair.py | 103 + .../models/retrieval_search_configuration.py | 101 + ...val_search_document_key_value_list_pair.py | 99 + .../models/retrieval_search_filter.py | 137 + .../models/retrieval_search_input.py | 112 + ...eval_search_input_post_processing_inner.py | 116 + ...nput_post_processing_inner_inputs_inner.py | 139 + ...ch_input_post_processing_inner_strategy.py | 137 + .../models/retrieval_search_results.py | 95 + .../retrieval_search_select_option_enum.py | 36 + .../models/retrieval_vector_search_filter.py | 154 + .../retrieval_vector_search_filter_filter.py | 140 + .../generated/models/right.py | 136 + .../generated/models/right1.py | 136 + .../generated/models/s3_configuration.py | 109 + .../models/s3_configuration_minimal.py | 92 + .../models/s3_pipeline_create_request.py | 120 + .../models/s3_pipeline_get_response.py | 109 + .../models/s3_pipeline_minimal_response.py | 113 + .../models/scoped_key_value_list_pair.py | 103 + .../generated/models/score.py | 88 + .../models/scores_aggregation_strategy.py | 38 + .../models/sdm_pipeline_create_request.py | 114 + .../models/sdm_pipeline_get_response.py | 103 + .../models/sdm_pipeline_minimal_response.py | 107 + .../generated/models/search_configuration.py | 101 + .../search_document_key_value_list_pair.py | 94 + .../generated/models/search_filter.py | 123 + .../generated/models/search_pipeline.py | 95 + .../models/search_pipelines_response.py | 97 + .../generated/models/search_results.py | 95 + .../generated/models/search_scores.py | 97 + .../models/search_scores_aggregated_score.py | 88 + .../models/search_select_option_enum.py | 36 + .../generated/models/service_now_config.py | 102 + .../service_now_configuration_minimal.py | 94 + ...e_now_configuration_minimal_service_now.py | 88 + .../service_now_configuration_struct.py | 111 + .../service_now_pipeline_create_request.py | 120 + .../service_now_pipeline_get_response.py | 109 + .../service_now_pipeline_minimal_response.py | 107 + .../generated/models/sftp_configuration.py | 109 + .../models/sftp_configuration_minimal.py | 92 + .../models/sftp_pipeline_create_request.py | 120 + .../models/sftp_pipeline_get_response.py | 109 + .../models/sftp_pipeline_minimal_response.py | 113 + .../generated/models/share_point_config.py | 105 + .../models/share_point_config_get_response.py | 92 + .../generated/models/share_point_site.py | 103 + .../models/share_point_site_detail.py | 92 + .../models/share_point_site_get_response.py | 92 + .../generated/models/strategy.py | 137 + .../generated/models/text_only_base_chunk.py | 100 + .../models/text_only_base_chunk_create.py | 97 + .../generated/models/text_search_request.py | 103 + .../generated/models/validation_error.py | 108 + .../generated/models/vector_chunk.py | 99 + .../vector_document_key_value_list_pair.py | 94 + .../models/vector_key_value_list_pair.py | 91 + .../models/vector_per_filter_search_result.py | 97 + .../models/vector_scoring_configuration.py | 114 + .../models/vector_search_configuration.py | 101 + ...tor_search_document_key_value_list_pair.py | 99 + .../generated/models/vector_search_filter.py | 143 + .../generated/models/vector_search_results.py | 95 + .../vector_search_select_option_enum.py | 36 + .../work_zone_pipeline_create_request.py | 114 + .../models/work_zone_pipeline_get_response.py | 103 + .../work_zone_pipeline_minimal_response.py | 107 + .../generated/py.typed | 0 .../generated/rest.py | 334 ++ packages/openapi-generator/Makefile | 41 + .../config/openapitools.json | 7 + .../config/python-config.yaml | 43 + packages/openapi-generator/openapitools.json | 7 + packages/openapi-generator/pyproject.toml | 30 + .../specs/document-grounding/api.yaml | 4686 ++++++++++++++++ .../options-per-service.json | 7 + .../src/sap_openapi_generator/__init__.py | 1 + .../sap_openapi_generator/preprocess_spec.py | 230 + .../tests/test_preprocess_spec.py | 352 ++ sample_code/Makefile | 2 + sample_code/README.md | 41 + sample_code/pyproject.toml | 25 + sample_code/pyrightconfig.json | 9 + sample_code/src/__init__.py | 0 sample_code/src/amazon.py | 25 + sample_code/src/core.py | 80 + .../src/document_grounding_generation.py | 79 + sample_code/src/google.py | 69 + sample_code/src/openai.py | 169 + sample_code/src/orchestration.py | 867 +++ sample_code/src/server.py | 77 + 237 files changed, 43026 insertions(+) create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/__init__.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/client.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/py.typed create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py create mode 100644 packages/openapi-generator/Makefile create mode 100644 packages/openapi-generator/config/openapitools.json create mode 100644 packages/openapi-generator/config/python-config.yaml create mode 100644 packages/openapi-generator/openapitools.json create mode 100644 packages/openapi-generator/pyproject.toml create mode 100644 packages/openapi-generator/specs/document-grounding/api.yaml create mode 100644 packages/openapi-generator/specs/document-grounding/options-per-service.json create mode 100644 packages/openapi-generator/src/sap_openapi_generator/__init__.py create mode 100644 packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py create mode 100644 packages/openapi-generator/tests/test_preprocess_spec.py create mode 100644 sample_code/Makefile create mode 100644 sample_code/README.md create mode 100644 sample_code/pyproject.toml create mode 100644 sample_code/pyrightconfig.json create mode 100644 sample_code/src/__init__.py create mode 100644 sample_code/src/amazon.py create mode 100644 sample_code/src/core.py create mode 100644 sample_code/src/document_grounding_generation.py create mode 100644 sample_code/src/google.py create mode 100644 sample_code/src/openai.py create mode 100644 sample_code/src/orchestration.py create mode 100644 sample_code/src/server.py diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py new file mode 100644 index 00000000..63d2cca9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py @@ -0,0 +1,418 @@ +from gen_ai_hub.document_grounding_generation.client import GroundingApiClient +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi +from gen_ai_hub.document_grounding_generation.generated.models import ( # noqa: F401 + ApiError, + BaseDocument, + BasePipelineMinimalResponse, + BasePipelineResponse, + BatchUpdateDocumentSuccess, + BatchUpdateDocumentsResponseInner, + BinaryBooleanFilter, + BoostingScoreComputationStrategy, + BoostingScoringConfiguration, + BoostingScoringConfigurationMetadataInner, + Chunk, + Collection, + CollectionCreatedResponse, + CollectionDeletedResponse, + CollectionPendingResponse, + CollectionRequest, + CollectionsListResponse, + ConfigurationDocument, + ConfigurationDocumentFullDetails, + CreatePipeline, + DataRepositories, + DataRepository, + DataRepositoryPerFilterSearchResult, + DataRepositorySearchResult, + DataRepositorySearchResults, + DataRepositoryType, + DataRepositoryWithDocuments, + DenseRetrievalScoringConfiguration, + DetailsErrorResponse, + Document, + DocumentBulkDeleteRequest, + DocumentBulkDeleteResponse, + DocumentCreateRequest, + DocumentInput, + DocumentKeyValueListPair, + DocumentMetadata, + DocumentMetadataBatchRequest, + DocumentMetadataUpdate, + DocumentMetadataUpdateError, + DocumentOutput, + DocumentResponse, + DocumentStatus, + DocumentUpdateRequest, + DocumentWithoutChunks, + Documents, + DocumentsChunk, + DocumentsListResponse, + DocumentsStatusResponse, + DocumentsStatusResponseResourcesInner, + EmbeddingConfig, + ErrorResponse, + Filter, + FilterMatchModeEnum, + FiltersInner, + GenericError, + GetAllPipelines400Response, + GetCollectionCreationStatus200Response, + GetCollectionDeletionStatus200Response, + GetPipeline, + GetPipelineExecutionById, + GetPipelineExecutions, + GetPipelineStatus, + GetPipelines, + GoogleDriveConfig, + GoogleDriveConfigurationMinimal, + GoogleDriveConfigurationStruct, + GoogleDrivePipelineCreateRequest, + GoogleDrivePipelineGetResponse, + GoogleDrivePipelineMinimalResponse, + GoogleDriveResourceDetail, + HTTPValidationError, + KeyValueListPair, + KeyWordRetrievalScoringConfiguration, + Left, + Left1, + ListConfigurationDocuments, + ListConfigurationDocumentsFullDetails, + ListMetadataConfigurations, + LocationInner, + ManualPipelineTrigger, + MergeStrategyReranker, + MergeStrategyRerankerBoostingInner, + MergeStrategyScoreReuse, + MergeStrategyType, + MessageResponse, + MSSharePointConfiguration, + MSSharePointConfigurationGetResponse, + MSSharePointConfigurationMinimal, + MSSharePointPipelineCreateRequest, + MSSharePointPipelineGetResponse, + MSSharePointPipelineMinimalResponse, + MetaData, + MetaDataDataRepositoryMetadataInner, + MetaDataKeyValuePairStrict, + MetadataConfiguration, + MetadataConfigurationMetadata, + MetadataConfigurationRequest, + MetadataConfigurationRequestLabelsInner, + MetadataConfigurationResponse, + MetadataConfigurationStruct, + MetadataItem, + MetadataKeyUpdate, + MetadataOperation, + MetadataOperationEnum, + MetadataResponse, + MetadataUpdateItem, + MetadataUpdates, + PatchPipeline, + PatchPipelineConfiguration, + PatchPipelineMetadata, + PerFilterSearchResult, + PerFilterSearchResultError, + PerFilterSearchResultWithError, + PipelineDocumentResponse, + PipelineExecutionData, + PipelineExecutionStatus, + PipelineId, + PipelineMinimalResponse, + PostProcessingObjectReference, + PostProcessingOperation, + ResultsInner, + ResultsInner1, + ResultsInner2, + RetrievalBinaryBooleanFilter, + RetrievalChunk, + RetrievalDataRepositorySearchResult, + RetrievalDocumentKeyValueListPair, + RetrievalKeyValueListPair, + RetrievalPerFilterSearchResult, + RetrievalPerFilterSearchResultError, + RetrievalPerFilterSearchResultWithError, + RetrievalScopedKeyValueListPair, + RetrievalSearchConfiguration, + RetrievalSearchDocumentKeyValueListPair, + RetrievalSearchFilter, + RetrievalSearchInput, + RetrievalSearchInputPostProcessingInner, + RetrievalSearchInputPostProcessingInnerInputsInner, + RetrievalSearchInputPostProcessingInnerStrategy, + RetrievalSearchResults, + RetrievalSearchSelectOptionEnum, + RetrievalVectorSearchFilter, + RetrievalVectorSearchFilterFilter, + Right, + Right1, + S3Configuration, + S3ConfigurationMinimal, + S3PipelineCreateRequest, + S3PipelineGetResponse, + S3PipelineMinimalResponse, + SDMPipelineCreateRequest, + SDMPipelineGetResponse, + SDMPipelineMinimalResponse, + SFTPConfiguration, + SFTPConfigurationMinimal, + SFTPPipelineCreateRequest, + SFTPPipelineGetResponse, + SFTPPipelineMinimalResponse, + ScopedKeyValueListPair, + Score, + ScoresAggregationStrategy, + SearchConfiguration, + SearchDocumentKeyValueListPair, + SearchFilter, + SearchPipeline, + SearchPipelinesResponse, + SearchResults, + SearchScores, + SearchScoresAggregatedScore, + SearchSelectOptionEnum, + ServiceNowConfig, + ServiceNowConfigurationMinimal, + ServiceNowConfigurationMinimalServiceNow, + ServiceNowConfigurationStruct, + ServiceNowPipelineCreateRequest, + ServiceNowPipelineGetResponse, + ServiceNowPipelineMinimalResponse, + SharePointConfig, + SharePointConfigGetResponse, + SharePointSite, + SharePointSiteDetail, + SharePointSiteGetResponse, + Strategy, + TextOnlyBaseChunk, + TextOnlyBaseChunkCreate, + TextSearchRequest, + ValidationError, + VectorChunk, + VectorDocumentKeyValueListPair, + VectorKeyValueListPair, + VectorPerFilterSearchResult, + VectorScoringConfiguration, + VectorSearchConfiguration, + VectorSearchDocumentKeyValueListPair, + VectorSearchFilter, + VectorSearchResults, + VectorSearchSelectOptionEnum, + WorkZonePipelineCreateRequest, + WorkZonePipelineGetResponse, + WorkZonePipelineMinimalResponse, +) + +__all__ = [ + # Client + "GroundingApiClient", + # API classes + "MetadataConfigurationsApi", + "PipelinesApi", + "RetrievalApi", + "VectorApi", + # Models + "ApiError", + "BaseDocument", + "BasePipelineMinimalResponse", + "BasePipelineResponse", + "BatchUpdateDocumentSuccess", + "BatchUpdateDocumentsResponseInner", + "BinaryBooleanFilter", + "BoostingScoreComputationStrategy", + "BoostingScoringConfiguration", + "BoostingScoringConfigurationMetadataInner", + "Chunk", + "Collection", + "CollectionCreatedResponse", + "CollectionDeletedResponse", + "CollectionPendingResponse", + "CollectionRequest", + "CollectionsListResponse", + "ConfigurationDocument", + "ConfigurationDocumentFullDetails", + "CreatePipeline", + "DataRepositories", + "DataRepository", + "DataRepositoryPerFilterSearchResult", + "DataRepositorySearchResult", + "DataRepositorySearchResults", + "DataRepositoryType", + "DataRepositoryWithDocuments", + "DenseRetrievalScoringConfiguration", + "DetailsErrorResponse", + "Document", + "DocumentBulkDeleteRequest", + "DocumentBulkDeleteResponse", + "DocumentCreateRequest", + "DocumentInput", + "DocumentKeyValueListPair", + "DocumentMetadata", + "DocumentMetadataBatchRequest", + "DocumentMetadataUpdate", + "DocumentMetadataUpdateError", + "DocumentOutput", + "DocumentResponse", + "DocumentStatus", + "DocumentUpdateRequest", + "DocumentWithoutChunks", + "Documents", + "DocumentsChunk", + "DocumentsListResponse", + "DocumentsStatusResponse", + "DocumentsStatusResponseResourcesInner", + "EmbeddingConfig", + "ErrorResponse", + "Filter", + "FilterMatchModeEnum", + "FiltersInner", + "GenericError", + "GetAllPipelines400Response", + "GetCollectionCreationStatus200Response", + "GetCollectionDeletionStatus200Response", + "GetPipeline", + "GetPipelineExecutionById", + "GetPipelineExecutions", + "GetPipelineStatus", + "GetPipelines", + "GoogleDriveConfig", + "GoogleDriveConfigurationMinimal", + "GoogleDriveConfigurationStruct", + "GoogleDrivePipelineCreateRequest", + "GoogleDrivePipelineGetResponse", + "GoogleDrivePipelineMinimalResponse", + "GoogleDriveResourceDetail", + "HTTPValidationError", + "KeyValueListPair", + "KeyWordRetrievalScoringConfiguration", + "Left", + "Left1", + "ListConfigurationDocuments", + "ListConfigurationDocumentsFullDetails", + "ListMetadataConfigurations", + "LocationInner", + "ManualPipelineTrigger", + "MergeStrategyReranker", + "MergeStrategyRerankerBoostingInner", + "MergeStrategyScoreReuse", + "MergeStrategyType", + "MessageResponse", + "MSSharePointConfiguration", + "MSSharePointConfigurationGetResponse", + "MSSharePointConfigurationMinimal", + "MSSharePointPipelineCreateRequest", + "MSSharePointPipelineGetResponse", + "MSSharePointPipelineMinimalResponse", + "MetaData", + "MetaDataDataRepositoryMetadataInner", + "MetaDataKeyValuePairStrict", + "MetadataConfiguration", + "MetadataConfigurationMetadata", + "MetadataConfigurationRequest", + "MetadataConfigurationRequestLabelsInner", + "MetadataConfigurationResponse", + "MetadataConfigurationStruct", + "MetadataItem", + "MetadataKeyUpdate", + "MetadataOperation", + "MetadataOperationEnum", + "MetadataResponse", + "MetadataUpdateItem", + "MetadataUpdates", + "PatchPipeline", + "PatchPipelineConfiguration", + "PatchPipelineMetadata", + "PerFilterSearchResult", + "PerFilterSearchResultError", + "PerFilterSearchResultWithError", + "PipelineDocumentResponse", + "PipelineExecutionData", + "PipelineExecutionStatus", + "PipelineId", + "PipelineMinimalResponse", + "PostProcessingObjectReference", + "PostProcessingOperation", + "ResultsInner", + "ResultsInner1", + "ResultsInner2", + "RetrievalBinaryBooleanFilter", + "RetrievalChunk", + "RetrievalDataRepositorySearchResult", + "RetrievalDocumentKeyValueListPair", + "RetrievalKeyValueListPair", + "RetrievalPerFilterSearchResult", + "RetrievalPerFilterSearchResultError", + "RetrievalPerFilterSearchResultWithError", + "RetrievalScopedKeyValueListPair", + "RetrievalSearchConfiguration", + "RetrievalSearchDocumentKeyValueListPair", + "RetrievalSearchFilter", + "RetrievalSearchInput", + "RetrievalSearchInputPostProcessingInner", + "RetrievalSearchInputPostProcessingInnerInputsInner", + "RetrievalSearchInputPostProcessingInnerStrategy", + "RetrievalSearchResults", + "RetrievalSearchSelectOptionEnum", + "RetrievalVectorSearchFilter", + "RetrievalVectorSearchFilterFilter", + "Right", + "Right1", + "S3Configuration", + "S3ConfigurationMinimal", + "S3PipelineCreateRequest", + "S3PipelineGetResponse", + "S3PipelineMinimalResponse", + "SDMPipelineCreateRequest", + "SDMPipelineGetResponse", + "SDMPipelineMinimalResponse", + "SFTPConfiguration", + "SFTPConfigurationMinimal", + "SFTPPipelineCreateRequest", + "SFTPPipelineGetResponse", + "SFTPPipelineMinimalResponse", + "ScopedKeyValueListPair", + "Score", + "ScoresAggregationStrategy", + "SearchConfiguration", + "SearchDocumentKeyValueListPair", + "SearchFilter", + "SearchPipeline", + "SearchPipelinesResponse", + "SearchResults", + "SearchScores", + "SearchScoresAggregatedScore", + "SearchSelectOptionEnum", + "ServiceNowConfig", + "ServiceNowConfigurationMinimal", + "ServiceNowConfigurationMinimalServiceNow", + "ServiceNowConfigurationStruct", + "ServiceNowPipelineCreateRequest", + "ServiceNowPipelineGetResponse", + "ServiceNowPipelineMinimalResponse", + "SharePointConfig", + "SharePointConfigGetResponse", + "SharePointSite", + "SharePointSiteDetail", + "SharePointSiteGetResponse", + "Strategy", + "TextOnlyBaseChunk", + "TextOnlyBaseChunkCreate", + "TextSearchRequest", + "ValidationError", + "VectorChunk", + "VectorDocumentKeyValueListPair", + "VectorKeyValueListPair", + "VectorPerFilterSearchResult", + "VectorScoringConfiguration", + "VectorSearchConfiguration", + "VectorSearchDocumentKeyValueListPair", + "VectorSearchFilter", + "VectorSearchResults", + "VectorSearchSelectOptionEnum", + "WorkZonePipelineCreateRequest", + "WorkZonePipelineGetResponse", + "WorkZonePipelineMinimalResponse", +] diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/client.py b/packages/gen/gen_ai_hub/document_grounding_generation/client.py new file mode 100644 index 00000000..8a9521a4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/client.py @@ -0,0 +1,63 @@ +"""SAP AI Core authentication wiring for the generated document grounding client. + +Subclasses the generated RESTClientObject and ApiClient to inject auth headers +from an AiCoreV2Client or GenAIHubProxyClient via httpx event hooks — the same +pattern used in packages/gen (PR #44 utils.py). + +Usage: + from ai_core_sdk.ai_core_v2_client import AICoreV2Client + from gen_ai_hub.document_grounding_generation import GroundingApiClient, VectorApi + + client = GroundingApiClient(AICoreV2Client.from_env()) + collections = await VectorApi(client).get_all_collections( + header_parameters={"AI-Resource-Group": "default"} + ) +""" + +from __future__ import annotations + +from typing import Any + +import httpx + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration +from gen_ai_hub.document_grounding_generation.generated.rest import RESTClientObject + + +def _make_auth_hook(proxy_client: Any): + """Return an httpx request event hook that injects SAP AI Core auth headers.""" + + async def inject_auth(request: httpx.Request) -> None: + for key, value in proxy_client.request_header.items(): + request.headers[key] = value + + return inject_auth + + +class _SapRESTClientObject(RESTClientObject): + def __init__(self, configuration: Configuration, proxy_client: Any) -> None: + super().__init__(configuration) + self._proxy_client = proxy_client + + def _create_pool_manager(self) -> httpx.AsyncClient: + return httpx.AsyncClient( + event_hooks={"request": [_make_auth_hook(self._proxy_client)]} + ) + + +class GroundingApiClient(ApiClient): + """ApiClient pre-wired with SAP AI Core authentication. + + Args: + proxy_client: An AICoreV2Client or GenAIHubProxyClient instance. + Its request_header property is called per-request to inject + Authorization and AI-* headers. + base_url: Optional override for the service base URL. Defaults to the + basePath baked into Configuration (/lm/document-grounding). + """ + + def __init__(self, proxy_client: Any, base_url: str | None = None) -> None: + config = Configuration(host=base_url) if base_url else Configuration() + super().__init__(configuration=config) + self.rest_client = _SapRESTClientObject(config, proxy_client) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py new file mode 100644 index 00000000..17c372a9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py @@ -0,0 +1,454 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# Define package exports +__all__ = [ + "MetadataConfigurationsApi", + "PipelinesApi", + "RetrievalApi", + "VectorApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "ApiError", + "BaseDocument", + "BasePipelineMinimalResponse", + "BasePipelineResponse", + "BatchUpdateDocumentSuccess", + "BatchUpdateDocumentsResponseInner", + "BinaryBooleanFilter", + "BoostingScoreComputationStrategy", + "BoostingScoringConfiguration", + "BoostingScoringConfigurationMetadataInner", + "Chunk", + "Collection", + "CollectionCreatedResponse", + "CollectionDeletedResponse", + "CollectionPendingResponse", + "CollectionRequest", + "CollectionsListResponse", + "ConfigurationDocument", + "ConfigurationDocumentFullDetails", + "CreatePipeline", + "DataRepositories", + "DataRepository", + "DataRepositoryPerFilterSearchResult", + "DataRepositorySearchResult", + "DataRepositorySearchResults", + "DataRepositoryType", + "DataRepositoryWithDocuments", + "DenseRetrievalScoringConfiguration", + "DetailsErrorResponse", + "Document", + "DocumentBulkDeleteRequest", + "DocumentBulkDeleteResponse", + "DocumentCreateRequest", + "DocumentInput", + "DocumentKeyValueListPair", + "DocumentMetadata", + "DocumentMetadataBatchRequest", + "DocumentMetadataUpdate", + "DocumentMetadataUpdateError", + "DocumentOutput", + "DocumentResponse", + "DocumentStatus", + "DocumentUpdateRequest", + "DocumentWithoutChunks", + "Documents", + "DocumentsChunk", + "DocumentsListResponse", + "DocumentsStatusResponse", + "DocumentsStatusResponseResourcesInner", + "EmbeddingConfig", + "ErrorResponse", + "Filter", + "FilterMatchModeEnum", + "FiltersInner", + "GenericError", + "GetAllPipelines400Response", + "GetCollectionCreationStatus200Response", + "GetCollectionDeletionStatus200Response", + "GetPipeline", + "GetPipelineExecutionById", + "GetPipelineExecutions", + "GetPipelineStatus", + "GetPipelines", + "GoogleDriveConfig", + "GoogleDriveConfigurationMinimal", + "GoogleDriveConfigurationStruct", + "GoogleDrivePipelineCreateRequest", + "GoogleDrivePipelineGetResponse", + "GoogleDrivePipelineMinimalResponse", + "GoogleDriveResourceDetail", + "HTTPValidationError", + "KeyValueListPair", + "KeyWordRetrievalScoringConfiguration", + "Left", + "Left1", + "ListConfigurationDocuments", + "ListConfigurationDocumentsFullDetails", + "ListMetadataConfigurations", + "LocationInner", + "MSSharePointConfiguration", + "MSSharePointConfigurationGetResponse", + "MSSharePointConfigurationMinimal", + "MSSharePointPipelineCreateRequest", + "MSSharePointPipelineGetResponse", + "MSSharePointPipelineMinimalResponse", + "ManualPipelineTrigger", + "MergeStrategyReranker", + "MergeStrategyRerankerBoostingInner", + "MergeStrategyScoreReuse", + "MergeStrategyType", + "MessageResponse", + "MetaData", + "MetaDataDataRepositoryMetadataInner", + "MetaDataKeyValuePairStrict", + "MetadataConfiguration", + "MetadataConfigurationMetadata", + "MetadataConfigurationRequest", + "MetadataConfigurationRequestLabelsInner", + "MetadataConfigurationResponse", + "MetadataConfigurationStruct", + "MetadataItem", + "MetadataKeyUpdate", + "MetadataOperation", + "MetadataOperationEnum", + "MetadataResponse", + "MetadataUpdateItem", + "MetadataUpdates", + "PatchPipeline", + "PatchPipelineConfiguration", + "PatchPipelineMetadata", + "PerFilterSearchResult", + "PerFilterSearchResultError", + "PerFilterSearchResultWithError", + "PipelineDocumentResponse", + "PipelineExecutionData", + "PipelineExecutionStatus", + "PipelineId", + "PipelineMinimalResponse", + "PostProcessingObjectReference", + "PostProcessingOperation", + "ResultsInner", + "ResultsInner1", + "ResultsInner2", + "RetrievalBinaryBooleanFilter", + "RetrievalChunk", + "RetrievalDataRepositorySearchResult", + "RetrievalDocumentKeyValueListPair", + "RetrievalKeyValueListPair", + "RetrievalPerFilterSearchResult", + "RetrievalPerFilterSearchResultError", + "RetrievalPerFilterSearchResultWithError", + "RetrievalScopedKeyValueListPair", + "RetrievalSearchConfiguration", + "RetrievalSearchDocumentKeyValueListPair", + "RetrievalSearchFilter", + "RetrievalSearchInput", + "RetrievalSearchInputPostProcessingInner", + "RetrievalSearchInputPostProcessingInnerInputsInner", + "RetrievalSearchInputPostProcessingInnerStrategy", + "RetrievalSearchResults", + "RetrievalSearchSelectOptionEnum", + "RetrievalVectorSearchFilter", + "RetrievalVectorSearchFilterFilter", + "Right", + "Right1", + "S3Configuration", + "S3ConfigurationMinimal", + "S3PipelineCreateRequest", + "S3PipelineGetResponse", + "S3PipelineMinimalResponse", + "SDMPipelineCreateRequest", + "SDMPipelineGetResponse", + "SDMPipelineMinimalResponse", + "SFTPConfiguration", + "SFTPConfigurationMinimal", + "SFTPPipelineCreateRequest", + "SFTPPipelineGetResponse", + "SFTPPipelineMinimalResponse", + "ScopedKeyValueListPair", + "Score", + "ScoresAggregationStrategy", + "SearchConfiguration", + "SearchDocumentKeyValueListPair", + "SearchFilter", + "SearchPipeline", + "SearchPipelinesResponse", + "SearchResults", + "SearchScores", + "SearchScoresAggregatedScore", + "SearchSelectOptionEnum", + "ServiceNowConfig", + "ServiceNowConfigurationMinimal", + "ServiceNowConfigurationMinimalServiceNow", + "ServiceNowConfigurationStruct", + "ServiceNowPipelineCreateRequest", + "ServiceNowPipelineGetResponse", + "ServiceNowPipelineMinimalResponse", + "SharePointConfig", + "SharePointConfigGetResponse", + "SharePointSite", + "SharePointSiteDetail", + "SharePointSiteGetResponse", + "Strategy", + "TextOnlyBaseChunk", + "TextOnlyBaseChunkCreate", + "TextSearchRequest", + "ValidationError", + "VectorChunk", + "VectorDocumentKeyValueListPair", + "VectorKeyValueListPair", + "VectorPerFilterSearchResult", + "VectorScoringConfiguration", + "VectorSearchConfiguration", + "VectorSearchDocumentKeyValueListPair", + "VectorSearchFilter", + "VectorSearchResults", + "VectorSearchSelectOptionEnum", + "WorkZonePipelineCreateRequest", + "WorkZonePipelineGetResponse", + "WorkZonePipelineMinimalResponse", +] + +# import apis into sdk package +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi as MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi as PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi as RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi as VectorApi + +# import ApiClient +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse as ApiResponse +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient as ApiClient +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration as Configuration +from gen_ai_hub.document_grounding_generation.generated.exceptions import OpenApiException as OpenApiException +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiTypeError as ApiTypeError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiValueError as ApiValueError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiKeyError as ApiKeyError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiAttributeError as ApiAttributeError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiException as ApiException + +# import models into sdk package +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError as ApiError +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument as BaseDocument +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_minimal_response import BasePipelineMinimalResponse as BasePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_response import BasePipelineResponse as BasePipelineResponse +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_document_success import BatchUpdateDocumentSuccess as BatchUpdateDocumentSuccess +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner as BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter as BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy as BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration as BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner as BoostingScoringConfigurationMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.chunk import Chunk as Chunk +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection as Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse as CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse as CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse as CollectionPendingResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest as CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse as CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument as ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails as ConfigurationDocumentFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline as CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories as DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository as DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult as DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult as DataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_results import DataRepositorySearchResults as DataRepositorySearchResults +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType as DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments as DataRepositoryWithDocuments +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration as DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse as DetailsErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.document import Document as Document +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest as DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse as DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest as DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput as DocumentInput +from gen_ai_hub.document_grounding_generation.generated.models.document_key_value_list_pair import DocumentKeyValueListPair as DocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata as DocumentMetadata +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest as DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate as DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError as DocumentMetadataUpdateError +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput as DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse as DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus as DocumentStatus +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest as DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks as DocumentWithoutChunks +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents as Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk as DocumentsChunk +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse as DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse as DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner as DocumentsStatusResponseResourcesInner +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig as EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.error_response import ErrorResponse as ErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter as Filter +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum as FilterMatchModeEnum +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner as FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.generic_error import GenericError as GenericError +from gen_ai_hub.document_grounding_generation.generated.models.get_all_pipelines400_response import GetAllPipelines400Response as GetAllPipelines400Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response as GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response as GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline as GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById as GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions as GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus as GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines as GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig as GoogleDriveConfig +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal as GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct as GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest as GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse as GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse as GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail as GoogleDriveResourceDetail +from gen_ai_hub.document_grounding_generation.generated.models.http_validation_error import HTTPValidationError as HTTPValidationError +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair as KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration as KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.left import Left as Left +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 as Left1 +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments as ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents_full_details import ListConfigurationDocumentsFullDetails as ListConfigurationDocumentsFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations as ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner as LocationInner +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration as MSSharePointConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse as MSSharePointConfigurationGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal as MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest as MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse as MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse as MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger as ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker as MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner as MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse as MergeStrategyScoreReuse +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType as MergeStrategyType +from gen_ai_hub.document_grounding_generation.generated.models.message_response import MessageResponse as MessageResponse +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData as MetaData +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner as MetaDataDataRepositoryMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict as MetaDataKeyValuePairStrict +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration as MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata as MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest as MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner as MetadataConfigurationRequestLabelsInner +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse as MetadataConfigurationResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct as MetadataConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem as MetadataItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate as MetadataKeyUpdate +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation as MetadataOperation +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum as MetadataOperationEnum +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse as MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem as MetadataUpdateItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates as MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline as PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration as PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata as PatchPipelineMetadata +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult as PerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError as PerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError as PerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse as PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData as PipelineExecutionData +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus as PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId as PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse as PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference as PostProcessingObjectReference +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation as PostProcessingOperation +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner as ResultsInner +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 as ResultsInner1 +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 as ResultsInner2 +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter as RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk as RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult as RetrievalDataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair as RetrievalDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair as RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult as RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError as RetrievalPerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError as RetrievalPerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair as RetrievalScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration as RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair as RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter as RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput as RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner as RetrievalSearchInputPostProcessingInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner as RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy as RetrievalSearchInputPostProcessingInnerStrategy +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults as RetrievalSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum as RetrievalSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter as RetrievalVectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter as RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.right import Right as Right +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 as Right1 +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration as S3Configuration +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal as S3ConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest as S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse as S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse as S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest as SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse as SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse as SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration as SFTPConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal as SFTPConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest as SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse as SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse as SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair as ScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score as Score +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy as ScoresAggregationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration as SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair as SearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_filter import SearchFilter as SearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline as SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse as SearchPipelinesResponse +from gen_ai_hub.document_grounding_generation.generated.models.search_results import SearchResults as SearchResults +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores as SearchScores +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore as SearchScoresAggregatedScore +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum as SearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig as ServiceNowConfig +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal as ServiceNowConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow as ServiceNowConfigurationMinimalServiceNow +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct as ServiceNowConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest as ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse as ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse as ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig as SharePointConfig +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse as SharePointConfigGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite as SharePointSite +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail as SharePointSiteDetail +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse as SharePointSiteGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy as Strategy +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk as TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate as TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest as TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError as ValidationError +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk as VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair as VectorDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair as VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult as VectorPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration as VectorScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration as VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair as VectorSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter as VectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults as VectorSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum as VectorSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest as WorkZonePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse as WorkZonePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse as WorkZonePipelineMinimalResponse + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py new file mode 100644 index 00000000..2f6ec93f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py @@ -0,0 +1,8 @@ +# flake8: noqa + +# import apis into api package +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py new file mode 100644 index 00000000..320e4a0e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py @@ -0,0 +1,2054 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType + + +class MetadataConfigurationsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def batch_update_documents_metadata( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BatchUpdateDocumentsResponseInner]: + """Batch update metadata for multiple documents + + Patch the documents of a configuration in batch + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_metadata_batch_request: (required) + :type document_metadata_batch_request: DocumentMetadataBatchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_documents_metadata_serialize( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[BatchUpdateDocumentsResponseInner]", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def batch_update_documents_metadata_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BatchUpdateDocumentsResponseInner]]: + """Batch update metadata for multiple documents + + Patch the documents of a configuration in batch + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_metadata_batch_request: (required) + :type document_metadata_batch_request: DocumentMetadataBatchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_documents_metadata_serialize( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[BatchUpdateDocumentsResponseInner]", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def batch_update_documents_metadata_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Batch update metadata for multiple documents + + Patch the documents of a configuration in batch + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_metadata_batch_request: (required) + :type document_metadata_batch_request: DocumentMetadataBatchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_documents_metadata_serialize( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[BatchUpdateDocumentsResponseInner]", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _batch_update_documents_metadata_serialize( + self, + metadata_config_id, + document_metadata_batch_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if document_metadata_batch_request is not None: + _body_params = document_metadata_batch_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/merge-patch+json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_metadata_configuration( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create a metadata configuration + + Creates a new metadata configuration. + + :param metadata_configuration_request: (required) + :type metadata_configuration_request: MetadataConfigurationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metadata_configuration_serialize( + metadata_configuration_request=metadata_configuration_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_metadata_configuration_with_http_info( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create a metadata configuration + + Creates a new metadata configuration. + + :param metadata_configuration_request: (required) + :type metadata_configuration_request: MetadataConfigurationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metadata_configuration_serialize( + metadata_configuration_request=metadata_configuration_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_metadata_configuration_without_preload_content( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a metadata configuration + + Creates a new metadata configuration. + + :param metadata_configuration_request: (required) + :type metadata_configuration_request: MetadataConfigurationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metadata_configuration_serialize( + metadata_configuration_request=metadata_configuration_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_metadata_configuration_serialize( + self, + metadata_configuration_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if metadata_configuration_request is not None: + _body_params = metadata_configuration_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines/metadata/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_metadata_configuration_by_id( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a configuration by ID + + Delete a metadata configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '404': "ErrorResponse", + '500': "ErrorResponse", + '409': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_metadata_configuration_by_id_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a configuration by ID + + Delete a metadata configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '404': "ErrorResponse", + '500': "ErrorResponse", + '409': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_metadata_configuration_by_id_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a configuration by ID + + Delete a metadata configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '404': "ErrorResponse", + '500': "ErrorResponse", + '409': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_metadata_configuration_by_id_serialize( + self, + metadata_config_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_metadata_configuration_by_id( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataConfigurationResponse: + """Get a configuration by ID + + Get the details of a configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataConfigurationResponse", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_metadata_configuration_by_id_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataConfigurationResponse]: + """Get a configuration by ID + + Get the details of a configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataConfigurationResponse", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_metadata_configuration_by_id_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a configuration by ID + + Get the details of a configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataConfigurationResponse", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_metadata_configuration_by_id_serialize( + self, + metadata_config_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_metadata_document_details( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ConfigurationDocument: + """Get document details + + Get the details of a document by document id + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_id: Document ID (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_document_details_serialize( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigurationDocument", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_metadata_document_details_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ConfigurationDocument]: + """Get document details + + Get the details of a document by document id + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_id: Document ID (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_document_details_serialize( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigurationDocument", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_metadata_document_details_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document details + + Get the details of a document by document id + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_id: Document ID (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_document_details_serialize( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigurationDocument", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_metadata_document_details_serialize( + self, + metadata_config_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_metadata_configuration_documents( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListConfigurationDocuments: + """List documents of a configuration + + List the documents for a configuration + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param absolute_path: Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + :type absolute_path: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configuration_documents_serialize( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConfigurationDocuments", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_metadata_configuration_documents_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListConfigurationDocuments]: + """List documents of a configuration + + List the documents for a configuration + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param absolute_path: Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + :type absolute_path: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configuration_documents_serialize( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConfigurationDocuments", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_metadata_configuration_documents_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List documents of a configuration + + List the documents for a configuration + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param absolute_path: Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + :type absolute_path: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configuration_documents_serialize( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConfigurationDocuments", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_metadata_configuration_documents_serialize( + self, + metadata_config_id, + absolute_path, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + if absolute_path is not None: + + _query_params.append(('absolutePath', absolute_path)) + + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_metadata_configurations( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListMetadataConfigurations: + """List metadata configurations + + List all metadata configurations + + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configurations_serialize( + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMetadataConfigurations", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_metadata_configurations_with_http_info( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListMetadataConfigurations]: + """List metadata configurations + + List all metadata configurations + + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configurations_serialize( + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMetadataConfigurations", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_metadata_configurations_without_preload_content( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List metadata configurations + + List all metadata configurations + + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configurations_serialize( + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMetadataConfigurations", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_metadata_configurations_serialize( + self, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py new file mode 100644 index 00000000..625db200 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py @@ -0,0 +1,4340 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType + + +class PipelinesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineId: + """Pipeline Creation + + Create a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param create_pipeline: (required) + :type create_pipeline: CreatePipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_pipeline_serialize( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PipelineId", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineId]: + """Pipeline Creation + + Create a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param create_pipeline: (required) + :type create_pipeline: CreatePipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_pipeline_serialize( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PipelineId", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Creation + + Create a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param create_pipeline: (required) + :type create_pipeline: CreatePipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_pipeline_serialize( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PipelineId", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_pipeline_serialize( + self, + ai_resource_group, + create_pipeline, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if create_pipeline is not None: + _body_params = create_pipeline + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_pipeline_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete pipeline + + Delete a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to delete. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_pipeline_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete pipeline + + Delete a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to delete. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_pipeline_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete pipeline + + Delete a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to delete. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_pipeline_by_id_serialize( + self, + ai_resource_group, + pipeline_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/pipelines/{pipelineId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_all_documents_for_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline + + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_all_documents_for_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline + + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_all_documents_for_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline + + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_all_documents_for_pipeline_serialize( + self, + ai_resource_group, + pipeline_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_all_executions_for_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutions: + """Get Pipeline Executions + + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param last_execution: Filter to get the last execution + :type last_execution: bool + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_executions_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutions", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_all_executions_for_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutions]: + """Get Pipeline Executions + + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param last_execution: Filter to get the last execution + :type last_execution: bool + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_executions_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutions", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_all_executions_for_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Executions + + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param last_execution: Filter to get the last execution + :type last_execution: bool + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_executions_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutions", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_all_executions_for_pipeline_serialize( + self, + ai_resource_group, + pipeline_id, + last_execution, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + if last_execution is not None: + + _query_params.append(('lastExecution', last_execution)) + + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_all_pipelines( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelines: + """Get Pipelines + + Get all pipelines + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_config_id: Filter pipelines based on metadataConfigId + :type metadata_config_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_pipelines_serialize( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelines", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_all_pipelines_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelines]: + """Get Pipelines + + Get all pipelines + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_config_id: Filter pipelines based on metadataConfigId + :type metadata_config_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_pipelines_serialize( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelines", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_all_pipelines_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipelines + + Get all pipelines + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_config_id: Filter pipelines based on metadataConfigId + :type metadata_config_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_pipelines_serialize( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelines", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_all_pipelines_serialize( + self, + ai_resource_group, + metadata_config_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if metadata_config_id is not None: + + _query_params.append(('metadataConfigId', metadata_config_id)) + + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_document_by_id_for_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline + + Retrieve details of a specific document associated with a pipeline. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_document_by_id_for_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline + + Retrieve details of a specific document associated with a pipeline. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_document_by_id_for_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline + + Retrieve details of a specific document associated with a pipeline. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_document_by_id_for_pipeline_serialize( + self, + ai_resource_group, + pipeline_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_document_by_id_for_pipeline_execution( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline Execution + + Retrieve details of a specific document associated with a pipeline execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_document_by_id_for_pipeline_execution_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline Execution + + Retrieve details of a specific document associated with a pipeline execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_document_by_id_for_pipeline_execution_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline Execution + + Retrieve details of a specific document associated with a pipeline execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_document_by_id_for_pipeline_execution_serialize( + self, + ai_resource_group, + pipeline_id, + execution_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if execution_id is not None: + _path_params['executionId'] = execution_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions/{executionId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_documents_for_pipeline_execution( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline Execution + + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_documents_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_documents_for_pipeline_execution_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline Execution + + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_documents_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_documents_for_pipeline_execution_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline Execution + + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_documents_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_documents_for_pipeline_execution_serialize( + self, + ai_resource_group, + pipeline_id, + execution_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if execution_id is not None: + _path_params['executionId'] = execution_id + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions/{executionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutionById: + """Get Pipeline Execution by ID + + Retrieve details of a specific pipeline execution by its execution ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_execution_details_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutionById", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutionById]: + """Get Pipeline Execution by ID + + Retrieve details of a specific pipeline execution by its execution ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_execution_details_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutionById", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Execution by ID + + Retrieve details of a specific pipeline execution by its execution ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_execution_details_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutionById", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_execution_details_by_id_for_pipeline_execution_serialize( + self, + ai_resource_group, + pipeline_id, + execution_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if execution_id is not None: + _path_params['executionId'] = execution_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions/{executionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_pipeline_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipeline: + """Get details of a Pipeline + + Get details of a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipeline", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_pipeline_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipeline]: + """Get details of a Pipeline + + Get details of a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipeline", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_pipeline_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get details of a Pipeline + + Get details of a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipeline", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_pipeline_by_id_serialize( + self, + ai_resource_group, + pipeline_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_pipeline_status( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineStatus: + """Get status of Pipeline + + Get pipeline status by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get status. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_status_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineStatus", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_pipeline_status_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineStatus]: + """Get status of Pipeline + + Get pipeline status by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get status. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_status_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineStatus", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_pipeline_status_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get status of Pipeline + + Get pipeline status by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get status. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_status_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineStatus", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_pipeline_status_serialize( + self, + ai_resource_group, + pipeline_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/status', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def manual_trigger_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Pipeline Trigger + + Manually trigger a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param manual_pipeline_trigger: (required) + :type manual_pipeline_trigger: ManualPipelineTrigger + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._manual_trigger_pipeline_serialize( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def manual_trigger_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Pipeline Trigger + + Manually trigger a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param manual_pipeline_trigger: (required) + :type manual_pipeline_trigger: ManualPipelineTrigger + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._manual_trigger_pipeline_serialize( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def manual_trigger_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Trigger + + Manually trigger a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param manual_pipeline_trigger: (required) + :type manual_pipeline_trigger: ManualPipelineTrigger + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._manual_trigger_pipeline_serialize( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _manual_trigger_pipeline_serialize( + self, + ai_resource_group, + manual_pipeline_trigger, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if manual_pipeline_trigger is not None: + _body_params = manual_pipeline_trigger + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines/trigger', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def patch_pipeline_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Patch pipeline + + Patch a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to patch. (required) + :type pipeline_id: str + :param patch_pipeline: (required) + :type patch_pipeline: PatchPipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._patch_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def patch_pipeline_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Patch pipeline + + Patch a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to patch. (required) + :type pipeline_id: str + :param patch_pipeline: (required) + :type patch_pipeline: PatchPipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._patch_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def patch_pipeline_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch pipeline + + Patch a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to patch. (required) + :type pipeline_id: str + :param patch_pipeline: (required) + :type patch_pipeline: PatchPipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._patch_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _patch_pipeline_by_id_serialize( + self, + ai_resource_group, + pipeline_id, + patch_pipeline, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if patch_pipeline is not None: + _body_params = patch_pipeline + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/pipelines/{pipelineId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def search_pipelines_by_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SearchPipelinesResponse: + """Pipeline Search by Metadata + + Search for pipelines based on metadata + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param search_pipeline: (required) + :type search_pipeline: SearchPipeline + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_pipelines_by_metadata_serialize( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SearchPipelinesResponse", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def search_pipelines_by_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SearchPipelinesResponse]: + """Pipeline Search by Metadata + + Search for pipelines based on metadata + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param search_pipeline: (required) + :type search_pipeline: SearchPipeline + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_pipelines_by_metadata_serialize( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SearchPipelinesResponse", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def search_pipelines_by_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Search by Metadata + + Search for pipelines based on metadata + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param search_pipeline: (required) + :type search_pipeline: SearchPipeline + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_pipelines_by_metadata_serialize( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SearchPipelinesResponse", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _search_pipelines_by_metadata_serialize( + self, + ai_resource_group, + search_pipeline, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if search_pipeline is not None: + _body_params = search_pipeline + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py new file mode 100644 index 00000000..092f0152 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py @@ -0,0 +1,951 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType + + +class RetrievalApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_data_repositories( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepositories: + """List all DataRepository objects. + + List all Data Repositories + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repositories_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepositories", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_data_repositories_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepositories]: + """List all DataRepository objects. + + List all Data Repositories + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repositories_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepositories", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_data_repositories_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all DataRepository objects. + + List all Data Repositories + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repositories_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepositories", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_data_repositories_serialize( + self, + ai_resource_group, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/retrieval/dataRepositories', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_data_repository_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepository: + """List single DataRepository object. + + List data repository by id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param repository_id: Repository ID (required) + :type repository_id: UUID + :param remote_name: Remote name if DataRepository is from remote DG. + :type remote_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repository_by_id_serialize( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepository", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_data_repository_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepository]: + """List single DataRepository object. + + List data repository by id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param repository_id: Repository ID (required) + :type repository_id: UUID + :param remote_name: Remote name if DataRepository is from remote DG. + :type remote_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repository_by_id_serialize( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepository", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_data_repository_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List single DataRepository object. + + List data repository by id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param repository_id: Repository ID (required) + :type repository_id: UUID + :param remote_name: Remote name if DataRepository is from remote DG. + :type remote_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repository_by_id_serialize( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepository", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_data_repository_by_id_serialize( + self, + ai_resource_group, + repository_id, + remote_name, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if repository_id is not None: + _path_params['repositoryId'] = repository_id + # process the query parameters + if remote_name is not None: + + _query_params.append(('remoteName', remote_name)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/retrieval/dataRepositories/{repositoryId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def search( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RetrievalSearchResults: + """Retrieve relevant content + + Retrieve relevant content given a query string. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param retrieval_search_input: (required) + :type retrieval_search_input: RetrievalSearchInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetrievalSearchResults", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def search_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RetrievalSearchResults]: + """Retrieve relevant content + + Retrieve relevant content given a query string. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param retrieval_search_input: (required) + :type retrieval_search_input: RetrievalSearchInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetrievalSearchResults", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def search_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve relevant content + + Retrieve relevant content given a query string. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param retrieval_search_input: (required) + :type retrieval_search_input: RetrievalSearchInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetrievalSearchResults", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _search_serialize( + self, + ai_resource_group, + retrieval_search_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if retrieval_search_input is not None: + _body_params = retrieval_search_input + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/retrieval/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py new file mode 100644 index 00000000..952791af --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py @@ -0,0 +1,4840 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType + + +class VectorApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_collection( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create collection + + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_request: (required) + :type collection_request: CollectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_collection_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create collection + + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_request: (required) + :type collection_request: CollectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_collection_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create collection + + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_request: (required) + :type collection_request: CollectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_collection_serialize( + self, + ai_resource_group, + collection_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if collection_request is not None: + _body_params = collection_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/vector/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Create documents in collection + + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_create_request: (required) + :type document_create_request: DocumentCreateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Create documents in collection + + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_create_request: (required) + :type document_create_request: DocumentCreateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create documents in collection + + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_create_request: (required) + :type document_create_request: DocumentCreateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_documents_serialize( + self, + ai_resource_group, + collection_id, + document_create_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if document_create_request is not None: + _body_params = document_create_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/vector/collections/{collectionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_all_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentBulkDeleteResponse: + """Delete list of documents across collections + + Deletes list of documents across collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param document_bulk_delete_request: (required) + :type document_bulk_delete_request: DocumentBulkDeleteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_documents_serialize( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentBulkDeleteResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_all_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentBulkDeleteResponse]: + """Delete list of documents across collections + + Deletes list of documents across collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param document_bulk_delete_request: (required) + :type document_bulk_delete_request: DocumentBulkDeleteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_documents_serialize( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentBulkDeleteResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_all_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete list of documents across collections + + Deletes list of documents across collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param document_bulk_delete_request: (required) + :type document_bulk_delete_request: DocumentBulkDeleteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_documents_serialize( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentBulkDeleteResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_all_documents_serialize( + self, + ai_resource_group, + document_bulk_delete_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if document_bulk_delete_request is not None: + _body_params = document_bulk_delete_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/vector/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_collection_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete collection by ID + + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_collection_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete collection by ID + + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_collection_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete collection by ID + + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_collection_by_id_serialize( + self, + ai_resource_group, + collection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/vector/collections/{collectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_document_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a document + + Deletes a specific document of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_document_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a document + + Deletes a specific document of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_document_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a document + + Deletes a specific document of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_document_by_id_serialize( + self, + ai_resource_group, + collection_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/vector/collections/{collectionId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_all_collections( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CollectionsListResponse: + """Get collections + + Gets a list of collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_collections_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionsListResponse", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_all_collections_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CollectionsListResponse]: + """Get collections + + Gets a list of collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_collections_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionsListResponse", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_all_collections_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collections + + Gets a list of collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_collections_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionsListResponse", + '400': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_all_collections_serialize( + self, + ai_resource_group, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_all_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Documents: + """Get documents + + Gets a list of documents of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Documents", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_all_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Documents]: + """Get documents + + Gets a list of documents of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Documents", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_all_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get documents + + Gets a list of documents of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Documents", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_all_documents_serialize( + self, + ai_resource_group, + collection_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{collectionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_collection_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Get collection by ID + + Gets a specific collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_collection_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Get collection by ID + + Gets a specific collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_collection_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection by ID + + Gets a specific collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_collection_by_id_serialize( + self, + ai_resource_group, + collection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{collectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_collection_creation_status( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionCreationStatus200Response: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_creation_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionCreationStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_collection_creation_status_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionCreationStatus200Response]: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_creation_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionCreationStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_collection_creation_status_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_creation_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionCreationStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_collection_creation_status_serialize( + self, + ai_resource_group, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{id}/creationStatus', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_collection_deletion_status( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionDeletionStatus200Response: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_deletion_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionDeletionStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_collection_deletion_status_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionDeletionStatus200Response]: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_deletion_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionDeletionStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_collection_deletion_status_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_deletion_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionDeletionStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_collection_deletion_status_serialize( + self, + ai_resource_group, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{id}/deletionStatus', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_document_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentResponse: + """Get document by ID + + Gets a specific document in a collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_document_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentResponse]: + """Get document by ID + + Gets a specific document in a collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_document_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document by ID + + Gets a specific document in a collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_document_by_id_serialize( + self, + ai_resource_group, + collection_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{collectionId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def search( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VectorSearchResults: + """Search chunk by vector + + Search chunks + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param text_search_request: (required) + :type text_search_request: TextSearchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VectorSearchResults", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def search_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VectorSearchResults]: + """Search chunk by vector + + Search chunks + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param text_search_request: (required) + :type text_search_request: TextSearchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VectorSearchResults", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def search_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search chunk by vector + + Search chunks + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param text_search_request: (required) + :type text_search_request: TextSearchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VectorSearchResults", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _search_serialize( + self, + ai_resource_group, + text_search_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if text_search_request is not None: + _body_params = text_search_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/vector/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_chunks_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch chunks metadata + + Allows to add, remove and modify the chunks metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_chunks_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_chunks_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch chunks metadata + + Allows to add, remove and modify the chunks metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_chunks_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_chunks_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch chunks metadata + + Allows to add, remove and modify the chunks metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_chunks_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_chunks_metadata_serialize( + self, + ai_resource_group, + metadata_updates, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if metadata_updates is not None: + _body_params = metadata_updates + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/chunks/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_collections_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch collections metadata + + Allows to add, remove and modify the collections metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_collections_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_collections_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch collections metadata + + Allows to add, remove and modify the collections metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_collections_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_collections_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch collections metadata + + Allows to add, remove and modify the collections metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_collections_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_collections_metadata_serialize( + self, + ai_resource_group, + metadata_updates, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if metadata_updates is not None: + _body_params = metadata_updates + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/collections/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Upsert documents in collection + + Upserts the data of multiple documents into a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_update_request: (required) + :type document_update_request: DocumentUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Upsert documents in collection + + Upserts the data of multiple documents into a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_update_request: (required) + :type document_update_request: DocumentUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upsert documents in collection + + Upserts the data of multiple documents into a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_update_request: (required) + :type document_update_request: DocumentUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_documents_serialize( + self, + ai_resource_group, + collection_id, + document_update_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if document_update_request is not None: + _body_params = document_update_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/collections/{collectionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_documents_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch documents metadata + + Allows to add, remove and modify the documents metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_documents_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch documents metadata + + Allows to add, remove and modify the documents metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_documents_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch documents metadata + + Allows to add, remove and modify the documents metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_documents_metadata_serialize( + self, + ai_resource_group, + metadata_updates, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if metadata_updates is not None: + _body_params = metadata_updates + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/documents/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py new file mode 100644 index 00000000..48d58fc5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py @@ -0,0 +1,833 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile +import uuid + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse, T as ApiResponseT +import gen_ai_hub.document_grounding_generation.generated.models +from gen_ai_hub.document_grounding_generation.generated import rest +from gen_ai_hub.document_grounding_generation.generated.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it. + if response_type is None and str(response_data.status) not in response_types_map \ + and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \ + and 'default' in response_types_map: + response_type = response_types_map['default'] + + # deserialize response data + response_text = None + return_data = None + try: + if response_type in ("bytearray", "bytes"): + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.headers.get('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.headers, + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, uuid.UUID): + return str(obj) + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + elif isinstance(obj, dict): + return { + key: self.sanitize_for_serialization(val) + for key, val in obj.items() + } + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return self.sanitize_for_serialization(obj_dict) + + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('Optional['): + m = re.match(r'Optional\[(.*)]', klass) + assert m is not None, "Malformed Optional type definition" + # data is not None here, so the optionality is already resolved + return self.__deserialize(data, m.group(1)) + + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(generated.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, str(value).lower() if isinstance(value, bool) else value) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + str(value).lower() if isinstance(value, bool) else str(value) + for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, quote(str(value).lower() if isinstance(value, bool) else str(value))) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + quote(str(value).lower() if isinstance(value, bool) else str(value)) + for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters, excluding base64 delimiters + cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=") + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.headers.get("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py new file mode 100644 index 00000000..9bc7c11f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py new file mode 100644 index 00000000..209bed89 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py @@ -0,0 +1,654 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import http.client as httplib +import logging +from logging import FileHandler +import multiprocessing +import ssl +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from urllib.parse import urlparse +from urllib.request import getproxies +from typing_extensions import NotRequired, Self + +import urllib3 + + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "Oauth2": OAuth2AuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: int | urllib3.util.retry.Retry - Retry configuration. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param no_proxy: Comma-separated hosts that bypass the proxy. + :param proxy_headers: Proxy headers. + :param proxy_ssl_context: SSL context used only for the TLS handshake with the proxy itself, independent of the destination TLS settings. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. + + :Example: + """ + + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[Union[int, urllib3.util.retry.Retry]] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + no_proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + proxy_ssl_context: Optional[ssl.SSLContext]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "/lm/document-grounding" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("generated") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = verify_ssl + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file + """client certificate file + """ + self.key_file = key_file + """client key file + """ + self.assert_hostname = assert_hostname + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = tls_server_name + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. None in the constructor is coerced to cpu_count * 5. + """ + + # urllib3 does not read proxy environment variables itself: + # https://github.com/urllib3/urllib3/issues/1785 + # A proxy taken from the environment is re-resolved when the host is + # assigned; see the host setter. + self._proxy_from_env = proxy is None + if proxy is None or no_proxy is None: + proxies = getproxies() + if proxy is None: + proxy = self._env_proxy(proxies, self.host) + if no_proxy is None: + no_proxy = proxies.get("no") + self._proxy = proxy + self.no_proxy = no_proxy + """Hosts that bypass the proxy + """ + self.proxy_headers = proxy_headers + """Proxy headers + """ + self.proxy_ssl_context = proxy_ssl_context + """SSL context used only for the TLS handshake with the proxy itself + (e.g. an HTTPS CONNECT tunnel), independent of the destination TLS + settings above. + """ + self.safe_chars_for_path_param = safe_chars_for_path_param + """Safe chars for path_param + """ + self.retries = retries + """Retry configuration + """ + # Enable client side validation + self.client_side_validation = client_side_validation + + self.socket_options = socket_options + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = datetime_format + """datetime format + """ + + self.date_format = date_format + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k == 'proxy_ssl_context': + # ssl.SSLContext holds unpicklable C state and can't be deepcopied. + setattr(result, k, v) + continue + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setter to re-create the file handler (excluded from __dict__ copy) + result.logger_file = self.logger_file + + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default + + @property + def logger_file(self) -> Optional[str]: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value: Optional[str]) -> None: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self) -> bool: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value: bool) -> None: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self) -> str: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value: str) -> None: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self)-> AuthSettings: + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth: AuthSettings = {} + if self.access_token is not None: + auth['Oauth2'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + return auth + + def to_debug_report(self) -> str: + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 0.1.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "/lm/document-grounding", + 'description': "No description provided", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and variable['enum_values'] \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None + if self._proxy_from_env: + # the scheme-specific proxy depends on the host, which is + # commonly assigned after construction + self._proxy = self._env_proxy(getproxies(), value) + + @staticmethod + def _env_proxy(proxies: Dict[str, str], host: str) -> Optional[str]: + """Pick the environment proxy that applies to `host`.""" + return proxies.get(urlparse(host).scheme) or proxies.get("all") + + @property + def proxy(self) -> Optional[str]: + """Proxy URL + """ + return self._proxy + + @proxy.setter + def proxy(self, value: Optional[str]) -> None: + self._proxy = value + self._proxy_from_env = False diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py new file mode 100644 index 00000000..f5e8536f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py @@ -0,0 +1,218 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py new file mode 100644 index 00000000..8f515861 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +# flake8: noqa +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_minimal_response import BasePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_response import BasePipelineResponse +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_document_success import BatchUpdateDocumentSuccess +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.chunk import Chunk +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_results import DataRepositorySearchResults +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.document import Document +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput +from gen_ai_hub.document_grounding_generation.generated.models.document_key_value_list_pair import DocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.error_response import ErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.generic_error import GenericError +from gen_ai_hub.document_grounding_generation.generated.models.get_all_pipelines400_response import GetAllPipelines400Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail +from gen_ai_hub.document_grounding_generation.generated.models.http_validation_error import HTTPValidationError +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.left import Left +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents_full_details import ListConfigurationDocumentsFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType +from gen_ai_hub.document_grounding_generation.generated.models.message_response import MessageResponse +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.right import Right +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_filter import SearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse +from gen_ai_hub.document_grounding_generation.generated.models.search_results import SearchResults +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py new file mode 100644 index 00000000..6ceebd3c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ApiError(BaseModel): + """ + ApiError + """ # noqa: E501 + code: StrictStr = Field(description="Descriptive error code (not http status code).") + message: StrictStr = Field(description="plaintext error description") + request_id: Optional[StrictStr] = Field(default=None, description="id of individual request", alias="requestId") + target: Optional[StrictStr] = Field(default=None, description="url that has been called") + details: Optional[List[DetailsErrorResponse]] = None + __properties: ClassVar[List[str]] = ["code", "message", "requestId", "target", "details"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in details (list) + _items = [] + if self.details: + for _item_details in self.details: + _items.append(_item_details.to_dict() if _item_details is not None else None) + _dict['details'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "requestId": obj.get("requestId"), + "target": obj.get("target"), + "details": [DetailsErrorResponse.from_dict(_item) for _item in obj["details"]] if obj.get("details") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py new file mode 100644 index 00000000..4eb04aff --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BaseDocument(BaseModel): + """ + Base class for documents, document requests and responses. + """ # noqa: E501 + chunks: List[TextOnlyBaseChunkCreate] + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + __properties: ClassVar[List[str]] = ["chunks", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BaseDocument from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseDocument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chunks": [TextOnlyBaseChunkCreate.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None, + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py new file mode 100644 index 00000000..1d26fb21 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BasePipelineMinimalResponse(BaseModel): + """ + BasePipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + __properties: ClassVar[List[str]] = ["id", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BasePipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BasePipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py new file mode 100644 index 00000000..5ab2c9f4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BasePipelineResponse(BaseModel): + """ + BasePipelineResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + __properties: ClassVar[List[str]] = ["id", "type", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BasePipelineResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BasePipelineResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py new file mode 100644 index 00000000..3bdd30bc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BatchUpdateDocumentSuccess(BaseModel): + """ + BatchUpdateDocumentSuccess + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of the document.") + metadata: List[DocumentMetadata] = Field(description="Metadata updates for this document.") + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchUpdateDocumentSuccess from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchUpdateDocumentSuccess from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py new file mode 100644 index 00000000..a77202a5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +BATCHUPDATEDOCUMENTSRESPONSEINNER_ONE_OF_SCHEMAS = ["DocumentMetadataUpdate", "DocumentMetadataUpdateError"] + +class BatchUpdateDocumentsResponseInner(BaseModel): + """ + BatchUpdateDocumentsResponseInner + """ + # data type: DocumentMetadataUpdate + oneof_schema_1_validator: Optional[DocumentMetadataUpdate] = None + # data type: DocumentMetadataUpdateError + oneof_schema_2_validator: Optional[DocumentMetadataUpdateError] = None + actual_instance: Optional[Union[DocumentMetadataUpdate, DocumentMetadataUpdateError]] = None + one_of_schemas: Set[str] = { "DocumentMetadataUpdate", "DocumentMetadataUpdateError" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = BatchUpdateDocumentsResponseInner.model_construct() + error_messages = [] + match = 0 + # validate data type: DocumentMetadataUpdate + if not isinstance(v, DocumentMetadataUpdate): + error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentMetadataUpdate`") + else: + match += 1 + # validate data type: DocumentMetadataUpdateError + if not isinstance(v, DocumentMetadataUpdateError): + error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentMetadataUpdateError`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into DocumentMetadataUpdate + try: + instance.actual_instance = DocumentMetadataUpdate.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DocumentMetadataUpdateError + try: + instance.actual_instance = DocumentMetadataUpdateError.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], DocumentMetadataUpdate, DocumentMetadataUpdateError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py new file mode 100644 index 00000000..c555e144 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BinaryBooleanFilter(BaseModel): + """ + BinaryBooleanFilter + """ # noqa: E501 + operator: StrictStr = Field(description="Boolean operator for combining filter conditions") + left: Left1 + right: Right1 + __properties: ClassVar[List[str]] = ["operator", "left", "right"] + + @field_validator('operator') + def operator_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['and', 'or']): + raise ValueError("must be one of enum values ('and', 'or')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BinaryBooleanFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of left + if self.left: + _dict['left'] = self.left.to_dict() + # override the default output from pydantic by calling `to_dict()` of right + if self.right: + _dict['right'] = self.right.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BinaryBooleanFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "operator": obj.get("operator"), + "left": Left1.from_dict(obj["left"]) if obj.get("left") is not None else None, + "right": Right1.from_dict(obj["right"]) if obj.get("right") is not None else None + }) + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 +# TODO: Rewrite to not use raise_errors +BinaryBooleanFilter.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py new file mode 100644 index 00000000..681ac48f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class BoostingScoreComputationStrategy(str, Enum): + """ + BoostingScoreComputationStrategy + """ + + """ + allowed enum values + """ + MATCH_COUNT = 'match_count' + EMBEDDING = 'embedding' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BoostingScoreComputationStrategy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py new file mode 100644 index 00000000..8df4768a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BoostingScoringConfiguration(BaseModel): + """ + BoostingScoringConfiguration + """ # noqa: E501 + enabled: Optional[StrictBool] = Field(default=True, description="Enable metadata-based boosting.") + metadata: Optional[List[BoostingScoringConfigurationMetadataInner]] = None + weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") + score_computation_strategy: Optional[BoostingScoreComputationStrategy] = Field(default=None, alias="scoreComputationStrategy") + __properties: ClassVar[List[str]] = ["enabled", "metadata", "weight", "scoreComputationStrategy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BoostingScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoostingScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "metadata": [BoostingScoringConfigurationMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "weight": obj.get("weight") if "weight" in obj else 1, + "scoreComputationStrategy": obj.get("scoreComputationStrategy") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py new file mode 100644 index 00000000..3161a9db --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BoostingScoringConfigurationMetadataInner(BaseModel): + """ + BoostingScoringConfigurationMetadataInner + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: Optional[StrictStr] = 'document' + weight: StrictInt + __properties: ClassVar[List[str]] = ["key", "value", "scope", "weight"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['repository', 'document', 'chunk']): + raise ValueError("must be one of enum values ('repository', 'document', 'chunk')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BoostingScoringConfigurationMetadataInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoostingScoringConfigurationMetadataInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") if obj.get("scope") is not None else 'document', + "weight": obj.get("weight") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py new file mode 100644 index 00000000..54de2aea --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Chunk(BaseModel): + """ + Chunk + """ # noqa: E501 + id: StrictStr + content: StrictStr + metadata: Optional[List[KeyValueListPair]] = None + __properties: ClassVar[List[str]] = ["id", "content", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Chunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Chunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "content": obj.get("content"), + "metadata": [KeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py new file mode 100644 index 00000000..6deaa962 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Collection(BaseModel): + """ + A logical grouping of content. + """ # noqa: E501 + title: Optional[StrictStr] = None + embedding_config: EmbeddingConfig = Field(alias="embeddingConfig") + metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") + id: UUID = Field(description="Unique identifier of a collection.") + __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Collection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of embedding_config + if self.embedding_config: + _dict['embeddingConfig'] = self.embedding_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Collection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "embeddingConfig": EmbeddingConfig.from_dict(obj["embeddingConfig"]) if obj.get("embeddingConfig") is not None else None, + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py new file mode 100644 index 00000000..153e5fa9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionCreatedResponse(BaseModel): + """ + CollectionCreatedResponse + """ # noqa: E501 + collection_url: StrictStr = Field(alias="collectionURL") + status: StrictStr + __properties: ClassVar[List[str]] = ["collectionURL", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionCreatedResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionCreatedResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collectionURL": obj.get("collectionURL"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py new file mode 100644 index 00000000..09eb6c7f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionDeletedResponse(BaseModel): + """ + CollectionDeletedResponse + """ # noqa: E501 + collection_url: StrictStr = Field(alias="collectionURL") + status: StrictStr + __properties: ClassVar[List[str]] = ["collectionURL", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionDeletedResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionDeletedResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collectionURL": obj.get("collectionURL"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py new file mode 100644 index 00000000..f9e2dd6c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionPendingResponse(BaseModel): + """ + CollectionPendingResponse + """ # noqa: E501 + monitor_url: StrictStr = Field(alias="monitorURL") + __properties: ClassVar[List[str]] = ["monitorURL"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionPendingResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionPendingResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "monitorURL": obj.get("monitorURL") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py new file mode 100644 index 00000000..8171e681 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionRequest(BaseModel): + """ + A request for creating a new, single collection. + """ # noqa: E501 + title: Optional[StrictStr] = None + embedding_config: EmbeddingConfig = Field(alias="embeddingConfig") + metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") + id: Optional[UUID] = Field(default=None, description="Unique identifier of a collection.") + __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of embedding_config + if self.embedding_config: + _dict['embeddingConfig'] = self.embedding_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "embeddingConfig": EmbeddingConfig.from_dict(obj["embeddingConfig"]) if obj.get("embeddingConfig") is not None else None, + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py new file mode 100644 index 00000000..3f3642fc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionsListResponse(BaseModel): + """ + A response containing collections retrieved from the server. + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[Collection] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [Collection.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py new file mode 100644 index 00000000..4f0d01fa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ConfigurationDocument(BaseModel): + """ + ConfigurationDocument + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the document.", json_schema_extra={"examples": ["3cba7512-b07a-58e6-a442-c83996a0b3bb"]}) + title: Optional[StrictStr] = Field(default=None, description="Title of the document.", json_schema_extra={"examples": ["Quarterly Report"]}) + absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) + created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) + type: Optional[StrictStr] = Field(default=None, description="Type of the resource. Can be FOLDER, DOCUMENT.") + metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") + __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['FOLDER', 'DOCUMENT']): + raise ValueError("must be one of enum values ('FOLDER', 'DOCUMENT')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConfigurationDocument from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigurationDocument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "absoluteFilePath": obj.get("absoluteFilePath"), + "createdTimestamp": obj.get("createdTimestamp"), + "type": obj.get("type"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py new file mode 100644 index 00000000..debda35f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ConfigurationDocumentFullDetails(BaseModel): + """ + ConfigurationDocumentFullDetails + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the document.", json_schema_extra={"examples": ["3cba7512-b07a-58e6-a442-c83996a0b3bb"]}) + title: Optional[StrictStr] = Field(default=None, description="Title of the document.", json_schema_extra={"examples": ["Quarterly Report"]}) + absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) + created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) + resource_uri: Optional[StrictStr] = Field(default=None, description="URI of the resource.", alias="resourceUri", json_schema_extra={"examples": ["https://example.com/resource/123"]}) + web_url: Optional[StrictStr] = Field(default=None, description="Web URL of the document.", alias="webUrl", json_schema_extra={"examples": ["https://example.com/web/123"]}) + document_etag: Optional[StrictStr] = Field(default=None, description="ETag of the document.", alias="documentEtag", json_schema_extra={"examples": ["abc123etag"]}) + file_suffix: Optional[StrictStr] = Field(default=None, description="File suffix of the document.", alias="fileSuffix", json_schema_extra={"examples": [".pdf"]}) + view_location: Optional[StrictStr] = Field(default=None, description="View location of the document.", alias="viewLocation", json_schema_extra={"examples": ["https://example.com/view/123"]}) + download_location: Optional[StrictStr] = Field(default=None, description="Download location of the document.", alias="downloadLocation", json_schema_extra={"examples": ["https://example.com/download/123"]}) + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the document.", alias="mimeType", json_schema_extra={"examples": ["application/pdf"]}) + file_size_mb: Optional[StrictStr] = Field(default=None, description="File size of the document in megabytes.", alias="fileSizeMb", json_schema_extra={"examples": ["1.5"]}) + metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") + __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "resourceUri", "webUrl", "documentEtag", "fileSuffix", "viewLocation", "downloadLocation", "mimeType", "fileSizeMb", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConfigurationDocumentFullDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigurationDocumentFullDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "absoluteFilePath": obj.get("absoluteFilePath"), + "createdTimestamp": obj.get("createdTimestamp"), + "resourceUri": obj.get("resourceUri"), + "webUrl": obj.get("webUrl"), + "documentEtag": obj.get("documentEtag"), + "fileSuffix": obj.get("fileSuffix"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "mimeType": obj.get("mimeType"), + "fileSizeMb": obj.get("fileSizeMb"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py new file mode 100644 index 00000000..945e14a1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py @@ -0,0 +1,224 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +CREATEPIPELINE_ONE_OF_SCHEMAS = ["GoogleDrivePipelineCreateRequest", "MSSharePointPipelineCreateRequest", "MetadataConfiguration", "S3PipelineCreateRequest", "SDMPipelineCreateRequest", "SFTPPipelineCreateRequest", "ServiceNowPipelineCreateRequest", "WorkZonePipelineCreateRequest"] + +class CreatePipeline(BaseModel): + """ + CreatePipeline + """ + # data type: MSSharePointPipelineCreateRequest + oneof_schema_1_validator: Optional[MSSharePointPipelineCreateRequest] = None + # data type: S3PipelineCreateRequest + oneof_schema_2_validator: Optional[S3PipelineCreateRequest] = None + # data type: SFTPPipelineCreateRequest + oneof_schema_3_validator: Optional[SFTPPipelineCreateRequest] = None + # data type: SDMPipelineCreateRequest + oneof_schema_4_validator: Optional[SDMPipelineCreateRequest] = None + # data type: WorkZonePipelineCreateRequest + oneof_schema_5_validator: Optional[WorkZonePipelineCreateRequest] = None + # data type: ServiceNowPipelineCreateRequest + oneof_schema_6_validator: Optional[ServiceNowPipelineCreateRequest] = None + # data type: GoogleDrivePipelineCreateRequest + oneof_schema_7_validator: Optional[GoogleDrivePipelineCreateRequest] = None + # data type: MetadataConfiguration + oneof_schema_8_validator: Optional[MetadataConfiguration] = None + actual_instance: Optional[Union[GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest]] = None + one_of_schemas: Set[str] = { "GoogleDrivePipelineCreateRequest", "MSSharePointPipelineCreateRequest", "MetadataConfiguration", "S3PipelineCreateRequest", "SDMPipelineCreateRequest", "SFTPPipelineCreateRequest", "ServiceNowPipelineCreateRequest", "WorkZonePipelineCreateRequest" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = CreatePipeline.model_construct() + error_messages = [] + match = 0 + # validate data type: MSSharePointPipelineCreateRequest + if not isinstance(v, MSSharePointPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `MSSharePointPipelineCreateRequest`") + else: + match += 1 + # validate data type: S3PipelineCreateRequest + if not isinstance(v, S3PipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `S3PipelineCreateRequest`") + else: + match += 1 + # validate data type: SFTPPipelineCreateRequest + if not isinstance(v, SFTPPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `SFTPPipelineCreateRequest`") + else: + match += 1 + # validate data type: SDMPipelineCreateRequest + if not isinstance(v, SDMPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `SDMPipelineCreateRequest`") + else: + match += 1 + # validate data type: WorkZonePipelineCreateRequest + if not isinstance(v, WorkZonePipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `WorkZonePipelineCreateRequest`") + else: + match += 1 + # validate data type: ServiceNowPipelineCreateRequest + if not isinstance(v, ServiceNowPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `ServiceNowPipelineCreateRequest`") + else: + match += 1 + # validate data type: GoogleDrivePipelineCreateRequest + if not isinstance(v, GoogleDrivePipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleDrivePipelineCreateRequest`") + else: + match += 1 + # validate data type: MetadataConfiguration + if not isinstance(v, MetadataConfiguration): + error_messages.append(f"Error! Input type `{type(v)}` is not `MetadataConfiguration`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MSSharePointPipelineCreateRequest + try: + instance.actual_instance = MSSharePointPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineCreateRequest + try: + instance.actual_instance = S3PipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineCreateRequest + try: + instance.actual_instance = SFTPPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineCreateRequest + try: + instance.actual_instance = SDMPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineCreateRequest + try: + instance.actual_instance = WorkZonePipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineCreateRequest + try: + instance.actual_instance = ServiceNowPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineCreateRequest + try: + instance.actual_instance = GoogleDrivePipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MetadataConfiguration + try: + instance.actual_instance = MetadataConfiguration.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py new file mode 100644 index 00000000..7f7879d3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositories(BaseModel): + """ + DataRepositories + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[DataRepository] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositories from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositories from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [DataRepository.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py new file mode 100644 index 00000000..eeb07217 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepository(BaseModel): + """ + DataRepository schema expected by Retrieval. + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of this DataRepository.") + title: StrictStr + metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories.") + remote_grounding_name: Optional[StrictStr] = Field(default=None, alias="remoteGroundingName") + message: Optional[StrictStr] = None + type: DataRepositoryType + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "type"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepository from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepository from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName"), + "message": obj.get("message"), + "type": obj.get("type") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py new file mode 100644 index 00000000..936c5134 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositoryPerFilterSearchResult(BaseModel): + """ + DataRepositoryPerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(alias="filterId") + results: Optional[List[DataRepositorySearchResult]] = Field(default=None, description="List of returned results.") + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositoryPerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositoryPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py new file mode 100644 index 00000000..53364c7a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositorySearchResult(BaseModel): + """ + DataRepositorySearchResult + """ # noqa: E501 + data_repository: DataRepositoryWithDocuments = Field(alias="dataRepository") + __properties: ClassVar[List[str]] = ["dataRepository"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositorySearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data_repository + if self.data_repository: + _dict['dataRepository'] = self.data_repository.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositorySearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py new file mode 100644 index 00000000..3c82d1ca --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositorySearchResults(BaseModel): + """ + DataRepositorySearchResults + """ # noqa: E501 + results: List[ResultsInner2] = Field(description="List of returned results.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositorySearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositorySearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [ResultsInner2.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py new file mode 100644 index 00000000..a290173c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DataRepositoryType(str, Enum): + """ + Only include DataRepositories with the given type. + """ + + """ + allowed enum values + """ + VECTOR = 'vector' + HELP_DOT_SAP_DOT_COM = 'help.sap.com' + REMOTE_COLON_DG = 'remote:dg' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DataRepositoryType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py new file mode 100644 index 00000000..236cc929 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document import Document +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositoryWithDocuments(BaseModel): + """ + DataRepository schema returned by the Vector search endpoint + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of this DataRepository.") + title: StrictStr + metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories.") + remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly destination Name (grounding.name) of remote instance.", alias="remoteGroundingName") + message: Optional[StrictStr] = Field(default=None, description="Optional message.") + documents: List[Document] + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositoryWithDocuments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositoryWithDocuments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName"), + "message": obj.get("message"), + "documents": [Document.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py new file mode 100644 index 00000000..ed0a7b00 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DenseRetrievalScoringConfiguration(BaseModel): + """ + DenseRetrievalScoringConfiguration + """ # noqa: E501 + enabled: Optional[StrictBool] = Field(default=True, description="Enable dense retrieval.") + weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") + __properties: ClassVar[List[str]] = ["enabled", "weight"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DenseRetrievalScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DenseRetrievalScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "weight": obj.get("weight") if "weight" in obj else 1 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py new file mode 100644 index 00000000..b67a2acb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DetailsErrorResponse(BaseModel): + """ + DetailsErrorResponse + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Descriptive error code (not http status code)") + message: Optional[StrictStr] = Field(default=None, description="Plaintext error description") + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DetailsErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DetailsErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py new file mode 100644 index 00000000..eed09cd3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Document(BaseModel): + """ + Document + """ # noqa: E501 + id: StrictStr + metadata: Optional[List[RetrievalDocumentKeyValueListPair]] = None + chunks: List[RetrievalChunk] + __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Document from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Document from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [RetrievalDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "chunks": [RetrievalChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py new file mode 100644 index 00000000..96845a68 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentBulkDeleteRequest(BaseModel): + """ + A request to delete documents by their IDs. + """ # noqa: E501 + ids: Annotated[List[UUID], Field(min_length=1, max_length=100)] = Field(description="List of document IDs to delete") + __properties: ClassVar[List[str]] = ["ids"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py new file mode 100644 index 00000000..5e988e4a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentBulkDeleteResponse(BaseModel): + """ + Response after deleting documents in bulk. + """ # noqa: E501 + deleted: List[UUID] = Field(description="List of successfully deleted document IDs") + not_found: List[UUID] = Field(description="List of document IDs that were not found", alias="notFound") + __properties: ClassVar[List[str]] = ["deleted", "notFound"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deleted": obj.get("deleted"), + "notFound": obj.get("notFound") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py new file mode 100644 index 00000000..9e145c61 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentCreateRequest(BaseModel): + """ + A create request containing one or more new documents to create and store in a collection. + """ # noqa: E501 + documents: List[BaseDocument] + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "documents": [BaseDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py new file mode 100644 index 00000000..91b7eaa1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentInput(BaseModel): + """ + A single document stored in a collection by ID. + """ # noqa: E501 + chunks: List[TextOnlyBaseChunkCreate] + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + id: UUID = Field(description="Unique identifier of a document.") + __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentInput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentInput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chunks": [TextOnlyBaseChunkCreate.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None, + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py new file mode 100644 index 00000000..baec5b98 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentKeyValueListPair(BaseModel): + """ + DocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py new file mode 100644 index 00000000..c667d40d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadata(BaseModel): + """ + DocumentMetadata + """ # noqa: E501 + key: StrictStr = Field(description="Metadata key name.", json_schema_extra={"examples": ["contentObjectId"]}) + value: Optional[List[StrictStr]] = Field(description="An array of string values associated with the metadata key. If the key already exists, its values will be overwritten. Setting the value to null will delete the metadata key-value pair.") + match_mode: Optional[StrictStr] = Field(default=None, description="Match mode for the metadata key (ANY or ALL).", alias="matchMode") + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + @field_validator('match_mode') + def match_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ANY', 'ALL']): + raise ValueError("must be one of enum values ('ANY', 'ALL')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if value (nullable) is None + # and model_fields_set contains the field + if self.value is None and "value" in self.model_fields_set: + _dict['value'] = None + + # set to None if match_mode (nullable) is None + # and model_fields_set contains the field + if self.match_mode is None and "match_mode" in self.model_fields_set: + _dict['matchMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py new file mode 100644 index 00000000..e0b920b5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadataBatchRequest(BaseModel): + """ + DocumentMetadataBatchRequest + """ # noqa: E501 + value: Annotated[List[DocumentMetadataUpdate], Field(max_length=1000)] = Field(description="List of document metadata updates to be applied in batch.") + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadataBatchRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in value (list) + _items = [] + if self.value: + for _item_value in self.value: + _items.append(_item_value.to_dict() if _item_value is not None else None) + _dict['value'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadataBatchRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "value": [DocumentMetadataUpdate.from_dict(_item) for _item in obj["value"]] if obj.get("value") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py new file mode 100644 index 00000000..28570098 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadataUpdate(BaseModel): + """ + DocumentMetadataUpdate + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of the document to update.", json_schema_extra={"examples": ["550e8400-e29b-41d4-a716-446655440000"]}) + metadata: Annotated[List[DocumentMetadata], Field(max_length=10)] = Field(description="Metadata updates for this document.") + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py new file mode 100644 index 00000000..a16114c3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadataUpdateError(BaseModel): + """ + DocumentMetadataUpdateError + """ # noqa: E501 + target: StrictStr = Field(description="Document ID that caused the error.", json_schema_extra={"examples": ["550e8400-e29b-41d4-a716-446655440000"]}) + code: StrictInt = Field(description="HTTP error status code.", json_schema_extra={"examples": [500]}) + message: StrictStr = Field(description="Error message.", json_schema_extra={"examples": ["Some unexpected error occurred."]}) + __properties: ClassVar[List[str]] = ["target", "code", "message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdateError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdateError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "target": obj.get("target"), + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py new file mode 100644 index 00000000..38def6f9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentOutput(BaseModel): + """ + DocumentOutput + """ # noqa: E501 + id: UUID + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + chunks: List[VectorChunk] + __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentOutput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentOutput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "chunks": [VectorChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py new file mode 100644 index 00000000..906c1dd2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentResponse(BaseModel): + """ + A response containing information about a newly created, single document. + """ # noqa: E501 + chunks: List[TextOnlyBaseChunk] + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + id: UUID = Field(description="Unique identifier of a document.") + __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chunks": [TextOnlyBaseChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None, + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py new file mode 100644 index 00000000..96120a5e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DocumentStatus(str, Enum): + """ + DocumentStatus + """ + + """ + allowed enum values + """ + TO_BE_PROCESSED = 'TO_BE_PROCESSED' + INDEXED = 'INDEXED' + REINDEXED = 'REINDEXED' + DEINDEXED = 'DEINDEXED' + FAILED = 'FAILED' + FAILED_TO_BE_RETRIED = 'FAILED_TO_BE_RETRIED' + TO_BE_SCHEDULED = 'TO_BE_SCHEDULED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DocumentStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py new file mode 100644 index 00000000..cd781a61 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentUpdateRequest(BaseModel): + """ + An update request containing one or more documents to update existing documents in a collection by ID. + """ # noqa: E501 + documents: List[DocumentInput] + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentUpdateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentUpdateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "documents": [DocumentInput.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py new file mode 100644 index 00000000..ae54d7df --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentWithoutChunks(BaseModel): + """ + A single document stored in a collection by ID without exposing its chunks. + """ # noqa: E501 + metadata: List[VectorDocumentKeyValueListPair] + id: UUID = Field(description="Unique identifier of a document.") + __properties: ClassVar[List[str]] = ["metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentWithoutChunks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentWithoutChunks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py new file mode 100644 index 00000000..a3d4d056 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Documents(BaseModel): + """ + A response containing documents retrieved from the server. + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[DocumentWithoutChunks] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Documents from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Documents from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [DocumentWithoutChunks.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py new file mode 100644 index 00000000..3b21551d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsChunk(BaseModel): + """ + DocumentsChunk + """ # noqa: E501 + id: UUID + title: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + documents: List[DocumentOutput] + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "documents": [DocumentOutput.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py new file mode 100644 index 00000000..6675ab18 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsListResponse(BaseModel): + """ + A response containing documents retrieved from the server. + """ # noqa: E501 + documents: List[DocumentWithoutChunks] + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "documents": [DocumentWithoutChunks.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py new file mode 100644 index 00000000..930d1670 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsStatusResponse(BaseModel): + """ + DocumentsStatusResponse + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1]}) + resources: Optional[List[DocumentsStatusResponseResourcesInner]] = None + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsStatusResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsStatusResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [DocumentsStatusResponseResourcesInner.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py new file mode 100644 index 00000000..fbb7033f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsStatusResponseResourcesInner(BaseModel): + """ + DocumentsStatusResponseResourcesInner + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + status: Optional[DocumentStatus] = None + view_location: Optional[StrictStr] = Field(default=None, alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, alias="absoluteUrl") + title: Optional[StrictStr] = None + metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsStatusResponseResourcesInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if view_location (nullable) is None + # and model_fields_set contains the field + if self.view_location is None and "view_location" in self.model_fields_set: + _dict['viewLocation'] = None + + # set to None if download_location (nullable) is None + # and model_fields_set contains the field + if self.download_location is None and "download_location" in self.model_fields_set: + _dict['downloadLocation'] = None + + # set to None if absolute_url (nullable) is None + # and model_fields_set contains the field + if self.absolute_url is None and "absolute_url" in self.model_fields_set: + _dict['absoluteUrl'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if metadata_id (nullable) is None + # and model_fields_set contains the field + if self.metadata_id is None and "metadata_id" in self.model_fields_set: + _dict['metadataId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsStatusResponseResourcesInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "absoluteUrl": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadataId": obj.get("metadataId"), + "createdTimestamp": obj.get("createdTimestamp"), + "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py new file mode 100644 index 00000000..4bbdbcab --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EmbeddingConfig(BaseModel): + """ + EmbeddingConfig + """ # noqa: E501 + model_name: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(default='text-embedding-ada-002', alias="modelName") + __properties: ClassVar[List[str]] = ["modelName"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EmbeddingConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EmbeddingConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modelName": obj.get("modelName") if obj.get("modelName") is not None else 'text-embedding-ada-002' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py new file mode 100644 index 00000000..77098bd1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ErrorResponse(BaseModel): + """ + ErrorResponse + """ # noqa: E501 + error: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Error occurred during tenant onboarding"]}) + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": obj.get("error") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py new file mode 100644 index 00000000..35b332b3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTER_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Filter(BaseModel): + """ + Advanced filter expression for combining metadata filters with boolean logic + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = Filter.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Filter with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Filter with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py new file mode 100644 index 00000000..1e2216f9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class FilterMatchModeEnum(str, Enum): + """ + FilterMatchModeEnum + """ + + """ + allowed enum values + """ + ANY = 'ANY' + ALL = 'ALL' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of FilterMatchModeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py new file mode 100644 index 00000000..caf90051 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTERSINNER_ANY_OF_SCHEMAS = ["RetrievalSearchFilter", "RetrievalVectorSearchFilter"] + +class FiltersInner(BaseModel): + """ + FiltersInner + """ + + # data type: RetrievalSearchFilter + anyof_schema_1_validator: Optional[RetrievalSearchFilter] = None + # data type: RetrievalVectorSearchFilter + anyof_schema_2_validator: Optional[RetrievalVectorSearchFilter] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalSearchFilter, RetrievalVectorSearchFilter]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalSearchFilter", "RetrievalVectorSearchFilter" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = FiltersInner.model_construct() + error_messages = [] + # validate data type: RetrievalSearchFilter + if not isinstance(v, RetrievalSearchFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalSearchFilter`") + else: + return v + + # validate data type: RetrievalVectorSearchFilter + if not isinstance(v, RetrievalVectorSearchFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalVectorSearchFilter`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in FiltersInner with anyOf schemas: RetrievalSearchFilter, RetrievalVectorSearchFilter. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalSearchFilter] = None + try: + instance.actual_instance = RetrievalSearchFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalVectorSearchFilter] = None + try: + instance.actual_instance = RetrievalVectorSearchFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into FiltersInner with anyOf schemas: RetrievalSearchFilter, RetrievalVectorSearchFilter. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalSearchFilter, RetrievalVectorSearchFilter]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py new file mode 100644 index 00000000..c785ed27 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GenericError(BaseModel): + """ + GenericError + """ # noqa: E501 + error: StrictStr = Field(description="Human-readable error message") + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GenericError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GenericError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": obj.get("error") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py new file mode 100644 index 00000000..26e0f39f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetAllPipelines400Response(BaseModel): + """ + GetAllPipelines400Response + """ # noqa: E501 + error: Optional[ApiError] = None + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetAllPipelines400Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetAllPipelines400Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": ApiError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py new file mode 100644 index 00000000..3a90f732 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETCOLLECTIONCREATIONSTATUS200RESPONSE_ONE_OF_SCHEMAS = ["CollectionCreatedResponse", "CollectionPendingResponse"] + +class GetCollectionCreationStatus200Response(BaseModel): + """ + GetCollectionCreationStatus200Response + """ + # data type: CollectionCreatedResponse + oneof_schema_1_validator: Optional[CollectionCreatedResponse] = None + # data type: CollectionPendingResponse + oneof_schema_2_validator: Optional[CollectionPendingResponse] = None + actual_instance: Optional[Union[CollectionCreatedResponse, CollectionPendingResponse]] = None + one_of_schemas: Set[str] = { "CollectionCreatedResponse", "CollectionPendingResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetCollectionCreationStatus200Response.model_construct() + error_messages = [] + match = 0 + # validate data type: CollectionCreatedResponse + if not isinstance(v, CollectionCreatedResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionCreatedResponse`") + else: + match += 1 + # validate data type: CollectionPendingResponse + if not isinstance(v, CollectionPendingResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionPendingResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into CollectionCreatedResponse + try: + instance.actual_instance = CollectionCreatedResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CollectionPendingResponse + try: + instance.actual_instance = CollectionPendingResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], CollectionCreatedResponse, CollectionPendingResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py new file mode 100644 index 00000000..8f248f5a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETCOLLECTIONDELETIONSTATUS200RESPONSE_ONE_OF_SCHEMAS = ["CollectionDeletedResponse", "CollectionPendingResponse"] + +class GetCollectionDeletionStatus200Response(BaseModel): + """ + GetCollectionDeletionStatus200Response + """ + # data type: CollectionDeletedResponse + oneof_schema_1_validator: Optional[CollectionDeletedResponse] = None + # data type: CollectionPendingResponse + oneof_schema_2_validator: Optional[CollectionPendingResponse] = None + actual_instance: Optional[Union[CollectionDeletedResponse, CollectionPendingResponse]] = None + one_of_schemas: Set[str] = { "CollectionDeletedResponse", "CollectionPendingResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetCollectionDeletionStatus200Response.model_construct() + error_messages = [] + match = 0 + # validate data type: CollectionDeletedResponse + if not isinstance(v, CollectionDeletedResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionDeletedResponse`") + else: + match += 1 + # validate data type: CollectionPendingResponse + if not isinstance(v, CollectionPendingResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionPendingResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into CollectionDeletedResponse + try: + instance.actual_instance = CollectionDeletedResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CollectionPendingResponse + try: + instance.actual_instance = CollectionPendingResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], CollectionDeletedResponse, CollectionPendingResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py new file mode 100644 index 00000000..3cc9d364 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETPIPELINE_ONE_OF_SCHEMAS = ["GoogleDrivePipelineGetResponse", "MSSharePointPipelineGetResponse", "S3PipelineGetResponse", "SDMPipelineGetResponse", "SFTPPipelineGetResponse", "ServiceNowPipelineGetResponse", "WorkZonePipelineGetResponse"] + +class GetPipeline(BaseModel): + """ + GetPipeline + """ + # data type: MSSharePointPipelineGetResponse + oneof_schema_1_validator: Optional[MSSharePointPipelineGetResponse] = None + # data type: S3PipelineGetResponse + oneof_schema_2_validator: Optional[S3PipelineGetResponse] = None + # data type: SFTPPipelineGetResponse + oneof_schema_3_validator: Optional[SFTPPipelineGetResponse] = None + # data type: SDMPipelineGetResponse + oneof_schema_4_validator: Optional[SDMPipelineGetResponse] = None + # data type: WorkZonePipelineGetResponse + oneof_schema_5_validator: Optional[WorkZonePipelineGetResponse] = None + # data type: ServiceNowPipelineGetResponse + oneof_schema_6_validator: Optional[ServiceNowPipelineGetResponse] = None + # data type: GoogleDrivePipelineGetResponse + oneof_schema_7_validator: Optional[GoogleDrivePipelineGetResponse] = None + actual_instance: Optional[Union[GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse]] = None + one_of_schemas: Set[str] = { "GoogleDrivePipelineGetResponse", "MSSharePointPipelineGetResponse", "S3PipelineGetResponse", "SDMPipelineGetResponse", "SFTPPipelineGetResponse", "ServiceNowPipelineGetResponse", "WorkZonePipelineGetResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetPipeline.model_construct() + error_messages = [] + match = 0 + # validate data type: MSSharePointPipelineGetResponse + if not isinstance(v, MSSharePointPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MSSharePointPipelineGetResponse`") + else: + match += 1 + # validate data type: S3PipelineGetResponse + if not isinstance(v, S3PipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `S3PipelineGetResponse`") + else: + match += 1 + # validate data type: SFTPPipelineGetResponse + if not isinstance(v, SFTPPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SFTPPipelineGetResponse`") + else: + match += 1 + # validate data type: SDMPipelineGetResponse + if not isinstance(v, SDMPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SDMPipelineGetResponse`") + else: + match += 1 + # validate data type: WorkZonePipelineGetResponse + if not isinstance(v, WorkZonePipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `WorkZonePipelineGetResponse`") + else: + match += 1 + # validate data type: ServiceNowPipelineGetResponse + if not isinstance(v, ServiceNowPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `ServiceNowPipelineGetResponse`") + else: + match += 1 + # validate data type: GoogleDrivePipelineGetResponse + if not isinstance(v, GoogleDrivePipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleDrivePipelineGetResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MSSharePointPipelineGetResponse + try: + instance.actual_instance = MSSharePointPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineGetResponse + try: + instance.actual_instance = S3PipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineGetResponse + try: + instance.actual_instance = SFTPPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineGetResponse + try: + instance.actual_instance = SDMPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineGetResponse + try: + instance.actual_instance = WorkZonePipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineGetResponse + try: + instance.actual_instance = ServiceNowPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineGetResponse + try: + instance.actual_instance = GoogleDrivePipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py new file mode 100644 index 00000000..3bc1174c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelineExecutionById(BaseModel): + """ + GetPipelineExecutionById + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + created_at: Optional[StrictStr] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[StrictStr] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + status: Optional[PipelineExecutionStatus] = None + __properties: ClassVar[List[str]] = ["id", "createdAt", "modifiedAt", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelineExecutionById from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineExecutionById from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "createdAt": obj.get("createdAt"), + "modifiedAt": obj.get("modifiedAt"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py new file mode 100644 index 00000000..f03432e0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelineExecutions(BaseModel): + """ + GetPipelineExecutions + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [2]}) + resources: Optional[List[PipelineExecutionData]] = None + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelineExecutions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineExecutions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [PipelineExecutionData.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py new file mode 100644 index 00000000..9c888bfa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelineStatus(BaseModel): + """ + GetPipelineStatus + """ # noqa: E501 + last_started: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="lastStarted", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + last_completed_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="lastCompletedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + status: Optional[PipelineExecutionStatus] = None + __properties: ClassVar[List[str]] = ["lastStarted", "createdAt", "lastCompletedAt", "status"] + + @field_validator('last_started', mode="before") + def last_started_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + @field_validator('created_at', mode="before") + def created_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + @field_validator('last_completed_at', mode="before") + def last_completed_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelineStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['createdAt'] = None + + # set to None if last_completed_at (nullable) is None + # and model_fields_set contains the field + if self.last_completed_at is None and "last_completed_at" in self.model_fields_set: + _dict['lastCompletedAt'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "lastStarted": obj.get("lastStarted"), + "createdAt": obj.get("createdAt"), + "lastCompletedAt": obj.get("lastCompletedAt"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py new file mode 100644 index 00000000..5f126b11 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelines(BaseModel): + """ + GetPipelines + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[GetPipeline] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelines from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelines from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [GetPipeline.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py new file mode 100644 index 00000000..cb1ff0a7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveConfig(BaseModel): + """ + GoogleDriveConfig + """ # noqa: E501 + resource_type: StrictStr = Field(alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["resourceType", "resourceId", "includePaths"] + + @field_validator('resource_type') + def resource_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SHARED_FOLDER', 'SHARED_DRIVE']): + raise ValueError("must be one of enum values ('SHARED_FOLDER', 'SHARED_DRIVE')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "resourceType": obj.get("resourceType"), + "resourceId": obj.get("resourceId"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py new file mode 100644 index 00000000..0df1a95b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveConfigurationMinimal(BaseModel): + """ + GoogleDriveConfigurationMinimal + """ # noqa: E501 + google_drive: GoogleDriveResourceDetail = Field(alias="googleDrive") + __properties: ClassVar[List[str]] = ["googleDrive"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "googleDrive": GoogleDriveResourceDetail.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py new file mode 100644 index 00000000..762ffce7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveConfigurationStruct(BaseModel): + """ + GoogleDriveConfigurationStruct + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) + google_drive: GoogleDriveConfig = Field(alias="googleDrive") + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + metadata_config_id: Optional[StrictStr] = Field(default=None, alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "googleDrive", "cronExpression", "metadataConfigId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "googleDrive": GoogleDriveConfig.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None, + "cronExpression": obj.get("cronExpression"), + "metadataConfigId": obj.get("metadataConfigId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py new file mode 100644 index 00000000..f02d223a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDrivePipelineCreateRequest(BaseModel): + """ + GoogleDrivePipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: Optional[MetaData] = None + configuration: GoogleDriveConfigurationStruct + __properties: ClassVar[List[str]] = ["type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['GoogleDrive']): + raise ValueError("must be one of enum values ('GoogleDrive')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": GoogleDriveConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py new file mode 100644 index 00000000..c7106e4a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDrivePipelineGetResponse(BaseModel): + """ + GoogleDrivePipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: GoogleDriveConfigurationMinimal + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['GoogleDrive']): + raise ValueError("must be one of enum values ('GoogleDrive')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": GoogleDriveConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py new file mode 100644 index 00000000..5ea5811e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDrivePipelineMinimalResponse(BaseModel): + """ + GoogleDrivePipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: Optional[GoogleDriveConfigurationMinimal] = None + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['GoogleDrive']): + raise ValueError("must be one of enum values ('GoogleDrive')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": GoogleDriveConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py new file mode 100644 index 00000000..f3a1ac8c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveResourceDetail(BaseModel): + """ + GoogleDriveResourceDetail + """ # noqa: E501 + resource_type: Optional[StrictStr] = Field(default=None, alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["resourceType", "resourceId", "includePaths"] + + @field_validator('resource_type') + def resource_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SHARED_FOLDER', 'SHARED_DRIVE']): + raise ValueError("must be one of enum values ('SHARED_FOLDER', 'SHARED_DRIVE')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveResourceDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveResourceDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "resourceType": obj.get("resourceType"), + "resourceId": obj.get("resourceId"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py new file mode 100644 index 00000000..6df75c1c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class HTTPValidationError(BaseModel): + """ + HTTPValidationError + """ # noqa: E501 + detail: Optional[List[ValidationError]] = None + __properties: ClassVar[List[str]] = ["detail"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HTTPValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in detail (list) + _items = [] + if self.detail: + for _item_detail in self.detail: + _items.append(_item_detail.to_dict() if _item_detail is not None else None) + _dict['detail'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HTTPValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py new file mode 100644 index 00000000..b10a0d61 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class KeyValueListPair(BaseModel): + """ + KeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of KeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of KeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py new file mode 100644 index 00000000..ea2b1835 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class KeyWordRetrievalScoringConfiguration(BaseModel): + """ + KeyWordRetrievalScoringConfiguration + """ # noqa: E501 + enabled: Optional[StrictBool] = Field(default=True, description="Enable dense retrieval.") + weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") + extract_key_words_from_query: Optional[StrictBool] = Field(default=False, description="Extract Keywords from Query.", alias="extractKeyWordsFromQuery") + __properties: ClassVar[List[str]] = ["enabled", "weight", "extractKeyWordsFromQuery"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of KeyWordRetrievalScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + # set to None if extract_key_words_from_query (nullable) is None + # and model_fields_set contains the field + if self.extract_key_words_from_query is None and "extract_key_words_from_query" in self.model_fields_set: + _dict['extractKeyWordsFromQuery'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of KeyWordRetrievalScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "weight": obj.get("weight") if "weight" in obj else 1, + "extractKeyWordsFromQuery": obj.get("extractKeyWordsFromQuery") if "extractKeyWordsFromQuery" in obj else False + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py new file mode 100644 index 00000000..d6e6183c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LEFT_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class Left(BaseModel): + """ + Left + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Left.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Left with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Left with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Left.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py new file mode 100644 index 00000000..81ae7aa8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LEFT1_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Left1(BaseModel): + """ + Left operand of the boolean expression + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Left1.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Left1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Left1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Left1.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py new file mode 100644 index 00000000..a823c9d8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListConfigurationDocuments(BaseModel): + """ + ListConfigurationDocuments + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Total number of documents returned.", json_schema_extra={"examples": [1]}) + resources: Optional[List[ConfigurationDocument]] = Field(default=None, description="List of document objects. It will be empty array if no records found.") + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListConfigurationDocuments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListConfigurationDocuments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [ConfigurationDocument.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py new file mode 100644 index 00000000..4f8d6276 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListConfigurationDocumentsFullDetails(BaseModel): + """ + ListConfigurationDocumentsFullDetails + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Total number of documents returned.", json_schema_extra={"examples": [1]}) + resources: Optional[List[ConfigurationDocumentFullDetails]] = Field(default=None, description="List of document objects. It will be empty array if no records found.") + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListConfigurationDocumentsFullDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListConfigurationDocumentsFullDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [ConfigurationDocumentFullDetails.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py new file mode 100644 index 00000000..8a2596d6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListMetadataConfigurations(BaseModel): + """ + ListMetadataConfigurations + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Total number of metadata configurations returned.", json_schema_extra={"examples": [1]}) + resources: Optional[List[MetadataConfigurationResponse]] = Field(default=None, description="List of metadata configuration objects. It will be empty array if no records found.") + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListMetadataConfigurations from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListMetadataConfigurations from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [MetadataConfigurationResponse.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py new file mode 100644 index 00000000..3d1fa359 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"] + +class LocationInner(BaseModel): + """ + LocationInner + """ + + # data type: str + anyof_schema_1_validator: Optional[StrictStr] = None + # data type: int + anyof_schema_2_validator: Optional[StrictInt] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[int, str]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "int", "str" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = LocationInner.model_construct() + error_messages = [] + # validate data type: str + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: int + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into str + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into int + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py new file mode 100644 index 00000000..dd4c0ed1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ManualPipelineTrigger(BaseModel): + """ + ManualPipelineTrigger + """ # noqa: E501 + pipeline_id: Optional[StrictStr] = Field(default=None, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + metadata_only: Optional[StrictBool] = Field(default=None, alias="metadataOnly", json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["pipelineId", "metadataOnly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ManualPipelineTrigger from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ManualPipelineTrigger from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pipelineId": obj.get("pipelineId"), + "metadataOnly": obj.get("metadataOnly") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py new file mode 100644 index 00000000..9fc64a45 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MergeStrategyReranker(BaseModel): + """ + The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult instances. This strategy adds latency, but yields good results. + """ # noqa: E501 + type: Optional[MergeStrategyType] = None + model: Optional[StrictStr] = Field(default='cohere-3.5', description="The RerankerModel to use.") + boosting: Optional[List[MergeStrategyRerankerBoostingInner]] = Field(default=None, description="Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.") + include_all_meta_data: Optional[StrictBool] = Field(default=False, description="If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.", alias="includeAllMetaData") + __properties: ClassVar[List[str]] = ["type", "model", "boosting", "includeAllMetaData"] + + @field_validator('model') + def model_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['cohere-3.5']): + raise ValueError("must be one of enum values ('cohere-3.5')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MergeStrategyReranker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in boosting (list) + _items = [] + if self.boosting: + for _item_boosting in self.boosting: + _items.append(_item_boosting.to_dict() if _item_boosting is not None else None) + _dict['boosting'] = _items + # set to None if model (nullable) is None + # and model_fields_set contains the field + if self.model is None and "model" in self.model_fields_set: + _dict['model'] = None + + # set to None if boosting (nullable) is None + # and model_fields_set contains the field + if self.boosting is None and "boosting" in self.model_fields_set: + _dict['boosting'] = None + + # set to None if include_all_meta_data (nullable) is None + # and model_fields_set contains the field + if self.include_all_meta_data is None and "include_all_meta_data" in self.model_fields_set: + _dict['includeAllMetaData'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MergeStrategyReranker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "model": obj.get("model") if "model" in obj else 'cohere-3.5', + "boosting": [MergeStrategyRerankerBoostingInner.from_dict(_item) for _item in obj["boosting"]] if obj.get("boosting") is not None else None, + "includeAllMetaData": obj.get("includeAllMetaData") if "includeAllMetaData" in obj else False + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py new file mode 100644 index 00000000..be3cf901 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MergeStrategyRerankerBoostingInner(BaseModel): + """ + MergeStrategyRerankerBoostingInner + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: List[StrictStr] = Field(description="PerFilterSearchResult ID or a new ID for each PostProcessingOperation.") + __properties: ClassVar[List[str]] = ["key", "value", "scope"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MergeStrategyRerankerBoostingInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MergeStrategyRerankerBoostingInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py new file mode 100644 index 00000000..36716f52 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MergeStrategyScoreReuse(BaseModel): + """ + The MergeStrategyScoreReuse merges the given PerFilterSearchResult instances according to the scores returned by the downstream retrieval process. It is important that the scores are comparable, meaning they should come from the same embedding model or reranker model. + """ # noqa: E501 + type: Optional[MergeStrategyType] = None + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MergeStrategyScoreReuse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MergeStrategyScoreReuse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py new file mode 100644 index 00000000..85e49ed1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MergeStrategyType(str, Enum): + """ + MergeStrategyType + """ + + """ + allowed enum values + """ + RERANKER = 'reranker' + SCOREREUSE = 'scoreReuse' + RECIPROCALRANKFUSION = 'reciprocalRankFusion' + RANDOM = 'random' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MergeStrategyType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py new file mode 100644 index 00000000..6e46486c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MessageResponse(BaseModel): + """ + MessageResponse + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Tenant onboarding request accepted"]}) + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py new file mode 100644 index 00000000..ac391ef9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetaData(BaseModel): + """ + MetaData + """ # noqa: E501 + destination: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["destination-name"]}) + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "dataRepositoryMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py new file mode 100644 index 00000000..bd4d035c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetaDataDataRepositoryMetadataInner(BaseModel): + """ + MetaDataDataRepositoryMetadataInner + """ # noqa: E501 + key: Annotated[str, Field(min_length=1, strict=True, max_length=1024)] + value: Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=1024)]], Field(min_length=1)] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaDataDataRepositoryMetadataInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaDataDataRepositoryMetadataInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py new file mode 100644 index 00000000..e20d10b3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetaDataKeyValuePairStrict(BaseModel): + """ + MetaDataKeyValuePairStrict + """ # noqa: E501 + key: Annotated[str, Field(min_length=1, strict=True, max_length=1024)] + value: Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=1024)]], Field(min_length=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaDataKeyValuePairStrict from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaDataKeyValuePairStrict from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py new file mode 100644 index 00000000..d3e13d0c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfiguration(BaseModel): + """ + MetadataConfiguration + """ # noqa: E501 + type: StrictStr + configuration: MetadataConfigurationStruct + metadata: Optional[MetadataConfigurationMetadata] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['metadata']): + raise ValueError("must be one of enum values ('metadata')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": MetadataConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetadataConfigurationMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py new file mode 100644 index 00000000..3336019f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationMetadata(BaseModel): + """ + MetadataConfigurationMetadata + """ # noqa: E501 + data_repository_metadata: List[MetaDataKeyValuePairStrict] = Field(alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataKeyValuePairStrict.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py new file mode 100644 index 00000000..b1995ec2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationRequest(BaseModel): + """ + MetadataConfigurationRequest + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be generated.") + name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") + destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) + labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None + __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels"] + + @field_validator('data_repository_type') + def data_repository_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint', 'S3', 'SFTP']): + raise ValueError("must be one of enum values ('MSSharePoint', 'S3', 'SFTP')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in labels (list) + _items = [] + if self.labels: + for _item_labels in self.labels: + _items.append(_item_labels.to_dict() if _item_labels is not None else None) + _dict['labels'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "destinationName": obj.get("destinationName"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "includePaths": obj.get("includePaths"), + "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py new file mode 100644 index 00000000..4dd5ae43 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationRequestLabelsInner(BaseModel): + """ + MetadataConfigurationRequestLabelsInner + """ # noqa: E501 + key: StrictStr = Field(json_schema_extra={"examples": ["department"]}) + value: StrictStr = Field(json_schema_extra={"examples": ["finance"]}) + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequestLabelsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequestLabelsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py new file mode 100644 index 00000000..a67dc660 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationResponse(BaseModel): + """ + MetadataConfigurationResponse + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be generated.") + name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") + destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) + labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None + enumeration_status: Optional[StrictStr] = Field(default=None, description="Status of metadata enumeration for the configuration.", alias="enumerationStatus") + __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels", "enumerationStatus"] + + @field_validator('data_repository_type') + def data_repository_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint', 'S3', 'SFTP']): + raise ValueError("must be one of enum values ('MSSharePoint', 'S3', 'SFTP')") + return value + + @field_validator('enumeration_status') + def enumeration_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['NEW', 'IN_PROGRESS', 'COMPLETED', 'ERROR']): + raise ValueError("must be one of enum values ('NEW', 'IN_PROGRESS', 'COMPLETED', 'ERROR')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in labels (list) + _items = [] + if self.labels: + for _item_labels in self.labels: + _items.append(_item_labels.to_dict() if _item_labels is not None else None) + _dict['labels'] = _items + # set to None if enumeration_status (nullable) is None + # and model_fields_set contains the field + if self.enumeration_status is None and "enumeration_status" in self.model_fields_set: + _dict['enumerationStatus'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "destinationName": obj.get("destinationName"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "includePaths": obj.get("includePaths"), + "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None, + "enumerationStatus": obj.get("enumerationStatus") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py new file mode 100644 index 00000000..804545fc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationStruct(BaseModel): + """ + MetadataConfigurationStruct + """ # noqa: E501 + metadata_config_id: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["metadataConfigId", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadataConfigId": obj.get("metadataConfigId"), + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py new file mode 100644 index 00000000..ddf54f05 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataItem(BaseModel): + """ + MetadataItem + """ # noqa: E501 + id: UUID = Field(description="ID of collection") + metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="List of metadata of the collections or documents or chunks") + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py new file mode 100644 index 00000000..7eb14aba --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataKeyUpdate(BaseModel): + """ + MetadataKeyUpdate + """ # noqa: E501 + key: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Key to update") + operations: Optional[List[MetadataOperation]] = Field(default=None, description="Update operation executed for the key") + __properties: ClassVar[List[str]] = ["key", "operations"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataKeyUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in operations (list) + _items = [] + if self.operations: + for _item_operations in self.operations: + _items.append(_item_operations.to_dict() if _item_operations is not None else None) + _dict['operations'] = _items + # set to None if operations (nullable) is None + # and model_fields_set contains the field + if self.operations is None and "operations" in self.model_fields_set: + _dict['operations'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataKeyUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "operations": [MetadataOperation.from_dict(_item) for _item in obj["operations"]] if obj.get("operations") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py new file mode 100644 index 00000000..0009ddd6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataOperation(BaseModel): + """ + MetadataOperation + """ # noqa: E501 + op: MetadataOperationEnum + values: Optional[List[StrictStr]] = Field(default=None, description="List of values to update.") + __properties: ClassVar[List[str]] = ["op", "values"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataOperation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if values (nullable) is None + # and model_fields_set contains the field + if self.values is None and "values" in self.model_fields_set: + _dict['values'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataOperation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "op": obj.get("op"), + "values": obj.get("values") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py new file mode 100644 index 00000000..ef99f22d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MetadataOperationEnum(str, Enum): + """ + MetadataOperationEnum + """ + + """ + allowed enum values + """ + ADD = 'add' + REMOVE = 'remove' + REPLACE = 'replace' + DELETE_KEY = 'delete_key' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MetadataOperationEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py new file mode 100644 index 00000000..27b82ad8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataResponse(BaseModel): + """ + MetadataResponse + """ # noqa: E501 + current_metadata: Optional[List[MetadataItem]] = Field(default=None, description="List of metadata after updates.") + __properties: ClassVar[List[str]] = ["current_metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in current_metadata (list) + _items = [] + if self.current_metadata: + for _item_current_metadata in self.current_metadata: + _items.append(_item_current_metadata.to_dict() if _item_current_metadata is not None else None) + _dict['current_metadata'] = _items + # set to None if current_metadata (nullable) is None + # and model_fields_set contains the field + if self.current_metadata is None and "current_metadata" in self.model_fields_set: + _dict['current_metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "current_metadata": [MetadataItem.from_dict(_item) for _item in obj["current_metadata"]] if obj.get("current_metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py new file mode 100644 index 00000000..55edd56e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataUpdateItem(BaseModel): + """ + MetadataUpdateItem + """ # noqa: E501 + ids: List[UUID] = Field(description="List of collection or document or chunk ids for which the metadata should be updated") + metadata_updates: List[MetadataKeyUpdate] = Field(description="List of metadata updates for the given resource ids", alias="metadataUpdates") + __properties: ClassVar[List[str]] = ["ids", "metadataUpdates"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataUpdateItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata_updates (list) + _items = [] + if self.metadata_updates: + for _item_metadata_updates in self.metadata_updates: + _items.append(_item_metadata_updates.to_dict() if _item_metadata_updates is not None else None) + _dict['metadataUpdates'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataUpdateItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "metadataUpdates": [MetadataKeyUpdate.from_dict(_item) for _item in obj["metadataUpdates"]] if obj.get("metadataUpdates") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py new file mode 100644 index 00000000..b33bc4ef --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataUpdates(BaseModel): + """ + MetadataUpdates + """ # noqa: E501 + updates: List[MetadataUpdateItem] = Field(description="List of metadata updates.") + __properties: ClassVar[List[str]] = ["updates"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataUpdates from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in updates (list) + _items = [] + if self.updates: + for _item_updates in self.updates: + _items.append(_item_updates.to_dict() if _item_updates is not None else None) + _dict['updates'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataUpdates from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "updates": [MetadataUpdateItem.from_dict(_item) for _item in obj["updates"]] if obj.get("updates") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py new file mode 100644 index 00000000..aaa86e48 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointConfiguration(BaseModel): + """ + MSSharePointConfiguration + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) + share_point: SharePointConfig = Field(alias="sharePoint") + cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "sharePoint", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sharePoint": SharePointConfig.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py new file mode 100644 index 00000000..953bd0b0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointConfigurationGetResponse(BaseModel): + """ + MSSharePointConfigurationGetResponse + """ # noqa: E501 + destination: StrictStr + share_point: SharePointConfigGetResponse = Field(alias="sharePoint") + __properties: ClassVar[List[str]] = ["destination", "sharePoint"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sharePoint": SharePointConfigGetResponse.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py new file mode 100644 index 00000000..5676fa57 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointConfigurationMinimal(BaseModel): + """ + MSSharePointConfigurationMinimal + """ # noqa: E501 + share_point: SharePointSiteDetail = Field(alias="sharePoint") + __properties: ClassVar[List[str]] = ["sharePoint"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sharePoint": SharePointSiteDetail.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py new file mode 100644 index 00000000..a05ca764 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointPipelineCreateRequest(BaseModel): + """ + MSSharePointPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + configuration: MSSharePointConfiguration + metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint']): + raise ValueError("must be one of enum values ('MSSharePoint')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": MSSharePointConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py new file mode 100644 index 00000000..66df4f4f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointPipelineGetResponse(BaseModel): + """ + MSSharePointPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: MSSharePointConfigurationGetResponse + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint']): + raise ValueError("must be one of enum values ('MSSharePoint')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": MSSharePointConfigurationGetResponse.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py new file mode 100644 index 00000000..853bd3fe --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointPipelineMinimalResponse(BaseModel): + """ + MSSharePointPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: MSSharePointConfigurationMinimal + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint']): + raise ValueError("must be one of enum values ('MSSharePoint')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": MSSharePointConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py new file mode 100644 index 00000000..3eab15de --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PatchPipeline(BaseModel): + """ + PatchPipeline + """ # noqa: E501 + metadata: Optional[PatchPipelineMetadata] = None + configuration: Optional[PatchPipelineConfiguration] = None + __properties: ClassVar[List[str]] = ["metadata", "configuration"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PatchPipeline from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipeline from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": PatchPipelineMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": PatchPipelineConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py new file mode 100644 index 00000000..5117e86f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PatchPipelineConfiguration(BaseModel): + """ + PatchPipelineConfiguration + """ # noqa: E501 + cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + __properties: ClassVar[List[str]] = ["cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PatchPipelineConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipelineConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cronExpression": obj.get("cronExpression") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py new file mode 100644 index 00000000..e9fdd7d9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PatchPipelineMetadata(BaseModel): + """ + PatchPipelineMetadata + """ # noqa: E501 + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Patch for metadata happens at key level. Value for the specific key would be inserted/replaced.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PatchPipelineMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipelineMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py new file mode 100644 index 00000000..90f1518a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PerFilterSearchResult(BaseModel): + """ + PerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(alias="filterId") + results: List[DocumentsChunk] + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py new file mode 100644 index 00000000..7d52ede8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PerFilterSearchResultError(BaseModel): + """ + Error message if any. + """ # noqa: E501 + message: StrictStr + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PerFilterSearchResultError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResultError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") if obj.get("message") is not None else 'Unknown Error Occurred' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py new file mode 100644 index 00000000..8fee6755 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PerFilterSearchResultWithError(BaseModel): + """ + PerFilterSearchResultWithError + """ # noqa: E501 + filter_id: StrictStr = Field(alias="filterId") + error: Optional[PerFilterSearchResultError] = None + __properties: ClassVar[List[str]] = ["filterId", "error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PerFilterSearchResultWithError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResultWithError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "error": PerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py new file mode 100644 index 00000000..9bc1b3b7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PipelineDocumentResponse(BaseModel): + """ + PipelineDocumentResponse + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + status: Optional[DocumentStatus] = None + view_location: Optional[StrictStr] = Field(default=None, alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, alias="absoluteUrl") + title: Optional[StrictStr] = None + metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PipelineDocumentResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if view_location (nullable) is None + # and model_fields_set contains the field + if self.view_location is None and "view_location" in self.model_fields_set: + _dict['viewLocation'] = None + + # set to None if download_location (nullable) is None + # and model_fields_set contains the field + if self.download_location is None and "download_location" in self.model_fields_set: + _dict['downloadLocation'] = None + + # set to None if absolute_url (nullable) is None + # and model_fields_set contains the field + if self.absolute_url is None and "absolute_url" in self.model_fields_set: + _dict['absoluteUrl'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if metadata_id (nullable) is None + # and model_fields_set contains the field + if self.metadata_id is None and "metadata_id" in self.model_fields_set: + _dict['metadataId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineDocumentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "absoluteUrl": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadataId": obj.get("metadataId"), + "createdTimestamp": obj.get("createdTimestamp"), + "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py new file mode 100644 index 00000000..f882e16a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PipelineExecutionData(BaseModel): + """ + PipelineExecutionData + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] = None + created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + __properties: ClassVar[List[str]] = ["id", "status", "createdAt", "modifiedAt"] + + @field_validator('created_at', mode="before") + def created_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + @field_validator('modified_at', mode="before") + def modified_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PipelineExecutionData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['createdAt'] = None + + # set to None if modified_at (nullable) is None + # and model_fields_set contains the field + if self.modified_at is None and "modified_at" in self.model_fields_set: + _dict['modifiedAt'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineExecutionData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "createdAt": obj.get("createdAt"), + "modifiedAt": obj.get("modifiedAt") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py new file mode 100644 index 00000000..1b7eae72 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class PipelineExecutionStatus(str, Enum): + """ + PipelineExecutionStatus + """ + + """ + allowed enum values + """ + NEW = 'NEW' + CREATING = 'CREATING' + CREATED = 'CREATED' + CREATION_FAILED = 'CREATION_FAILED' + UNKNOWN = 'UNKNOWN' + INPROGRESS = 'INPROGRESS' + FINISHED = 'FINISHED' + FINISHEDWITHERRORS = 'FINISHEDWITHERRORS' + TIMEOUT = 'TIMEOUT' + DELETION_INPROGRESS = 'DELETION_INPROGRESS' + DELETION_FAILED = 'DELETION_FAILED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PipelineExecutionStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py new file mode 100644 index 00000000..d5778d9f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PipelineId(BaseModel): + """ + PipelineId + """ # noqa: E501 + pipeline_id: Optional[StrictStr] = Field(default=None, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + __properties: ClassVar[List[str]] = ["pipelineId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PipelineId from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pipelineId": obj.get("pipelineId") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py new file mode 100644 index 00000000..da6363a8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +PIPELINEMINIMALRESPONSE_ONE_OF_SCHEMAS = ["GoogleDrivePipelineMinimalResponse", "MSSharePointPipelineMinimalResponse", "S3PipelineMinimalResponse", "SDMPipelineMinimalResponse", "SFTPPipelineMinimalResponse", "ServiceNowPipelineMinimalResponse", "WorkZonePipelineMinimalResponse"] + +class PipelineMinimalResponse(BaseModel): + """ + PipelineMinimalResponse + """ + # data type: MSSharePointPipelineMinimalResponse + oneof_schema_1_validator: Optional[MSSharePointPipelineMinimalResponse] = None + # data type: S3PipelineMinimalResponse + oneof_schema_2_validator: Optional[S3PipelineMinimalResponse] = None + # data type: SFTPPipelineMinimalResponse + oneof_schema_3_validator: Optional[SFTPPipelineMinimalResponse] = None + # data type: SDMPipelineMinimalResponse + oneof_schema_4_validator: Optional[SDMPipelineMinimalResponse] = None + # data type: WorkZonePipelineMinimalResponse + oneof_schema_5_validator: Optional[WorkZonePipelineMinimalResponse] = None + # data type: ServiceNowPipelineMinimalResponse + oneof_schema_6_validator: Optional[ServiceNowPipelineMinimalResponse] = None + # data type: GoogleDrivePipelineMinimalResponse + oneof_schema_7_validator: Optional[GoogleDrivePipelineMinimalResponse] = None + actual_instance: Optional[Union[GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse]] = None + one_of_schemas: Set[str] = { "GoogleDrivePipelineMinimalResponse", "MSSharePointPipelineMinimalResponse", "S3PipelineMinimalResponse", "SDMPipelineMinimalResponse", "SFTPPipelineMinimalResponse", "ServiceNowPipelineMinimalResponse", "WorkZonePipelineMinimalResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = PipelineMinimalResponse.model_construct() + error_messages = [] + match = 0 + # validate data type: MSSharePointPipelineMinimalResponse + if not isinstance(v, MSSharePointPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MSSharePointPipelineMinimalResponse`") + else: + match += 1 + # validate data type: S3PipelineMinimalResponse + if not isinstance(v, S3PipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `S3PipelineMinimalResponse`") + else: + match += 1 + # validate data type: SFTPPipelineMinimalResponse + if not isinstance(v, SFTPPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SFTPPipelineMinimalResponse`") + else: + match += 1 + # validate data type: SDMPipelineMinimalResponse + if not isinstance(v, SDMPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SDMPipelineMinimalResponse`") + else: + match += 1 + # validate data type: WorkZonePipelineMinimalResponse + if not isinstance(v, WorkZonePipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `WorkZonePipelineMinimalResponse`") + else: + match += 1 + # validate data type: ServiceNowPipelineMinimalResponse + if not isinstance(v, ServiceNowPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `ServiceNowPipelineMinimalResponse`") + else: + match += 1 + # validate data type: GoogleDrivePipelineMinimalResponse + if not isinstance(v, GoogleDrivePipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleDrivePipelineMinimalResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MSSharePointPipelineMinimalResponse + try: + instance.actual_instance = MSSharePointPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineMinimalResponse + try: + instance.actual_instance = S3PipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineMinimalResponse + try: + instance.actual_instance = SFTPPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineMinimalResponse + try: + instance.actual_instance = SDMPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineMinimalResponse + try: + instance.actual_instance = WorkZonePipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineMinimalResponse + try: + instance.actual_instance = ServiceNowPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineMinimalResponse + try: + instance.actual_instance = GoogleDrivePipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py new file mode 100644 index 00000000..ff77906d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PostProcessingObjectReference(BaseModel): + """ + PostProcessingObjectReference + """ # noqa: E501 + id: Optional[StrictStr] = Field(default='6d3eeafd-f3db-4e8e-949a-0e40e50eab64', description="PerFilterSearchResult ID or PostProcessingOperation ID.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PostProcessingObjectReference from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PostProcessingObjectReference from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else '6d3eeafd-f3db-4e8e-949a-0e40e50eab64' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py new file mode 100644 index 00000000..a7c51da7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PostProcessingOperation(BaseModel): + """ + PostProcessingOperation + """ # noqa: E501 + id: Optional[StrictStr] = Field(default='ae9eee48-4671-4321-a3e5-640adaaf26ae', description="New ID for each PostProcessingOperation.") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", alias="maxChunkCount") + strategy: Strategy + inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PostProcessingOperation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of strategy + if self.strategy: + _dict['strategy'] = self.strategy.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in inputs (list) + _items = [] + if self.inputs: + for _item_inputs in self.inputs: + _items.append(_item_inputs.to_dict() if _item_inputs is not None else None) + _dict['inputs'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PostProcessingOperation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else 'ae9eee48-4671-4321-a3e5-640adaaf26ae', + "maxChunkCount": obj.get("maxChunkCount") if "maxChunkCount" in obj else 5, + "strategy": Strategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, + "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None + }) + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +# TODO: Rewrite to not use raise_errors +PostProcessingOperation.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py new file mode 100644 index 00000000..fb68357b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER_ANY_OF_SCHEMAS = ["PerFilterSearchResult"] + +class ResultsInner(BaseModel): + """ + ResultsInner + """ + + # data type: PerFilterSearchResult + anyof_schema_1_validator: Optional[PerFilterSearchResult] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[PerFilterSearchResult]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "PerFilterSearchResult" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner.model_construct() + error_messages = [] + # validate data type: PerFilterSearchResult + if not isinstance(v, PerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `PerFilterSearchResult`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner with anyOf schemas: PerFilterSearchResult. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[PerFilterSearchResult] = None + try: + instance.actual_instance = PerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner with anyOf schemas: PerFilterSearchResult. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PerFilterSearchResult]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py new file mode 100644 index 00000000..68e93388 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER1_ANY_OF_SCHEMAS = ["RetrievalPerFilterSearchResult", "RetrievalPerFilterSearchResultWithError"] + +class ResultsInner1(BaseModel): + """ + ResultsInner1 + """ + + # data type: RetrievalPerFilterSearchResult + anyof_schema_1_validator: Optional[RetrievalPerFilterSearchResult] = None + # data type: RetrievalPerFilterSearchResultWithError + anyof_schema_2_validator: Optional[RetrievalPerFilterSearchResultWithError] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalPerFilterSearchResult", "RetrievalPerFilterSearchResultWithError" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner1.model_construct() + error_messages = [] + # validate data type: RetrievalPerFilterSearchResult + if not isinstance(v, RetrievalPerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalPerFilterSearchResult`") + else: + return v + + # validate data type: RetrievalPerFilterSearchResultWithError + if not isinstance(v, RetrievalPerFilterSearchResultWithError): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalPerFilterSearchResultWithError`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner1 with anyOf schemas: RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalPerFilterSearchResult] = None + try: + instance.actual_instance = RetrievalPerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalPerFilterSearchResultWithError] = None + try: + instance.actual_instance = RetrievalPerFilterSearchResultWithError.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner1 with anyOf schemas: RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py new file mode 100644 index 00000000..fad54610 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER2_ANY_OF_SCHEMAS = ["DataRepositoryPerFilterSearchResult", "PerFilterSearchResultWithError"] + +class ResultsInner2(BaseModel): + """ + ResultsInner2 + """ + + # data type: DataRepositoryPerFilterSearchResult + anyof_schema_1_validator: Optional[DataRepositoryPerFilterSearchResult] = None + # data type: PerFilterSearchResultWithError + anyof_schema_2_validator: Optional[PerFilterSearchResultWithError] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "DataRepositoryPerFilterSearchResult", "PerFilterSearchResultWithError" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner2.model_construct() + error_messages = [] + # validate data type: DataRepositoryPerFilterSearchResult + if not isinstance(v, DataRepositoryPerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `DataRepositoryPerFilterSearchResult`") + else: + return v + + # validate data type: PerFilterSearchResultWithError + if not isinstance(v, PerFilterSearchResultWithError): + error_messages.append(f"Error! Input type `{type(v)}` is not `PerFilterSearchResultWithError`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner2 with anyOf schemas: DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[DataRepositoryPerFilterSearchResult] = None + try: + instance.actual_instance = DataRepositoryPerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[PerFilterSearchResultWithError] = None + try: + instance.actual_instance = PerFilterSearchResultWithError.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner2 with anyOf schemas: DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py new file mode 100644 index 00000000..798a6c61 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalBinaryBooleanFilter(BaseModel): + """ + RetrievalBinaryBooleanFilter + """ # noqa: E501 + operator: StrictStr + left: Left + right: Right + __properties: ClassVar[List[str]] = ["operator", "left", "right"] + + @field_validator('operator') + def operator_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['and', 'or']): + raise ValueError("must be one of enum values ('and', 'or')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalBinaryBooleanFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of left + if self.left: + _dict['left'] = self.left.to_dict() + # override the default output from pydantic by calling `to_dict()` of right + if self.right: + _dict['right'] = self.right.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalBinaryBooleanFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "operator": obj.get("operator"), + "left": Left.from_dict(obj["left"]) if obj.get("left") is not None else None, + "right": Right.from_dict(obj["right"]) if obj.get("right") is not None else None + }) + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.left import Left +from gen_ai_hub.document_grounding_generation.generated.models.right import Right +# TODO: Rewrite to not use raise_errors +RetrievalBinaryBooleanFilter.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py new file mode 100644 index 00000000..2c4a64fa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalChunk(BaseModel): + """ + RetrievalChunk + """ # noqa: E501 + id: StrictStr + content: StrictStr + metadata: Optional[List[RetrievalKeyValueListPair]] = None + search_scores: Optional[SearchScores] = Field(default=None, alias="searchScores") + post_processing_score: Optional[Score] = Field(default=None, alias="postProcessingScore") + __properties: ClassVar[List[str]] = ["id", "content", "metadata", "searchScores", "postProcessingScore"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of search_scores + if self.search_scores: + _dict['searchScores'] = self.search_scores.to_dict() + # override the default output from pydantic by calling `to_dict()` of post_processing_score + if self.post_processing_score: + _dict['postProcessingScore'] = self.post_processing_score.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "content": obj.get("content"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "searchScores": SearchScores.from_dict(obj["searchScores"]) if obj.get("searchScores") is not None else None, + "postProcessingScore": Score.from_dict(obj["postProcessingScore"]) if obj.get("postProcessingScore") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py new file mode 100644 index 00000000..a6deb470 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalDataRepositorySearchResult(BaseModel): + """ + RetrievalDataRepositorySearchResult + """ # noqa: E501 + data_repository: DataRepositoryWithDocuments = Field(alias="dataRepository") + __properties: ClassVar[List[str]] = ["dataRepository"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalDataRepositorySearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data_repository + if self.data_repository: + _dict['dataRepository'] = self.data_repository.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalDataRepositorySearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py new file mode 100644 index 00000000..14f64d4b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalDocumentKeyValueListPair(BaseModel): + """ + RetrievalDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py new file mode 100644 index 00000000..ec2cb084 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalKeyValueListPair(BaseModel): + """ + RetrievalKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py new file mode 100644 index 00000000..46a27abd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalPerFilterSearchResult(BaseModel): + """ + RetrievalPerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(alias="filterId") + results: Optional[List[RetrievalDataRepositorySearchResult]] = Field(default=None, description="List of returned results.") + remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly Destination Name of remote instance (grounding.name). Only present if dataRepositoryType = remote:dg.", alias="remoteGroundingName") + __properties: ClassVar[List[str]] = ["filterId", "results", "remoteGroundingName"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [RetrievalDataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py new file mode 100644 index 00000000..f2ca28a2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalPerFilterSearchResultError(BaseModel): + """ + Error message if any. + """ # noqa: E501 + message: StrictStr + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") if obj.get("message") is not None else 'Unknown Error Occurred' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py new file mode 100644 index 00000000..e5cc642b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalPerFilterSearchResultWithError(BaseModel): + """ + RetrievalPerFilterSearchResultWithError + """ # noqa: E501 + filter_id: StrictStr = Field(alias="filterId") + error: Optional[RetrievalPerFilterSearchResultError] = None + __properties: ClassVar[List[str]] = ["filterId", "error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultWithError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultWithError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "error": RetrievalPerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py new file mode 100644 index 00000000..48735814 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalScopedKeyValueListPair(BaseModel): + """ + RetrievalScopedKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: Optional[StrictStr] = 'document' + __properties: ClassVar[List[str]] = ["key", "value", "scope"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['repository', 'document', 'chunk']): + raise ValueError("must be one of enum values ('repository', 'document', 'chunk')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalScopedKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalScopedKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") if obj.get("scope") is not None else 'document' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py new file mode 100644 index 00000000..492b7708 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchConfiguration(BaseModel): + """ + RetrievalSearchConfiguration + """ # noqa: E501 + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py new file mode 100644 index 00000000..759ceb20 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchDocumentKeyValueListPair(BaseModel): + """ + RetrievalSearchDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + select_mode: Optional[List[RetrievalSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if select_mode (nullable) is None + # and model_fields_set contains the field + if self.select_mode is None and "select_mode" in self.model_fields_set: + _dict['selectMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py new file mode 100644 index 00000000..f7c45cb1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchFilter(BaseModel): + """ + Limit scope of search to certain DataRepositories, Documents or Chunks. + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this RetrievalSearchFilter - unique per request.") + search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, alias="searchConfiguration") + data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", alias="dataRepositories") + data_repository_type: DataRepositoryType = Field(alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", alias="remoteName") + data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of search_configuration + if self.search_configuration: + _dict['searchConfiguration'] = self.search_configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + # set to None if search_configuration (nullable) is None + # and model_fields_set contains the field + if self.search_configuration is None and "search_configuration" in self.model_fields_set: + _dict['searchConfiguration'] = None + + # set to None if remote_name (nullable) is None + # and model_fields_set contains the field + if self.remote_name is None and "remote_name" in self.model_fields_set: + _dict['remoteName'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "searchConfiguration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "dataRepositories": obj.get("dataRepositories"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "remoteName": obj.get("remoteName"), + "dataRepositoryMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "documentMetadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py new file mode 100644 index 00000000..85908186 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchInput(BaseModel): + """ + RetrievalSearchInput + """ # noqa: E501 + query: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(description="Query string") + filters: List[FiltersInner] + post_processing: Optional[List[RetrievalSearchInputPostProcessingInner]] = Field(default=None, description="List of operations to be performed across PerFilterSearchResults.", alias="postProcessing") + __properties: ClassVar[List[str]] = ["query", "filters", "postProcessing"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchInput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in filters (list) + _items = [] + if self.filters: + for _item_filters in self.filters: + _items.append(_item_filters.to_dict() if _item_filters is not None else None) + _dict['filters'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in post_processing (list) + _items = [] + if self.post_processing: + for _item_post_processing in self.post_processing: + _items.append(_item_post_processing.to_dict() if _item_post_processing is not None else None) + _dict['postProcessing'] = _items + # set to None if query (nullable) is None + # and model_fields_set contains the field + if self.query is None and "query" in self.model_fields_set: + _dict['query'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchInput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "filters": [FiltersInner.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None, + "postProcessing": [RetrievalSearchInputPostProcessingInner.from_dict(_item) for _item in obj["postProcessing"]] if obj.get("postProcessing") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py new file mode 100644 index 00000000..b129576c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchInputPostProcessingInner(BaseModel): + """ + RetrievalSearchInputPostProcessingInner + """ # noqa: E501 + id: Optional[StrictStr] = Field(default='ae9eee48-4671-4321-a3e5-640adaaf26ae', description="New ID for each PostProcessingOperation.") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", alias="maxChunkCount") + strategy: RetrievalSearchInputPostProcessingInnerStrategy + inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchInputPostProcessingInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of strategy + if self.strategy: + _dict['strategy'] = self.strategy.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in inputs (list) + _items = [] + if self.inputs: + for _item_inputs in self.inputs: + _items.append(_item_inputs.to_dict() if _item_inputs is not None else None) + _dict['inputs'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchInputPostProcessingInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else 'ae9eee48-4671-4321-a3e5-640adaaf26ae', + "maxChunkCount": obj.get("maxChunkCount") if "maxChunkCount" in obj else 5, + "strategy": RetrievalSearchInputPostProcessingInnerStrategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, + "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py new file mode 100644 index 00000000..13834876 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +RETRIEVALSEARCHINPUTPOSTPROCESSINGINNERINPUTSINNER_ONE_OF_SCHEMAS = ["PostProcessingObjectReference", "PostProcessingOperation"] + +class RetrievalSearchInputPostProcessingInnerInputsInner(BaseModel): + """ + RetrievalSearchInputPostProcessingInnerInputsInner + """ + # data type: PostProcessingObjectReference + oneof_schema_1_validator: Optional[PostProcessingObjectReference] = None + # data type: PostProcessingOperation + oneof_schema_2_validator: Optional[PostProcessingOperation] = None + actual_instance: Optional[Union[PostProcessingObjectReference, PostProcessingOperation]] = None + one_of_schemas: Set[str] = { "PostProcessingObjectReference", "PostProcessingOperation" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = RetrievalSearchInputPostProcessingInnerInputsInner.model_construct() + error_messages = [] + match = 0 + # validate data type: PostProcessingObjectReference + if not isinstance(v, PostProcessingObjectReference): + error_messages.append(f"Error! Input type `{type(v)}` is not `PostProcessingObjectReference`") + else: + match += 1 + # validate data type: PostProcessingOperation + if not isinstance(v, PostProcessingOperation): + error_messages.append(f"Error! Input type `{type(v)}` is not `PostProcessingOperation`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into PostProcessingObjectReference + try: + instance.actual_instance = PostProcessingObjectReference.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PostProcessingOperation + try: + instance.actual_instance = PostProcessingOperation.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PostProcessingObjectReference, PostProcessingOperation]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation +# TODO: Rewrite to not use raise_errors +RetrievalSearchInputPostProcessingInnerInputsInner.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py new file mode 100644 index 00000000..61c18795 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +RETRIEVALSEARCHINPUTPOSTPROCESSINGINNERSTRATEGY_ONE_OF_SCHEMAS = ["MergeStrategyReranker", "MergeStrategyScoreReuse"] + +class RetrievalSearchInputPostProcessingInnerStrategy(BaseModel): + """ + Merging and scoring strategy to derive final PerSearchFilterResult. + """ + # data type: MergeStrategyScoreReuse + oneof_schema_1_validator: Optional[MergeStrategyScoreReuse] = None + # data type: MergeStrategyReranker + oneof_schema_2_validator: Optional[MergeStrategyReranker] = None + actual_instance: Optional[Union[MergeStrategyReranker, MergeStrategyScoreReuse]] = None + one_of_schemas: Set[str] = { "MergeStrategyReranker", "MergeStrategyScoreReuse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = RetrievalSearchInputPostProcessingInnerStrategy.model_construct() + error_messages = [] + match = 0 + # validate data type: MergeStrategyScoreReuse + if not isinstance(v, MergeStrategyScoreReuse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyScoreReuse`") + else: + match += 1 + # validate data type: MergeStrategyReranker + if not isinstance(v, MergeStrategyReranker): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyReranker`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MergeStrategyScoreReuse + try: + instance.actual_instance = MergeStrategyScoreReuse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MergeStrategyReranker + try: + instance.actual_instance = MergeStrategyReranker.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], MergeStrategyReranker, MergeStrategyScoreReuse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py new file mode 100644 index 00000000..ce50ad33 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchResults(BaseModel): + """ + RetrievalSearchResults + """ # noqa: E501 + results: List[ResultsInner1] = Field(description="List of returned results.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [ResultsInner1.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py new file mode 100644 index 00000000..31e9eea7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class RetrievalSearchSelectOptionEnum(str, Enum): + """ + RetrievalSearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RetrievalSearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py new file mode 100644 index 00000000..4e53a26d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalVectorSearchFilter(BaseModel): + """ + RetrievalVectorSearchFilter + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this RetrievalSearchFilter - unique per request.") + search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, alias="searchConfiguration") + data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", alias="dataRepositories") + data_repository_type: Optional[DataRepositoryType] = Field(default=None, alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", alias="remoteName") + data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + filter: Optional[RetrievalVectorSearchFilterFilter] = None + scoring_configuration: Optional[VectorScoringConfiguration] = Field(default=None, alias="scoringConfiguration") + __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata", "filter", "scoringConfiguration"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalVectorSearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of search_configuration + if self.search_configuration: + _dict['searchConfiguration'] = self.search_configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # override the default output from pydantic by calling `to_dict()` of scoring_configuration + if self.scoring_configuration: + _dict['scoringConfiguration'] = self.scoring_configuration.to_dict() + # set to None if search_configuration (nullable) is None + # and model_fields_set contains the field + if self.search_configuration is None and "search_configuration" in self.model_fields_set: + _dict['searchConfiguration'] = None + + # set to None if remote_name (nullable) is None + # and model_fields_set contains the field + if self.remote_name is None and "remote_name" in self.model_fields_set: + _dict['remoteName'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalVectorSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "searchConfiguration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "dataRepositories": obj.get("dataRepositories"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "remoteName": obj.get("remoteName"), + "dataRepositoryMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "documentMetadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None, + "filter": RetrievalVectorSearchFilterFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "scoringConfiguration": VectorScoringConfiguration.from_dict(obj["scoringConfiguration"]) if obj.get("scoringConfiguration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py new file mode 100644 index 00000000..3ea17cc4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RETRIEVALVECTORSEARCHFILTERFILTER_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class RetrievalVectorSearchFilterFilter(BaseModel): + """ + Filter to apply on the search results. This cannot be used together with 'documentMetadata'. The depth of the filter must not exceed 5 levels. + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = RetrievalVectorSearchFilterFilter.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in RetrievalVectorSearchFilterFilter with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalVectorSearchFilterFilter with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py new file mode 100644 index 00000000..4e268a96 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RIGHT_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class Right(BaseModel): + """ + Right + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Right.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Right with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Right with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Right.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py new file mode 100644 index 00000000..10277c58 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RIGHT1_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Right1(BaseModel): + """ + Right operand of the boolean expression + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Right1.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Right1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Right1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Right1.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py new file mode 100644 index 00000000..25cac469 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3Configuration(BaseModel): + """ + S3Configuration + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) + s3: Optional[ServiceNowConfigurationMinimalServiceNow] = None + cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "s3", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3Configuration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of s3 + if self.s3: + _dict['s3'] = self.s3.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3Configuration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "s3": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["s3"]) if obj.get("s3") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py new file mode 100644 index 00000000..09b78d63 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3ConfigurationMinimal(BaseModel): + """ + S3ConfigurationMinimal + """ # noqa: E501 + s3: ServiceNowConfigurationMinimalServiceNow + __properties: ClassVar[List[str]] = ["s3"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3ConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of s3 + if self.s3: + _dict['s3'] = self.s3.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3ConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "s3": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["s3"]) if obj.get("s3") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py new file mode 100644 index 00000000..a76250aa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3PipelineCreateRequest(BaseModel): + """ + S3PipelineCreateRequest + """ # noqa: E501 + type: StrictStr + configuration: S3Configuration + metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['S3']): + raise ValueError("must be one of enum values ('S3')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3PipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3PipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": S3Configuration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py new file mode 100644 index 00000000..0575e4fc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3PipelineGetResponse(BaseModel): + """ + S3PipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: S3Configuration + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['S3']): + raise ValueError("must be one of enum values ('S3')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3PipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3PipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": S3Configuration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py new file mode 100644 index 00000000..03f9cb9f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3PipelineMinimalResponse(BaseModel): + """ + S3PipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: Optional[S3ConfigurationMinimal] = None + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['S3']): + raise ValueError("must be one of enum values ('S3')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3PipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3PipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": S3ConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py new file mode 100644 index 00000000..ae037ecb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScopedKeyValueListPair(BaseModel): + """ + ScopedKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: Optional[StrictStr] = Field(default='document', description="Scope of the metadata filter (e.g., collection, document, chunk)") + __properties: ClassVar[List[str]] = ["key", "value", "scope"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['collection', 'document', 'chunk']): + raise ValueError("must be one of enum values ('collection', 'document', 'chunk')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScopedKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScopedKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") if obj.get("scope") is not None else 'document' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py new file mode 100644 index 00000000..dbb8398b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Score(BaseModel): + """ + Score + """ # noqa: E501 + value: Union[StrictFloat, StrictInt] + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Score from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Score from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "value": obj.get("value") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py new file mode 100644 index 00000000..a5668132 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoresAggregationStrategy(str, Enum): + """ + ScoresAggregationStrategy + """ + + """ + allowed enum values + """ + WEIGHTED_AVERAGE = 'weighted_average' + RRF = 'rrf' + WEIGHTED_RRF = 'weighted_rrf' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoresAggregationStrategy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py new file mode 100644 index 00000000..e1d74c6a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SDMPipelineCreateRequest(BaseModel): + """ + SDMPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: MetaData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SDM']): + raise ValueError("must be one of enum values ('SDM')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SDMPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SDMPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py new file mode 100644 index 00000000..b6418521 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SDMPipelineGetResponse(BaseModel): + """ + SDMPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: MetaData + __properties: ClassVar[List[str]] = ["id", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SDM']): + raise ValueError("must be one of enum values ('SDM')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SDMPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SDMPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py new file mode 100644 index 00000000..578e1187 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SDMPipelineMinimalResponse(BaseModel): + """ + SDMPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SDM']): + raise ValueError("must be one of enum values ('SDM')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SDMPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SDMPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py new file mode 100644 index 00000000..a909b072 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchConfiguration(BaseModel): + """ + SearchConfiguration + """ # noqa: E501 + max_chunk_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py new file mode 100644 index 00000000..24011973 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchDocumentKeyValueListPair(BaseModel): + """ + SearchDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + select_mode: Optional[List[Optional[SearchSelectOptionEnum]]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py new file mode 100644 index 00000000..5c4583c0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchFilter(BaseModel): + """ + SearchFilter + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this SearchFilter - unique per request.") + collection_ids: List[StrictStr] = Field(alias="collectionIds") + configuration: SearchConfiguration + collection_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", alias="collectionMetadata") + document_metadata: Optional[Annotated[List[SearchDocumentKeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") + chunk_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collection_metadata (list) + _items = [] + if self.collection_metadata: + for _item_collection_metadata in self.collection_metadata: + _items.append(_item_collection_metadata.to_dict() if _item_collection_metadata is not None else None) + _dict['collectionMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "collectionIds": obj.get("collectionIds"), + "configuration": SearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collectionMetadata": [KeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "documentMetadata": [SearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [KeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py new file mode 100644 index 00000000..ed1e0699 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchPipeline(BaseModel): + """ + SearchPipeline + """ # noqa: E501 + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Search for metadata happens at key level. Pipelines matching the search criteria will be returned.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchPipeline from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchPipeline from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py new file mode 100644 index 00000000..e953ba64 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchPipelinesResponse(BaseModel): + """ + SearchPipelinesResponse + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[PipelineMinimalResponse] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchPipelinesResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchPipelinesResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [PipelineMinimalResponse.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py new file mode 100644 index 00000000..8b6d6f88 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchResults(BaseModel): + """ + SearchResults + """ # noqa: E501 + results: List[ResultsInner] = Field(description="List of returned results.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [ResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py new file mode 100644 index 00000000..994a2337 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchScores(BaseModel): + """ + SearchScores + """ # noqa: E501 + aggregated_score: SearchScoresAggregatedScore = Field(alias="aggregatedScore") + dense_retrieval_score: SearchScoresAggregatedScore = Field(alias="denseRetrievalScore") + __properties: ClassVar[List[str]] = ["aggregatedScore", "denseRetrievalScore"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchScores from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of aggregated_score + if self.aggregated_score: + _dict['aggregatedScore'] = self.aggregated_score.to_dict() + # override the default output from pydantic by calling `to_dict()` of dense_retrieval_score + if self.dense_retrieval_score: + _dict['denseRetrievalScore'] = self.dense_retrieval_score.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchScores from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "aggregatedScore": SearchScoresAggregatedScore.from_dict(obj["aggregatedScore"]) if obj.get("aggregatedScore") is not None else None, + "denseRetrievalScore": SearchScoresAggregatedScore.from_dict(obj["denseRetrievalScore"]) if obj.get("denseRetrievalScore") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py new file mode 100644 index 00000000..01e55ebc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchScoresAggregatedScore(BaseModel): + """ + SearchScoresAggregatedScore + """ # noqa: E501 + value: Optional[Union[StrictFloat, StrictInt]] = None + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchScoresAggregatedScore from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchScoresAggregatedScore from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "value": obj.get("value") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py new file mode 100644 index 00000000..170a28a1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class SearchSelectOptionEnum(str, Enum): + """ + SearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py new file mode 100644 index 00000000..0b8f7326 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfig(BaseModel): + """ + ServiceNowConfig + """ # noqa: E501 + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["active=true", "sys_domain_path=/health"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py new file mode 100644 index 00000000..7b9e725f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfigurationMinimal(BaseModel): + """ + ServiceNowConfigurationMinimal + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) + service_now: Optional[ServiceNowConfigurationMinimalServiceNow] = Field(default=None, alias="serviceNow") + __properties: ClassVar[List[str]] = ["destination", "serviceNow"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_now + if self.service_now: + _dict['serviceNow'] = self.service_now.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "serviceNow": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["serviceNow"]) if obj.get("serviceNow") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py new file mode 100644 index 00000000..d9861f72 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfigurationMinimalServiceNow(BaseModel): + """ + ServiceNowConfigurationMinimalServiceNow + """ # noqa: E501 + include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + __properties: ClassVar[List[str]] = ["includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimalServiceNow from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimalServiceNow from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "includePaths": obj.get("includePaths") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py new file mode 100644 index 00000000..1ef22c80 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfigurationStruct(BaseModel): + """ + ServiceNowConfigurationStruct + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) + service_now: Optional[ServiceNowConfig] = Field(default=None, alias="serviceNow") + metadata_config_id: Optional[StrictStr] = Field(default=None, alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "serviceNow", "metadataConfigId", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_now + if self.service_now: + _dict['serviceNow'] = self.service_now.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "serviceNow": ServiceNowConfig.from_dict(obj["serviceNow"]) if obj.get("serviceNow") is not None else None, + "metadataConfigId": obj.get("metadataConfigId"), + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py new file mode 100644 index 00000000..a586f443 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowPipelineCreateRequest(BaseModel): + """ + ServiceNowPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: Optional[MetaData] = None + configuration: Optional[ServiceNowConfigurationStruct] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ServiceNow']): + raise ValueError("must be one of enum values ('ServiceNow')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": ServiceNowConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py new file mode 100644 index 00000000..543113cb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowPipelineGetResponse(BaseModel): + """ + ServiceNowPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: ServiceNowConfigurationMinimal + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ServiceNow']): + raise ValueError("must be one of enum values ('ServiceNow')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": ServiceNowConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py new file mode 100644 index 00000000..f2c70703 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowPipelineMinimalResponse(BaseModel): + """ + ServiceNowPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ServiceNow']): + raise ValueError("must be one of enum values ('ServiceNow')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py new file mode 100644 index 00000000..0d32c5e0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPConfiguration(BaseModel): + """ + SFTPConfiguration + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) + sftp: Optional[ServiceNowConfigurationMinimalServiceNow] = None + cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "sftp", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of sftp + if self.sftp: + _dict['sftp'] = self.sftp.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sftp": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["sftp"]) if obj.get("sftp") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py new file mode 100644 index 00000000..2150c856 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPConfigurationMinimal(BaseModel): + """ + SFTPConfigurationMinimal + """ # noqa: E501 + sftp: ServiceNowConfigurationMinimalServiceNow + __properties: ClassVar[List[str]] = ["sftp"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of sftp + if self.sftp: + _dict['sftp'] = self.sftp.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sftp": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["sftp"]) if obj.get("sftp") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py new file mode 100644 index 00000000..cada6615 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPPipelineCreateRequest(BaseModel): + """ + SFTPPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + configuration: SFTPConfiguration + metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SFTP']): + raise ValueError("must be one of enum values ('SFTP')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": SFTPConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py new file mode 100644 index 00000000..bc04e535 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPPipelineGetResponse(BaseModel): + """ + SFTPPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: SFTPConfiguration + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SFTP']): + raise ValueError("must be one of enum values ('SFTP')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": SFTPConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py new file mode 100644 index 00000000..25436e38 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPPipelineMinimalResponse(BaseModel): + """ + SFTPPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: Optional[SFTPConfigurationMinimal] = None + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SFTP']): + raise ValueError("must be one of enum values ('SFTP')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": SFTPConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py new file mode 100644 index 00000000..d145dcba --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointConfig(BaseModel): + """ + SharePointConfig + """ # noqa: E501 + site: SharePointSite + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["site"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of site + if self.site: + _dict['site'] = self.site.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "site": SharePointSite.from_dict(obj["site"]) if obj.get("site") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py new file mode 100644 index 00000000..809b82d2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointConfigGetResponse(BaseModel): + """ + SharePointConfigGetResponse + """ # noqa: E501 + site: SharePointSiteGetResponse + __properties: ClassVar[List[str]] = ["site"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointConfigGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of site + if self.site: + _dict['site'] = self.site.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointConfigGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "site": SharePointSiteGetResponse.from_dict(obj["site"]) if obj.get("site") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py new file mode 100644 index 00000000..1ee43f62 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointSite(BaseModel): + """ + SharePointSite + """ # noqa: E501 + name: StrictStr = Field(json_schema_extra={"examples": ["sharepoint-site-name"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointSite from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSite from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py new file mode 100644 index 00000000..afc908a8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointSiteDetail(BaseModel): + """ + SharePointSiteDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["sharepoint-site-id"]}) + name: StrictStr = Field(json_schema_extra={"examples": ["sharepoint-site-name"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointSiteDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSiteDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py new file mode 100644 index 00000000..b4ff0d74 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointSiteGetResponse(BaseModel): + """ + SharePointSiteGetResponse + """ # noqa: E501 + id: Optional[StrictStr] = None + name: StrictStr + include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths") + __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointSiteGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSiteGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py new file mode 100644 index 00000000..75abb5fe --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +STRATEGY_ONE_OF_SCHEMAS = ["MergeStrategyReranker", "MergeStrategyScoreReuse"] + +class Strategy(BaseModel): + """ + Merging and scoring strategy to derive final PerSearchFilterResult. + """ + # data type: MergeStrategyScoreReuse + oneof_schema_1_validator: Optional[MergeStrategyScoreReuse] = None + # data type: MergeStrategyReranker + oneof_schema_2_validator: Optional[MergeStrategyReranker] = None + actual_instance: Optional[Union[MergeStrategyReranker, MergeStrategyScoreReuse]] = None + one_of_schemas: Set[str] = { "MergeStrategyReranker", "MergeStrategyScoreReuse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = Strategy.model_construct() + error_messages = [] + match = 0 + # validate data type: MergeStrategyScoreReuse + if not isinstance(v, MergeStrategyScoreReuse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyScoreReuse`") + else: + match += 1 + # validate data type: MergeStrategyReranker + if not isinstance(v, MergeStrategyReranker): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyReranker`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MergeStrategyScoreReuse + try: + instance.actual_instance = MergeStrategyScoreReuse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MergeStrategyReranker + try: + instance.actual_instance = MergeStrategyReranker.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], MergeStrategyReranker, MergeStrategyScoreReuse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py new file mode 100644 index 00000000..676e490d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextOnlyBaseChunk(BaseModel): + """ + Schema for a text-only chunk. + """ # noqa: E501 + content: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + id: UUID = Field(description="Unique identifier of a chuk.") + __properties: ClassVar[List[str]] = ["content", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "content": obj.get("content"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py new file mode 100644 index 00000000..4a391496 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextOnlyBaseChunkCreate(BaseModel): + """ + Schema for a text-only chunk. + """ # noqa: E501 + content: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + __properties: ClassVar[List[str]] = ["content", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunkCreate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunkCreate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "content": obj.get("content"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py new file mode 100644 index 00000000..fd74b28c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextSearchRequest(BaseModel): + """ + TextSearchRequest + """ # noqa: E501 + query: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=2000)]] = Field(description="Query string") + filters: List[VectorSearchFilter] + __properties: ClassVar[List[str]] = ["query", "filters"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextSearchRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in filters (list) + _items = [] + if self.filters: + for _item_filters in self.filters: + _items.append(_item_filters.to_dict() if _item_filters is not None else None) + _dict['filters'] = _items + # set to None if query (nullable) is None + # and model_fields_set contains the field + if self.query is None and "query" in self.model_fields_set: + _dict['query'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextSearchRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "filters": [VectorSearchFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py new file mode 100644 index 00000000..11fb83aa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ValidationError(BaseModel): + """ + ValidationError + """ # noqa: E501 + loc: List[LocationInner] + msg: StrictStr + type: StrictStr + input: Optional[Any] = None + ctx: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in loc (list) + _items = [] + if self.loc: + for _item_loc in self.loc: + _items.append(_item_loc.to_dict() if _item_loc is not None else None) + _dict['loc'] = _items + # set to None if input (nullable) is None + # and model_fields_set contains the field + if self.input is None and "input" in self.model_fields_set: + _dict['input'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loc": [LocationInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None, + "msg": obj.get("msg"), + "type": obj.get("type"), + "input": obj.get("input"), + "ctx": obj.get("ctx") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py new file mode 100644 index 00000000..abb8ac45 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorChunk(BaseModel): + """ + VectorChunk + """ # noqa: E501 + id: StrictStr + content: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + __properties: ClassVar[List[str]] = ["id", "content", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "content": obj.get("content"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py new file mode 100644 index 00000000..26de54e7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorDocumentKeyValueListPair(BaseModel): + """ + VectorDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py new file mode 100644 index 00000000..cecb792c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorKeyValueListPair(BaseModel): + """ + Collection metadata during ingestion + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py new file mode 100644 index 00000000..796a8982 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorPerFilterSearchResult(BaseModel): + """ + VectorPerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(alias="filterId") + results: List[DocumentsChunk] + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorPerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py new file mode 100644 index 00000000..cd8969bc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorScoringConfiguration(BaseModel): + """ + VectorScoringConfiguration + """ # noqa: E501 + dense_retrieval: Optional[DenseRetrievalScoringConfiguration] = Field(default=None, alias="denseRetrieval") + keyword_retrieval: Optional[KeyWordRetrievalScoringConfiguration] = Field(default=None, alias="keywordRetrieval") + boosting: Optional[BoostingScoringConfiguration] = None + score_threshold: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum chunk score threshold.", alias="scoreThreshold") + aggregation_strategy: Optional[ScoresAggregationStrategy] = Field(default=None, alias="aggregationStrategy") + __properties: ClassVar[List[str]] = ["denseRetrieval", "keywordRetrieval", "boosting", "scoreThreshold", "aggregationStrategy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of dense_retrieval + if self.dense_retrieval: + _dict['denseRetrieval'] = self.dense_retrieval.to_dict() + # override the default output from pydantic by calling `to_dict()` of keyword_retrieval + if self.keyword_retrieval: + _dict['keywordRetrieval'] = self.keyword_retrieval.to_dict() + # override the default output from pydantic by calling `to_dict()` of boosting + if self.boosting: + _dict['boosting'] = self.boosting.to_dict() + # set to None if score_threshold (nullable) is None + # and model_fields_set contains the field + if self.score_threshold is None and "score_threshold" in self.model_fields_set: + _dict['scoreThreshold'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "denseRetrieval": DenseRetrievalScoringConfiguration.from_dict(obj["denseRetrieval"]) if obj.get("denseRetrieval") is not None else None, + "keywordRetrieval": KeyWordRetrievalScoringConfiguration.from_dict(obj["keywordRetrieval"]) if obj.get("keywordRetrieval") is not None else None, + "boosting": BoostingScoringConfiguration.from_dict(obj["boosting"]) if obj.get("boosting") is not None else None, + "scoreThreshold": obj.get("scoreThreshold"), + "aggregationStrategy": obj.get("aggregationStrategy") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py new file mode 100644 index 00000000..9f7f7b83 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchConfiguration(BaseModel): + """ + VectorSearchConfiguration + """ # noqa: E501 + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py new file mode 100644 index 00000000..6e902c3a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchDocumentKeyValueListPair(BaseModel): + """ + VectorSearchDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + select_mode: Optional[List[VectorSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if select_mode (nullable) is None + # and model_fields_set contains the field + if self.select_mode is None and "select_mode" in self.model_fields_set: + _dict['selectMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py new file mode 100644 index 00000000..d2c1db4c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchFilter(BaseModel): + """ + VectorSearchFilter + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this VectorSearchFilter - unique per request.") + collection_ids: List[StrictStr] = Field(alias="collectionIds") + configuration: VectorSearchConfiguration + collection_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", alias="collectionMetadata") + document_metadata: Optional[List[VectorSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") + chunk_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + filter: Optional[Filter] = None + __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata", "filter"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collection_metadata (list) + _items = [] + if self.collection_metadata: + for _item_collection_metadata in self.collection_metadata: + _items.append(_item_collection_metadata.to_dict() if _item_collection_metadata is not None else None) + _dict['collectionMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # set to None if collection_metadata (nullable) is None + # and model_fields_set contains the field + if self.collection_metadata is None and "collection_metadata" in self.model_fields_set: + _dict['collectionMetadata'] = None + + # set to None if document_metadata (nullable) is None + # and model_fields_set contains the field + if self.document_metadata is None and "document_metadata" in self.model_fields_set: + _dict['documentMetadata'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "collectionIds": obj.get("collectionIds"), + "configuration": VectorSearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collectionMetadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "documentMetadata": [VectorSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None, + "filter": Filter.from_dict(obj["filter"]) if obj.get("filter") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py new file mode 100644 index 00000000..eba65266 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchResults(BaseModel): + """ + VectorSearchResults + """ # noqa: E501 + results: List[VectorPerFilterSearchResult] = Field(description="List of returned results.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [VectorPerFilterSearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py new file mode 100644 index 00000000..98754a0e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class VectorSearchSelectOptionEnum(str, Enum): + """ + VectorSearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of VectorSearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py new file mode 100644 index 00000000..c05c956d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkZonePipelineCreateRequest(BaseModel): + """ + WorkZonePipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: MetaData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['WorkZone']): + raise ValueError("must be one of enum values ('WorkZone')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkZonePipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkZonePipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py new file mode 100644 index 00000000..75b30a91 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkZonePipelineGetResponse(BaseModel): + """ + WorkZonePipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: MetaData + __properties: ClassVar[List[str]] = ["id", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['WorkZone']): + raise ValueError("must be one of enum values ('WorkZone')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkZonePipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkZonePipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py new file mode 100644 index 00000000..2bfdb09c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkZonePipelineMinimalResponse(BaseModel): + """ + WorkZonePipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['WorkZone']): + raise ValueError("must be one of enum values ('WorkZone')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkZonePipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkZonePipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/py.typed b/packages/gen/gen_ai_hub/document_grounding_generation/generated/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py new file mode 100644 index 00000000..052a4b84 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import ipaddress +import io +import json +import re +import ssl +from urllib.parse import urlparse + +import urllib3 + +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + +def contenttype_matches(contenttype, maintype, subtype): + """Matches the given contenttype against the given type and subtype + + :param contenttype: the content type to match + :param maintype: the expected maintype + :param subtype: the expected subtype + :return: `true` when the given content type matches the given type and subtype, + regardless of the presence of mime type parameters, otherwise returns `false`. + :rtype: bool + """ + pattern = '{type}/(?:[^+;]+\\+)?{subtype}(?:[ \t]*;.*)?'.format( + type = re.escape(maintype), + subtype = re.escape(subtype), + ) + return re.fullmatch(pattern, contenttype, re.IGNORECASE) is not None + +def should_bypass_proxies(url: str, no_proxy: str) -> bool: + """Return whether ``url`` matches the comma-separated ``no_proxy`` rules.""" + parsed_url = urlparse(url) + if not parsed_url.hostname: + return True + + host = parsed_url.hostname.lower() + host_and_port = parsed_url.netloc.lower() + try: + host_ip = ipaddress.ip_address(host) + except ValueError: + host_ip = None + + for entry in (entry.strip().lower() for entry in no_proxy.split(',')): + if not entry: + continue + if entry == '*': + return True + + if host_ip is not None: + try: + if host_ip in ipaddress.ip_network(entry, strict=False): + return True + except ValueError: + pass + + entry = entry.lstrip('.') + if ( + host == entry + or host.endswith('.' + entry) + or host_and_port == entry + or host_and_port.endswith('.' + entry) + ): + return True + + return False + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers + + def getheaders(self): + """Returns a dictionary of the response headers; use ``headers`` instead.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header; use ``headers.get()`` instead.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + "ca_cert_data": configuration.ca_cert_data, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy and not should_bypass_proxies( + configuration.host, configuration.no_proxy or '' + ): + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + if configuration.proxy_ssl_context is not None: + pool_args["proxy_ssl_context"] = configuration.proxy_ssl_context + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, float)): + timeout = urllib3.Timeout(total=_request_timeout) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + content_type = headers.get('Content-Type') + is_json = ( + not content_type + or contenttype_matches(content_type, 'application', 'json') + ) + # JSON is valid YAML 1.2, so structured YAML bodies can use + # the existing JSON serializer: + # https://yaml.org/spec/1.2.2/#13-relation-to-json + is_structured_yaml = ( + content_type + and ( + contenttype_matches(content_type, 'application', 'yaml') + or contenttype_matches(content_type, 'text', 'yaml') + or contenttype_matches(content_type, 'text', 'x-yaml') + ) + and not isinstance(body, (str, bytes)) + ) + if is_json or is_structured_yaml: + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif contenttype_matches(content_type, 'multipart', 'form-data'): + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # Pass a `string` parameter directly in the body to support + # other content types than JSON when `body` argument is + # provided in serialized form. + elif isinstance(body, str) or isinstance(body, bytes): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type.startswith('text/') and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/packages/openapi-generator/Makefile b/packages/openapi-generator/Makefile new file mode 100644 index 00000000..89f28eb3 --- /dev/null +++ b/packages/openapi-generator/Makefile @@ -0,0 +1,41 @@ +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +SPEC_DIR := $(PKG_DIR)specs/document-grounding +OPTIONS_FILE := $(SPEC_DIR)/options-per-service.json +SPEC_KEY := src/spec/api.yaml +SPEC_INPUT := $(SPEC_DIR)/api.yaml +PROCESSED := $(PKG_DIR).cache/processed.yaml +MAPPINGS := $(PKG_DIR).cache/mappings.yaml +GEN_TMP := $(PKG_DIR).cache/gen-tmp +GEN_OUT := $(PKG_DIR)../../gen/gen_ai_hub/document_grounding_generation/generated +CONFIG := $(PKG_DIR)config/python-config.yaml +# Fully-qualified import prefix used inside the generated files after rewriting +GEN_PKG := gen_ai_hub.document_grounding_generation.generated + +.PHONY: generate test + +generate: + mkdir -p $(PKG_DIR).cache + uv run --package sap-openapi-generator python -m sap_openapi_generator.preprocess_spec \ + --input $(SPEC_INPUT) \ + --output $(PROCESSED) \ + --options $(OPTIONS_FILE) \ + --spec-key "$(SPEC_KEY)" \ + --mappings-output $(MAPPINGS) + npx --yes @openapitools/openapi-generator-cli generate \ + -g python \ + -i $(PROCESSED) \ + -o $(GEN_TMP) \ + -c $(CONFIG) \ + $$([ -f $(MAPPINGS) ] && echo "--config $(MAPPINGS)") \ + --additional-properties packageName=generated + rm -rf $(GEN_OUT) + mv $(GEN_TMP)/generated $(GEN_OUT) + rm -rf $(GEN_TMP) $(PROCESSED) $(MAPPINGS) + # Rewrite bare 'generated' imports to fully-qualified package path + find $(GEN_OUT) -name "*.py" -exec \ + sed -i '' \ + 's/from generated\./from $(GEN_PKG)./g; s/import generated\./import $(GEN_PKG)./g; s/from generated import /from $(GEN_PKG) import /g' \ + {} + + +test: + uv run --package sap-openapi-generator pytest $(PKG_DIR)tests/ -v diff --git a/packages/openapi-generator/config/openapitools.json b/packages/openapi-generator/config/openapitools.json new file mode 100644 index 00000000..b11fef7d --- /dev/null +++ b/packages/openapi-generator/config/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.8.0" + } +} diff --git a/packages/openapi-generator/config/python-config.yaml b/packages/openapi-generator/config/python-config.yaml new file mode 100644 index 00000000..39f2dc80 --- /dev/null +++ b/packages/openapi-generator/config/python-config.yaml @@ -0,0 +1,43 @@ +# openapi-generator-cli configuration for the Python generator (Pydantic v2, Python 3.10+). +# +# Usage (from repository root or package directory): +# +# # 1. Pre-process the spec +# sap-preprocess-spec --input path/to/spec.yaml --output .cache/processed.yaml +# +# # 2. Run the generator +# npx @openapitools/openapi-generator-cli generate \ +# -g python \ +# -i .cache/processed.yaml \ +# -o path/to/output \ +# -c packages/openapi-generator/config/python-config.yaml \ +# --additional-properties packageName= +# +# The openapitools.json at the repository root pins the generator version. + +generatorName: python + +# Override at call site with --additional-properties packageName= +packageName: generated_client +packageVersion: "1.0.0" + +# HTTP backend: urllib3 (sync, default), asyncio (async), httpx (sync+async) +library: httpx + +additionalProperties: + # Suppress timestamp comment in generated files for clean VCS diffs + hideGenerationTimestamp: true + # SAP APIs often include additional properties — allow them in models + disallowAdditionalPropertiesIfNotPresent: false + # Resolve discriminator lookups for oneOf/anyOf + useOneOfDiscriminatorLookup: true + # Emit only Python source files; the parent package owns pyproject.toml/setup.py + generateSourceCodeOnly: true + +# Ensure only the first tag drives API class assignment. +# The pre-processor sets exactly one tag per operation, so this is a safety net. +openapiNormalizer: + KEEP_ONLY_FIRST_TAG_IN_OPERATION: "true" + +# Uncomment to use custom Mustache templates (only needed for non-standard output): +# templateDir: packages/openapi-generator/config/custom-templates diff --git a/packages/openapi-generator/openapitools.json b/packages/openapi-generator/openapitools.json new file mode 100644 index 00000000..8dd0d745 --- /dev/null +++ b/packages/openapi-generator/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.25.0" + } +} diff --git a/packages/openapi-generator/pyproject.toml b/packages/openapi-generator/pyproject.toml new file mode 100644 index 00000000..39695398 --- /dev/null +++ b/packages/openapi-generator/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = ["setuptools>=68"] +build-backend = "setuptools.build_meta" + +[project] +name = "sap-openapi-generator" +version = "0.1.0" +description = "SAP Cloud SDK for AI (Python): OpenAPI code generation tooling" +license = "Apache-2.0" +license-files = ["LICENSE"] +authors = [{ name = "SAP SE" }] +requires-python = ">=3.10" +dependencies = [ + "PyYAML>=6.0", +] + +[project.scripts] +sap-preprocess-spec = "sap_openapi_generator.preprocess_spec:main" + +[dependency-groups] +dev = [ + "pytest>=8.0", + "pytest-cov>=5.0", +] + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.pytest.ini_options] +testpaths = ["tests"] diff --git a/packages/openapi-generator/specs/document-grounding/api.yaml b/packages/openapi-generator/specs/document-grounding/api.yaml new file mode 100644 index 00000000..44d28468 --- /dev/null +++ b/packages/openapi-generator/specs/document-grounding/api.yaml @@ -0,0 +1,4686 @@ +openapi: 3.0.0 +info: + title: Grounding + version: 0.1.0 + description: Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + contact: + name: SAP AI Core +x-sap-shortText: Enhance content generation with additional capabilities for business AI scenarios. +externalDocs: + description: Documentation for SAP AI Core - Grounding + url: https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/grounding +tags: + - name: Pipelines + description: Tag for pipelines component + - name: Vector + description: Tag for vector component + - name: Retrieval + description: Tag for retrieval component +servers: + - url: 'https://api.ai.{region}.ml.hana.ondemand.com/v2/lm/{service}' + description: Production endpoint for SAP AI Core + variables: + region: + enum: + - prod.eu-central-1.aws + - prodeuonly.eu-central-1.aws + - prod.us-east-1.aws + - prod.ap-northeast-1.aws + - prod.ap-southeast-2.aws + - prod-eu20.westeurope.azure + - prod-eu30.europe-west3.gcp + - prod-us21.eastus.azure + - prod-us30.us-central1.gcp + - prod-ap20.australiaeast.az + - prod-ap11.ap-southeast-1.aws + default: prod.eu-central-1.aws + service: + default: document-grounding +paths: + '/pipelines': + post: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.create_pipeline + summary: Pipeline Creation + description: Create a pipeline + x-sap-cloud-sdk-operation-name: createPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/createPipeline' + responses: + '201': + description: Returns pipelineId on successful creation. + content: + application/json: + schema: + $ref: '#/components/schemas/pipelineId' + '400': + $ref: '#/components/responses/BadRequest' + get: + tags: + - Pipelines + parameters: + - name: metadataConfigId + in: query + required: false + schema: + type: string + description: Filter pipelines based on metadataConfigId + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + operationId: pipeline.v1.pipeline_endpoints.get_all_pipeline + summary: Get Pipelines + description: Get all pipelines + x-sap-cloud-sdk-operation-name: getAllPipelines + responses: + '200': + description: Returns all pipelines for the tenant. + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelines' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/{pipelineId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_by_id + summary: Get details of a Pipeline + description: Get details of a pipeline by pipeline id + x-sap-cloud-sdk-operation-name: getPipelineById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get. + responses: + '200': + description: Returns the pipeline for an pipelineId + content: + application/json: + schema: + $ref: '#/components/schemas/getPipeline' + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.delete_pipeline_by_id + summary: Delete pipeline + description: Delete a pipeline by pipeline id + x-sap-cloud-sdk-operation-name: deletePipelineById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to delete. + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequest' + patch: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.patch_pipeline_by_id + summary: Patch pipeline + description: Patch a pipeline by pipeline id + x-sap-cloud-sdk-operation-name: patchPipelineById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to patch. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/patchPipeline' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/{pipelineId}/status': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_status + summary: Get status of Pipeline + description: Get pipeline status by pipeline id + x-sap-cloud-sdk-operation-name: getPipelineStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get status. + responses: + '200': + description: Returns the pipeline status for an pipelineId. + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelineStatus' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/search': + post: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.search_pipeline + summary: Pipeline Search by Metadata + description: Search for pipelines based on metadata + x-sap-cloud-sdk-operation-name: searchPipelinesByMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/searchPipeline' + responses: + '200': + description: Returns pipelines for the tenant that matches the metadata + content: + application/json: + schema: + $ref: '#/components/schemas/searchPipelinesResponse' + '400': + $ref: '#/components/responses/BadRequest' + + ### ### ### Pipeline Status API ### ### + ### ### ######################### ### ### + '/pipelines/{pipelineId}/executions': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_executions + summary: Get Pipeline Executions + description: Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + x-sap-cloud-sdk-operation-name: getAllExecutionsForPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: lastExecution + in: query + required: false + schema: + type: boolean + description: Filter to get the last execution + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Returns all executions + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelineExecutions' + + '/pipelines/{pipelineId}/executions/{executionId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_execution_by_id + summary: Get Pipeline Execution by ID + description: Retrieve details of a specific pipeline execution by its execution ID. + x-sap-cloud-sdk-operation-name: getExecutionDetailsByIdForPipelineExecution + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: executionId + in: path + required: true + schema: + type: string + description: The ID of the execution + responses: + '200': + description: Returns a response to execution id + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelineExecutionById' + + '/pipelines/{pipelineId}/executions/{executionId}/documents': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_execution_documents + summary: Get Documents for a Pipeline Execution + description: Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + x-sap-cloud-sdk-operation-name: getDocumentsForPipelineExecution + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: executionId + in: path + required: true + schema: + type: string + description: The ID of the execution + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Returns a response to execution id + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsStatusResponse' + + '/pipelines/{pipelineId}/executions/{executionId}/documents/{documentId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_execution_document_by_id + summary: Get Document by ID for a Pipeline Execution + description: Retrieve details of a specific document associated with a pipeline execution. + x-sap-cloud-sdk-operation-name: getDocumentByIdForPipelineExecution + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: executionId + in: path + required: true + schema: + type: string + description: The ID of the execution + - name: documentId + in: path + required: true + schema: + type: string + description: The ID of the document to get. + responses: + '200': + description: Returns a response to execution id and document id. + content: + application/json: + schema: + $ref: '#/components/schemas/PipelineDocumentResponse' + + '/pipelines/{pipelineId}/documents': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_documents + summary: Get Documents for a Pipeline + description: Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + x-sap-cloud-sdk-operation-name: getAllDocumentsForPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get. + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Returns all documents for a pipeline. + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsStatusResponse' + + '/pipelines/{pipelineId}/documents/{documentId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_document_by_id + summary: Get Document by ID for a Pipeline + description: Retrieve details of a specific document associated with a pipeline. + x-sap-cloud-sdk-operation-name: getDocumentByIdForPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get. + - name: documentId + in: path + required: true + schema: + type: string + description: The ID of the document to get. + responses: + '200': + description: Returns a response to document id. + content: + application/json: + schema: + $ref: '#/components/schemas/PipelineDocumentResponse' + + '/pipelines/trigger': + post: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.trigger_pipeline + summary: Pipeline Trigger + description: Manually trigger a pipeline + x-sap-cloud-sdk-operation-name: manualTriggerPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/manualPipelineTrigger' + responses: + '202': + description: Accepted + headers: + Location: + description: Location of the triggered pipeline execution + schema: + type: string + format: uri + '400': + $ref: '#/components/responses/BadRequest' + + '/pipelines/metadata/configurations': + post: + tags: + - Metadata Configurations + summary: Create a metadata configuration + description: Creates a new metadata configuration. + operationId: metadata_management.v1.metadata_endpoints.create_metadata_configuration + x-sap-cloud-sdk-operation-name: createMetadataConfiguration + requestBody: + required: true + x-body-name: config_payload + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataConfigurationRequest' + responses: + '202': + description: Accepted - Document enumeration in progress + headers: + Location: + description: URI of the created metadata configuration resource + schema: + type: string + example: /metadata/configurations/7e2b1111-aaaa-bbbb-cccc-123456789abc + '400': + $ref: '#/components/responses/BadRequest' + get: + tags: + - Metadata Configurations + summary: List metadata configurations + description: List all metadata configurations + operationId: metadata_management.v1.metadata_endpoints.list_metadata_configurations + x-sap-cloud-sdk-operation-name: listMetadataConfigurations + parameters: + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Paginated list of configurations + content: + application/json: + schema: + $ref: '#/components/schemas/ListMetadataConfigurations' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/metadata/configurations/{metadataConfigId}': + get: + tags: + - Metadata Configurations + summary: Get a configuration by ID + description: Get the details of a configuration by ID + operationId: metadata_management.v1.metadata_endpoints.get_metadata_configuration_by_id + x-sap-cloud-sdk-operation-name: getMetadataConfigurationById + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + responses: + '200': + description: Configuration found + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataConfigurationResponse' + '404': + description: Configuration not found + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - Metadata Configurations + summary: Delete a configuration by ID + description: Delete a metadata configuration by ID + operationId: metadata_management.v1.metadata_endpoints.delete_metadata_configuration_by_id + x-sap-cloud-sdk-operation-name: deleteMetadataConfigurationById + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + responses: + '202': + description: Configuration deletion initiated + '404': + description: Configuration not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: Internal server error during deletion of configuration + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '409': + description: Pipelines exists for this configuration. Delete the pipelines before deleting the configuration. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '/pipelines/metadata/configurations/{metadataConfigId}/documents': + get: + tags: + - Metadata Configurations + summary: List documents of a configuration + description: List the documents for a configuration + operationId: metadata_management.v1.metadata_endpoints.list_metadata_configuration_documents + x-sap-cloud-sdk-operation-name: listMetadataConfigurationDocuments + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + - in: query + name: absolutePath + schema: + type: string + description: > + Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: List of documents + content: + application/json: + schema: + $ref: '#/components/schemas/ListConfigurationDocuments' + patch: + tags: + - Metadata Configurations + summary: Batch update metadata for multiple documents + description: Patch the documents of a configuration in batch + operationId: metadata_management.v1.metadata_endpoints.batch_update_documents_metadata + x-sap-cloud-sdk-operation-name: batchUpdateDocumentsMetadata + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + requestBody: + required: true + x-body-name: documents_metadata_payload + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/DocumentMetadataBatchRequest' + responses: + '200': + description: Batch patch applied successfully + content: + application/json: + schema: + $ref: '#/components/schemas/BatchUpdateDocumentsResponse' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/metadata/configurations/{metadataConfigId}/documents/{documentId}': + get: + tags: + - Metadata Configurations + summary: Get document details + description: Get the details of a document by document id + operationId: metadata_management.v1.metadata_endpoints.get_document_details + x-sap-cloud-sdk-operation-name: getMetadataDocumentDetails + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + - name: documentId + in: path + required: true + schema: + type: string + description: Document ID + responses: + '200': + description: Document details + content: + application/json: + schema: + $ref: '#/components/schemas/ConfigurationDocument' + '404': + description: Document or configuration not found + '400': + $ref: '#/components/responses/BadRequest' + + '/vector/collections': + get: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + tags: + - Vector + summary: Get collections + description: Gets a list of collections. + operationId: vector.v1.vector_endpoints.get_all_collections + x-sap-cloud-sdk-operation-name: getAllCollections + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + tags: + - Vector + summary: Create collection + description: Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + operationId: vector.v1.vector_endpoints.create_collection + x-sap-cloud-sdk-operation-name: createCollection + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionRequest' + required: true + responses: + '202': + description: Successful Response + headers: + Location: + description: The newly created collections monitor url + schema: + type: string + format: uri + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}': + get: + tags: + - Vector + summary: Get collection by ID + description: Gets a specific collection by ID. + operationId: vector.v1.vector_endpoints.get_collection_by_id + x-sap-cloud-sdk-operation-name: getCollectionById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Collection' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + delete: + tags: + - Vector + summary: Delete collection by ID + description: Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + operationId: vector.v1.vector_endpoints.delete_collection + x-sap-cloud-sdk-operation-name: deleteCollectionById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + title: Collectionid + description: Collection ID + responses: + '202': + description: Successful Response + headers: + Location: + description: The deleted collections monitor url + schema: + type: string + format: uri + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}/documents/{documentId}': + get: + tags: + - Vector + summary: Get document by ID + description: Gets a specific document in a collection by ID. + operationId: vector.v1.vector_endpoints.get_document_by_id + x-sap-cloud-sdk-operation-name: getDocumentById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + - name: documentId + in: path + required: true + schema: + type: string + format: uuid + title: Documentid + description: Document ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + delete: + tags: + - Vector + summary: Delete a document + description: Deletes a specific document of a collection. + operationId: vector.v1.vector_endpoints.delete_document + x-sap-cloud-sdk-operation-name: deleteDocumentById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + - name: documentId + in: path + required: true + schema: + type: string + format: uuid + title: Documentid + description: Document ID + responses: + '204': + description: Successful Response + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}/documents': + get: + tags: + - Vector + summary: Get documents + description: Gets a list of documents of a collection. + operationId: vector.v1.vector_endpoints.get_all_documents + x-sap-cloud-sdk-operation-name: getAllDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Documents' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + post: + tags: + - Vector + summary: Create documents in collection + description: Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + operationId: vector.v1.vector_endpoints.create_documents + x-sap-cloud-sdk-operation-name: createDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentCreateRequest' + responses: + '201': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + patch: + tags: + - Vector + summary: Upsert documents in collection + description: Upserts the data of multiple documents into a collection. + operationId: vector.v1.vector_endpoints.update_documents + x-sap-cloud-sdk-operation-name: updateDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentUpdateRequest' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/search': + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + tags: + - Vector + summary: Search chunk by vector + description: Search chunks + operationId: vector.v1.vector_endpoints.search_chunk + x-sap-cloud-sdk-operation-name: search + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TextSearchRequest' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/VectorSearchResults' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{id}/creationStatus': + get: + tags: + - Vector + summary: Get collection status by ID + description: Gets a specific collection status from monitor by ID. + operationId: vector.v1.vector_endpoints.get_collection_creation_status + x-sap-cloud-sdk-operation-name: getCollectionCreationStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: id + in: path + required: true + schema: + type: string + format: uuid + title: ID + description: Collection ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CollectionCreatedResponse' + - $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{id}/deletionStatus': + get: + tags: + - Vector + summary: Get collection status by ID + description: Gets a specific collection status from monitor by ID. + operationId: vector.v1.vector_endpoints.get_collection_deletion_status + x-sap-cloud-sdk-operation-name: getCollectionDeletionStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: id + in: path + required: true + schema: + type: string + format: uuid + title: Id + description: Collection ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CollectionDeletedResponse' + - $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/documents': + delete: + tags: + - Vector + summary: Delete list of documents across collections + description: Deletes list of documents across collections. + operationId: vector.v1.vector_endpoints.delete_all_documents + x-sap-cloud-sdk-operation-name: deleteAllDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentBulkDeleteRequest' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentBulkDeleteResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/metadata': + patch: + tags: + - Vector + summary: Patch collections metadata + description: Allows to add, remove and modify the collections metadata. + operationId: vector.v1.vector_endpoints.update_collections_metadata + x-sap-cloud-sdk-operation-name: updateCollectionsMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/documents/metadata': + patch: + tags: + - Vector + summary: Patch documents metadata + description: Allows to add, remove and modify the documents metadata. + operationId: vector.v1.vector_endpoints.update_documents_metadata + x-sap-cloud-sdk-operation-name: updateDocumentsMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/chunks/metadata': + patch: + tags: + - Vector + summary: Patch chunks metadata + description: Allows to add, remove and modify the chunks metadata. + operationId: vector.v1.vector_endpoints.update_chunks_metadata + x-sap-cloud-sdk-operation-name: updateChunksMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/retrieval/dataRepositories': + get: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + tags: + - Retrieval + summary: List all DataRepository objects. + description: List all Data Repositories + operationId: retrieval.v1.retrieval_endpoints.get_data_repositories + x-sap-cloud-sdk-operation-name: getDataRepositories + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DataRepositories' + '400': + $ref: '#/components/responses/BadRequest' + '/retrieval/dataRepositories/{repositoryId}': + get: + tags: + - Retrieval + summary: List single DataRepository object. + description: List data repository by id + operationId: retrieval.v1.retrieval_endpoints.get_data_repository + x-sap-cloud-sdk-operation-name: getDataRepositoryById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: repositoryId + in: path + required: true + schema: + type: string + format: uuid + title: Repositoryid + description: Repository ID + - name: remoteName + in: query + required: false + schema: + type: string + minLength: 1 + nullable: true + title: Remotename + description: Remote name if DataRepository is from remote DG. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DataRepository' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '404': + $ref: '#/components/responses/NotFound' + '/retrieval/search': + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + tags: + - Retrieval + summary: Retrieve relevant content + description: Retrieve relevant content given a query string. + operationId: retrieval.v1.retrieval_endpoints.search + x-sap-cloud-sdk-operation-name: search + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RetrievalSearchInput' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/RetrievalSearchResults' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + +components: + securitySchemes: + Oauth2: + type: oauth2 + description: OAuth client credentials (client ID and secret) are required. These can be requested from SAP BTP cloud cockpit. + flows: + clientCredentials: + tokenUrl: https://(subdomain_identity_zone).authentication.(host)/oauth/token + scopes: {} + schemas: + createPipeline: + oneOf: + - $ref: '#/components/schemas/MSSharePointPipelineCreateRequest' + - $ref: '#/components/schemas/S3PipelineCreateRequest' + - $ref: '#/components/schemas/SFTPPipelineCreateRequest' + - $ref: '#/components/schemas/SDMPipelineCreateRequest' + - $ref: '#/components/schemas/WorkZonePipelineCreateRequest' + - $ref: '#/components/schemas/ServiceNowPipelineCreateRequest' + - $ref: '#/components/schemas/GoogleDrivePipelineCreateRequest' + - $ref: '#/components/schemas/MetadataConfiguration' + discriminator: + propertyName: type + mapping: + MSSharePoint: '#/components/schemas/MSSharePointPipelineCreateRequest' + S3: '#/components/schemas/S3PipelineCreateRequest' + SFTP: '#/components/schemas/SFTPPipelineCreateRequest' + SDM: '#/components/schemas/SDMPipelineCreateRequest' + WorkZone: '#/components/schemas/WorkZonePipelineCreateRequest' + ServiceNow: '#/components/schemas/ServiceNowPipelineCreateRequest' + GoogleDrive: '#/components/schemas/GoogleDrivePipelineCreateRequest' + metadata: '#/components/schemas/MetadataConfiguration' + + manualPipelineTrigger: + type: object + properties: + pipelineId: + type: string + example: uuid + metadataOnly: + type: boolean + example: True + + MSSharePointPipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: [MSSharePoint] + configuration: + $ref: '#/components/schemas/MSSharePointConfiguration' + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + S3PipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: [S3] + configuration: + $ref: '#/components/schemas/S3Configuration' + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + SFTPPipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: [SFTP] + configuration: + $ref: '#/components/schemas/SFTPConfiguration' + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + SDMPipelineCreateRequest: + type: object + required: + - type + - metadata + properties: + type: + type: string + enum: [SDM] + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + WorkZonePipelineCreateRequest: + type: object + required: + - type + - metadata + properties: + type: + type: string + enum: [WorkZone] + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + ServiceNowPipelineCreateRequest: + type: object + required: + - type + properties: + type: + type: string + enum: ['ServiceNow'] + metadata: + $ref: '#/components/schemas/MetaData' + configuration: + $ref: '#/components/schemas/ServiceNowConfigurationStruct' + additionalProperties: true + + MetadataConfiguration: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: ['metadata'] + configuration: + $ref: '#/components/schemas/MetadataConfigurationStruct' + metadata: + type: object + properties: + dataRepositoryMetadata: + $ref: '#/components/schemas/DataRepositoryMetaDataStrict' + required: + - dataRepositoryMetadata + additionalProperties: true + + MetadataConfigurationStruct: + type: object + properties: + metadataConfigId: + type: string + minLength: 1 + example: uuid + cronExpression: + type: string + description: | + Optional cron expression for scheduling pipeline execution. + Must represent an interval greater than 1 hour. + example: '0 */20 * * *' + required: + - metadataConfigId + additionalProperties: true + + # null is not allowed as the 'value' inside the items + DataRepositoryMetaDataStrict: + type: array + items: + $ref: '#/components/schemas/MetaDataKeyValuePairStrict' + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + + # null is not allowed as the 'value' + MetaDataKeyValuePairStrict: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + additionalProperties: true + + ServiceNowConfigurationStruct: + type: object + required: + - destination + properties: + destination: + type: string + example: destination-name + serviceNow: + $ref: '#/components/schemas/ServiceNowConfig' + metadataConfigId: + type: string + example: uuid + cronExpression: + type: string + description: | + Optional cron expression for scheduling pipeline execution. + Must represent an interval greater than 1 hour. + example: '0 */20 * * *' + additionalProperties: true + + ServiceNowConfig: + type: object + properties: + includePaths: + type: array + items: + type: string + minItems: 1 + example: + - active=true + - sys_domain_path=/health + additionalProperties: true + + GoogleDrivePipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: ['GoogleDrive'] + metadata: + $ref: '#/components/schemas/MetaData' + configuration: + $ref: '#/components/schemas/GoogleDriveConfigurationStruct' + + GoogleDriveConfigurationStruct: + type: object + required: + - destination + - googleDrive + properties: + destination: + type: string + example: destination-name + googleDrive: + $ref: '#/components/schemas/GoogleDriveConfig' + cronExpression: + type: string + description: | + Optional cron expression for scheduling pipeline execution. + Must represent an interval greater than 1 hour. + example: '0 */20 * * *' + metadataConfigId: + type: string + example: uuid + additionalProperties: true + + GoogleDriveConfig: + type: object + required: + - resourceType + properties: + resourceType: + type: string + enum: ['SHARED_FOLDER', 'SHARED_DRIVE'] + example: 'SHARED_DRIVE' + resourceId: + type: string + example: '0AGVUFpXcXc5Uk9PVA' + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: true + + GoogleDriveResourceDetail: + type: object + properties: + resourceType: + type: string + enum: ['SHARED_FOLDER', 'SHARED_DRIVE'] + example: 'SHARED_DRIVE' + resourceId: + type: string + example: '0AGVUFpXcXc5Uk9PVA' + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: true + + ServiceNowConfigurationMinimal: + type: object + required: + - destination + properties: + destination: + type: string + example: destination-name + serviceNow: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: false + + GoogleDriveConfigurationMinimal: + type: object + required: + - googleDrive + properties: + googleDrive: + $ref: '#/components/schemas/GoogleDriveResourceDetail' + additionalProperties: false + + MSSharePointConfiguration: + type: object + required: + - destination + - sharePoint + properties: + destination: + type: string + example: generic-secret-name + sharePoint: + $ref: '#/components/schemas/SharePointConfig' + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + additionalProperties: true + + SharePointConfig: + type: object + required: + - site + properties: + site: + $ref: '#/components/schemas/SharePointSite' + additionalProperties: true + + SharePointSite: + type: object + required: + - name + properties: + name: + type: string + example: sharepoint-site-name + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: true + + SFTPConfiguration: + type: object + required: + - destination + properties: + destination: + type: string + example: generic-secret-name + sftp: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + additionalProperties: true + + S3Configuration: + type: object + required: + - destination + properties: + destination: + type: string + example: generic-secret-name + s3: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + additionalProperties: true + + MetaData: + type: object + properties: + destination: + type: string + example: destination-name + dataRepositoryMetadata: + type: array + items: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + additionalProperties: true + + getPipelines: + type: object + required: + - resources + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/getPipeline' + + getPipeline: + oneOf: + - $ref: '#/components/schemas/MSSharePointPipelineGetResponse' + - $ref: '#/components/schemas/S3PipelineGetResponse' + - $ref: '#/components/schemas/SFTPPipelineGetResponse' + - $ref: '#/components/schemas/SDMPipelineGetResponse' + - $ref: '#/components/schemas/WorkZonePipelineGetResponse' + - $ref: '#/components/schemas/ServiceNowPipelineGetResponse' + - $ref: '#/components/schemas/GoogleDrivePipelineGetResponse' + discriminator: + propertyName: type + mapping: + MSSharePoint: '#/components/schemas/MSSharePointPipelineGetResponse' + S3: '#/components/schemas/S3PipelineGetResponse' + SFTP: '#/components/schemas/SFTPPipelineGetResponse' + SDM: '#/components/schemas/SDMPipelineGetResponse' + WorkZone: '#/components/schemas/WorkZonePipelineGetResponse' + ServiceNow: '#/components/schemas/ServiceNowPipelineGetResponse' + GoogleDrive: '#/components/schemas/GoogleDrivePipelineGetResponse' + + MSSharePointPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: [MSSharePoint] + configuration: + $ref: '#/components/schemas/MSSharePointConfigurationGetResponse' + + S3PipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: [S3] + configuration: + $ref: '#/components/schemas/S3Configuration' + + SFTPPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: [SFTP] + configuration: + $ref: '#/components/schemas/SFTPConfiguration' + + SDMPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - metadata + properties: + type: + type: string + enum: [SDM] + metadata: + $ref: '#/components/schemas/MetaData' + + WorkZonePipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - metadata + properties: + type: + type: string + enum: [WorkZone] + metadata: + $ref: '#/components/schemas/MetaData' + + ServiceNowPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: ['ServiceNow'] + configuration: + $ref: '#/components/schemas/ServiceNowConfigurationMinimal' + + GoogleDrivePipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: ['GoogleDrive'] + configuration: + $ref: '#/components/schemas/GoogleDriveConfigurationMinimal' + + BasePipelineResponse: + type: object + required: + - id + - type + properties: + id: + type: string + type: + type: string + metadata: + $ref: '#/components/schemas/MetaData' + + MSSharePointConfigurationGetResponse: + type: object + required: + - destination + - sharePoint + properties: + destination: + type: string + sharePoint: + $ref: '#/components/schemas/SharePointConfigGetResponse' + + SharePointConfigGetResponse: + type: object + required: + - site + properties: + site: + $ref: '#/components/schemas/SharePointSiteGetResponse' + + SharePointSiteGetResponse: + type: object + required: + - name + properties: + id: + type: string + name: + type: string + includePaths: + type: array + items: + type: string + + pipelineId: + type: object + properties: + pipelineId: + type: string + example: uuid + + PipelineExecutionData: + type: object + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + createdAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00Z' + nullable: true + modifiedAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00Z' + nullable: true + + getPipelineStatus: + type: object + properties: + lastStarted: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00.000Z' + createdAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00.000Z' + nullable: true + lastCompletedAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00.000Z' + nullable: true + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + + PipelineExecutionStatus: + type: string + anyOf: + - enum: + - NEW + - CREATING + - CREATED + - CREATION_FAILED + - UNKNOWN + - INPROGRESS + - FINISHED + - FINISHEDWITHERRORS + - TIMEOUT + - DELETION_INPROGRESS + - DELETION_FAILED + - {} + + getPipelineExecutions: + type: object + properties: + count: + type: integer + example: 2 + resources: + type: array + items: + $ref: '#/components/schemas/PipelineExecutionData' + + getPipelineExecutionById: + type: object + properties: + id: + type: string + example: uuid + createdAt: + type: string + example: '2024-02-15T12:45:00Z' # UTC + modifiedAt: + type: string + example: '2024-02-15T12:45:00Z' # UTC + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + + DocumentStatus: + type: string + anyOf: + - enum: + - TO_BE_PROCESSED + - INDEXED + - REINDEXED + - DEINDEXED + - FAILED + - FAILED_TO_BE_RETRIED + - TO_BE_SCHEDULED + - {} + example: 'INDEXED' + + DocumentsStatusResponse: + type: object + properties: + count: + type: integer + example: 1 + resources: + type: array + items: + type: object + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/DocumentStatus' + viewLocation: + type: string + example: 'location' + nullable: true + downloadLocation: + type: string + example: 'location' + nullable: true + absoluteUrl: + type: string + nullable: true + title: + type: string + nullable: true + metadataId: + type: string + nullable: true + createdTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + lastUpdatedTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + + PipelineDocumentResponse: + type: object + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/DocumentStatus' + viewLocation: + type: string + example: 'location' + nullable: true + downloadLocation: + type: string + example: 'location' + nullable: true + absoluteUrl: + type: string + nullable: true + title: + type: string + nullable: true + metadataId: + type: string + nullable: true + createdTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + lastUpdatedTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + searchPipeline: + type: object + properties: + dataRepositoryMetadata: + type: array + description: Search for metadata happens at key level. Pipelines matching the search criteria will be returned. + items: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + + searchPipelinesResponse: + type: object + required: + - resources + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/PipelineMinimalResponse' + + PipelineMinimalResponse: + oneOf: + - $ref: '#/components/schemas/MSSharePointPipelineMinimalResponse' + - $ref: '#/components/schemas/S3PipelineMinimalResponse' + - $ref: '#/components/schemas/SFTPPipelineMinimalResponse' + - $ref: '#/components/schemas/SDMPipelineMinimalResponse' + - $ref: '#/components/schemas/WorkZonePipelineMinimalResponse' + - $ref: '#/components/schemas/ServiceNowPipelineMinimalResponse' + - $ref: '#/components/schemas/GoogleDrivePipelineMinimalResponse' + discriminator: + propertyName: type + mapping: + MSSharePoint: '#/components/schemas/MSSharePointPipelineMinimalResponse' + S3: '#/components/schemas/S3PipelineMinimalResponse' + SFTP: '#/components/schemas/SFTPPipelineMinimalResponse' + SDM: '#/components/schemas/SDMPipelineMinimalResponse' + WorkZone: '#/components/schemas/WorkZonePipelineMinimalResponse' + ServiceNow: '#/components/schemas/ServiceNowPipelineMinimalResponse' + GoogleDrive: '#/components/schemas/GoogleDrivePipelineMinimalResponse' + + MSSharePointPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + - configuration + properties: + type: + type: string + enum: + - MSSharePoint + configuration: + $ref: '#/components/schemas/MSSharePointConfigurationMinimal' + metadata: + type: boolean + example: true + + S3PipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - S3 + configuration: + $ref: '#/components/schemas/S3ConfigurationMinimal' + metadata: + type: boolean + example: true + + SFTPPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - SFTP + configuration: + $ref: '#/components/schemas/SFTPConfigurationMinimal' + metadata: + type: boolean + example: true + + SDMPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - SDM + metadata: + type: boolean + example: true + + WorkZonePipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - WorkZone + metadata: + type: boolean + example: true + + ServiceNowPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - ServiceNow + metadata: + type: boolean + example: true + + GoogleDrivePipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - GoogleDrive + configuration: + $ref: '#/components/schemas/GoogleDriveConfigurationMinimal' + metadata: + type: boolean + example: true + + BasePipelineMinimalResponse: + type: object + required: + - id + - status + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + + MSSharePointConfigurationMinimal: + type: object + required: + - sharePoint + properties: + sharePoint: + $ref: '#/components/schemas/SharePointSiteDetail' + + SharePointSiteDetail: + type: object + required: + - name + properties: + id: + type: string + example: sharepoint-site-id + name: + type: string + example: sharepoint-site-name + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + + S3ConfigurationMinimal: + type: object + required: + - s3 + properties: + s3: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: false + + SFTPConfigurationMinimal: + type: object + required: + - sftp + properties: + sftp: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: false + + IncludePathsArray: + type: array + items: + type: string + example: + - /testFolder1 + - /testFolder2 + + patchPipeline: + type: object + properties: + metadata: + type: object + properties: + dataRepositoryMetadata: + type: array + description: Patch for metadata happens at key level. Value for the specific key would be inserted/replaced. + items: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + configuration: + type: object + properties: + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + + Chunk: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Metadata + default: [] + type: object + required: + - id + - content + title: Chunk + VectorChunk: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: array + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + title: Metadata + default: [] + type: object + required: + - id + - content + title: VectorChunk + RetrievalChunk: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Metadata + default: [] + searchScores: + $ref: '#/components/schemas/SearchScores' + nullable: true + postProcessingScore: + $ref: '#/components/schemas/Score' + nullable: true + type: object + required: + - id + - content + title: RetrievalChunk + DocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + matchMode: + title: MatchMode + description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + nullable: true + default: ANY + type: object + required: + - key + - value + title: DocumentKeyValueListPair + VectorDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + matchMode: + title: MatchMode + description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + nullable: true + default: ANY + type: object + required: + - key + - value + title: VectorDocumentKeyValueListPair + RetrievalDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + matchMode: + title: MatchMode + nullable: true + description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + default: ANY + type: object + required: + - key + - value + title: RetrievalDocumentKeyValueListPair + HTTPValidationError: + properties: + detail: + type: array + items: + $ref: '#/components/schemas/ValidationError' + title: Detail + type: object + title: HTTPValidationError + KeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + title: KeyValueListPair + VectorKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + description: Collection metadata during ingestion + title: VectorKeyValueListPair + RetrievalKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + title: RetrievalKeyValueListPair + Document-Output: + properties: + id: + type: string + format: uuid + title: Id + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + chunks: + items: + $ref: '#/components/schemas/VectorChunk' + type: array + title: VectorChunks + type: object + required: + - id + - chunks + title: Document + DocumentsChunk: + properties: + id: + type: string + format: uuid + title: Id + title: + type: string + title: Title + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + default: [] + documents: + items: + $ref: '#/components/schemas/Document-Output' + type: array + title: Documents + type: object + required: + - id + - title + - documents + title: Collection + PerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + items: + $ref: '#/components/schemas/DocumentsChunk' + type: array + title: Results + type: object + required: + - filterId + - results + title: PerFilterSearchResult + VectorPerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + items: + $ref: '#/components/schemas/DocumentsChunk' + type: array + title: Results + type: object + required: + - filterId + - results + title: VectorPerFilterSearchResult + SearchConfiguration: + properties: + maxChunkCount: + nullable: true + type: integer + minimum: 0 + maximum: 0 + exclusiveMinimum: true + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + maxDocumentCount: + nullable: true + type: integer + minimum: 0 + maximum: 0 + exclusiveMinimum: true + title: Maxdocumentcount + description: "[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned." + type: object + title: SearchConfiguration + VectorSearchConfiguration: + properties: + maxChunkCount: + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + maxDocumentCount: + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + title: Maxdocumentcount + description: "[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned." + type: object + title: VectorSearchConfiguration + RetrievalSearchConfiguration: + nullable: true + default: {} + minProperties: 0 + maxProperties: 2 + properties: + maxChunkCount: + nullable: true + type: integer + minimum: 0 + exclusiveMinimum: true + maximum: 10000000 + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + maxDocumentCount: + nullable: true + type: integer + minimum: 0 + exclusiveMinimum: true + maximum: 10000000 + title: Maxdocumentcount + description: "[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned." + type: object + title: RetrievalSearchConfiguration + SearchDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + selectMode: + type: array + items: + $ref: '#/components/schemas/SearchSelectOptionEnum' + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: SearchDocumentKeyValueListPair + VectorSearchDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + selectMode: + type: array + items: + $ref: '#/components/schemas/VectorSearchSelectOptionEnum' + nullable: true + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: VectorSearchDocumentKeyValueListPair + RetrievalSearchDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + selectMode: + type: array + items: + $ref: '#/components/schemas/RetrievalSearchSelectOptionEnum' + nullable: true + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: RetrievalSearchDocumentKeyValueListPair + SearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/PerFilterSearchResult' + title: Results + description: List of returned results. + type: object + required: + - results + title: SearchResults + VectorSearchResults: + properties: + results: + type: array + items: + $ref: '#/components/schemas/VectorPerFilterSearchResult' + title: Results + description: List of returned results. + type: object + required: + - results + title: VectorSearchResults + + CollectionsListResponse: + properties: + count: + type: integer + resources: + items: + $ref: '#/components/schemas/Collection' + type: array + title: Collections + type: object + required: + - resources + title: CollectionsListResponse + description: A response containing collections retrieved from the server. + CollectionRequest: + properties: + title: + type: string + nullable: true + title: Title + embeddingConfig: + $ref: '#/components/schemas/EmbeddingConfig' + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + description: >- + Metadata attached to collection. Useful to restrict search to a + subset of collections. + default: [] + id: + type: string + format: uuid + nullable: true + title: Id + description: Unique identifier of a collection. + type: object + required: + - embeddingConfig + title: CollectionRequest + description: A request for creating a new, single collection. + CollectionCreatedResponse: + properties: + collectionURL: + type: string + title: Collectionurl + status: + type: string + title: Status + type: object + required: + - collectionURL + - status + title: CollectionCreatedResponse + CollectionPendingResponse: + properties: + monitorURL: + type: string + title: MonitorURL + type: object + required: + - monitorURL + title: CollectionPendingResponse + CollectionDeletedResponse: + properties: + collectionURL: + type: string + title: Collectionurl + status: + type: string + title: Status + type: object + required: + - collectionURL + - status + title: CollectionDeletedResponse + BaseDocument: + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunkCreate' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + type: object + required: + - chunks + title: BaseDocument + description: Base class for documents, document requests and responses. + DocumentCreateRequest: + properties: + documents: + items: + $ref: '#/components/schemas/BaseDocument' + type: array + title: Documents + type: object + required: + - documents + title: DocumentCreateRequest + description: >- + A create request containing one or more new documents to create and + store in a collection. + Document-Input: + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunkCreate' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - chunks + - id + title: Document + description: A single document stored in a collection by ID. + DocumentUpdateRequest: + properties: + documents: + items: + $ref: '#/components/schemas/Document-Input' + type: array + title: Documents + type: object + required: + - documents + title: DocumentUpdateRequest + description: + An update request containing one or more documents to update existing + documents in a collection by ID. + DocumentWithoutChunks: + properties: + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - metadata + - id + title: DocumentWithoutChunks + description: + A single document stored in a collection by ID without exposing + its chunks. + DocumentsListResponse: + properties: + documents: + items: + $ref: '#/components/schemas/DocumentWithoutChunks' + type: array + title: Documents + type: object + required: + - documents + title: DocumentsListResponse + description: A response containing documents retrieved from the server. + Documents: + properties: + count: + type: integer + resources: + items: + $ref: '#/components/schemas/DocumentWithoutChunks' + type: array + title: Documents + type: object + required: + - resources + title: Documents + description: A response containing documents retrieved from the server. + TextOnlyBaseChunk: + properties: + content: + type: string + title: Content + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a chuk. + type: object + required: + - content + - id + title: TextOnlyBaseChunk + description: Schema for a text-only chunk. + TextOnlyBaseChunkCreate: + properties: + content: + type: string + title: Content + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + default: [] + type: object + required: + - content + title: TextOnlyBaseChunk + description: Schema for a text-only chunk. + DocumentResponse: + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunk' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - chunks + - id + title: DocumentResponse + description: >- + A response containing information about a newly created, single + document. + SearchSelectOptionEnum: + type: string + anyOf: + - enum: + - ignoreIfKeyAbsent + - {} + default: ignoreIfKeyAbsent + title: SearchSelectOptionEnum + VectorSearchSelectOptionEnum: + type: string + enum: + - ignoreIfKeyAbsent + title: VectorSearchSelectOptionEnum + RetrievalSearchSelectOptionEnum: + type: string + enum: + - ignoreIfKeyAbsent + title: RetrievalSearchSelectOptionEnum + SearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this SearchFilter - unique per request. + collectionIds: + items: + type: string + type: array + title: Collectionids + configuration: + $ref: '#/components/schemas/SearchConfiguration' + collectionMetadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + maxItems: 2000 + title: Collectionmetadata + description: >- + Restrict collections considered during search to those annotated + with the given metadata. Useful when combined with collections=['*'] + default: [] + documentMetadata: + items: + $ref: '#/components/schemas/SearchDocumentKeyValueListPair' + type: array + maxItems: 2000 + title: Documentmetadata + description: >- + Restrict documents considered during search to those annotated with + the given metadata. + default: [] + chunkMetadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + maxItems: 2000 + title: Chunkmetadata + description: >- + Restrict chunks considered during search to those with the given + metadata. + default: [] + type: object + required: + - id + - collectionIds + - configuration + title: SearchFilter + VectorSearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this VectorSearchFilter - unique per request. + collectionIds: + items: + type: string + type: array + title: Collectionids + configuration: + $ref: '#/components/schemas/VectorSearchConfiguration' + collectionMetadata: + type: array + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + nullable: true + title: Collectionmetadata + description: >- + Restrict collections considered during search to those annotated + with the given metadata. Useful when combined with collections=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: '#/components/schemas/VectorSearchDocumentKeyValueListPair' + nullable: true + title: Documentmetadata + description: >- + Restrict documents considered during search to those annotated with + the given metadata. + default: [] + chunkMetadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Chunkmetadata + description: >- + Restrict chunks considered during search to those with the given + metadata. + default: [] + filter: + title: Filter + description: + Advanced filter expression for combining metadata filters with + boolean logic + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + nullable: true + type: object + required: + - id + - collectionIds + - configuration + title: VectorSearchFilter + TextSearchRequest: + properties: + query: + type: string + maxLength: 2000 + minLength: 1 + nullable: true + title: Query + description: Query string + filters: + items: + $ref: '#/components/schemas/VectorSearchFilter' + type: array + title: Filters + type: object + required: + - query + - filters + title: TextSearchRequest + EmbeddingConfig: + properties: + modelName: + type: string + maxLength: 1024 + title: Modelname + default: text-embedding-ada-002 + type: object + title: EmbeddingConfig + Collection: + properties: + title: + type: string + nullable: true + title: Title + embeddingConfig: + $ref: '#/components/schemas/EmbeddingConfig' + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + description: >- + Metadata attached to collection. Useful to restrict search to a + subset of collections. + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a collection. + type: object + required: + - embeddingConfig + - id + title: Collection + description: A logical grouping of content. + DataRepositories: + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/DataRepository' + title: Datarepositories + type: object + required: + - resources + title: DataRepositories + DataRepository: + properties: + id: + type: string + format: uuid + title: Id + description: Unique identifier of this DataRepository. + title: + type: string + title: Title + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Metadata + description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + default: [] + remoteGroundingName: + type: string + nullable: true + message: + type: string + nullable: true + type: + $ref: '#/components/schemas/DataRepositoryType' + type: object + required: + - id + - title + - type + title: DataRepository + description: DataRepository schema expected by Retrieval. + DataRepositorySearchResult: + properties: + dataRepository: + $ref: '#/components/schemas/DataRepositoryWithDocuments' + type: object + required: + - dataRepository + title: DataRepositorySearchResult + DataRepositoryType: + description: Only include DataRepositories with the given type. + type: string + enum: + - vector + - help.sap.com + - remote:dg + title: DataRepositoryType + DataRepositoryWithDocuments: + properties: + id: + type: string + format: uuid + title: Id + description: Unique identifier of this DataRepository. + title: + type: string + title: Title + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Metadata + description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + default: [] + remoteGroundingName: + type: string + nullable: true + description: Friendly destination Name (grounding.name) of remote instance. + message: + type: string + nullable: true + description: Optional message. + documents: + type: array + items: + $ref: '#/components/schemas/Document' + title: Documents + type: object + required: + - id + - title + - documents + title: DataRepositoryWithDocuments + description: DataRepository schema returned by the Vector search endpoint + Document: + properties: + id: + type: string + title: Id + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalDocumentKeyValueListPair' + title: Metadata + default: [] + chunks: + type: array + items: + $ref: '#/components/schemas/RetrievalChunk' + title: RetrievalChunks + type: object + required: + - id + - chunks + title: Document + DataRepositoryPerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + type: array + items: + $ref: '#/components/schemas/DataRepositorySearchResult' + title: Results + description: List of returned results. + default: [] + type: object + required: + - filterId + title: PerFilterSearchResult + PerFilterSearchResultError: + description: Error message if any. + properties: + message: + type: string + title: Message + default: Unknown Error Occurred + type: object + required: + - message + title: PerFilterSearchResultError + RetrievalPerFilterSearchResultError: + description: Error message if any. + properties: + message: + type: string + title: Message + default: Unknown Error Occurred + type: object + required: + - message + title: RetrievalPerFilterSearchResultError + PerFilterSearchResultWithError: + properties: + filterId: + type: string + title: Filterid + error: + $ref: '#/components/schemas/PerFilterSearchResultError' + type: object + required: + - filterId + title: PerFilterSearchResultWithError + RetrievalSearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this RetrievalSearchFilter - unique per request. + searchConfiguration: + nullable: true + $ref: '#/components/schemas/RetrievalSearchConfiguration' + default: {} + dataRepositories: + type: array + items: + type: string + title: Datarepositories + description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + default: ['*'] + dataRepositoryType: + $ref: '#/components/schemas/DataRepositoryType' + description: Only include DataRepositories with the given type. + remoteName: + description: Destination Name of remote instance. + type: string + nullable: true + dataRepositoryMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalSearchDocumentKeyValueListPair' + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + default: [] + chunkMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + default: [] + type: object + required: + - id + - dataRepositoryType + title: RetrievalSearchFilter + description: Limit scope of search to certain DataRepositories, Documents or Chunks. + RetrievalSearchInput: + properties: + query: + type: string + minLength: 1 + nullable: true + title: Query + description: Query string + filters: + type: array + items: + anyOf: + - $ref: '#/components/schemas/RetrievalSearchFilter' + - $ref: '#/components/schemas/RetrievalVectorSearchFilter' + title: Filters + postProcessing: + type: array + items: + type: object + required: + - strategy + - inputs + properties: + id: + description: New ID for each PostProcessingOperation. + default: ae9eee48-4671-4321-a3e5-640adaaf26ae + type: string + nullable: true + maxChunkCount: + description: 'Maximum number of chunks to be retained in final PerSearchFilterResult.' + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + default: 5 + strategy: + description: 'Merging and scoring strategy to derive final PerSearchFilterResult.' + oneOf: + - $ref: '#/components/schemas/MergeStrategyScoreReuse' + - $ref: '#/components/schemas/MergeStrategyReranker' + inputs: + type: array + items: + oneOf: + - $ref: '#/components/schemas/PostProcessingObjectReference' + - $ref: '#/components/schemas/PostProcessingOperation' + description: List of operations to be performed across PerFilterSearchResults. + default: [] + type: object + required: + - query + - filters + title: RetrievalSearchInput + Score: + type: object + properties: + value: + type: number + required: + - value + title: Score + SearchScores: + properties: + aggregatedScore: + type: object + properties: + value: + type: number + denseRetrievalScore: + type: object + properties: + value: + type: number + required: + - aggregatedScore + - denseRetrievalScore + title: SearchScores + RetrievalVectorSearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this RetrievalSearchFilter - unique per request. + searchConfiguration: + $ref: '#/components/schemas/RetrievalSearchConfiguration' + nullable: true + default: {} + dataRepositories: + type: array + items: + type: string + title: Datarepositories + description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + default: + - '*' + dataRepositoryType: + $ref: '#/components/schemas/DataRepositoryType' + nullable: true + default: vector + remoteName: + description: Destination Name of remote instance. + type: string + nullable: true + dataRepositoryMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalSearchDocumentKeyValueListPair' + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + default: [] + chunkMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + default: [] + filter: + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + nullable: true + description: Filter to apply on the search results. This cannot be used together with 'documentMetadata'. The depth of the filter must not exceed 5 levels. + scoringConfiguration: + $ref: '#/components/schemas/VectorScoringConfiguration' + nullable: true + description: Scoring configuration for retrieval and ranking. + default: + denseRetrieval: + enabled: true + weight: 1 + keywordRetrieval: + enabled: true + extractKeyWordsFromQuery: false + weight: 1 + boosting: + enabled: true + metadata: [] + scoreComputationStrategy: match_count + weight: 1 + aggregationStrategy: weighted_average + type: object + required: + - id + title: RetrievalVectorSearchFilter + RetrievalBinaryBooleanFilter: + properties: + operator: + type: string + title: Operator + enum: + - and + - or + left: + title: Left + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + right: + title: Right + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + type: object + required: + - operator + - left + - right + title: RetrievalBinaryBooleanFilter + RetrievalScopedKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + scope: + type: string + title: Scope + enum: + - repository + - document + - chunk + default: document + type: object + required: + - key + - value + title: RetrievalScopedKeyValueListPair + MergeStrategyScoreReuse: + properties: + type: + description: 'The type of merge strategy.' + $ref: '#/components/schemas/MergeStrategyType' + nullable: true + default: scoreReuse + type: object + title: MergeStrategyScoreReuse + description: The MergeStrategyScoreReuse merges the given PerFilterSearchResult instances according to the scores returned by the downstream retrieval process. It is important that the scores are comparable, meaning they should come from the same embedding model or reranker model. + MergeStrategyReranker: + properties: + type: + $ref: '#/components/schemas/MergeStrategyType' + nullable: true + default: reranker + model: + description: The RerankerModel to use. + type: string + enum: + - cohere-3.5 + nullable: true + title: RerankerModel + default: cohere-3.5 + boosting: + description: Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true. + type: array + items: + type: object + required: + - key + - value + - scope + properties: + key: + type: string + maxLength: 1024 + value: + type: array + items: + type: string + maxLength: 1024 + scope: + type: array + description: PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + items: + type: string + nullable: true + includeAllMetaData: + description: If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk. + type: boolean + nullable: true + default: false + type: object + title: MergeStrategyReranker + description: The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult instances. This strategy adds latency, but yields good results. + MergeStrategyType: + enum: + - reranker + - scoreReuse + - reciprocalRankFusion + - random + type: string + title: MergeStrategyType + PostProcessingObjectReference: + properties: + id: + description: PerFilterSearchResult ID or PostProcessingOperation ID. + type: string + nullable: true + default: '6d3eeafd-f3db-4e8e-949a-0e40e50eab64' + type: object + title: PostProcessingObjectReference + PostProcessingOperation: + properties: + id: + type: string + nullable: true + description: New ID for each PostProcessingOperation. + default: ae9eee48-4671-4321-a3e5-640adaaf26ae + title: Id + maxChunkCount: + title: Maxchunkcount + description: Maximum number of chunks to be retained in final PerSearchFilterResult. + default: 5 + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + strategy: + title: Strategy + description: Merging and scoring strategy to derive final PerSearchFilterResult. + oneOf: + - $ref: '#/components/schemas/MergeStrategyScoreReuse' + - $ref: '#/components/schemas/MergeStrategyReranker' + inputs: + title: Inputs + type: array + items: + oneOf: + - $ref: '#/components/schemas/PostProcessingObjectReference' + - $ref: '#/components/schemas/PostProcessingOperation' + type: object + required: + - strategy + - inputs + title: PostProcessingOperation + VectorScoringConfiguration: + properties: + denseRetrieval: + $ref: '#/components/schemas/DenseRetrievalScoringConfiguration' + nullable: true + default: + enabled: true + weight: 1 + keywordRetrieval: + $ref: '#/components/schemas/KeyWordRetrievalScoringConfiguration' + nullable: true + default: + enabled: true + weight: 1 + extractKeyWordsFromQuery: false + boosting: + $ref: '#/components/schemas/BoostingScoringConfiguration' + nullable: true + default: + enabled: true + metadata: [] + weight: 1 + scoreComputationStrategy: match_count + scoreThreshold: + title: Scorethreshold + description: Minimum chunk score threshold. + type: number + nullable: true + aggregationStrategy: + description: Methodology to calculate the final aggregate score. + $ref: '#/components/schemas/ScoresAggregationStrategy' + nullable: true + default: weighted_average + type: object + title: VectorScoringConfiguration + DenseRetrievalScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + description: Enable dense retrieval. + default: true + weight: + type: integer + nullable: true + description: Contribution to final score. + default: 1 + type: object + title: DenseRetrievalScoringConfiguration + KeyWordRetrievalScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + default: true + description: Enable dense retrieval. + weight: + type: integer + nullable: true + default: 1 + description: Contribution to final score. + extractKeyWordsFromQuery: + type: boolean + nullable: true + default: false + description: Extract Keywords from Query. + type: object + title: KeyWordRetrievalScoringConfiguration + BoostingScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + default: true + description: Enable metadata-based boosting. + metadata: + type: array + items: + type: object + required: + - key + - value + - weight + properties: + key: + type: string + maxLength: 1024 + value: + type: array + items: + type: string + maxLength: 1024 + scope: + type: string + enum: [repository, document, chunk] + default: document + weight: + type: integer + nullable: true + default: [] + weight: + type: integer + nullable: true + default: 1 + description: Contribution to final score. + scoreComputationStrategy: + description: How the similarity between document metadata and boosted key-value pairs is computed. + $ref: '#/components/schemas/BoostingScoreComputationStrategy' + nullable: true + default: match_count + type: object + title: BoostingScoringConfiguration + BoostingScoreComputationStrategy: + enum: + - match_count + - embedding + type: string + title: BoostingScoreComputationStrategy + ScoresAggregationStrategy: + enum: + - weighted_average + - rrf + - weighted_rrf + type: string + title: ScoresAggregationStrategy + + RetrievalDataRepositorySearchResult: + properties: + dataRepository: + $ref: '#/components/schemas/DataRepositoryWithDocuments' + type: object + required: + - dataRepository + title: RetrievalDataRepositorySearchResult + RetrievalPerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + type: array + items: + $ref: '#/components/schemas/RetrievalDataRepositorySearchResult' + title: Results + description: List of returned results. + default: [] + remoteGroundingName: + type: string + nullable: true + description: + Friendly Destination Name of remote instance (grounding.name). + Only present if dataRepositoryType = remote:dg. + type: object + required: + - filterId + title: RetrievalPerFilterSearchResult + RetrievalPerFilterSearchResultWithError: + properties: + filterId: + type: string + title: Filterid + error: + $ref: '#/components/schemas/RetrievalPerFilterSearchResultError' + type: object + required: + - filterId + title: RetrievalPerFilterSearchResultWithError + RetrievalSearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/RetrievalPerFilterSearchResult' + - $ref: '#/components/schemas/RetrievalPerFilterSearchResultWithError' + title: Results + description: List of returned results. + type: object + required: + - results + title: RetrievalSearchResults + DataRepositorySearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/DataRepositoryPerFilterSearchResult' + - $ref: '#/components/schemas/PerFilterSearchResultWithError' + title: Results + description: List of returned results. + type: object + required: + - results + title: SearchResults + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + msg: + type: string + title: Message + type: + type: string + title: Error Type + input: + title: Input + ctx: + type: object + title: Context + type: object + required: + - loc + - msg + - type + title: ValidationError + GenericError: + type: object + required: + - error + properties: + error: + type: string + description: Human-readable error message + title: GenericError + DocumentBulkDeleteRequest: + properties: + ids: + items: + type: string + format: uuid + type: array + maxItems: 100 + minItems: 1 + title: Ids + description: List of document IDs to delete + type: object + required: + - ids + title: DocumentBulkDeleteRequest + description: A request to delete documents by their IDs. + DocumentBulkDeleteResponse: + properties: + deleted: + type: array + items: + type: string + format: uuid + title: Deleted + description: List of successfully deleted document IDs + notFound: + type: array + items: + type: string + format: uuid + title: NotFound + description: List of document IDs that were not found + type: object + required: + - deleted + - notFound + title: DocumentBulkDeleteResponse + description: Response after deleting documents in bulk. + BinaryBooleanFilter: + type: object + required: + - operator + - left + - right + properties: + operator: + type: string + title: Operator + description: Boolean operator for combining filter conditions + enum: + - and + - or + left: + title: Left + description: Left operand of the boolean expression + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + right: + title: Right + description: Right operand of the boolean expression + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + title: BinaryBooleanFilter + ScopedKeyValueListPair: + type: object + required: + - key + - value + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + scope: + type: string + title: Scope + description: Scope of the metadata filter (e.g., collection, document, chunk) + enum: + - collection + - document + - chunk + default: document + title: ScopedKeyValueListPair + MetadataUpdates: + properties: + updates: + type: array + items: + $ref: '#/components/schemas/MetadataUpdateItem' + title: Updates + description: List of metadata updates. + type: object + required: + - updates + title: MetadataUpdates + MetadataUpdateItem: + properties: + ids: + type: array + items: + type: string + format: uuid + title: Ids + description: List of collection or document or chunk ids for which the metadata should be updated + metadataUpdates: + type: array + items: + $ref: '#/components/schemas/MetadataKeyUpdate' + title: MetadataUpdates + description: List of metadata updates for the given resource ids + type: object + required: + - ids + - metadataUpdates + title: MetadataUpdateItem + MetadataKeyUpdate: + properties: + key: + type: string + minLength: 1 + title: Key + description: Key to update + operations: + type: array + items: + $ref: '#/components/schemas/MetadataOperation' + nullable: true + title: Operations + description: Update operation executed for the key + type: object + required: + - key + title: MetadataKeyUpdate + MetadataOperation: + type: object + required: + - op + properties: + op: + $ref: '#/components/schemas/MetadataOperationEnum' + values: + type: array + items: + type: string + nullable: true + title: Values + description: List of values to update. + title: MetadataOperation + MetadataOperationEnum: + type: string + enum: + - add + - remove + - replace + - delete_key + title: MetadataOperationEnum + MetadataResponse: + type: object + properties: + current_metadata: + type: array + items: + $ref: '#/components/schemas/MetadataItem' + nullable: true + title: CurrentMetadata + description: List of metadata after updates. + default: [] + title: MetadataResponse + MetadataItem: + type: object + required: + - id + properties: + id: + type: string + format: uuid + title: Id + description: ID of collection + metadata: + type: array + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + nullable: true + title: Metadata + description: List of metadata of the collections or documents or chunks + default: [] + title: MetadataItem + FilterMatchModeEnum: + type: string + enum: + - ANY + - ALL + title: FilterMatchModeEnum + + ### ### ######################## ### ### + ### ### ### Error ### ### ### + ### ### ######################## ### ### + + ApiError: + required: + - code + - message + type: object + properties: + code: + description: >- + Descriptive error code (not http status code). + type: string + message: + description: plaintext error description + type: string + requestId: + description: id of individual request + type: string + target: + description: url that has been called + type: string + details: + type: array + items: + $ref: '#/components/schemas/DetailsErrorResponse' + + DetailsErrorResponse: + type: object + properties: + code: + description: Descriptive error code (not http status code) + type: string + message: + description: Plaintext error description + type: string + + # Metadata Management Schemas + MetadataConfigurationRequest: + type: object + required: + - destinationName + - dataRepositoryType + properties: + id: + type: string + description: If provided, must be a valid UUID. If not provided, a new UUID will be generated. + name: + type: string + description: If provided, must be a valid string. If not provided, will be same as id. + destinationName: + type: string + description: Contains destination name containing credentials to access the data repository. + dataRepositoryType: + type: string + enum: [MSSharePoint, S3, SFTP] + example: MSSharePoint + description: The data repository type for which this configuration is being created. + includePaths: + type: array + items: + type: string + minItems: 1 + example: ['/site/documents', '/shared/team'] + labels: + type: array + items: + type: object + required: [key, value] + properties: + key: + type: string + example: 'department' + value: + type: string + example: 'finance' + + ListMetadataConfigurations: + type: object + properties: + count: + type: integer + example: 1 + description: Total number of metadata configurations returned. + resources: + type: array + items: + $ref: '#/components/schemas/MetadataConfigurationResponse' + description: List of metadata configuration objects. It will be empty array if no records found. + + MetadataConfigurationResponse: + allOf: + - $ref: '#/components/schemas/MetadataConfigurationRequest' + - type: object + properties: + enumerationStatus: + anyOf: + - enum: [NEW, IN_PROGRESS, COMPLETED, ERROR] + - {} + example: 'IN_PROGRESS' + description: Status of metadata enumeration for the configuration. + + ListConfigurationDocuments: + type: object + properties: + count: + type: integer + example: 1 + description: Total number of documents returned. + resources: + type: array + items: + $ref: '#/components/schemas/ConfigurationDocument' + description: List of document objects. It will be empty array if no records found. + + ListConfigurationDocumentsFullDetails: + type: object + properties: + count: + type: integer + example: 1 + description: Total number of documents returned. + resources: + type: array + items: + $ref: '#/components/schemas/ConfigurationDocumentFullDetails' + description: List of document objects. It will be empty array if no records found. + + ConfigurationDocument: + type: object + properties: + id: + type: string + example: 3cba7512-b07a-58e6-a442-c83996a0b3bb + description: Unique identifier for the document. + title: + type: string + example: 'Quarterly Report' + description: Title of the document. + absoluteFilePath: + type: string + example: '/sites/team/finance/Q1/report.pdf' + description: Absolute file path of the document in the repository. + createdTimestamp: + type: string + format: date-time + description: UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z) + example: '2025-08-28T06:15:30Z' + type: + anyOf: + - enum: [FOLDER, DOCUMENT] + - {} + example: 'FOLDER' + description: Type of the resource. Can be FOLDER, DOCUMENT. + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata key-value pairs associated with the document. + + ConfigurationDocumentFullDetails: + type: object + properties: + id: + type: string + example: 3cba7512-b07a-58e6-a442-c83996a0b3bb + description: Unique identifier for the document. + title: + type: string + example: 'Quarterly Report' + description: Title of the document. + absoluteFilePath: + type: string + example: '/sites/team/finance/Q1/report.pdf' + description: Absolute file path of the document in the repository. + createdTimestamp: + type: string + format: date-time + description: UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z) + example: '2025-08-28T06:15:30Z' + resourceUri: + type: string + example: 'https://example.com/resource/123' + description: URI of the resource. + webUrl: + type: string + example: 'https://example.com/web/123' + description: Web URL of the document. + documentEtag: + type: string + example: 'abc123etag' + description: ETag of the document. + fileSuffix: + type: string + example: '.pdf' + description: File suffix of the document. + viewLocation: + type: string + example: 'https://example.com/view/123' + description: View location of the document. + downloadLocation: + type: string + example: 'https://example.com/download/123' + description: Download location of the document. + mimeType: + type: string + example: 'application/pdf' + description: MIME type of the document. + fileSizeMb: + type: string + example: '1.5' + description: File size of the document in megabytes. + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata key-value pairs associated with the document. + + DocumentMetadata: + type: object + required: [key, value] + properties: + key: + type: string + example: contentObjectId + description: Metadata key name. + value: + type: array + items: + type: string + example: some-id + nullable: true + description: An array of string values associated with the metadata key. If the key already exists, its values will be overwritten. Setting the value to null will delete the metadata key-value pair. + matchMode: + anyOf: + - enum: [ANY, ALL] + - {} + example: ANY + description: Match mode for the metadata key (ANY or ALL). + + DocumentMetadataUpdate: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier of the document to update. + example: 550e8400-e29b-41d4-a716-446655440000 + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata updates for this document. + maxItems: 10 + required: + - id + - metadata + + DocumentMetadataBatchRequest: + type: object + required: + - value + properties: + value: + type: array + items: + $ref: '#/components/schemas/DocumentMetadataUpdate' + maxItems: 1000 + description: List of document metadata updates to be applied in batch. + + BatchUpdateDocumentSuccess: + type: object + required: [id, metadata] + properties: + id: + type: string + format: uuid + description: Unique identifier of the document. + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata updates for this document. + + DocumentMetadataUpdateError: + type: object + required: [target, code, message] + properties: + target: + type: string + description: Document ID that caused the error. + example: 550e8400-e29b-41d4-a716-446655440000 + code: + type: integer + description: HTTP error status code. + example: 500 + message: + type: string + description: Error message. + example: Some unexpected error occurred. + + BatchUpdateDocumentsResponse: + type: array + items: + oneOf: + - $ref: '#/components/schemas/DocumentMetadataUpdate' + - $ref: '#/components/schemas/DocumentMetadataUpdateError' + + MessageResponse: + type: object + properties: + message: + type: string + example: Tenant onboarding request accepted + + ErrorResponse: + type: object + properties: + error: + type: string + example: Error occurred during tenant onboarding + + ### *** ***************************************************** *** ### + ### *** *** Start of responses *** *** ### + ### *** ***************************************************** *** ### + + responses: + BadRequest: + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + description: The specification of the resource was incorrect + + NotFound: + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + description: The specification of the resource was incorrect + + UnprocessableEntity: + description: There are validation issues with the data. + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + MonitorNotFound: + description: The specified monitor resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + + parameters: + top: + name: $top + description: Number of results to display + in: query + required: false + schema: + type: integer + minimum: 0 + example: 10 + + skip: + name: $skip + description: Number of results to be skipped from the ordered list of results + in: query + required: false + schema: + type: integer + minimum: 0 + example: 10 + + count: + name: $count + description: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + in: query + required: false + schema: + type: boolean + example: true diff --git a/packages/openapi-generator/specs/document-grounding/options-per-service.json b/packages/openapi-generator/specs/document-grounding/options-per-service.json new file mode 100644 index 00000000..b233246f --- /dev/null +++ b/packages/openapi-generator/specs/document-grounding/options-per-service.json @@ -0,0 +1,7 @@ +{ + "src/spec/api.yaml": { + "packageName": "document_grounding", + "directoryName": "document_grounding", + "basePath": "/lm/document-grounding" + } +} diff --git a/packages/openapi-generator/src/sap_openapi_generator/__init__.py b/packages/openapi-generator/src/sap_openapi_generator/__init__.py new file mode 100644 index 00000000..83f8e9c6 --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/__init__.py @@ -0,0 +1 @@ +"""SAP OpenAPI Generator package.""" diff --git a/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py new file mode 100644 index 00000000..decbb48c --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py @@ -0,0 +1,230 @@ +"""Pre-process an OpenAPI spec to apply SAP Cloud SDK vendor extensions. + +Replicates the Java ApiClassNameFieldPreprocessor and MethodNameFieldPreprocessor +logic so the standard openapi-generator-cli sees a clean, normalized spec. + +Two vendor extensions are handled: + + x-sap-cloud-sdk-api-name: + Sets operation tags[0] to the given value (trailing "Api" suffix stripped). + Cascade resolution: operation level > path level > root level. + + x-sap-cloud-sdk-operation-name: + Overwrites the operation's operationId with the given value. + The generator then derives the Python method name from that operationId. + +Additionally, an options-per-service.json file (same format as the JS SDK) can be +supplied to embed service-level config such as basePath into the spec servers list: + + options-per-service.json format: + { "": { "basePath": "/lm/document-grounding", "packageName": "..." } } + + Effect: spec["servers"] is replaced with [{"url": basePath}] so the generator + bakes it into Configuration._base_path. + +Usage: + sap-preprocess-spec --input path/to/spec.yaml --output path/to/processed.yaml + sap-preprocess-spec --input api.yaml --output out.yaml \\ + --options options-per-service.json --spec-key src/spec/api.yaml + python -m sap_openapi_generator.preprocess_spec --input ... --output ... +""" + +from __future__ import annotations + +import argparse +import copy +import json +import sys +from pathlib import Path + +import yaml + +HTTP_METHODS = ("get", "post", "put", "delete", "patch", "options", "head", "trace") + + +def strip_api_suffix(name: str) -> str: + """Remove a trailing literal 'Api' suffix (case-sensitive, matching Java behavior).""" + return name[:-3] if name.endswith("Api") else name + + +def apply_api_name_extension(spec: dict) -> None: + """Set operation tags[0] based on x-sap-cloud-sdk-api-name. + + Cascade resolution: operation level > path level > root level. + Strips a trailing literal 'Api' suffix from the resolved name before setting. + """ + root_name = spec.get("x-sap-cloud-sdk-api-name") + for path_item in spec.get("paths", {}).values(): + if not isinstance(path_item, dict): + continue + path_name = path_item.get("x-sap-cloud-sdk-api-name") + for method in HTTP_METHODS: + op = path_item.get(method) + if not isinstance(op, dict): + continue + effective = op.get("x-sap-cloud-sdk-api-name") or path_name or root_name + if effective: + op["tags"] = [strip_api_suffix(effective)] + + +def _snake_case(name: str) -> str: + """Convert camelCase or PascalCase to snake_case.""" + import re + s1 = re.sub(r"(.)([A-Z][a-z]+)", r"\1_\2", name) + return re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", s1).lower() + + +def apply_operation_name_extension(spec: dict) -> dict: + """Overwrite operationId with x-sap-cloud-sdk-operation-name when present. + + When two operations share the same desired name (valid in JS since they live in + different API classes), disambiguates by prefixing with the operation's tag: + e.g. both want "search" → "vector_search" and "retrieval_search" + + Returns an operationIdNameMappings dict (may be empty) that the generator config + should merge in, mapping the scoped operationId back to the desired method name. + """ + # First pass: collect all desired (tag, name) pairs to detect cross-tag collisions + desired: list[tuple[dict, str, str]] = [] # (op_dict, desired_name, tag) + for path_item in spec.get("paths", {}).values(): + if not isinstance(path_item, dict): + continue + for method in HTTP_METHODS: + op = path_item.get(method) + if not isinstance(op, dict): + continue + override = op.get("x-sap-cloud-sdk-operation-name") + if override: + tag = (op.get("tags") or ["default"])[0] + desired.append((op, override, tag)) + + # Detect which names appear more than once (across different tags) + from collections import Counter + name_counts = Counter(name for _, name, _ in desired) + duplicates = {name for name, count in name_counts.items() if count > 1} + + mappings: dict[str, str] = {} + for op, name, tag in desired: + if name in duplicates: + # Scope the operationId: snake_case(tag) + "_" + snake_case(name) + scoped = f"{_snake_case(tag)}_{_snake_case(name)}" + op["operationId"] = scoped + # Map scoped → desired so the generator uses the desired method name + mappings[scoped] = _snake_case(name) + else: + op["operationId"] = name + + return mappings + +def apply_options_per_service(spec: dict, options_path: Path, spec_key: str) -> None: + """Inject service options from an options-per-service.json file into the spec. + + Replaces spec["servers"] with a single entry whose URL is the basePath from + the options file. This causes the generator to bake basePath into + Configuration._base_path rather than leaving it as "http://localhost". + """ + with options_path.open() as f: + options: dict = json.load(f) + + service_opts = options.get(spec_key) + if not service_opts: + print( + f"WARNING: spec key '{spec_key}' not found in {options_path}. " + "No service options applied.", + file=sys.stderr, + ) + return + + base_path = service_opts.get("basePath") + if base_path: + spec["servers"] = [{"url": base_path}] + + +def validate_unique_operation_ids(spec: dict) -> None: + """Exit with an error if duplicate operationIds exist after applying overrides.""" + seen: dict[str, str] = {} + for path, path_item in spec.get("paths", {}).items(): + if not isinstance(path_item, dict): + continue + for method in HTTP_METHODS: + op = path_item.get(method) + if not isinstance(op, dict): + continue + op_id = op.get("operationId") + if not op_id: + continue + if op_id in seen: + print( + f"ERROR: Duplicate operationId '{op_id}' at " + f"'{method.upper()} {path}' conflicts with '{seen[op_id]}'.", + file=sys.stderr, + ) + sys.exit(1) + seen[op_id] = f"{method.upper()} {path}" + + +def load_spec(path: Path) -> dict: + with path.open() as f: + if path.suffix == ".json": + return json.load(f) + return yaml.safe_load(f) + + +def dump_spec(spec: dict, path: Path) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + with path.open("w") as f: + if path.suffix == ".json": + json.dump(spec, f, indent=2) + else: + yaml.dump(spec, f, allow_unicode=True, sort_keys=False) + + +def preprocess( + input_path: Path, + output_path: Path, + options_path: Path | None = None, + spec_key: str | None = None, + mappings_output_path: Path | None = None, +) -> None: + spec = copy.deepcopy(load_spec(input_path)) + if options_path: + apply_options_per_service(spec, options_path, spec_key or "") + apply_api_name_extension(spec) + mappings = apply_operation_name_extension(spec) + validate_unique_operation_ids(spec) + dump_spec(spec, output_path) + if mappings and mappings_output_path: + mappings_output_path.parent.mkdir(parents=True, exist_ok=True) + with mappings_output_path.open("w") as f: + yaml.dump({"operationIdNameMappings": mappings}, f, sort_keys=True) + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Pre-process an OpenAPI spec to apply SAP Cloud SDK vendor extensions." + ) + parser.add_argument("--input", required=True, type=Path, help="Source spec file (.yaml or .json)") + parser.add_argument("--output", required=True, type=Path, help="Output path for processed spec") + parser.add_argument( + "--options", + type=Path, + default=None, + help="Path to options-per-service.json (JS SDK format)", + ) + parser.add_argument( + "--spec-key", + default=None, + help="Key in options-per-service.json selecting this spec's options (e.g. 'src/spec/api.yaml')", + ) + parser.add_argument( + "--mappings-output", + type=Path, + default=None, + help="Optional path to write operationIdNameMappings YAML fragment (for --config merging)", + ) + args = parser.parse_args() + preprocess(args.input, args.output, args.options, args.spec_key, args.mappings_output) + + +if __name__ == "__main__": + main() diff --git a/packages/openapi-generator/tests/test_preprocess_spec.py b/packages/openapi-generator/tests/test_preprocess_spec.py new file mode 100644 index 00000000..1686704b --- /dev/null +++ b/packages/openapi-generator/tests/test_preprocess_spec.py @@ -0,0 +1,352 @@ +"""Unit tests for sap_openapi_generator.preprocess_spec.""" + +from __future__ import annotations + +import json +import pytest +from pathlib import Path + +from sap_openapi_generator.preprocess_spec import ( + apply_api_name_extension, + apply_operation_name_extension, + apply_options_per_service, + strip_api_suffix, + validate_unique_operation_ids, + _snake_case, +) + + +# --------------------------------------------------------------------------- +# strip_api_suffix +# --------------------------------------------------------------------------- + + +def test_strip_api_suffix_removes_trailing_Api(): + assert strip_api_suffix("FooApi") == "Foo" + + +def test_strip_api_suffix_case_sensitive_uppercase_unchanged(): + # Only literal "Api" is stripped — "API" is not (matches Java behavior) + assert strip_api_suffix("FooAPI") == "FooAPI" + + +def test_strip_api_suffix_not_at_end(): + assert strip_api_suffix("MyApiService") == "MyApiService" + + +def test_strip_api_suffix_only_api(): + # Edge case: name IS "Api" → empty string + assert strip_api_suffix("Api") == "" + + +def test_strip_api_suffix_no_suffix(): + assert strip_api_suffix("Foo") == "Foo" + + +# --------------------------------------------------------------------------- +# apply_api_name_extension +# --------------------------------------------------------------------------- + + +def _op(**kwargs) -> dict: + op: dict = {"operationId": "defaultOp", "responses": {"200": {"description": "ok"}}} + op.update(kwargs) + return op + + +def test_api_name_root_level_applied_to_all_operations(): + spec = { + "x-sap-cloud-sdk-api-name": "SodasApi", + "paths": { + "/sodas": {"get": _op(operationId="listSodas")}, + "/sodas/{id}": {"get": _op(operationId="getSoda")}, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/sodas"]["get"]["tags"] == ["Sodas"] + assert spec["paths"]["/sodas/{id}"]["get"]["tags"] == ["Sodas"] + + +def test_api_name_path_level_overrides_root(): + spec = { + "x-sap-cloud-sdk-api-name": "RootApi", + "paths": { + "/a": { + "x-sap-cloud-sdk-api-name": "PathApi", + "get": _op(operationId="opA"), + }, + "/b": {"get": _op(operationId="opB")}, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Path"] + assert spec["paths"]["/b"]["get"]["tags"] == ["Root"] + + +def test_api_name_operation_level_overrides_path_and_root(): + spec = { + "x-sap-cloud-sdk-api-name": "RootApi", + "paths": { + "/a": { + "x-sap-cloud-sdk-api-name": "PathApi", + "get": _op(operationId="opA", **{"x-sap-cloud-sdk-api-name": "OperationApi"}), + }, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Operation"] + + +def test_api_name_no_extension_preserves_existing_tags(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "tags": ["existing"], "responses": {}}}, + } + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["existing"] + + +def test_api_name_multiple_methods_on_same_path(): + spec = { + "paths": { + "/items": { + "x-sap-cloud-sdk-api-name": "ItemsApi", + "get": _op(operationId="listItems"), + "post": _op(operationId="createItem"), + } + } + } + apply_api_name_extension(spec) + assert spec["paths"]["/items"]["get"]["tags"] == ["Items"] + assert spec["paths"]["/items"]["post"]["tags"] == ["Items"] + + +def test_api_name_non_http_method_keys_ignored(): + spec = { + "x-sap-cloud-sdk-api-name": "FooApi", + "paths": { + "/a": { + "parameters": [{"name": "id", "in": "path"}], + "get": _op(operationId="getA"), + } + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Foo"] + assert isinstance(spec["paths"]["/a"]["parameters"], list) + + +def test_api_name_empty_paths_does_not_crash(): + apply_api_name_extension({"paths": {}}) + + +def test_api_name_no_paths_key_does_not_crash(): + apply_api_name_extension({}) + + +# --------------------------------------------------------------------------- +# apply_operation_name_extension +# --------------------------------------------------------------------------- + + +def test_operation_name_overwrites_operation_id(): + spec = { + "paths": { + "/pets/{id}": { + "get": { + "operationId": "getPetById", + "tags": ["Pets"], + "x-sap-cloud-sdk-operation-name": "fetchPet", + "responses": {}, + } + } + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/pets/{id}"]["get"]["operationId"] == "fetchPet" + assert mappings == {} + + +def test_operation_name_absent_leaves_operation_id_unchanged(): + spec = {"paths": {"/pets": {"get": {"operationId": "listPets", "responses": {}}}}} + apply_operation_name_extension(spec) + assert spec["paths"]["/pets"]["get"]["operationId"] == "listPets" + + +def test_operation_name_no_paths_key_does_not_crash(): + apply_operation_name_extension({}) + + +def test_operation_name_disambiguates_cross_tag_collision(): + """Two operations in different tags both want 'search' — must be scoped.""" + spec = { + "paths": { + "/vector/search": { + "post": { + "operationId": "vector.search_chunk", + "tags": ["Vector"], + "x-sap-cloud-sdk-operation-name": "search", + "responses": {}, + } + }, + "/retrieval/search": { + "post": { + "operationId": "retrieval.search", + "tags": ["Retrieval"], + "x-sap-cloud-sdk-operation-name": "search", + "responses": {}, + } + }, + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/vector/search"]["post"]["operationId"] == "vector_search" + assert spec["paths"]["/retrieval/search"]["post"]["operationId"] == "retrieval_search" + assert mappings == {"vector_search": "search", "retrieval_search": "search"} + + +def test_operation_name_no_collision_no_mappings(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "tags": ["A"], + "x-sap-cloud-sdk-operation-name": "getA", "responses": {}}}, + "/b": {"get": {"operationId": "opB", "tags": ["B"], + "x-sap-cloud-sdk-operation-name": "getB", "responses": {}}}, + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/a"]["get"]["operationId"] == "getA" + assert spec["paths"]["/b"]["get"]["operationId"] == "getB" + assert mappings == {} + + +# --------------------------------------------------------------------------- +# _snake_case +# --------------------------------------------------------------------------- + + +def test_snake_case_camel(): + assert _snake_case("camelCase") == "camel_case" + + +def test_snake_case_pascal(): + assert _snake_case("PascalCase") == "pascal_case" + + +def test_snake_case_already_snake(): + assert _snake_case("already_snake") == "already_snake" + + +# --------------------------------------------------------------------------- +# Both extensions applied together +# --------------------------------------------------------------------------- + + +def test_both_extensions_applied_independently(): + spec = { + "paths": { + "/drinks/{id}": { + "get": { + "operationId": "getDrinkById", + "x-sap-cloud-sdk-api-name": "DrinksApi", + "x-sap-cloud-sdk-operation-name": "fetchDrink", + "responses": {}, + } + } + } + } + apply_api_name_extension(spec) + apply_operation_name_extension(spec) + op = spec["paths"]["/drinks/{id}"]["get"] + assert op["tags"] == ["Drinks"] + assert op["operationId"] == "fetchDrink" + +def test_no_extension_is_a_passthrough(): + spec = { + "paths": { + "/items": { + "get": {"operationId": "listItems", "tags": ["items"], "responses": {}} + } + } + } + import copy + original = copy.deepcopy(spec) + apply_api_name_extension(spec) + apply_operation_name_extension(spec) + assert spec == original + + +# --------------------------------------------------------------------------- +# validate_unique_operation_ids +# --------------------------------------------------------------------------- + + +def test_validate_passes_when_all_ids_unique(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "responses": {}}}, + "/b": {"get": {"operationId": "opB", "responses": {}}}, + } + } + validate_unique_operation_ids(spec) # must not raise or exit + + +def test_validate_exits_on_duplicate(capsys): + spec = { + "paths": { + "/a": {"get": {"operationId": "dupOp", "responses": {}}}, + "/b": {"post": {"operationId": "dupOp", "responses": {}}}, + } + } + with pytest.raises(SystemExit) as exc_info: + validate_unique_operation_ids(spec) + assert exc_info.value.code == 1 + assert "dupOp" in capsys.readouterr().err + + +# --------------------------------------------------------------------------- +# apply_options_per_service +# --------------------------------------------------------------------------- + + +def test_options_per_service_sets_servers(tmp_path): + options = {"src/spec/api.yaml": {"basePath": "/lm/document-grounding"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert spec["servers"] == [{"url": "/lm/document-grounding"}] + + +def test_options_per_service_overwrites_existing_servers(tmp_path): + options = {"src/spec/api.yaml": {"basePath": "/new/path"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {"servers": [{"url": "http://old-host"}]} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert spec["servers"] == [{"url": "/new/path"}] + + +def test_options_per_service_missing_key_warns_and_does_not_modify(tmp_path, capsys): + options = {"other/key.yaml": {"basePath": "/other"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert "servers" not in spec + assert "src/spec/api.yaml" in capsys.readouterr().err + + +def test_options_per_service_no_base_path_does_not_set_servers(tmp_path): + options = {"src/spec/api.yaml": {"packageName": "my_pkg"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert "servers" not in spec + diff --git a/sample_code/Makefile b/sample_code/Makefile new file mode 100644 index 00000000..c9fe416a --- /dev/null +++ b/sample_code/Makefile @@ -0,0 +1,2 @@ +server: + uv run uvicorn sample_code.server:app --app-dir src --env-file .env --reload diff --git a/sample_code/README.md b/sample_code/README.md new file mode 100644 index 00000000..6b9ffe89 --- /dev/null +++ b/sample_code/README.md @@ -0,0 +1,41 @@ +# Sample Code - Work in Progress + +Sample code to demonstrate the usage of the SAP Cloud SDK for AI. + +## Prerequisites + +Before running the application, ensure the following prerequisites are met: + +- Python installation (3.10 or higher) +- uv installation (0.12) +- Credentials for [SAP AI Core](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/what-is-sap-ai-core) service configured. +- Deployments of the orchestration service as well as the following models in the resource group specified in the `.env` file below: + - `gpt-5.4-nano` + - `text-embedding-3-small` + - `anthropic--claude-4.6-sonnet` + - `gemini-3.5-flash` + +## Local Deployment + +Create a `.env` file in the sample-code directory with the complete content of your AI core service key by adding the following lines: + +```bash +AICORE_CLIENT_ID="..." +AICORE_CLIENT_SECRET="..." +AICORE_AUTH_URL="..." +AICORE_BASE_URL="..." +``` + +Optionally, you can add the `AICORE_RESOURCE_GROUP` environment variable to specify a resource group different from the `default` one. + +The server can be started with + +```bash +uv run uvicorn sample_code.server:app --app-dir src --env-file .env --reload +``` + +or by running ```make```. + +## Usage + +When the server is running, head to `http://localhost:8000/docs` to see all available endpoints. diff --git a/sample_code/pyproject.toml b/sample_code/pyproject.toml new file mode 100644 index 00000000..ed4b3737 --- /dev/null +++ b/sample_code/pyproject.toml @@ -0,0 +1,25 @@ +[project] +name = "sample-code" +version = "0.1.0" +description = "Sample code for using the AI Core Python SDK" +readme = "README.md" +requires-python = ">=3.10" +dependencies = [ + "fastapi>=0.141.1", + "sap-ai-sdk-gen", + "uvicorn>=0.52.1", +] + +[build-system] +requires = ["setuptools>=68"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +where = ["."] +include = ["src*"] + +[tool.setuptools.package-dir] +"sample_code" = "src" + +[tool.uv.sources] +sap-ai-sdk-gen = { workspace = true, editable = true } diff --git a/sample_code/pyrightconfig.json b/sample_code/pyrightconfig.json new file mode 100644 index 00000000..bec92e0d --- /dev/null +++ b/sample_code/pyrightconfig.json @@ -0,0 +1,9 @@ +{ + "venvPath": "..", + "venv": ".venv", + "extraPaths": [ + "../packages/base", + "../packages/core", + "../packages/gen" + ] +} diff --git a/sample_code/src/__init__.py b/sample_code/src/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sample_code/src/amazon.py b/sample_code/src/amazon.py new file mode 100644 index 00000000..8d5e2cf8 --- /dev/null +++ b/sample_code/src/amazon.py @@ -0,0 +1,25 @@ +from gen_ai_hub.proxy.native.amazon import Session + + +def converse(): + """ + Run chat example for Claude 4.6 Sonnet. + + Returns: + JSON object containing the model response as result. + """ + bedrock = Session().client(model_name="anthropic--claude-4.6-sonnet") + conversation = [ + { + "role": "user", + "content": [ + { + "text": "Describe the purpose of a 'Hello World' program in one sentence." + } + ], + } + ] + response = bedrock.converse( + messages=conversation, + ) + return {"result": response["output"]["message"]["content"][0]["text"]} diff --git a/sample_code/src/core.py b/sample_code/src/core.py new file mode 100644 index 00000000..e92f1af3 --- /dev/null +++ b/sample_code/src/core.py @@ -0,0 +1,80 @@ +from typing import Annotated + +from ai_api_client_sdk.models.parameter_binding import ParameterBinding +from ai_core_sdk.ai_core_v2_client import AICoreV2Client +from fastapi import Body + + +def get_configurations(): + """ + Get all configurations for the resource group specified in the .env file. + + Returns: + A dict containing the configurations in a ConfigurationQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.configuration.query() + + +def create_configuration(): + """ + Create configuration for GPT-5.4-nano. + + The configuration is created for the resource group specified in the .env file. + """ + client = AICoreV2Client.from_env() + # for illustrative purposes the example config is hardcoded + parameter_bindings = [ + ParameterBinding.from_dict({"key": "modelName", "value": "gpt-5.4-nano"}), + ParameterBinding.from_dict({"key": "modelVersion", "value": "latest"}), + ] + return client.configuration.create( + name="my-gpt-5.4-nano-config", + scenario_id="foundation-models", + executable_id="azure-openai", + parameter_bindings=parameter_bindings, + input_artifact_bindings=[], + ) + + +def get_deployments(): + """ + Get all deployments for the resource group specified in the .env file. + + Returns: + A dict containing the deployments in a DeploymentQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.deployment.query() + + +def create_deployment(configuration_id: Annotated[str, Body(embed=True)]): + """ + Create deployment for the configuration_id in the request body. + + The deployment is created for the resource group specified in the .env file. + """ + client = AICoreV2Client.from_env() + return client.deployment.create(configuration_id=configuration_id) + + +def get_scenarios(): + """ + Get all scenarios. + + Returns: + A dict containing the scenarios in a ScenarioQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.scenario.query() + + +def get_models(): + """ + Get all available models. + + Returns: + A dict containing the models in a ModelQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.model.query() diff --git a/sample_code/src/document_grounding_generation.py b/sample_code/src/document_grounding_generation.py new file mode 100644 index 00000000..00299d6f --- /dev/null +++ b/sample_code/src/document_grounding_generation.py @@ -0,0 +1,79 @@ +from ai_core_sdk.ai_core_v2_client import AICoreV2Client +from gen_ai_hub.document_grounding_generation import ( + GroundingApiClient, + CollectionRequest, + EmbeddingConfig, + PipelinesApi, + RetrievalApi, + RetrievalSearchConfiguration, + RetrievalSearchFilter, + RetrievalSearchInput, + TextSearchRequest, + VectorApi, +) + +RESOURCE_GROUP = "default" + + +def _client() -> GroundingApiClient: + return GroundingApiClient(AICoreV2Client.from_env()) + + +async def create_collection(): + """ + Create a new vector collection through the Document Grounding Vector API. + + Returns: + JSON object containing the created collection details. + """ + client = _client() + result = await VectorApi(client).create_collection( + collection_request=CollectionRequest( + title="my-collection", + embeddingConfig=EmbeddingConfig(modelName="text-embedding-3-small"), + ), + header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, + ) + return {"result": result.to_dict()} + + +async def get_all_pipelines(): + """ + List all document grounding pipelines through the Document Grounding Pipelines API. + + Returns: + JSON object containing the list of pipelines. + """ + client = _client() + result = await PipelinesApi(client).get_all_pipelines( + header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, + ) + return {"result": result.to_dict()} + + +async def retrieval_search(): + """ + Search across data repositories through the Document Grounding Retrieval API. + + Returns: + JSON object containing the search results. + """ + client = _client() + result = await RetrievalApi(client).search( + text_search_request=TextSearchRequest( + query="What is SAP BTP?", + filters=[ + RetrievalSearchFilter( + id="my-data-repository-id", + search_configuration=RetrievalSearchConfiguration( + max_chunk_count=5, + ), + ) + ], + search_configuration=RetrievalSearchInput( + max_chunk_count=10, + ), + ), + header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, + ) + return {"result": result.to_dict()} diff --git a/sample_code/src/google.py b/sample_code/src/google.py new file mode 100644 index 00000000..bb026973 --- /dev/null +++ b/sample_code/src/google.py @@ -0,0 +1,69 @@ +from fastapi.responses import StreamingResponse +from gen_ai_hub.proxy import get_proxy_client +from gen_ai_hub.proxy.native.google_genai import Client +from google.genai import types + + +def generate(): + """ + Run chat example for Gemini 3.5 Flash. + + Returns: + JSON object containing the model response as result. + """ + proxy_client = get_proxy_client("gen-ai-hub") + client = Client(proxy_client=proxy_client) + response = client.models.generate_content( + model="gemini-3.5-flash", contents="How many paws are there for a dog?" + ) + return {"result": response.candidates[0].content.parts[0].text} + + +def generate_stream(): + """ + Run chat example with streaming response for Gemini 3.5 Flash. + + Returns: + Streaming response emitting the produced text. + """ + proxy_client = get_proxy_client("gen-ai-hub") + + client = Client( + proxy_client=proxy_client, + ) + + def stream(): + stream = client.models.generate_content_stream( + model="gemini-3.5-flash", contents="Explain singularity in short terms." + ) + for chunk in stream: + if chunk.text: + yield chunk.text + + return StreamingResponse(stream(), media_type="text/plain") + + +def tool_call(): + """ + Run chat example including a tool call for Gemini 3.5 Flash. + + Returns: + JSON object containing the model response as result. + """ + + # addition tool to call + def add(a: int, b: int) -> int: + """Add two numbers.""" + return a + b + + proxy_client = get_proxy_client("gen-ai-hub") + + client = Client( + proxy_client=proxy_client, + ) + response = client.models.generate_content( + model="gemini-3.5-flash", + contents="What is 769 + 348?", + config=types.GenerateContentConfig(tools=[add]), + ) + return {"result": response.candidates[0].content.parts[0].text} diff --git a/sample_code/src/openai.py b/sample_code/src/openai.py new file mode 100644 index 00000000..934acf9c --- /dev/null +++ b/sample_code/src/openai.py @@ -0,0 +1,169 @@ +from fastapi.responses import StreamingResponse +from gen_ai_hub.proxy.native.openai import AsyncOpenAI, chat, embeddings, responses +from openai.types.responses import Response +from pydantic import BaseModel + + +def chat_completion(): + """ + Run chat example for GPT-5.4-nano with the ChatCompletions API. + + Returns: + JSON object containing the model response as result. + """ + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"}, + { + "role": "assistant", + "content": "Yes, customer managed keys are supported by Azure OpenAI.", + }, + { + "role": "user", + "content": "Do other Azure Cognitive Services support this too?", + }, + ] + response = chat.completions.create(model_name="gpt-5.4-nano", messages=messages) + return {"result": response.choices[0].message.content} + + +async def chat_completion_async(): + """ + Run async chat example for GPT-5.4-nano with the ChatCompletions API. + + Returns: + JSON object containing the model response as result. + """ + client = AsyncOpenAI() + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"}, + { + "role": "assistant", + "content": "Yes, customer managed keys are supported by Azure OpenAI.", + }, + { + "role": "user", + "content": "Do other Azure Cognitive Services support this too?", + }, + ] + response = await client.chat.completions.create( + model_name="gpt-5.4-nano", messages=messages + ) + await client.close() + return {"result": response.choices[0].message.content} + + +def chat_completion_structured(): + """ + Run structured output (JSON) example for GPT-5.4-nano with the ChatCompletions API. + + Returns: + JSON object response from the model. + """ + + class Person(BaseModel): + name: str + age: int + + response = chat.completions.parse( + model_name="gpt-5.4-nano", + messages=[{"role": "user", "content": "Tell me about John Doe, aged 30."}], + response_format=Person, + ) + return response.choices[0].message.parsed + + +def chat_completion_stream(): + """ + Run chat example with streaming response for GPT-5.4-nano with the ChatCompletions API. + + Returns: + Streaming response emitting the produced text. + """ + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Count from 1 to 10, one number per line."}, + ] + + def generate(): + stream = chat.completions.create( + model_name="gpt-5.4-nano", + messages=messages, + stream=True, + ) + for chunk in stream: + if chunk.choices: + content = chunk.choices[0].delta.content + if content: + yield content + + return StreamingResponse(generate(), media_type="text/plain") + + +def responses_simple(): + """ + Run chat example for GPT-5.4-nano with the Responses API. + + Returns: + JSON object containing the model response as result. + """ + response = responses.create( + model="gpt-5.4-nano", + instructions="You are a helpful assistant.", + input="What is the capital of France?", + ) + return {"result": response.output[0].content[0].text} + + +async def responses_simple_async(): + """ + Run async chat example for GPT-5.4-nano with the Responses API. + + Returns: + JSON object containing the model response as result. + """ + client = AsyncOpenAI() + response: Response = await client.responses.create( # type: ignore[assignment] + model="gpt-5.4-nano", + instructions="You are a helpful assistant.", + input="What is the capital of France?", + ) + await client.close() + return {"result": response.output[0].content[0].text} # type: ignore[union-attr] + + +def responses_structured(): + """ + Run structured output (JSON) example for GPT-5.4-nano with the Responses API. + + Returns: + JSON object response from the model. + """ + + class Person(BaseModel): + name: str + age: int + + response = responses.parse( + model="gpt-5.4-nano", + input="Tell me about John Doe aged 30.", + text_format=Person, + ) + return response.output_parsed + + +def embedding(): + """ + Run embedding example. + + Returns: + JSON object containing the embedding. + """ + result = embeddings.create( + model_name="text-embedding-3-small", + input="The quick brown fox jumps over the lazy dog.", + ) + return { + "result": result.data[0].embedding, + } diff --git a/sample_code/src/orchestration.py b/sample_code/src/orchestration.py new file mode 100644 index 00000000..70887444 --- /dev/null +++ b/sample_code/src/orchestration.py @@ -0,0 +1,867 @@ +from fastapi.responses import StreamingResponse +from gen_ai_hub.orchestration_v2 import ( + AzureContentSafetyInput, + AzureContentSafetyInputFilterConfig, + AzureContentSafetyOutput, + AzureContentSafetyOutputFilterConfig, + AzureThreshold, + DPICustomEntity, + DPIMethodConstant, + DPIStandardEntity, + EmbeddingsInput, + EmbeddingsModelConfig, + EmbeddingsModelDetails, + EmbeddingsModuleConfigs, + EmbeddingsOrchestrationConfig, + FilteringModuleConfig, + FunctionObject, + FunctionTool, + GlobalStreamOptions, + ImageItem, + InputFiltering, + InputTranslationConfig, + JSONResponseSchema, + LlamaGuard38bFilter, + LlamaGuard38bFilterConfig, + LLMModelDetails, + MaskingMethod, + MaskingModuleConfig, + MaskingProviderConfig, + ModuleConfig, + OrchestrationConfig, + OrchestrationError, + OrchestrationService, + OutputFiltering, + OutputTranslationConfig, + ProfileEntity, + PromptTemplatingModuleConfig, + ResponseFormatJsonSchema, + SAPDocumentTranslationInput, + SAPDocumentTranslationOutput, + SystemMessage, + Template, + ToolChatMessage, + TranslationModuleConfig, + UserMessage, + function_tool, +) + + +def completion(): + """ + Run chat example through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +async def completion_async(): + """ + Run async chat example through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = await service.arun() + await service.aclose_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_stream(): + """ + Run chat example with a streaming response through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ), + stream=GlobalStreamOptions(enabled=True), + ) + service = OrchestrationService(config=config) + + def generate(): + stream = service.stream() + for chunk in stream: + if chunk.final_result: + content = chunk.final_result.choices[0].delta.content + if content: + yield content + service.close_http_connection() + + return StreamingResponse(generate(), media_type="text/plain") + + +def completion_json(): + """ + Run chat example with structured output (JSON) through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + json_schema = { + "title": "Person", + "type": "object", + "properties": { + "firstName": {"type": "string", "description": "The person's first name."}, + "lastName": {"type": "string", "description": "The person's last name."}, + }, + } + + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage(content="Format the response as json."), + UserMessage(content="Who was the first person on the moon?"), + ], + # setting ResponseFormatJsonObject() enables JSON responses without a fixed schema + response_format=ResponseFormatJsonSchema( + json_schema=JSONResponseSchema( + name="person", + description="person mapping", + schema=json_schema, + ) + ), + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_template(): + """ + Run chat example with a template including placeholders through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + # add placeholder by wrapping it with {{?...}} + UserMessage(content="What is the capital of {{?country}}?") + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + # provide placeholder values + result = service.run(placeholder_values={"country": "Denmark"}) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_with_fallback(): + """ + Run chat example with fallback configurations through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=[ + # Trigger fallback with non-orchestration model + ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="sap-rpt-1-small"), + ) + ), + # Second configuration will succeed + ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="anthropic--claude-4.5-haiku"), + ) + ), + ] + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_abap(): + """ + Run chat example with SAP ABAP through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="Explain the concept of internal tables in ABAP" + ) + ] + ), + model=LLMModelDetails(name="sap-abap-1"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def message_history(): + """ + Run chat example with message history through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + # the service can also be started without providing a default config + # in this case, each call to service.run has to pass a config to use + service = OrchestrationService() + first_config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[UserMessage(content="What is the capital of France?")] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + + first_response = service.run(config=first_config) + # first_response.intermediate_results.templating contains the history + history = first_response.intermediate_results.templating or [] + history.append(first_response.final_result.choices[0].message) + + second_config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[UserMessage(content="What is the typical food there?")] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + second_response = service.run(config=second_config, history=history) + service.close_http_connection() + return {"result": second_response.final_result.choices[0].message.content} + + +def completion_image(): + """ + Run multimodal example with image input through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + # First option: load image from a standard, publicly accessible url + image = ImageItem(url="https://picsum.photos/id/1/200/300") + # Second option: pass the image content as base64-encoded data url + # with the format "data:[][;base64]," + # image = ImageItem( + # url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAE0lEQVR4nGP8z4APMOGVZRip0gBBLAETee26JgAAAABJRU5ErkJggg==" + # ) + # Third option: load the image from a local file path + # try: + # image = ImageItem.from_file("path/to/your/local/image.jpeg") + # except FileNotFoundError: + # print("Error: The specified image file was not found.") + # except Exception as e: + # print(f"An error occurred while loading the image: {e}") + multimodal_content = [image, "What objects are prominent in this image?"] + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + # add placeholder by wrapping it with {{?...}} + UserMessage(content=multimodal_content) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def input_filtering(): + """ + Run input filtering example through the Orchestration Service API. + + Returns: + JSON object containing a message confirming successful filtering. + Raises: + RuntimeError: Raised if the filtering is unsuccesful. + """ + content_filter_config = FilteringModuleConfig( + input=InputFiltering( + filters=[ + AzureContentSafetyInputFilterConfig( + # only safe content allowed for hate and violence + config=AzureContentSafetyInput( + hate=AzureThreshold.ALLOW_SAFE, + violence=AzureThreshold.ALLOW_SAFE, + ) + ), + # category 'privacy' enabled + LlamaGuard38bFilterConfig(config=LlamaGuard38bFilter(privacy=True)), + ] + ) + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + # should be filtered by Llama Guard + content="My social insurance number is ABC123456789." + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ), + filtering=content_filter_config, + ) + ) + service = OrchestrationService(config=config) + try: + service.run() + raise RuntimeError("Input was not filtered as expected") + except OrchestrationError as e: + if e.code == 400: + return {"result": "Input was filtered as expected."} + else: + raise + finally: + service.close_http_connection() + + +def output_filtering(): + """ + Run output filtering example through the Orchestration Service API. + + Returns: + JSON object containing a message confirming successful filtering. + Raises: + RuntimeError: Raised if the filtering is unsuccesful. + """ + content_filter_config = FilteringModuleConfig( + output=OutputFiltering( + filters=[ + AzureContentSafetyOutputFilterConfig( + # only safe content allowed for hate and violence + config=AzureContentSafetyOutput( + hate=AzureThreshold.ALLOW_SAFE, + violence=AzureThreshold.ALLOW_SAFE, + ) + ), + # category 'privacy' enabled + LlamaGuard38bFilterConfig(config=LlamaGuard38bFilter(privacy=True)), + ] + ) + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + # should be filtered by Azure content filter + content="Reparaphrase the sentence in 30 ways with strong feelings: 'I hate you!'." + ) + ] + ), + model=LLMModelDetails(name="anthropic--claude-4.5-haiku"), + ), + filtering=content_filter_config, + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + # should be filtered by the Azure content filter, hence content should be empty + if result.final_result.choices[0].message.content: + raise RuntimeError("Output was not filtered as expected") + else: + return {"result": "Output was filtered as expected"} + + +def completion_masking(): + """ + Run masked (pseudonymized) chat example through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + data_masking_config = MaskingModuleConfig( + providers=[ + MaskingProviderConfig( + method=MaskingMethod.PSEUDONYMIZATION, + entities=[ + DPIStandardEntity(type=ProfileEntity.ADDRESS), + DPIStandardEntity(type=ProfileEntity.EMAIL), + DPIStandardEntity(type=ProfileEntity.PHONE), + DPIStandardEntity(type=ProfileEntity.PERSON), + DPICustomEntity( + regex="[0-9]{4}[-/][0-9]{2}[-/][0-9]{2}", + replacement_strategy=DPIMethodConstant(value="MASKED_DATE"), + ), + ], + ) + ] + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="Generate HTML that shows the contact info for Jane Doe, born on 1975-03-05, living at 10 Downing Street, London UK with email 'jane.doe@mailprovider.com' and phone number +4902044123221." + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ), + masking=data_masking_config, + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def translation(): + """ + Run chat example with prompt and output translation through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + translation_config = TranslationModuleConfig( + input=SAPDocumentTranslationInput( + config=InputTranslationConfig( + source_language="en-US", target_language="de-DE" + ) + ), + output=SAPDocumentTranslationOutput( + config=OutputTranslationConfig( + source_language="de-DE", target_language="fr-FR" + ) + ), + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ), + translation=translation_config, + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def sonar_with_citations(): + """ + Run chat example with citations (Sonar model) through the Orchestration Service API. + + Returns: + JSON object containing the model response (text and citations) as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What are the latest developments in quantum computing?" + ) + ] + ), + model=LLMModelDetails(name="sonar"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return { + "result": { + "text": result.final_result.choices[0].message.content, + "citations": result.final_result.citations, + } + } + + +def embedding(): + """ + Run embedding example through the Orchestration Service API. + + Returns: + JSON object containing the embedding as result. + """ + embedding_config = EmbeddingsOrchestrationConfig( + modules=EmbeddingsModuleConfigs( + embeddings=EmbeddingsModelConfig( + model=EmbeddingsModelDetails(name="text-embedding-3-small") + ) + ) + ) + + service = OrchestrationService() + response = service.embed( + config=embedding_config, input=EmbeddingsInput(text="Hello World!") + ) + service.close_http_connection() + return {"result": response.final_result.data[0].embedding} + + +def embedding_batched(): + """ + Run batched embedding example through the Orchestration Service API. + + Returns: + JSON object containing the embedding as result. + """ + embedding_config = EmbeddingsOrchestrationConfig( + modules=EmbeddingsModuleConfigs( + embeddings=EmbeddingsModelConfig( + model=EmbeddingsModelDetails(name="text-embedding-3-small") + ) + ) + ) + + input_list = ["Hello World!", "This is your captain speaking"] + + service = OrchestrationService() + response = service.embed( + config=embedding_config, input=EmbeddingsInput(text=input_list) + ) + service.close_http_connection() + return {"result": response.final_result.data} + + +def embedding_masked(): + """ + Run masked (anonymized )embedding example through the Orchestration Service API. + + Returns: + JSON object containing the embedding as result. + """ + embedding_config = EmbeddingsOrchestrationConfig( + modules=EmbeddingsModuleConfigs( + embeddings=EmbeddingsModelConfig( + model=EmbeddingsModelDetails(name="text-embedding-3-small") + ), + masking=MaskingModuleConfig( + providers=[ + MaskingProviderConfig( + method=MaskingMethod.ANONYMIZATION, + entities=[ + DPIStandardEntity(type=ProfileEntity.PERSON), + DPIStandardEntity(type=ProfileEntity.EMAIL), + DPIStandardEntity(type=ProfileEntity.PHONE), + ], + ) + ] + ), + ) + ) + + service = OrchestrationService() + response = service.embed( + config=embedding_config, + input=EmbeddingsInput( + text="Contact John Smith at john.smith@example.com or call 555-123-4567." + ), + ) + service.close_http_connection() + return {"result": response.final_result.data[0].embedding} + + +def tool_call_decorator(): + """ + Run chat example with tool calls using the `function_tool` decorator through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + + @function_tool + def add(a: int, b: int) -> int: + """Add two numbers.""" + return a + b + + tools = [add] + + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage( + content="You are a helpful AI that performs the addition of two numbers." + ), + UserMessage(content="What is 279 + 929?"), + ], + tools=tools, + ), + model=LLMModelDetails(name="gpt-4o"), + ) + ) + ) + + service = OrchestrationService() + result = service.run(config=config) + tool_calls = result.final_result.choices[0].message.tool_calls + if not tool_calls: + raise RuntimeError("Unexpectedly no tool calls in response") + + history = list(result.intermediate_results.templating or []) + history.append(result.final_result.choices[0].message) + for tool_call in tool_calls: + if tool_call.function.name != "add": + raise RuntimeError( + f"Unexpectedly called '{tool_call.function.name}' instead of 'add'" + ) + result = add.execute(**tool_call.function.parse_arguments()) + tool_message = ToolChatMessage(content=str(result), tool_call_id=tool_call.id) + history.append(tool_message) + + result = service.run(config=config, history=history) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def tool_call_function_tool(): + """ + Run chat example with tool calls using the `FunctionTool` class through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + + def add(a: int, b: int) -> int: + """Add two numbers.""" + return a + b + + add_tool = FunctionTool( + function=FunctionObject( + name="add", + description="Add two numbers.", + parameters={ + "type": "object", + "properties": { + "a": { + "type": "number", + "description": "First operand of the addition function", + }, + "b": { + "type": "number", + "description": "Second operand of the addition function", + }, + }, + "required": ["a", "b"], + "additionalProperties": False, + }, + strict=True, + function=add, + ) + ) + + tools = [add_tool] + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage( + content="You are a helpful AI that performs the addition of two numbers." + ), + UserMessage(content="What is 279 + 929?"), + ], + tools=tools, + ), + model=LLMModelDetails(name="gpt-4o"), + ) + ) + ) + + service = OrchestrationService() + result = service.run(config=config) + tool_calls = result.final_result.choices[0].message.tool_calls + if tool_calls is None: + raise RuntimeError("Unexpectedly no tool calls in response") + + history = list(result.intermediate_results.templating or []) + history.append(result.final_result.choices[0].message) + for tool_call in tool_calls: + if tool_call.function.name != "add": + raise RuntimeError( + f"Unexpectedly called '{tool_call.function.name}' instead of 'add'" + ) + result = add_tool.execute(**tool_call.function.parse_arguments()) + tool_message = ToolChatMessage(content=str(result), tool_call_id=tool_call.id) + history.append(tool_message) + + result = service.run(config=config, history=history) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def tool_call_json(): + """ + Run chat example with tool calls using a JSON schema dictionary through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + # this is helpful if the tool call doesn't map to a Python function + tools = [ + { + "type": "function", + "function": { + "name": "add", + "description": "Add two numbers.", + "parameters": { + "type": "object", + "properties": { + "a": { + "type": "number", + "description": "First operand of the addition function", + }, + "b": { + "type": "number", + "description": "Second operand of the addition function", + }, + }, + "required": ["a", "b"], + "additionalProperties": False, + }, + "strict": True, + }, + } + ] + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage( + content="You are a helpful AI that performs the addition of two numbers." + ), + UserMessage(content="What is 279 + 929?"), + ], + tools=tools, + ), + model=LLMModelDetails(name="gpt-4o"), + ) + ) + ) + + service = OrchestrationService() + result = service.run(config=config) + tool_calls = result.final_result.choices[0].message.tool_calls + if tool_calls is None: + raise RuntimeError("Unexpectedly no tool calls in response") + + history = list(result.intermediate_results.templating or []) + history.append(result.final_result.choices[0].message) + for tool_call in tool_calls: + if tool_call.function.name != "add": + raise RuntimeError( + f"Unexpectedly called '{tool_call.function.name}' instead of 'add'" + ) + result = sum(tool_call.function.parse_arguments().values()) + tool_message = ToolChatMessage(content=str(result), tool_call_id=tool_call.id) + history.append(tool_message) + + result = service.run(config=config, history=history) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} diff --git a/sample_code/src/server.py b/sample_code/src/server.py new file mode 100644 index 00000000..168b51a4 --- /dev/null +++ b/sample_code/src/server.py @@ -0,0 +1,77 @@ +from fastapi import FastAPI, Request +from fastapi.responses import JSONResponse + +from sample_code import openai, amazon, core, google, orchestration, document_grounding_generation + +app = FastAPI(title="SAP AI Core Python SDK Sample Application") + + +# no specific error handling, simply return error message +@app.exception_handler(Exception) +async def global_exception_handler(request: Request, exc: Exception): + return JSONResponse(status_code=500, content={"error": str(exc)}) + + +# NOTE: /docs contains an auto-generated overview of the routes + + +@app.get("/") +@app.get("/health") +async def health(): + return {"status": "ok"} + + +# AI Core (Configurations/Deployments) +app.get("/core/configurations")(core.get_configurations) +app.post("/core/configuration/create")(core.create_configuration) +app.get("/core/deployments")(core.get_deployments) +app.post("/core/deployment/create")(core.create_deployment) +app.get("/core/scenarios")(core.get_scenarios) +app.get("/core/models")(core.get_models) + +# Azure/OpenAI +app.get("/openai/chat-completion")(openai.chat_completion) +app.get("/openai/chat-completion-stream")(openai.chat_completion_stream) +app.get("/openai/chat-completion-structured")(openai.chat_completion_structured) +app.get("/openai/chat-completion-async")(openai.chat_completion_async) +app.get("/openai/responses")(openai.responses_simple) +app.get("/openai/responses-structured")(openai.responses_structured) +app.get("/openai/responses-async")(openai.responses_simple_async) +app.get("/openai/embedding")(openai.embedding) + +# Google +app.get("/google/generate")(google.generate) +app.get("/google/generate-stream")(google.generate_stream) +app.get("/google/tool-call")(google.tool_call) + +# Amazon/Anthropic +app.get("/amazon/converse")(amazon.converse) + +# Orchestration +app.get("/orchestration/completion")(orchestration.completion) +app.get("/orchestration/completion-async")(orchestration.completion_async) +app.get("/orchestration/completion-stream")(orchestration.completion_stream) +app.get("/orchestration/completion-template")(orchestration.completion_template) +app.get("/orchestration/completion-json")(orchestration.completion_json) +app.get("/orchestration/completion-with-fallback")( + orchestration.completion_with_fallback +) +app.get("/orchestration/completion-abap")(orchestration.completion_abap) +app.get("/orchestration/message-history")(orchestration.message_history) +app.get("/orchestration/completion-image")(orchestration.completion_image) +app.get("/orchestration/input-filtering")(orchestration.input_filtering) +app.get("/orchestration/output-filtering")(orchestration.output_filtering) +app.get("/orchestration/completion-masking")(orchestration.completion_masking) +app.get("/orchestration/translation")(orchestration.translation) +app.get("/orchestration/citations")(orchestration.sonar_with_citations) +app.get("/orchestration/embedding")(orchestration.embedding) +app.get("/orchestration/embedding-batched")(orchestration.embedding_batched) +app.get("/orchestration/embedding-masked")(orchestration.embedding_masked) +app.get("/orchestration/tool-call-decorator")(orchestration.tool_call_decorator) +app.get("/orchestration/tool-call-function-tool")(orchestration.tool_call_function_tool) +app.get("/orchestration/tool-call-json")(orchestration.tool_call_json) + +# Document Grounding Generation (generated client) +app.post("/document-grounding-generation/collection/create")(document_grounding_generation.create_collection) +app.get("/document-grounding-generation/pipelines")(document_grounding_generation.get_all_pipelines) +app.post("/document-grounding-generation/retrieval/search")(document_grounding_generation.retrieval_search) From 391b42fa1268d2096b9f7836850bce5cfb8d9a6b Mon Sep 17 00:00:00 2001 From: Zhongpin Wang Date: Mon, 31 Aug 2026 13:28:51 +0800 Subject: [PATCH 2/6] refactor generator setup --- packages/gen/Makefile | 12 + .../api/metadata_configurations_api.py | 112 +++--- .../generated/api/pipelines_api.py | 224 +++++------ .../generated/api/retrieval_api.py | 48 +-- .../generated/api/vector_api.py | 256 ++++++------- .../generated/api_client.py | 13 +- .../generated/configuration.py | 72 +--- .../generated/models/api_error.py | 13 + .../generated/models/base_document.py | 13 + .../models/base_pipeline_minimal_response.py | 13 + .../models/base_pipeline_response.py | 13 + .../models/batch_update_document_success.py | 13 + .../generated/models/binary_boolean_filter.py | 13 + .../models/boosting_scoring_configuration.py | 13 + ...ng_scoring_configuration_metadata_inner.py | 13 + .../generated/models/chunk.py | 13 + .../generated/models/collection.py | 13 + .../models/collection_created_response.py | 13 + .../models/collection_deleted_response.py | 13 + .../models/collection_pending_response.py | 13 + .../generated/models/collection_request.py | 13 + .../models/collections_list_response.py | 13 + .../models/configuration_document.py | 13 + .../configuration_document_full_details.py | 13 + .../generated/models/create_pipeline.py | 46 +++ .../generated/models/data_repositories.py | 13 + .../generated/models/data_repository.py | 13 + ...ata_repository_per_filter_search_result.py | 13 + .../models/data_repository_search_result.py | 13 + .../models/data_repository_search_results.py | 13 + .../models/data_repository_with_documents.py | 13 + .../dense_retrieval_scoring_configuration.py | 13 + .../models/details_error_response.py | 13 + .../generated/models/document.py | 13 + .../models/document_bulk_delete_request.py | 13 + .../models/document_bulk_delete_response.py | 13 + .../models/document_create_request.py | 13 + .../generated/models/document_input.py | 13 + .../models/document_key_value_list_pair.py | 13 + .../generated/models/document_metadata.py | 13 + .../models/document_metadata_batch_request.py | 13 + .../models/document_metadata_update.py | 13 + .../models/document_metadata_update_error.py | 13 + .../generated/models/document_output.py | 13 + .../generated/models/document_response.py | 13 + .../models/document_update_request.py | 13 + .../models/document_without_chunks.py | 13 + .../generated/models/documents.py | 13 + .../generated/models/documents_chunk.py | 13 + .../models/documents_list_response.py | 13 + .../models/documents_status_response.py | 13 + ...cuments_status_response_resources_inner.py | 13 + .../generated/models/embedding_config.py | 13 + .../generated/models/error_response.py | 13 + .../generated/models/generic_error.py | 13 + .../models/get_all_pipelines400_response.py | 13 + .../generated/models/get_pipeline.py | 41 ++ .../models/get_pipeline_execution_by_id.py | 13 + .../models/get_pipeline_executions.py | 13 + .../generated/models/get_pipeline_status.py | 13 + .../generated/models/get_pipelines.py | 13 + .../google_drive_configuration_minimal.py | 2 +- .../google_drive_pipeline_create_request.py | 13 + .../google_drive_pipeline_get_response.py | 13 + .../google_drive_pipeline_minimal_response.py | 13 + .../generated/models/http_validation_error.py | 13 + .../generated/models/key_value_list_pair.py | 13 + ...ey_word_retrieval_scoring_configuration.py | 13 + .../models/list_configuration_documents.py | 13 + ...st_configuration_documents_full_details.py | 13 + .../models/list_metadata_configurations.py | 13 + .../models/manual_pipeline_trigger.py | 13 + .../models/merge_strategy_reranker.py | 13 + .../merge_strategy_reranker_boosting_inner.py | 13 + .../models/merge_strategy_score_reuse.py | 13 + .../generated/models/message_response.py | 13 + ...eta_data_data_repository_metadata_inner.py | 13 + .../models/metadata_configuration_metadata.py | 13 + .../models/metadata_configuration_request.py | 13 + ...data_configuration_request_labels_inner.py | 13 + .../models/metadata_configuration_response.py | 13 + .../generated/models/metadata_item.py | 13 + .../generated/models/metadata_key_update.py | 13 + .../generated/models/metadata_operation.py | 13 + .../generated/models/metadata_response.py | 13 + .../generated/models/metadata_update_item.py | 13 + .../generated/models/metadata_updates.py | 13 + ..._share_point_configuration_get_response.py | 13 + .../ms_share_point_configuration_minimal.py | 13 + .../ms_share_point_pipeline_get_response.py | 13 + ...s_share_point_pipeline_minimal_response.py | 13 + .../generated/models/patch_pipeline.py | 13 + .../models/patch_pipeline_configuration.py | 13 + .../models/patch_pipeline_metadata.py | 13 + .../models/per_filter_search_result.py | 13 + .../models/per_filter_search_result_error.py | 13 + .../per_filter_search_result_with_error.py | 13 + .../models/pipeline_document_response.py | 13 + .../models/pipeline_execution_data.py | 13 + .../generated/models/pipeline_id.py | 13 + .../models/pipeline_minimal_response.py | 41 ++ .../post_processing_object_reference.py | 13 + .../models/post_processing_operation.py | 13 + .../models/retrieval_binary_boolean_filter.py | 13 + .../generated/models/retrieval_chunk.py | 13 + ...retrieval_data_repository_search_result.py | 13 + .../retrieval_document_key_value_list_pair.py | 13 + .../models/retrieval_key_value_list_pair.py | 13 + .../retrieval_per_filter_search_result.py | 13 + ...etrieval_per_filter_search_result_error.py | 13 + ...val_per_filter_search_result_with_error.py | 13 + .../retrieval_scoped_key_value_list_pair.py | 13 + .../models/retrieval_search_configuration.py | 13 + ...val_search_document_key_value_list_pair.py | 13 + .../models/retrieval_search_filter.py | 13 + .../models/retrieval_search_input.py | 13 + ...eval_search_input_post_processing_inner.py | 13 + .../models/retrieval_search_results.py | 13 + .../models/retrieval_vector_search_filter.py | 13 + .../models/s3_configuration_minimal.py | 2 +- .../models/s3_pipeline_get_response.py | 13 + .../models/s3_pipeline_minimal_response.py | 13 + .../models/scoped_key_value_list_pair.py | 13 + .../generated/models/score.py | 13 + .../models/sdm_pipeline_get_response.py | 13 + .../models/sdm_pipeline_minimal_response.py | 13 + .../generated/models/search_configuration.py | 13 + .../search_document_key_value_list_pair.py | 13 + .../generated/models/search_filter.py | 13 + .../generated/models/search_pipeline.py | 13 + .../models/search_pipelines_response.py | 13 + .../generated/models/search_results.py | 13 + .../generated/models/search_scores.py | 13 + .../models/search_scores_aggregated_score.py | 13 + .../service_now_configuration_minimal.py | 2 +- ...e_now_configuration_minimal_service_now.py | 13 + .../service_now_pipeline_get_response.py | 13 + .../service_now_pipeline_minimal_response.py | 13 + .../models/sftp_configuration_minimal.py | 2 +- .../models/sftp_pipeline_get_response.py | 13 + .../models/sftp_pipeline_minimal_response.py | 13 + .../models/share_point_config_get_response.py | 13 + .../models/share_point_site_detail.py | 13 + .../models/share_point_site_get_response.py | 13 + .../generated/models/text_only_base_chunk.py | 13 + .../models/text_only_base_chunk_create.py | 13 + .../generated/models/text_search_request.py | 13 + .../generated/models/validation_error.py | 13 + .../generated/models/vector_chunk.py | 13 + .../vector_document_key_value_list_pair.py | 13 + .../models/vector_key_value_list_pair.py | 13 + .../models/vector_per_filter_search_result.py | 13 + .../models/vector_scoring_configuration.py | 13 + .../models/vector_search_configuration.py | 13 + ...tor_search_document_key_value_list_pair.py | 13 + .../generated/models/vector_search_filter.py | 13 + .../generated/models/vector_search_results.py | 13 + .../models/work_zone_pipeline_get_response.py | 13 + .../work_zone_pipeline_minimal_response.py | 13 + .../generated/rest.py | 359 ++++++------------ packages/gen/openapitools.json | 7 + .../specs/document-grounding/api.yaml | 0 .../options-per-service.json | 0 packages/openapi-generator/Makefile | 39 +- .../config/python-config.yaml | 8 +- packages/openapi-generator/pyproject.toml | 1 + .../src/sap_openapi_generator/generate.py | 152 ++++++++ .../sap_openapi_generator/preprocess_spec.py | 21 +- uv.lock | 24 ++ 169 files changed, 2686 insertions(+), 683 deletions(-) create mode 100644 packages/gen/Makefile create mode 100644 packages/gen/openapitools.json rename packages/{openapi-generator => gen}/specs/document-grounding/api.yaml (100%) rename packages/{openapi-generator => gen}/specs/document-grounding/options-per-service.json (100%) create mode 100644 packages/openapi-generator/src/sap_openapi_generator/generate.py diff --git a/packages/gen/Makefile b/packages/gen/Makefile new file mode 100644 index 00000000..825d44e5 --- /dev/null +++ b/packages/gen/Makefile @@ -0,0 +1,12 @@ +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +SPEC_DIR := $(PKG_DIR)specs/document-grounding + +.PHONY: generate + +generate: + uv run --package sap-openapi-generator sap-generate \ + --spec $(SPEC_DIR)/api.yaml \ + --output $(PKG_DIR)gen_ai_hub/document_grounding_generation/generated \ + --package-name gen_ai_hub.document_grounding_generation.generated \ + --options $(SPEC_DIR)/options-per-service.json \ + --spec-key src/spec/api.yaml diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py index 320e4a0e..14b72879 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py @@ -45,7 +45,7 @@ def __init__(self, api_client=None) -> None: @validate_call - def batch_update_documents_metadata( + async def batch_update_documents_metadata( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], document_metadata_batch_request: DocumentMetadataBatchRequest, @@ -105,11 +105,11 @@ def batch_update_documents_metadata( '200': "List[BatchUpdateDocumentsResponseInner]", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -117,7 +117,7 @@ def batch_update_documents_metadata( @validate_call - def batch_update_documents_metadata_with_http_info( + async def batch_update_documents_metadata_with_http_info( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], document_metadata_batch_request: DocumentMetadataBatchRequest, @@ -177,11 +177,11 @@ def batch_update_documents_metadata_with_http_info( '200': "List[BatchUpdateDocumentsResponseInner]", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -189,7 +189,7 @@ def batch_update_documents_metadata_with_http_info( @validate_call - def batch_update_documents_metadata_without_preload_content( + async def batch_update_documents_metadata_without_preload_content( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], document_metadata_batch_request: DocumentMetadataBatchRequest, @@ -249,7 +249,7 @@ def batch_update_documents_metadata_without_preload_content( '200': "List[BatchUpdateDocumentsResponseInner]", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -336,7 +336,7 @@ def _batch_update_documents_metadata_serialize( @validate_call - def create_metadata_configuration( + async def create_metadata_configuration( self, metadata_configuration_request: MetadataConfigurationRequest, _request_timeout: Union[ @@ -392,11 +392,11 @@ def create_metadata_configuration( '202': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -404,7 +404,7 @@ def create_metadata_configuration( @validate_call - def create_metadata_configuration_with_http_info( + async def create_metadata_configuration_with_http_info( self, metadata_configuration_request: MetadataConfigurationRequest, _request_timeout: Union[ @@ -460,11 +460,11 @@ def create_metadata_configuration_with_http_info( '202': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -472,7 +472,7 @@ def create_metadata_configuration_with_http_info( @validate_call - def create_metadata_configuration_without_preload_content( + async def create_metadata_configuration_without_preload_content( self, metadata_configuration_request: MetadataConfigurationRequest, _request_timeout: Union[ @@ -528,7 +528,7 @@ def create_metadata_configuration_without_preload_content( '202': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -612,7 +612,7 @@ def _create_metadata_configuration_serialize( @validate_call - def delete_metadata_configuration_by_id( + async def delete_metadata_configuration_by_id( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], _request_timeout: Union[ @@ -670,11 +670,11 @@ def delete_metadata_configuration_by_id( '500': "ErrorResponse", '409': "ErrorResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -682,7 +682,7 @@ def delete_metadata_configuration_by_id( @validate_call - def delete_metadata_configuration_by_id_with_http_info( + async def delete_metadata_configuration_by_id_with_http_info( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], _request_timeout: Union[ @@ -740,11 +740,11 @@ def delete_metadata_configuration_by_id_with_http_info( '500': "ErrorResponse", '409': "ErrorResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -752,7 +752,7 @@ def delete_metadata_configuration_by_id_with_http_info( @validate_call - def delete_metadata_configuration_by_id_without_preload_content( + async def delete_metadata_configuration_by_id_without_preload_content( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], _request_timeout: Union[ @@ -810,7 +810,7 @@ def delete_metadata_configuration_by_id_without_preload_content( '500': "ErrorResponse", '409': "ErrorResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -881,7 +881,7 @@ def _delete_metadata_configuration_by_id_serialize( @validate_call - def get_metadata_configuration_by_id( + async def get_metadata_configuration_by_id( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], _request_timeout: Union[ @@ -938,11 +938,11 @@ def get_metadata_configuration_by_id( '404': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -950,7 +950,7 @@ def get_metadata_configuration_by_id( @validate_call - def get_metadata_configuration_by_id_with_http_info( + async def get_metadata_configuration_by_id_with_http_info( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], _request_timeout: Union[ @@ -1007,11 +1007,11 @@ def get_metadata_configuration_by_id_with_http_info( '404': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1019,7 +1019,7 @@ def get_metadata_configuration_by_id_with_http_info( @validate_call - def get_metadata_configuration_by_id_without_preload_content( + async def get_metadata_configuration_by_id_without_preload_content( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], _request_timeout: Union[ @@ -1076,7 +1076,7 @@ def get_metadata_configuration_by_id_without_preload_content( '404': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1147,7 +1147,7 @@ def _get_metadata_configuration_by_id_serialize( @validate_call - def get_metadata_document_details( + async def get_metadata_document_details( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], document_id: Annotated[StrictStr, Field(description="Document ID")], @@ -1208,11 +1208,11 @@ def get_metadata_document_details( '404': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1220,7 +1220,7 @@ def get_metadata_document_details( @validate_call - def get_metadata_document_details_with_http_info( + async def get_metadata_document_details_with_http_info( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], document_id: Annotated[StrictStr, Field(description="Document ID")], @@ -1281,11 +1281,11 @@ def get_metadata_document_details_with_http_info( '404': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1293,7 +1293,7 @@ def get_metadata_document_details_with_http_info( @validate_call - def get_metadata_document_details_without_preload_content( + async def get_metadata_document_details_without_preload_content( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], document_id: Annotated[StrictStr, Field(description="Document ID")], @@ -1354,7 +1354,7 @@ def get_metadata_document_details_without_preload_content( '404': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1428,7 +1428,7 @@ def _get_metadata_document_details_serialize( @validate_call - def list_metadata_configuration_documents( + async def list_metadata_configuration_documents( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, @@ -1499,11 +1499,11 @@ def list_metadata_configuration_documents( _response_types_map: Dict[str, Optional[str]] = { '200': "ListConfigurationDocuments", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1511,7 +1511,7 @@ def list_metadata_configuration_documents( @validate_call - def list_metadata_configuration_documents_with_http_info( + async def list_metadata_configuration_documents_with_http_info( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, @@ -1582,11 +1582,11 @@ def list_metadata_configuration_documents_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "ListConfigurationDocuments", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1594,7 +1594,7 @@ def list_metadata_configuration_documents_with_http_info( @validate_call - def list_metadata_configuration_documents_without_preload_content( + async def list_metadata_configuration_documents_without_preload_content( self, metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, @@ -1665,7 +1665,7 @@ def list_metadata_configuration_documents_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "ListConfigurationDocuments", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1756,7 +1756,7 @@ def _list_metadata_configuration_documents_serialize( @validate_call - def list_metadata_configurations( + async def list_metadata_configurations( self, top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, @@ -1820,11 +1820,11 @@ def list_metadata_configurations( '200': "ListMetadataConfigurations", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1832,7 +1832,7 @@ def list_metadata_configurations( @validate_call - def list_metadata_configurations_with_http_info( + async def list_metadata_configurations_with_http_info( self, top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, @@ -1896,11 +1896,11 @@ def list_metadata_configurations_with_http_info( '200': "ListMetadataConfigurations", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1908,7 +1908,7 @@ def list_metadata_configurations_with_http_info( @validate_call - def list_metadata_configurations_without_preload_content( + async def list_metadata_configurations_without_preload_content( self, top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, @@ -1972,7 +1972,7 @@ def list_metadata_configurations_without_preload_content( '200': "ListMetadataConfigurations", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py index 625db200..e9d50464 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py @@ -51,7 +51,7 @@ def __init__(self, api_client=None) -> None: @validate_call - def create_pipeline( + async def create_pipeline( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], create_pipeline: CreatePipeline, @@ -111,11 +111,11 @@ def create_pipeline( '201': "PipelineId", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -123,7 +123,7 @@ def create_pipeline( @validate_call - def create_pipeline_with_http_info( + async def create_pipeline_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], create_pipeline: CreatePipeline, @@ -183,11 +183,11 @@ def create_pipeline_with_http_info( '201': "PipelineId", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -195,7 +195,7 @@ def create_pipeline_with_http_info( @validate_call - def create_pipeline_without_preload_content( + async def create_pipeline_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], create_pipeline: CreatePipeline, @@ -255,7 +255,7 @@ def create_pipeline_without_preload_content( '201': "PipelineId", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -342,7 +342,7 @@ def _create_pipeline_serialize( @validate_call - def delete_pipeline_by_id( + async def delete_pipeline_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], @@ -402,11 +402,11 @@ def delete_pipeline_by_id( '204': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -414,7 +414,7 @@ def delete_pipeline_by_id( @validate_call - def delete_pipeline_by_id_with_http_info( + async def delete_pipeline_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], @@ -474,11 +474,11 @@ def delete_pipeline_by_id_with_http_info( '204': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -486,7 +486,7 @@ def delete_pipeline_by_id_with_http_info( @validate_call - def delete_pipeline_by_id_without_preload_content( + async def delete_pipeline_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], @@ -546,7 +546,7 @@ def delete_pipeline_by_id_without_preload_content( '204': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -620,7 +620,7 @@ def _delete_pipeline_by_id_serialize( @validate_call - def get_all_documents_for_pipeline( + async def get_all_documents_for_pipeline( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -691,11 +691,11 @@ def get_all_documents_for_pipeline( _response_types_map: Dict[str, Optional[str]] = { '200': "DocumentsStatusResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -703,7 +703,7 @@ def get_all_documents_for_pipeline( @validate_call - def get_all_documents_for_pipeline_with_http_info( + async def get_all_documents_for_pipeline_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -774,11 +774,11 @@ def get_all_documents_for_pipeline_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "DocumentsStatusResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -786,7 +786,7 @@ def get_all_documents_for_pipeline_with_http_info( @validate_call - def get_all_documents_for_pipeline_without_preload_content( + async def get_all_documents_for_pipeline_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -857,7 +857,7 @@ def get_all_documents_for_pipeline_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "DocumentsStatusResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -946,7 +946,7 @@ def _get_all_documents_for_pipeline_serialize( @validate_call - def get_all_executions_for_pipeline( + async def get_all_executions_for_pipeline( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -1021,11 +1021,11 @@ def get_all_executions_for_pipeline( _response_types_map: Dict[str, Optional[str]] = { '200': "GetPipelineExecutions", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1033,7 +1033,7 @@ def get_all_executions_for_pipeline( @validate_call - def get_all_executions_for_pipeline_with_http_info( + async def get_all_executions_for_pipeline_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -1108,11 +1108,11 @@ def get_all_executions_for_pipeline_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "GetPipelineExecutions", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1120,7 +1120,7 @@ def get_all_executions_for_pipeline_with_http_info( @validate_call - def get_all_executions_for_pipeline_without_preload_content( + async def get_all_executions_for_pipeline_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -1195,7 +1195,7 @@ def get_all_executions_for_pipeline_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "GetPipelineExecutions", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1289,7 +1289,7 @@ def _get_all_executions_for_pipeline_serialize( @validate_call - def get_all_pipelines( + async def get_all_pipelines( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, @@ -1361,11 +1361,11 @@ def get_all_pipelines( '200': "GetPipelines", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1373,7 +1373,7 @@ def get_all_pipelines( @validate_call - def get_all_pipelines_with_http_info( + async def get_all_pipelines_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, @@ -1445,11 +1445,11 @@ def get_all_pipelines_with_http_info( '200': "GetPipelines", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1457,7 +1457,7 @@ def get_all_pipelines_with_http_info( @validate_call - def get_all_pipelines_without_preload_content( + async def get_all_pipelines_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, @@ -1529,7 +1529,7 @@ def get_all_pipelines_without_preload_content( '200': "GetPipelines", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1620,7 +1620,7 @@ def _get_all_pipelines_serialize( @validate_call - def get_document_by_id_for_pipeline( + async def get_document_by_id_for_pipeline( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -1683,11 +1683,11 @@ def get_document_by_id_for_pipeline( _response_types_map: Dict[str, Optional[str]] = { '200': "PipelineDocumentResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1695,7 +1695,7 @@ def get_document_by_id_for_pipeline( @validate_call - def get_document_by_id_for_pipeline_with_http_info( + async def get_document_by_id_for_pipeline_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -1758,11 +1758,11 @@ def get_document_by_id_for_pipeline_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "PipelineDocumentResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1770,7 +1770,7 @@ def get_document_by_id_for_pipeline_with_http_info( @validate_call - def get_document_by_id_for_pipeline_without_preload_content( + async def get_document_by_id_for_pipeline_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -1833,7 +1833,7 @@ def get_document_by_id_for_pipeline_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "PipelineDocumentResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1910,7 +1910,7 @@ def _get_document_by_id_for_pipeline_serialize( @validate_call - def get_document_by_id_for_pipeline_execution( + async def get_document_by_id_for_pipeline_execution( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -1977,11 +1977,11 @@ def get_document_by_id_for_pipeline_execution( _response_types_map: Dict[str, Optional[str]] = { '200': "PipelineDocumentResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1989,7 +1989,7 @@ def get_document_by_id_for_pipeline_execution( @validate_call - def get_document_by_id_for_pipeline_execution_with_http_info( + async def get_document_by_id_for_pipeline_execution_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2056,11 +2056,11 @@ def get_document_by_id_for_pipeline_execution_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "PipelineDocumentResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2068,7 +2068,7 @@ def get_document_by_id_for_pipeline_execution_with_http_info( @validate_call - def get_document_by_id_for_pipeline_execution_without_preload_content( + async def get_document_by_id_for_pipeline_execution_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2135,7 +2135,7 @@ def get_document_by_id_for_pipeline_execution_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "PipelineDocumentResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -2215,7 +2215,7 @@ def _get_document_by_id_for_pipeline_execution_serialize( @validate_call - def get_documents_for_pipeline_execution( + async def get_documents_for_pipeline_execution( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2290,11 +2290,11 @@ def get_documents_for_pipeline_execution( _response_types_map: Dict[str, Optional[str]] = { '200': "DocumentsStatusResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2302,7 +2302,7 @@ def get_documents_for_pipeline_execution( @validate_call - def get_documents_for_pipeline_execution_with_http_info( + async def get_documents_for_pipeline_execution_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2377,11 +2377,11 @@ def get_documents_for_pipeline_execution_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "DocumentsStatusResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2389,7 +2389,7 @@ def get_documents_for_pipeline_execution_with_http_info( @validate_call - def get_documents_for_pipeline_execution_without_preload_content( + async def get_documents_for_pipeline_execution_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2464,7 +2464,7 @@ def get_documents_for_pipeline_execution_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "DocumentsStatusResponse", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -2556,7 +2556,7 @@ def _get_documents_for_pipeline_execution_serialize( @validate_call - def get_execution_details_by_id_for_pipeline_execution( + async def get_execution_details_by_id_for_pipeline_execution( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2619,11 +2619,11 @@ def get_execution_details_by_id_for_pipeline_execution( _response_types_map: Dict[str, Optional[str]] = { '200': "GetPipelineExecutionById", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2631,7 +2631,7 @@ def get_execution_details_by_id_for_pipeline_execution( @validate_call - def get_execution_details_by_id_for_pipeline_execution_with_http_info( + async def get_execution_details_by_id_for_pipeline_execution_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2694,11 +2694,11 @@ def get_execution_details_by_id_for_pipeline_execution_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "GetPipelineExecutionById", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2706,7 +2706,7 @@ def get_execution_details_by_id_for_pipeline_execution_with_http_info( @validate_call - def get_execution_details_by_id_for_pipeline_execution_without_preload_content( + async def get_execution_details_by_id_for_pipeline_execution_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], @@ -2769,7 +2769,7 @@ def get_execution_details_by_id_for_pipeline_execution_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "GetPipelineExecutionById", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -2846,7 +2846,7 @@ def _get_execution_details_by_id_for_pipeline_execution_serialize( @validate_call - def get_pipeline_by_id( + async def get_pipeline_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -2906,11 +2906,11 @@ def get_pipeline_by_id( '200': "GetPipeline", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2918,7 +2918,7 @@ def get_pipeline_by_id( @validate_call - def get_pipeline_by_id_with_http_info( + async def get_pipeline_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -2978,11 +2978,11 @@ def get_pipeline_by_id_with_http_info( '200': "GetPipeline", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2990,7 +2990,7 @@ def get_pipeline_by_id_with_http_info( @validate_call - def get_pipeline_by_id_without_preload_content( + async def get_pipeline_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], @@ -3050,7 +3050,7 @@ def get_pipeline_by_id_without_preload_content( '200': "GetPipeline", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3124,7 +3124,7 @@ def _get_pipeline_by_id_serialize( @validate_call - def get_pipeline_status( + async def get_pipeline_status( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], @@ -3184,11 +3184,11 @@ def get_pipeline_status( '200': "GetPipelineStatus", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3196,7 +3196,7 @@ def get_pipeline_status( @validate_call - def get_pipeline_status_with_http_info( + async def get_pipeline_status_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], @@ -3256,11 +3256,11 @@ def get_pipeline_status_with_http_info( '200': "GetPipelineStatus", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3268,7 +3268,7 @@ def get_pipeline_status_with_http_info( @validate_call - def get_pipeline_status_without_preload_content( + async def get_pipeline_status_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], @@ -3328,7 +3328,7 @@ def get_pipeline_status_without_preload_content( '200': "GetPipelineStatus", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3402,7 +3402,7 @@ def _get_pipeline_status_serialize( @validate_call - def manual_trigger_pipeline( + async def manual_trigger_pipeline( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], manual_pipeline_trigger: ManualPipelineTrigger, @@ -3462,11 +3462,11 @@ def manual_trigger_pipeline( '202': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3474,7 +3474,7 @@ def manual_trigger_pipeline( @validate_call - def manual_trigger_pipeline_with_http_info( + async def manual_trigger_pipeline_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], manual_pipeline_trigger: ManualPipelineTrigger, @@ -3534,11 +3534,11 @@ def manual_trigger_pipeline_with_http_info( '202': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3546,7 +3546,7 @@ def manual_trigger_pipeline_with_http_info( @validate_call - def manual_trigger_pipeline_without_preload_content( + async def manual_trigger_pipeline_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], manual_pipeline_trigger: ManualPipelineTrigger, @@ -3606,7 +3606,7 @@ def manual_trigger_pipeline_without_preload_content( '202': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3693,7 +3693,7 @@ def _manual_trigger_pipeline_serialize( @validate_call - def patch_pipeline_by_id( + async def patch_pipeline_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], @@ -3757,11 +3757,11 @@ def patch_pipeline_by_id( '204': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3769,7 +3769,7 @@ def patch_pipeline_by_id( @validate_call - def patch_pipeline_by_id_with_http_info( + async def patch_pipeline_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], @@ -3833,11 +3833,11 @@ def patch_pipeline_by_id_with_http_info( '204': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3845,7 +3845,7 @@ def patch_pipeline_by_id_with_http_info( @validate_call - def patch_pipeline_by_id_without_preload_content( + async def patch_pipeline_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], @@ -3909,7 +3909,7 @@ def patch_pipeline_by_id_without_preload_content( '204': None, '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3999,7 +3999,7 @@ def _patch_pipeline_by_id_serialize( @validate_call - def search_pipelines_by_metadata( + async def search_pipelines_by_metadata( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], search_pipeline: SearchPipeline, @@ -4071,11 +4071,11 @@ def search_pipelines_by_metadata( '200': "SearchPipelinesResponse", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4083,7 +4083,7 @@ def search_pipelines_by_metadata( @validate_call - def search_pipelines_by_metadata_with_http_info( + async def search_pipelines_by_metadata_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], search_pipeline: SearchPipeline, @@ -4155,11 +4155,11 @@ def search_pipelines_by_metadata_with_http_info( '200': "SearchPipelinesResponse", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4167,7 +4167,7 @@ def search_pipelines_by_metadata_with_http_info( @validate_call - def search_pipelines_by_metadata_without_preload_content( + async def search_pipelines_by_metadata_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], search_pipeline: SearchPipeline, @@ -4239,7 +4239,7 @@ def search_pipelines_by_metadata_without_preload_content( '200': "SearchPipelinesResponse", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py index 092f0152..307c6f34 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py @@ -43,7 +43,7 @@ def __init__(self, api_client=None) -> None: @validate_call - def get_data_repositories( + async def get_data_repositories( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, @@ -111,11 +111,11 @@ def get_data_repositories( '200': "DataRepositories", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -123,7 +123,7 @@ def get_data_repositories( @validate_call - def get_data_repositories_with_http_info( + async def get_data_repositories_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, @@ -191,11 +191,11 @@ def get_data_repositories_with_http_info( '200': "DataRepositories", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -203,7 +203,7 @@ def get_data_repositories_with_http_info( @validate_call - def get_data_repositories_without_preload_content( + async def get_data_repositories_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, @@ -271,7 +271,7 @@ def get_data_repositories_without_preload_content( '200': "DataRepositories", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -357,7 +357,7 @@ def _get_data_repositories_serialize( @validate_call - def get_data_repository_by_id( + async def get_data_repository_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], repository_id: Annotated[UUID, Field(description="Repository ID")], @@ -423,11 +423,11 @@ def get_data_repository_by_id( '422': "GetAllPipelines400Response", '404': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -435,7 +435,7 @@ def get_data_repository_by_id( @validate_call - def get_data_repository_by_id_with_http_info( + async def get_data_repository_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], repository_id: Annotated[UUID, Field(description="Repository ID")], @@ -501,11 +501,11 @@ def get_data_repository_by_id_with_http_info( '422': "GetAllPipelines400Response", '404': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -513,7 +513,7 @@ def get_data_repository_by_id_with_http_info( @validate_call - def get_data_repository_by_id_without_preload_content( + async def get_data_repository_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], repository_id: Annotated[UUID, Field(description="Repository ID")], @@ -579,7 +579,7 @@ def get_data_repository_by_id_without_preload_content( '422': "GetAllPipelines400Response", '404': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -658,7 +658,7 @@ def _get_data_repository_by_id_serialize( @validate_call - def search( + async def search( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], retrieval_search_input: RetrievalSearchInput, @@ -719,11 +719,11 @@ def search( '400': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -731,7 +731,7 @@ def search( @validate_call - def search_with_http_info( + async def search_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], retrieval_search_input: RetrievalSearchInput, @@ -792,11 +792,11 @@ def search_with_http_info( '400': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -804,7 +804,7 @@ def search_with_http_info( @validate_call - def search_without_preload_content( + async def search_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], retrieval_search_input: RetrievalSearchInput, @@ -865,7 +865,7 @@ def search_without_preload_content( '400': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py index 952791af..b2fd9d97 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py @@ -55,7 +55,7 @@ def __init__(self, api_client=None) -> None: @validate_call - def create_collection( + async def create_collection( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_request: CollectionRequest, @@ -116,11 +116,11 @@ def create_collection( '400': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -128,7 +128,7 @@ def create_collection( @validate_call - def create_collection_with_http_info( + async def create_collection_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_request: CollectionRequest, @@ -189,11 +189,11 @@ def create_collection_with_http_info( '400': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -201,7 +201,7 @@ def create_collection_with_http_info( @validate_call - def create_collection_without_preload_content( + async def create_collection_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_request: CollectionRequest, @@ -262,7 +262,7 @@ def create_collection_without_preload_content( '400': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -349,7 +349,7 @@ def _create_collection_serialize( @validate_call - def create_documents( + async def create_documents( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -415,11 +415,11 @@ def create_documents( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -427,7 +427,7 @@ def create_documents( @validate_call - def create_documents_with_http_info( + async def create_documents_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -493,11 +493,11 @@ def create_documents_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -505,7 +505,7 @@ def create_documents_with_http_info( @validate_call - def create_documents_without_preload_content( + async def create_documents_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -571,7 +571,7 @@ def create_documents_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -661,7 +661,7 @@ def _create_documents_serialize( @validate_call - def delete_all_documents( + async def delete_all_documents( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], document_bulk_delete_request: DocumentBulkDeleteRequest, @@ -723,11 +723,11 @@ def delete_all_documents( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -735,7 +735,7 @@ def delete_all_documents( @validate_call - def delete_all_documents_with_http_info( + async def delete_all_documents_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], document_bulk_delete_request: DocumentBulkDeleteRequest, @@ -797,11 +797,11 @@ def delete_all_documents_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -809,7 +809,7 @@ def delete_all_documents_with_http_info( @validate_call - def delete_all_documents_without_preload_content( + async def delete_all_documents_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], document_bulk_delete_request: DocumentBulkDeleteRequest, @@ -871,7 +871,7 @@ def delete_all_documents_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -958,7 +958,7 @@ def _delete_all_documents_serialize( @validate_call - def delete_collection_by_id( + async def delete_collection_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[StrictStr, Field(description="Collection ID")], @@ -1020,11 +1020,11 @@ def delete_collection_by_id( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1032,7 +1032,7 @@ def delete_collection_by_id( @validate_call - def delete_collection_by_id_with_http_info( + async def delete_collection_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[StrictStr, Field(description="Collection ID")], @@ -1094,11 +1094,11 @@ def delete_collection_by_id_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1106,7 +1106,7 @@ def delete_collection_by_id_with_http_info( @validate_call - def delete_collection_by_id_without_preload_content( + async def delete_collection_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[StrictStr, Field(description="Collection ID")], @@ -1168,7 +1168,7 @@ def delete_collection_by_id_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1242,7 +1242,7 @@ def _delete_collection_by_id_serialize( @validate_call - def delete_document_by_id( + async def delete_document_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -1308,11 +1308,11 @@ def delete_document_by_id( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1320,7 +1320,7 @@ def delete_document_by_id( @validate_call - def delete_document_by_id_with_http_info( + async def delete_document_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -1386,11 +1386,11 @@ def delete_document_by_id_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1398,7 +1398,7 @@ def delete_document_by_id_with_http_info( @validate_call - def delete_document_by_id_without_preload_content( + async def delete_document_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -1464,7 +1464,7 @@ def delete_document_by_id_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1541,7 +1541,7 @@ def _delete_document_by_id_serialize( @validate_call - def get_all_collections( + async def get_all_collections( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, @@ -1609,11 +1609,11 @@ def get_all_collections( '200': "CollectionsListResponse", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1621,7 +1621,7 @@ def get_all_collections( @validate_call - def get_all_collections_with_http_info( + async def get_all_collections_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, @@ -1689,11 +1689,11 @@ def get_all_collections_with_http_info( '200': "CollectionsListResponse", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1701,7 +1701,7 @@ def get_all_collections_with_http_info( @validate_call - def get_all_collections_without_preload_content( + async def get_all_collections_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, @@ -1769,7 +1769,7 @@ def get_all_collections_without_preload_content( '200': "CollectionsListResponse", '400': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1855,7 +1855,7 @@ def _get_all_collections_serialize( @validate_call - def get_all_documents( + async def get_all_documents( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -1929,11 +1929,11 @@ def get_all_documents( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1941,7 +1941,7 @@ def get_all_documents( @validate_call - def get_all_documents_with_http_info( + async def get_all_documents_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -2015,11 +2015,11 @@ def get_all_documents_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2027,7 +2027,7 @@ def get_all_documents_with_http_info( @validate_call - def get_all_documents_without_preload_content( + async def get_all_documents_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -2101,7 +2101,7 @@ def get_all_documents_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -2190,7 +2190,7 @@ def _get_all_documents_serialize( @validate_call - def get_collection_by_id( + async def get_collection_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -2252,11 +2252,11 @@ def get_collection_by_id( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2264,7 +2264,7 @@ def get_collection_by_id( @validate_call - def get_collection_by_id_with_http_info( + async def get_collection_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -2326,11 +2326,11 @@ def get_collection_by_id_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2338,7 +2338,7 @@ def get_collection_by_id_with_http_info( @validate_call - def get_collection_by_id_without_preload_content( + async def get_collection_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -2400,7 +2400,7 @@ def get_collection_by_id_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -2474,7 +2474,7 @@ def _get_collection_by_id_serialize( @validate_call - def get_collection_creation_status( + async def get_collection_creation_status( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], id: Annotated[UUID, Field(description="Collection ID")], @@ -2536,11 +2536,11 @@ def get_collection_creation_status( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2548,7 +2548,7 @@ def get_collection_creation_status( @validate_call - def get_collection_creation_status_with_http_info( + async def get_collection_creation_status_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], id: Annotated[UUID, Field(description="Collection ID")], @@ -2610,11 +2610,11 @@ def get_collection_creation_status_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2622,7 +2622,7 @@ def get_collection_creation_status_with_http_info( @validate_call - def get_collection_creation_status_without_preload_content( + async def get_collection_creation_status_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], id: Annotated[UUID, Field(description="Collection ID")], @@ -2684,7 +2684,7 @@ def get_collection_creation_status_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -2758,7 +2758,7 @@ def _get_collection_creation_status_serialize( @validate_call - def get_collection_deletion_status( + async def get_collection_deletion_status( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], id: Annotated[UUID, Field(description="Collection ID")], @@ -2820,11 +2820,11 @@ def get_collection_deletion_status( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2832,7 +2832,7 @@ def get_collection_deletion_status( @validate_call - def get_collection_deletion_status_with_http_info( + async def get_collection_deletion_status_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], id: Annotated[UUID, Field(description="Collection ID")], @@ -2894,11 +2894,11 @@ def get_collection_deletion_status_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -2906,7 +2906,7 @@ def get_collection_deletion_status_with_http_info( @validate_call - def get_collection_deletion_status_without_preload_content( + async def get_collection_deletion_status_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], id: Annotated[UUID, Field(description="Collection ID")], @@ -2968,7 +2968,7 @@ def get_collection_deletion_status_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3042,7 +3042,7 @@ def _get_collection_deletion_status_serialize( @validate_call - def get_document_by_id( + async def get_document_by_id( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -3108,11 +3108,11 @@ def get_document_by_id( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3120,7 +3120,7 @@ def get_document_by_id( @validate_call - def get_document_by_id_with_http_info( + async def get_document_by_id_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -3186,11 +3186,11 @@ def get_document_by_id_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3198,7 +3198,7 @@ def get_document_by_id_with_http_info( @validate_call - def get_document_by_id_without_preload_content( + async def get_document_by_id_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -3264,7 +3264,7 @@ def get_document_by_id_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3341,7 +3341,7 @@ def _get_document_by_id_serialize( @validate_call - def search( + async def search( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], text_search_request: TextSearchRequest, @@ -3403,11 +3403,11 @@ def search( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3415,7 +3415,7 @@ def search( @validate_call - def search_with_http_info( + async def search_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], text_search_request: TextSearchRequest, @@ -3477,11 +3477,11 @@ def search_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3489,7 +3489,7 @@ def search_with_http_info( @validate_call - def search_without_preload_content( + async def search_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], text_search_request: TextSearchRequest, @@ -3551,7 +3551,7 @@ def search_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3638,7 +3638,7 @@ def _search_serialize( @validate_call - def update_chunks_metadata( + async def update_chunks_metadata( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -3700,11 +3700,11 @@ def update_chunks_metadata( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3712,7 +3712,7 @@ def update_chunks_metadata( @validate_call - def update_chunks_metadata_with_http_info( + async def update_chunks_metadata_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -3774,11 +3774,11 @@ def update_chunks_metadata_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -3786,7 +3786,7 @@ def update_chunks_metadata_with_http_info( @validate_call - def update_chunks_metadata_without_preload_content( + async def update_chunks_metadata_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -3848,7 +3848,7 @@ def update_chunks_metadata_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -3935,7 +3935,7 @@ def _update_chunks_metadata_serialize( @validate_call - def update_collections_metadata( + async def update_collections_metadata( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -3997,11 +3997,11 @@ def update_collections_metadata( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4009,7 +4009,7 @@ def update_collections_metadata( @validate_call - def update_collections_metadata_with_http_info( + async def update_collections_metadata_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -4071,11 +4071,11 @@ def update_collections_metadata_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4083,7 +4083,7 @@ def update_collections_metadata_with_http_info( @validate_call - def update_collections_metadata_without_preload_content( + async def update_collections_metadata_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -4145,7 +4145,7 @@ def update_collections_metadata_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -4232,7 +4232,7 @@ def _update_collections_metadata_serialize( @validate_call - def update_documents( + async def update_documents( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -4298,11 +4298,11 @@ def update_documents( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4310,7 +4310,7 @@ def update_documents( @validate_call - def update_documents_with_http_info( + async def update_documents_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -4376,11 +4376,11 @@ def update_documents_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4388,7 +4388,7 @@ def update_documents_with_http_info( @validate_call - def update_documents_without_preload_content( + async def update_documents_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], collection_id: Annotated[UUID, Field(description="Collection ID")], @@ -4454,7 +4454,7 @@ def update_documents_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -4544,7 +4544,7 @@ def _update_documents_serialize( @validate_call - def update_documents_metadata( + async def update_documents_metadata( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -4606,11 +4606,11 @@ def update_documents_metadata( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4618,7 +4618,7 @@ def update_documents_metadata( @validate_call - def update_documents_metadata_with_http_info( + async def update_documents_metadata_with_http_info( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -4680,11 +4680,11 @@ def update_documents_metadata_with_http_info( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -4692,7 +4692,7 @@ def update_documents_metadata_with_http_info( @validate_call - def update_documents_metadata_without_preload_content( + async def update_documents_metadata_without_preload_content( self, ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], metadata_updates: MetadataUpdates, @@ -4754,7 +4754,7 @@ def update_documents_metadata_without_preload_content( '404': "GetAllPipelines400Response", '422': "GetAllPipelines400Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py index 48d58fc5..f371e3af 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py @@ -94,11 +94,14 @@ def __init__( self.user_agent = 'OpenAPI-Generator/1.0.0/python' self.client_side_validation = configuration.client_side_validation - def __enter__(self): + async def __aenter__(self): return self - def __exit__(self, exc_type, exc_value, traceback): - pass + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() @property def user_agent(self): @@ -247,7 +250,7 @@ def param_serialize( return method, url, header_params, body, post_params - def call_api( + async def call_api( self, method, url, @@ -270,7 +273,7 @@ def call_api( try: # perform request and return response - response_data = self.rest_client.request( + response_data = await self.rest_client.request( method, url, headers=header_params, body=body, post_params=post_params, diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py index 209bed89..b827a34c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py @@ -10,19 +10,15 @@ """ # noqa: E501 +import base64 import copy import http.client as httplib import logging from logging import FileHandler -import multiprocessing -import ssl import sys from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union -from urllib.parse import urlparse -from urllib.request import getproxies from typing_extensions import NotRequired, Self -import urllib3 JSON_SCHEMA_VALIDATION_KEYWORDS = { @@ -163,7 +159,7 @@ class Configuration: when calling API from https server. :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format. - :param retries: int | urllib3.util.retry.Retry - Retry configuration. + :param retries: int - Retry configuration. :param ca_cert_data: verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format. :param cert_file: the path to a client certificate file, for mTLS. @@ -172,9 +168,7 @@ class Configuration: :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. :param proxy: Proxy URL. - :param no_proxy: Comma-separated hosts that bypass the proxy. :param proxy_headers: Proxy headers. - :param proxy_ssl_context: SSL context used only for the TLS handshake with the proxy itself, independent of the destination TLS settings. :param safe_chars_for_path_param: Safe characters for path parameter encoding. :param client_side_validation: Enable client-side validation. Default True. :param socket_options: Options to pass down to the underlying urllib3 socket. @@ -200,7 +194,7 @@ def __init__( server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, ignore_operation_servers: bool=False, ssl_ca_cert: Optional[str]=None, - retries: Optional[Union[int, urllib3.util.retry.Retry]] = None, + retries: Optional[int] = None, ca_cert_data: Optional[Union[str, bytes]] = None, cert_file: Optional[str]=None, key_file: Optional[str]=None, @@ -209,9 +203,7 @@ def __init__( tls_server_name: Optional[str]=None, connection_pool_maxsize: Optional[int]=None, proxy: Optional[str]=None, - no_proxy: Optional[str]=None, proxy_headers: Optional[Any]=None, - proxy_ssl_context: Optional[ssl.SSLContext]=None, safe_chars_for_path_param: str='', client_side_validation: bool=True, socket_options: Optional[Any]=None, @@ -266,7 +258,6 @@ def __init__( """Logging Settings """ self.logger["package_logger"] = logging.getLogger("generated") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") self.logger_format = '%(asctime)s %(levelname)s %(message)s' """Log format """ @@ -312,34 +303,17 @@ def __init__( Set this to the SNI value expected by the server. """ - self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. None in the constructor is coerced to cpu_count * 5. + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100 + """This value is passed to the aiohttp to limit simultaneous connections. + None in the constructor is coerced to default 100. """ - # urllib3 does not read proxy environment variables itself: - # https://github.com/urllib3/urllib3/issues/1785 - # A proxy taken from the environment is re-resolved when the host is - # assigned; see the host setter. - self._proxy_from_env = proxy is None - if proxy is None or no_proxy is None: - proxies = getproxies() - if proxy is None: - proxy = self._env_proxy(proxies, self.host) - if no_proxy is None: - no_proxy = proxies.get("no") - self._proxy = proxy - self.no_proxy = no_proxy - """Hosts that bypass the proxy + self.proxy = proxy + """Proxy URL """ self.proxy_headers = proxy_headers """Proxy headers """ - self.proxy_ssl_context = proxy_ssl_context - """SSL context used only for the TLS handshake with the proxy itself - (e.g. an HTTPS CONNECT tunnel), independent of the destination TLS - settings above. - """ self.safe_chars_for_path_param = safe_chars_for_path_param """Safe chars for path_param """ @@ -366,10 +340,6 @@ def __deepcopy__(self, memo: Dict[int, Any]) -> Self: result = cls.__new__(cls) memo[id(self)] = result for k, v in self.__dict__.items(): - if k == 'proxy_ssl_context': - # ssl.SSLContext holds unpicklable C state and can't be deepcopied. - setattr(result, k, v) - continue if k not in ('logger', 'logger_file_handler'): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers @@ -534,9 +504,9 @@ def get_basic_auth_token(self) -> Optional[str]: if self.password is not None: password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') + return "Basic " + base64.b64encode( + (username + ":" + password).encode('utf-8') + ).decode('utf-8') def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. @@ -632,23 +602,3 @@ def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None - if self._proxy_from_env: - # the scheme-specific proxy depends on the host, which is - # commonly assigned after construction - self._proxy = self._env_proxy(getproxies(), value) - - @staticmethod - def _env_proxy(proxies: Dict[str, str], host: str) -> Optional[str]: - """Pick the environment proxy that applies to `host`.""" - return proxies.get(urlparse(host).scheme) or proxies.get("all") - - @property - def proxy(self) -> Optional[str]: - """Proxy URL - """ - return self._proxy - - @proxy.setter - def proxy(self, value: Optional[str]) -> None: - self._proxy = value - self._proxy_from_env = False diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py index 6ceebd3c..53cdb827 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py @@ -33,6 +33,7 @@ class ApiError(BaseModel): request_id: Optional[StrictStr] = Field(default=None, description="id of individual request", alias="requestId") target: Optional[StrictStr] = Field(default=None, description="url that has been called") details: Optional[List[DetailsErrorResponse]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["code", "message", "requestId", "target", "details"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -80,6 +83,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_details in self.details: _items.append(_item_details.to_dict() if _item_details is not None else None) _dict['details'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "target": obj.get("target"), "details": [DetailsErrorResponse.from_dict(_item) for _item in obj["details"]] if obj.get("details") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py index 4eb04aff..30beaa95 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py @@ -31,6 +31,7 @@ class BaseDocument(BaseModel): """ # noqa: E501 chunks: List[TextOnlyBaseChunkCreate] metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["chunks", "metadata"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -84,6 +87,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -99,6 +107,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "chunks": [TextOnlyBaseChunkCreate.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None, "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py index 1d26fb21..409b64f5 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py @@ -30,6 +30,7 @@ class BasePipelineMinimalResponse(BaseModel): """ # noqa: E501 id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) status: Optional[PipelineExecutionStatus] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -91,6 +99,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "id": obj.get("id"), "status": obj.get("status") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py index 5ab2c9f4..15dad5d6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py @@ -31,6 +31,7 @@ class BasePipelineResponse(BaseModel): id: StrictStr type: StrictStr metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -75,6 +78,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of metadata if self.metadata: _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -91,6 +99,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py index 3bdd30bc..78953448 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py @@ -31,6 +31,7 @@ class BatchUpdateDocumentSuccess(BaseModel): """ # noqa: E501 id: UUID = Field(description="Unique identifier of the document.") metadata: List[DocumentMetadata] = Field(description="Metadata updates for this document.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "metadata"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -93,6 +101,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "id": obj.get("id"), "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py index c555e144..08af2681 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py @@ -30,6 +30,7 @@ class BinaryBooleanFilter(BaseModel): operator: StrictStr = Field(description="Boolean operator for combining filter conditions") left: Left1 right: Right1 + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["operator", "left", "right"] @field_validator('operator') @@ -69,8 +70,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -84,6 +87,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of right if self.right: _dict['right'] = self.right.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -100,6 +108,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "left": Left1.from_dict(obj["left"]) if obj.get("left") is not None else None, "right": Right1.from_dict(obj["right"]) if obj.get("right") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py index 8df4768a..bfa4f4c6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py @@ -33,6 +33,7 @@ class BoostingScoringConfiguration(BaseModel): metadata: Optional[List[BoostingScoringConfigurationMetadataInner]] = None weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") score_computation_strategy: Optional[BoostingScoreComputationStrategy] = Field(default=None, alias="scoreComputationStrategy") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["enabled", "metadata", "weight", "scoreComputationStrategy"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -80,6 +83,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if enabled (nullable) is None # and model_fields_set contains the field if self.enabled is None and "enabled" in self.model_fields_set: @@ -112,6 +120,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "weight": obj.get("weight") if "weight" in obj else 1, "scoreComputationStrategy": obj.get("scoreComputationStrategy") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py index 3161a9db..9fe3cceb 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py @@ -32,6 +32,7 @@ class BoostingScoringConfigurationMetadataInner(BaseModel): value: List[Annotated[str, Field(strict=True, max_length=1024)]] scope: Optional[StrictStr] = 'document' weight: StrictInt + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "scope", "weight"] @field_validator('scope') @@ -74,8 +75,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -83,6 +86,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -100,6 +108,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "scope": obj.get("scope") if obj.get("scope") is not None else 'document', "weight": obj.get("weight") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py index 54de2aea..ffa8faf4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py @@ -31,6 +31,7 @@ class Chunk(BaseModel): id: StrictStr content: StrictStr metadata: Optional[List[KeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "content", "metadata"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -94,6 +102,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "content": obj.get("content"), "metadata": [KeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py index 6deaa962..a0d47d38 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py @@ -34,6 +34,7 @@ class Collection(BaseModel): embedding_config: EmbeddingConfig = Field(alias="embeddingConfig") metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") id: UUID = Field(description="Unique identifier of a collection.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] model_config = ConfigDict( @@ -66,8 +67,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -84,6 +87,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if title (nullable) is None # and model_fields_set contains the field if self.title is None and "title" in self.model_fields_set: @@ -106,6 +114,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "id": obj.get("id") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py index 153e5fa9..47a21795 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py @@ -29,6 +29,7 @@ class CollectionCreatedResponse(BaseModel): """ # noqa: E501 collection_url: StrictStr = Field(alias="collectionURL") status: StrictStr + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["collectionURL", "status"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -85,6 +93,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "collectionURL": obj.get("collectionURL"), "status": obj.get("status") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py index 09eb6c7f..f0000b61 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py @@ -29,6 +29,7 @@ class CollectionDeletedResponse(BaseModel): """ # noqa: E501 collection_url: StrictStr = Field(alias="collectionURL") status: StrictStr + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["collectionURL", "status"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -85,6 +93,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "collectionURL": obj.get("collectionURL"), "status": obj.get("status") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py index f9e2dd6c..44aa735d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py @@ -28,6 +28,7 @@ class CollectionPendingResponse(BaseModel): CollectionPendingResponse """ # noqa: E501 monitor_url: StrictStr = Field(alias="monitorURL") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["monitorURL"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "monitorURL": obj.get("monitorURL") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py index 8171e681..056a72e4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py @@ -34,6 +34,7 @@ class CollectionRequest(BaseModel): embedding_config: EmbeddingConfig = Field(alias="embeddingConfig") metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") id: Optional[UUID] = Field(default=None, description="Unique identifier of a collection.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] model_config = ConfigDict( @@ -66,8 +67,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -84,6 +87,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if title (nullable) is None # and model_fields_set contains the field if self.title is None and "title" in self.model_fields_set: @@ -111,6 +119,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "id": obj.get("id") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py index 3f3642fc..ffeda67a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py @@ -30,6 +30,7 @@ class CollectionsListResponse(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = None resources: List[Collection] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [Collection.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py index 4f0d01fa..1b9bca9b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py @@ -35,6 +35,7 @@ class ConfigurationDocument(BaseModel): created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) type: Optional[StrictStr] = Field(default=None, description="Type of the resource. Can be FOLDER, DOCUMENT.") metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "type", "metadata"] @field_validator('type') @@ -77,8 +78,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -92,6 +95,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if type (nullable) is None # and model_fields_set contains the field if self.type is None and "type" in self.model_fields_set: @@ -116,6 +124,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py index debda35f..17410c2a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py @@ -42,6 +42,7 @@ class ConfigurationDocumentFullDetails(BaseModel): mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the document.", alias="mimeType", json_schema_extra={"examples": ["application/pdf"]}) file_size_mb: Optional[StrictStr] = Field(default=None, description="File size of the document in megabytes.", alias="fileSizeMb", json_schema_extra={"examples": ["1.5"]}) metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "resourceUri", "webUrl", "documentEtag", "fileSuffix", "viewLocation", "downloadLocation", "mimeType", "fileSizeMb", "metadata"] model_config = ConfigDict( @@ -74,8 +75,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -89,6 +92,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -115,6 +123,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "fileSizeMb": obj.get("fileSizeMb"), "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py index 945e14a1..51bae012 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py @@ -138,6 +138,52 @@ def from_json(cls, json_str: str) -> Self: error_messages = [] match = 0 + # use oneOf discriminator to lookup the data type + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) + if not _data_type: + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") + + # check if data type is `GoogleDrivePipelineCreateRequest` + if _data_type == "GoogleDrive": + instance.actual_instance = GoogleDrivePipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `MSSharePointPipelineCreateRequest` + if _data_type == "MSSharePoint": + instance.actual_instance = MSSharePointPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `S3PipelineCreateRequest` + if _data_type == "S3": + instance.actual_instance = S3PipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `SDMPipelineCreateRequest` + if _data_type == "SDM": + instance.actual_instance = SDMPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `SFTPPipelineCreateRequest` + if _data_type == "SFTP": + instance.actual_instance = SFTPPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `ServiceNowPipelineCreateRequest` + if _data_type == "ServiceNow": + instance.actual_instance = ServiceNowPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `WorkZonePipelineCreateRequest` + if _data_type == "WorkZone": + instance.actual_instance = WorkZonePipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `MetadataConfiguration` + if _data_type == "metadata": + instance.actual_instance = MetadataConfiguration.from_json(json_str) + return instance + # deserialize data into MSSharePointPipelineCreateRequest try: instance.actual_instance = MSSharePointPipelineCreateRequest.from_json(json_str) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py index 7f7879d3..9a51830a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py @@ -30,6 +30,7 @@ class DataRepositories(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = None resources: List[DataRepository] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [DataRepository.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py index eeb07217..cfe7bbfd 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py @@ -36,6 +36,7 @@ class DataRepository(BaseModel): remote_grounding_name: Optional[StrictStr] = Field(default=None, alias="remoteGroundingName") message: Optional[StrictStr] = None type: DataRepositoryType + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "type"] model_config = ConfigDict( @@ -68,8 +69,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -83,6 +86,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if remote_grounding_name (nullable) is None # and model_fields_set contains the field if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: @@ -112,6 +120,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "message": obj.get("message"), "type": obj.get("type") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py index 936c5134..c4ba208b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py @@ -30,6 +30,7 @@ class DataRepositoryPerFilterSearchResult(BaseModel): """ # noqa: E501 filter_id: StrictStr = Field(alias="filterId") results: Optional[List[DataRepositorySearchResult]] = Field(default=None, description="List of returned results.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "filterId": obj.get("filterId"), "results": [DataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py index 53364c7a..4aaf7d98 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py @@ -29,6 +29,7 @@ class DataRepositorySearchResult(BaseModel): DataRepositorySearchResult """ # noqa: E501 data_repository: DataRepositoryWithDocuments = Field(alias="dataRepository") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepository"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of data_repository if self.data_repository: _dict['dataRepository'] = self.data_repository.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py index 3c82d1ca..518ac373 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py @@ -29,6 +29,7 @@ class DataRepositorySearchResults(BaseModel): DataRepositorySearchResults """ # noqa: E501 results: List[ResultsInner2] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "results": [ResultsInner2.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py index 236cc929..dd06dd52 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py @@ -36,6 +36,7 @@ class DataRepositoryWithDocuments(BaseModel): remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly destination Name (grounding.name) of remote instance.", alias="remoteGroundingName") message: Optional[StrictStr] = Field(default=None, description="Optional message.") documents: List[Document] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "documents"] model_config = ConfigDict( @@ -68,8 +69,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -89,6 +92,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_documents in self.documents: _items.append(_item_documents.to_dict() if _item_documents is not None else None) _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if remote_grounding_name (nullable) is None # and model_fields_set contains the field if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: @@ -118,6 +126,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "message": obj.get("message"), "documents": [Document.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py index ed0a7b00..086e9b7b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py @@ -29,6 +29,7 @@ class DenseRetrievalScoringConfiguration(BaseModel): """ # noqa: E501 enabled: Optional[StrictBool] = Field(default=True, description="Enable dense retrieval.") weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["enabled", "weight"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if enabled (nullable) is None # and model_fields_set contains the field if self.enabled is None and "enabled" in self.model_fields_set: @@ -95,6 +103,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "enabled": obj.get("enabled") if "enabled" in obj else True, "weight": obj.get("weight") if "weight" in obj else 1 }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py index b67a2acb..d12c2136 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py @@ -29,6 +29,7 @@ class DetailsErrorResponse(BaseModel): """ # noqa: E501 code: Optional[StrictStr] = Field(default=None, description="Descriptive error code (not http status code)") message: Optional[StrictStr] = Field(default=None, description="Plaintext error description") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["code", "message"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -85,6 +93,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "code": obj.get("code"), "message": obj.get("message") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py index eed09cd3..736672e5 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py @@ -32,6 +32,7 @@ class Document(BaseModel): id: StrictStr metadata: Optional[List[RetrievalDocumentKeyValueListPair]] = None chunks: List[RetrievalChunk] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -85,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_chunks in self.chunks: _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) _dict['chunks'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -101,6 +109,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [RetrievalDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "chunks": [RetrievalChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py index 96845a68..1d6f8fb7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py @@ -30,6 +30,7 @@ class DocumentBulkDeleteRequest(BaseModel): A request to delete documents by their IDs. """ # noqa: E501 ids: Annotated[List[UUID], Field(min_length=1, max_length=100)] = Field(description="List of document IDs to delete") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["ids"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -85,6 +93,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "ids": obj.get("ids") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py index 5e988e4a..2b0da6da 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py @@ -30,6 +30,7 @@ class DocumentBulkDeleteResponse(BaseModel): """ # noqa: E501 deleted: List[UUID] = Field(description="List of successfully deleted document IDs") not_found: List[UUID] = Field(description="List of document IDs that were not found", alias="notFound") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["deleted", "notFound"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -86,6 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "deleted": obj.get("deleted"), "notFound": obj.get("notFound") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py index 9e145c61..42896d74 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py @@ -29,6 +29,7 @@ class DocumentCreateRequest(BaseModel): A create request containing one or more new documents to create and store in a collection. """ # noqa: E501 documents: List[BaseDocument] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["documents"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_documents in self.documents: _items.append(_item_documents.to_dict() if _item_documents is not None else None) _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "documents": [BaseDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py index 91b7eaa1..5250757e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py @@ -33,6 +33,7 @@ class DocumentInput(BaseModel): chunks: List[TextOnlyBaseChunkCreate] metadata: Optional[List[VectorDocumentKeyValueListPair]] = None id: UUID = Field(description="Unique identifier of a document.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -86,6 +89,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "id": obj.get("id") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py index baec5b98..d55247c4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py @@ -32,6 +32,7 @@ class DocumentKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -89,6 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "matchMode": obj.get("matchMode") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py index c667d40d..e49550af 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py @@ -30,6 +30,7 @@ class DocumentMetadata(BaseModel): key: StrictStr = Field(description="Metadata key name.", json_schema_extra={"examples": ["contentObjectId"]}) value: Optional[List[StrictStr]] = Field(description="An array of string values associated with the metadata key. If the key already exists, its values will be overwritten. Setting the value to null will delete the metadata key-value pair.") match_mode: Optional[StrictStr] = Field(default=None, description="Match mode for the metadata key (ANY or ALL).", alias="matchMode") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] @field_validator('match_mode') @@ -72,8 +73,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -81,6 +84,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if value (nullable) is None # and model_fields_set contains the field if self.value is None and "value" in self.model_fields_set: @@ -107,6 +115,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "matchMode": obj.get("matchMode") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py index e0b920b5..e62a21e2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py @@ -30,6 +30,7 @@ class DocumentMetadataBatchRequest(BaseModel): DocumentMetadataBatchRequest """ # noqa: E501 value: Annotated[List[DocumentMetadataUpdate], Field(max_length=1000)] = Field(description="List of document metadata updates to be applied in batch.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["value"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_value in self.value: _items.append(_item_value.to_dict() if _item_value is not None else None) _dict['value'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -91,6 +99,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "value": [DocumentMetadataUpdate.from_dict(_item) for _item in obj["value"]] if obj.get("value") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py index 28570098..ca813ea9 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py @@ -32,6 +32,7 @@ class DocumentMetadataUpdate(BaseModel): """ # noqa: E501 id: UUID = Field(description="Unique identifier of the document to update.", json_schema_extra={"examples": ["550e8400-e29b-41d4-a716-446655440000"]}) metadata: Annotated[List[DocumentMetadata], Field(max_length=10)] = Field(description="Metadata updates for this document.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "metadata"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -79,6 +82,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -94,6 +102,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "id": obj.get("id"), "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py index a16114c3..2006daf4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py @@ -30,6 +30,7 @@ class DocumentMetadataUpdateError(BaseModel): target: StrictStr = Field(description="Document ID that caused the error.", json_schema_extra={"examples": ["550e8400-e29b-41d4-a716-446655440000"]}) code: StrictInt = Field(description="HTTP error status code.", json_schema_extra={"examples": [500]}) message: StrictStr = Field(description="Error message.", json_schema_extra={"examples": ["Some unexpected error occurred."]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["target", "code", "message"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "code": obj.get("code"), "message": obj.get("message") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py index 38def6f9..b3653635 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py @@ -33,6 +33,7 @@ class DocumentOutput(BaseModel): id: UUID metadata: Optional[List[VectorDocumentKeyValueListPair]] = None chunks: List[VectorChunk] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -86,6 +89,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_chunks in self.chunks: _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) _dict['chunks'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "chunks": [VectorChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py index 906c1dd2..712f681f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py @@ -33,6 +33,7 @@ class DocumentResponse(BaseModel): chunks: List[TextOnlyBaseChunk] metadata: Optional[List[VectorDocumentKeyValueListPair]] = None id: UUID = Field(description="Unique identifier of a document.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -86,6 +89,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "id": obj.get("id") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py index cd781a61..b3f0061b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py @@ -29,6 +29,7 @@ class DocumentUpdateRequest(BaseModel): An update request containing one or more documents to update existing documents in a collection by ID. """ # noqa: E501 documents: List[DocumentInput] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["documents"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_documents in self.documents: _items.append(_item_documents.to_dict() if _item_documents is not None else None) _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "documents": [DocumentInput.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py index ae54d7df..305042cc 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py @@ -31,6 +31,7 @@ class DocumentWithoutChunks(BaseModel): """ # noqa: E501 metadata: List[VectorDocumentKeyValueListPair] id: UUID = Field(description="Unique identifier of a document.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["metadata", "id"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -93,6 +101,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "id": obj.get("id") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py index a3d4d056..e680a550 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py @@ -30,6 +30,7 @@ class Documents(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = None resources: List[DocumentWithoutChunks] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [DocumentWithoutChunks.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py index 3b21551d..98d6ed77 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py @@ -34,6 +34,7 @@ class DocumentsChunk(BaseModel): title: StrictStr metadata: Optional[List[VectorKeyValueListPair]] = None documents: List[DocumentOutput] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "metadata", "documents"] model_config = ConfigDict( @@ -66,8 +67,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -87,6 +90,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_documents in self.documents: _items.append(_item_documents.to_dict() if _item_documents is not None else None) _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -104,6 +112,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "documents": [DocumentOutput.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py index 6675ab18..02a92cd6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py @@ -29,6 +29,7 @@ class DocumentsListResponse(BaseModel): A response containing documents retrieved from the server. """ # noqa: E501 documents: List[DocumentWithoutChunks] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["documents"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_documents in self.documents: _items.append(_item_documents.to_dict() if _item_documents is not None else None) _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "documents": [DocumentWithoutChunks.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py index 930d1670..c6ca0670 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py @@ -30,6 +30,7 @@ class DocumentsStatusResponse(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1]}) resources: Optional[List[DocumentsStatusResponseResourcesInner]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [DocumentsStatusResponseResourcesInner.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py index fbb7033f..75021e1c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py @@ -37,6 +37,7 @@ class DocumentsStatusResponseResourcesInner(BaseModel): metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] model_config = ConfigDict( @@ -69,8 +70,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -130,6 +138,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "createdTimestamp": obj.get("createdTimestamp"), "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py index 4bbdbcab..59650cfb 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py @@ -29,6 +29,7 @@ class EmbeddingConfig(BaseModel): EmbeddingConfig """ # noqa: E501 model_name: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(default='text-embedding-ada-002', alias="modelName") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["modelName"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -84,6 +92,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "modelName": obj.get("modelName") if obj.get("modelName") is not None else 'text-embedding-ada-002' }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py index 77098bd1..871aca4a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py @@ -28,6 +28,7 @@ class ErrorResponse(BaseModel): ErrorResponse """ # noqa: E501 error: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Error occurred during tenant onboarding"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "error": obj.get("error") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py index c785ed27..387ebc67 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py @@ -28,6 +28,7 @@ class GenericError(BaseModel): GenericError """ # noqa: E501 error: StrictStr = Field(description="Human-readable error message") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "error": obj.get("error") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py index 26e0f39f..6cb256ea 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py @@ -29,6 +29,7 @@ class GetAllPipelines400Response(BaseModel): GetAllPipelines400Response """ # noqa: E501 error: Optional[ApiError] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of error if self.error: _dict['error'] = self.error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "error": ApiError.from_dict(obj["error"]) if obj.get("error") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py index 3cc9d364..cb29093f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py @@ -130,6 +130,47 @@ def from_json(cls, json_str: str) -> Self: error_messages = [] match = 0 + # use oneOf discriminator to lookup the data type + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) + if not _data_type: + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") + + # check if data type is `GoogleDrivePipelineGetResponse` + if _data_type == "GoogleDrive": + instance.actual_instance = GoogleDrivePipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `MSSharePointPipelineGetResponse` + if _data_type == "MSSharePoint": + instance.actual_instance = MSSharePointPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `S3PipelineGetResponse` + if _data_type == "S3": + instance.actual_instance = S3PipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `SDMPipelineGetResponse` + if _data_type == "SDM": + instance.actual_instance = SDMPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `SFTPPipelineGetResponse` + if _data_type == "SFTP": + instance.actual_instance = SFTPPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `ServiceNowPipelineGetResponse` + if _data_type == "ServiceNow": + instance.actual_instance = ServiceNowPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `WorkZonePipelineGetResponse` + if _data_type == "WorkZone": + instance.actual_instance = WorkZonePipelineGetResponse.from_json(json_str) + return instance + # deserialize data into MSSharePointPipelineGetResponse try: instance.actual_instance = MSSharePointPipelineGetResponse.from_json(json_str) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py index 3bc1174c..25ab9e48 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py @@ -32,6 +32,7 @@ class GetPipelineExecutionById(BaseModel): created_at: Optional[StrictStr] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) modified_at: Optional[StrictStr] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) status: Optional[PipelineExecutionStatus] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "createdAt", "modifiedAt", "status"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -95,6 +103,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "modifiedAt": obj.get("modifiedAt"), "status": obj.get("status") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py index f03432e0..fcffe94f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py @@ -30,6 +30,7 @@ class GetPipelineExecutions(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [2]}) resources: Optional[List[PipelineExecutionData]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [PipelineExecutionData.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py index 9c888bfa..7a6813ab 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py @@ -33,6 +33,7 @@ class GetPipelineStatus(BaseModel): created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) last_completed_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="lastCompletedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) status: Optional[PipelineExecutionStatus] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["lastStarted", "createdAt", "lastCompletedAt", "status"] @field_validator('last_started', mode="before") @@ -95,8 +96,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -104,6 +107,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if created_at (nullable) is None # and model_fields_set contains the field if self.created_at is None and "created_at" in self.model_fields_set: @@ -136,6 +144,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "lastCompletedAt": obj.get("lastCompletedAt"), "status": obj.get("status") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py index 5f126b11..c957803c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py @@ -30,6 +30,7 @@ class GetPipelines(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = None resources: List[GetPipeline] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [GetPipeline.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py index 0df1a95b..984b4b9f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py @@ -18,7 +18,7 @@ import json from pydantic import BaseModel, ConfigDict, Field -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail from typing import Optional, Set from typing_extensions import Self diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py index f02d223a..29033084 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py @@ -32,6 +32,7 @@ class GoogleDrivePipelineCreateRequest(BaseModel): type: StrictStr metadata: Optional[MetaData] = None configuration: GoogleDriveConfigurationStruct + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["type", "metadata", "configuration"] @field_validator('type') @@ -71,8 +72,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -86,6 +89,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, "configuration": GoogleDriveConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py index c7106e4a..32710be9 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py @@ -33,6 +33,7 @@ class GoogleDrivePipelineGetResponse(BaseModel): type: StrictStr metadata: Optional[MetaData] = None configuration: GoogleDriveConfigurationMinimal + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] @field_validator('type') @@ -72,8 +73,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -87,6 +90,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -104,6 +112,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, "configuration": GoogleDriveConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py index 5ea5811e..9871af77 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py @@ -34,6 +34,7 @@ class GoogleDrivePipelineMinimalResponse(BaseModel): type: StrictStr configuration: Optional[GoogleDriveConfigurationMinimal] = None metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] @field_validator('type') @@ -73,8 +74,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -85,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -108,6 +116,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "configuration": GoogleDriveConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, "metadata": obj.get("metadata") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py index 6df75c1c..ba3b1ab4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py @@ -29,6 +29,7 @@ class HTTPValidationError(BaseModel): HTTPValidationError """ # noqa: E501 detail: Optional[List[ValidationError]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["detail"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_detail in self.detail: _items.append(_item_detail.to_dict() if _item_detail is not None else None) _dict['detail'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py index b10a0d61..0010e027 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py @@ -30,6 +30,7 @@ class KeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -86,6 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "key": obj.get("key"), "value": obj.get("value") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py index ea2b1835..4267d5bc 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py @@ -30,6 +30,7 @@ class KeyWordRetrievalScoringConfiguration(BaseModel): enabled: Optional[StrictBool] = Field(default=True, description="Enable dense retrieval.") weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") extract_key_words_from_query: Optional[StrictBool] = Field(default=False, description="Extract Keywords from Query.", alias="extractKeyWordsFromQuery") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["enabled", "weight", "extractKeyWordsFromQuery"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if enabled (nullable) is None # and model_fields_set contains the field if self.enabled is None and "enabled" in self.model_fields_set: @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "weight": obj.get("weight") if "weight" in obj else 1, "extractKeyWordsFromQuery": obj.get("extractKeyWordsFromQuery") if "extractKeyWordsFromQuery" in obj else False }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py index a823c9d8..039ccbc8 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py @@ -30,6 +30,7 @@ class ListConfigurationDocuments(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = Field(default=None, description="Total number of documents returned.", json_schema_extra={"examples": [1]}) resources: Optional[List[ConfigurationDocument]] = Field(default=None, description="List of document objects. It will be empty array if no records found.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [ConfigurationDocument.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py index 4f8d6276..8668822b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py @@ -30,6 +30,7 @@ class ListConfigurationDocumentsFullDetails(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = Field(default=None, description="Total number of documents returned.", json_schema_extra={"examples": [1]}) resources: Optional[List[ConfigurationDocumentFullDetails]] = Field(default=None, description="List of document objects. It will be empty array if no records found.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [ConfigurationDocumentFullDetails.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py index 8a2596d6..29879a78 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py @@ -30,6 +30,7 @@ class ListMetadataConfigurations(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = Field(default=None, description="Total number of metadata configurations returned.", json_schema_extra={"examples": [1]}) resources: Optional[List[MetadataConfigurationResponse]] = Field(default=None, description="List of metadata configuration objects. It will be empty array if no records found.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [MetadataConfigurationResponse.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py index dd4c0ed1..0bb642cd 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py @@ -29,6 +29,7 @@ class ManualPipelineTrigger(BaseModel): """ # noqa: E501 pipeline_id: Optional[StrictStr] = Field(default=None, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) metadata_only: Optional[StrictBool] = Field(default=None, alias="metadataOnly", json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["pipelineId", "metadataOnly"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -85,6 +93,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "pipelineId": obj.get("pipelineId"), "metadataOnly": obj.get("metadataOnly") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py index 9fc64a45..1ebb166d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py @@ -33,6 +33,7 @@ class MergeStrategyReranker(BaseModel): model: Optional[StrictStr] = Field(default='cohere-3.5', description="The RerankerModel to use.") boosting: Optional[List[MergeStrategyRerankerBoostingInner]] = Field(default=None, description="Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.") include_all_meta_data: Optional[StrictBool] = Field(default=False, description="If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.", alias="includeAllMetaData") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["type", "model", "boosting", "includeAllMetaData"] @field_validator('model') @@ -75,8 +76,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -90,6 +93,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_boosting in self.boosting: _items.append(_item_boosting.to_dict() if _item_boosting is not None else None) _dict['boosting'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if model (nullable) is None # and model_fields_set contains the field if self.model is None and "model" in self.model_fields_set: @@ -122,6 +130,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "boosting": [MergeStrategyRerankerBoostingInner.from_dict(_item) for _item in obj["boosting"]] if obj.get("boosting") is not None else None, "includeAllMetaData": obj.get("includeAllMetaData") if "includeAllMetaData" in obj else False }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py index be3cf901..70e9077b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py @@ -31,6 +31,7 @@ class MergeStrategyRerankerBoostingInner(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] scope: List[StrictStr] = Field(description="PerFilterSearchResult ID or a new ID for each PostProcessingOperation.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "scope"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -72,6 +75,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -88,6 +96,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "scope": obj.get("scope") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py index 36716f52..f3d8ded2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py @@ -29,6 +29,7 @@ class MergeStrategyScoreReuse(BaseModel): The MergeStrategyScoreReuse merges the given PerFilterSearchResult instances according to the scores returned by the downstream retrieval process. It is important that the scores are comparable, meaning they should come from the same embedding model or reranker model. """ # noqa: E501 type: Optional[MergeStrategyType] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["type"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -84,6 +92,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "type": obj.get("type") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py index 6e46486c..a55cf5e6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py @@ -28,6 +28,7 @@ class MessageResponse(BaseModel): MessageResponse """ # noqa: E501 message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Tenant onboarding request accepted"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["message"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "message": obj.get("message") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py index bd4d035c..d024351b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py @@ -30,6 +30,7 @@ class MetaDataDataRepositoryMetadataInner(BaseModel): """ # noqa: E501 key: Annotated[str, Field(min_length=1, strict=True, max_length=1024)] value: Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=1024)]], Field(min_length=1)] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -86,6 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "key": obj.get("key"), "value": obj.get("value") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py index 3336019f..02620c93 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py @@ -29,6 +29,7 @@ class MetadataConfigurationMetadata(BaseModel): MetadataConfigurationMetadata """ # noqa: E501 data_repository_metadata: List[MetaDataKeyValuePairStrict] = Field(alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_data_repository_metadata in self.data_repository_metadata: _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "dataRepositoryMetadata": [MetaDataKeyValuePairStrict.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py index b1995ec2..47212656 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py @@ -35,6 +35,7 @@ class MetadataConfigurationRequest(BaseModel): data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels"] @field_validator('data_repository_type') @@ -74,8 +75,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -89,6 +92,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_labels in self.labels: _items.append(_item_labels.to_dict() if _item_labels is not None else None) _dict['labels'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -108,6 +116,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "includePaths": obj.get("includePaths"), "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py index 4dd5ae43..3a03331a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py @@ -29,6 +29,7 @@ class MetadataConfigurationRequestLabelsInner(BaseModel): """ # noqa: E501 key: StrictStr = Field(json_schema_extra={"examples": ["department"]}) value: StrictStr = Field(json_schema_extra={"examples": ["finance"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -70,6 +73,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -85,6 +93,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "key": obj.get("key"), "value": obj.get("value") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py index a67dc660..46b05bbf 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py @@ -36,6 +36,7 @@ class MetadataConfigurationResponse(BaseModel): include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None enumeration_status: Optional[StrictStr] = Field(default=None, description="Status of metadata enumeration for the configuration.", alias="enumerationStatus") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels", "enumerationStatus"] @field_validator('data_repository_type') @@ -85,8 +86,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -100,6 +103,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_labels in self.labels: _items.append(_item_labels.to_dict() if _item_labels is not None else None) _dict['labels'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if enumeration_status (nullable) is None # and model_fields_set contains the field if self.enumeration_status is None and "enumeration_status" in self.model_fields_set: @@ -125,6 +133,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None, "enumerationStatus": obj.get("enumerationStatus") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py index ddf54f05..0fd7e94e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py @@ -31,6 +31,7 @@ class MetadataItem(BaseModel): """ # noqa: E501 id: UUID = Field(description="ID of collection") metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="List of metadata of the collections or documents or chunks") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "metadata"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if metadata (nullable) is None # and model_fields_set contains the field if self.metadata is None and "metadata" in self.model_fields_set: @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "id": obj.get("id"), "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py index 7eb14aba..70b4c662 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py @@ -31,6 +31,7 @@ class MetadataKeyUpdate(BaseModel): """ # noqa: E501 key: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Key to update") operations: Optional[List[MetadataOperation]] = Field(default=None, description="Update operation executed for the key") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "operations"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_operations in self.operations: _items.append(_item_operations.to_dict() if _item_operations is not None else None) _dict['operations'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if operations (nullable) is None # and model_fields_set contains the field if self.operations is None and "operations" in self.model_fields_set: @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "key": obj.get("key"), "operations": [MetadataOperation.from_dict(_item) for _item in obj["operations"]] if obj.get("operations") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py index 0009ddd6..e1fea570 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py @@ -30,6 +30,7 @@ class MetadataOperation(BaseModel): """ # noqa: E501 op: MetadataOperationEnum values: Optional[List[StrictStr]] = Field(default=None, description="List of values to update.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["op", "values"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if values (nullable) is None # and model_fields_set contains the field if self.values is None and "values" in self.model_fields_set: @@ -91,6 +99,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "op": obj.get("op"), "values": obj.get("values") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py index 27b82ad8..92106380 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py @@ -29,6 +29,7 @@ class MetadataResponse(BaseModel): MetadataResponse """ # noqa: E501 current_metadata: Optional[List[MetadataItem]] = Field(default=None, description="List of metadata after updates.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["current_metadata"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_current_metadata in self.current_metadata: _items.append(_item_current_metadata.to_dict() if _item_current_metadata is not None else None) _dict['current_metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if current_metadata (nullable) is None # and model_fields_set contains the field if self.current_metadata is None and "current_metadata" in self.model_fields_set: @@ -95,6 +103,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "current_metadata": [MetadataItem.from_dict(_item) for _item in obj["current_metadata"]] if obj.get("current_metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py index 55edd56e..fa687c74 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py @@ -31,6 +31,7 @@ class MetadataUpdateItem(BaseModel): """ # noqa: E501 ids: List[UUID] = Field(description="List of collection or document or chunk ids for which the metadata should be updated") metadata_updates: List[MetadataKeyUpdate] = Field(description="List of metadata updates for the given resource ids", alias="metadataUpdates") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["ids", "metadataUpdates"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata_updates in self.metadata_updates: _items.append(_item_metadata_updates.to_dict() if _item_metadata_updates is not None else None) _dict['metadataUpdates'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -93,6 +101,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "ids": obj.get("ids"), "metadataUpdates": [MetadataKeyUpdate.from_dict(_item) for _item in obj["metadataUpdates"]] if obj.get("metadataUpdates") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py index b33bc4ef..50c0059f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py @@ -29,6 +29,7 @@ class MetadataUpdates(BaseModel): MetadataUpdates """ # noqa: E501 updates: List[MetadataUpdateItem] = Field(description="List of metadata updates.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["updates"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_updates in self.updates: _items.append(_item_updates.to_dict() if _item_updates is not None else None) _dict['updates'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "updates": [MetadataUpdateItem.from_dict(_item) for _item in obj["updates"]] if obj.get("updates") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py index 953bd0b0..34261d61 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py @@ -30,6 +30,7 @@ class MSSharePointConfigurationGetResponse(BaseModel): """ # noqa: E501 destination: StrictStr share_point: SharePointConfigGetResponse = Field(alias="sharePoint") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "sharePoint"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -74,6 +77,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of share_point if self.share_point: _dict['sharePoint'] = self.share_point.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -89,6 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "destination": obj.get("destination"), "sharePoint": SharePointConfigGetResponse.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py index 5676fa57..3514710b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py @@ -29,6 +29,7 @@ class MSSharePointConfigurationMinimal(BaseModel): MSSharePointConfigurationMinimal """ # noqa: E501 share_point: SharePointSiteDetail = Field(alias="sharePoint") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["sharePoint"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of share_point if self.share_point: _dict['sharePoint'] = self.share_point.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "sharePoint": SharePointSiteDetail.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py index 66df4f4f..0b306eb9 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py @@ -33,6 +33,7 @@ class MSSharePointPipelineGetResponse(BaseModel): type: StrictStr metadata: Optional[MetaData] = None configuration: MSSharePointConfigurationGetResponse + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] @field_validator('type') @@ -72,8 +73,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -87,6 +90,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -104,6 +112,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, "configuration": MSSharePointConfigurationGetResponse.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py index 853bd3fe..44d3168e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py @@ -34,6 +34,7 @@ class MSSharePointPipelineMinimalResponse(BaseModel): type: StrictStr configuration: MSSharePointConfigurationMinimal metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] @field_validator('type') @@ -73,8 +74,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -85,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -108,6 +116,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "configuration": MSSharePointConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, "metadata": obj.get("metadata") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py index 3eab15de..9d5f0033 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py @@ -31,6 +31,7 @@ class PatchPipeline(BaseModel): """ # noqa: E501 metadata: Optional[PatchPipelineMetadata] = None configuration: Optional[PatchPipelineConfiguration] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["metadata", "configuration"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -93,6 +101,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": PatchPipelineMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, "configuration": PatchPipelineConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py index 5117e86f..98930f34 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py @@ -28,6 +28,7 @@ class PatchPipelineConfiguration(BaseModel): PatchPipelineConfiguration """ # noqa: E501 cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["cronExpression"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "cronExpression": obj.get("cronExpression") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py index e9fdd7d9..fb7bc7b2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py @@ -29,6 +29,7 @@ class PatchPipelineMetadata(BaseModel): PatchPipelineMetadata """ # noqa: E501 data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Patch for metadata happens at key level. Value for the specific key would be inserted/replaced.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_data_repository_metadata in self.data_repository_metadata: _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py index 90f1518a..39c770a0 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py @@ -30,6 +30,7 @@ class PerFilterSearchResult(BaseModel): """ # noqa: E501 filter_id: StrictStr = Field(alias="filterId") results: List[DocumentsChunk] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "filterId": obj.get("filterId"), "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py index 7d52ede8..e1a53a52 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py @@ -28,6 +28,7 @@ class PerFilterSearchResultError(BaseModel): Error message if any. """ # noqa: E501 message: StrictStr + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["message"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "message": obj.get("message") if obj.get("message") is not None else 'Unknown Error Occurred' }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py index 8fee6755..193592b6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py @@ -30,6 +30,7 @@ class PerFilterSearchResultWithError(BaseModel): """ # noqa: E501 filter_id: StrictStr = Field(alias="filterId") error: Optional[PerFilterSearchResultError] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "error"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -74,6 +77,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of error if self.error: _dict['error'] = self.error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -89,6 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "filterId": obj.get("filterId"), "error": PerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py index 9bc1b3b7..19f7d009 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py @@ -37,6 +37,7 @@ class PipelineDocumentResponse(BaseModel): metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] model_config = ConfigDict( @@ -69,8 +70,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -130,6 +138,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "createdTimestamp": obj.get("createdTimestamp"), "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py index f882e16a..36ecf1fc 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py @@ -33,6 +33,7 @@ class PipelineExecutionData(BaseModel): status: Optional[PipelineExecutionStatus] = None created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) modified_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "createdAt", "modifiedAt"] @field_validator('created_at', mode="before") @@ -85,8 +86,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -94,6 +97,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -126,6 +134,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "createdAt": obj.get("createdAt"), "modifiedAt": obj.get("modifiedAt") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py index d5778d9f..a818e9cd 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py @@ -28,6 +28,7 @@ class PipelineId(BaseModel): PipelineId """ # noqa: E501 pipeline_id: Optional[StrictStr] = Field(default=None, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["pipelineId"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "pipelineId": obj.get("pipelineId") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py index da6363a8..9ef685f9 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py @@ -130,6 +130,47 @@ def from_json(cls, json_str: str) -> Self: error_messages = [] match = 0 + # use oneOf discriminator to lookup the data type + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) + if not _data_type: + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") + + # check if data type is `GoogleDrivePipelineMinimalResponse` + if _data_type == "GoogleDrive": + instance.actual_instance = GoogleDrivePipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `MSSharePointPipelineMinimalResponse` + if _data_type == "MSSharePoint": + instance.actual_instance = MSSharePointPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `S3PipelineMinimalResponse` + if _data_type == "S3": + instance.actual_instance = S3PipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `SDMPipelineMinimalResponse` + if _data_type == "SDM": + instance.actual_instance = SDMPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `SFTPPipelineMinimalResponse` + if _data_type == "SFTP": + instance.actual_instance = SFTPPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `ServiceNowPipelineMinimalResponse` + if _data_type == "ServiceNow": + instance.actual_instance = ServiceNowPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `WorkZonePipelineMinimalResponse` + if _data_type == "WorkZone": + instance.actual_instance = WorkZonePipelineMinimalResponse.from_json(json_str) + return instance + # deserialize data into MSSharePointPipelineMinimalResponse try: instance.actual_instance = MSSharePointPipelineMinimalResponse.from_json(json_str) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py index ff77906d..4a45ed49 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py @@ -28,6 +28,7 @@ class PostProcessingObjectReference(BaseModel): PostProcessingObjectReference """ # noqa: E501 id: Optional[StrictStr] = Field(default='6d3eeafd-f3db-4e8e-949a-0e40e50eab64', description="PerFilterSearchResult ID or PostProcessingOperation ID.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if id (nullable) is None # and model_fields_set contains the field if self.id is None and "id" in self.model_fields_set: @@ -88,6 +96,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "id": obj.get("id") if "id" in obj else '6d3eeafd-f3db-4e8e-949a-0e40e50eab64' }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py index a7c51da7..8e0d8dae 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py @@ -33,6 +33,7 @@ class PostProcessingOperation(BaseModel): max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", alias="maxChunkCount") strategy: Strategy inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -83,6 +86,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_inputs in self.inputs: _items.append(_item_inputs.to_dict() if _item_inputs is not None else None) _dict['inputs'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if id (nullable) is None # and model_fields_set contains the field if self.id is None and "id" in self.model_fields_set: @@ -110,6 +118,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "strategy": Strategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py index 798a6c61..cc6c0389 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py @@ -30,6 +30,7 @@ class RetrievalBinaryBooleanFilter(BaseModel): operator: StrictStr left: Left right: Right + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["operator", "left", "right"] @field_validator('operator') @@ -69,8 +70,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -84,6 +87,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of right if self.right: _dict['right'] = self.right.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -100,6 +108,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "left": Left.from_dict(obj["left"]) if obj.get("left") is not None else None, "right": Right.from_dict(obj["right"]) if obj.get("right") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj from gen_ai_hub.document_grounding_generation.generated.models.left import Left diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py index 2c4a64fa..48240de4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py @@ -35,6 +35,7 @@ class RetrievalChunk(BaseModel): metadata: Optional[List[RetrievalKeyValueListPair]] = None search_scores: Optional[SearchScores] = Field(default=None, alias="searchScores") post_processing_score: Optional[Score] = Field(default=None, alias="postProcessingScore") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "content", "metadata", "searchScores", "postProcessingScore"] model_config = ConfigDict( @@ -67,8 +68,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -88,6 +91,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of post_processing_score if self.post_processing_score: _dict['postProcessingScore'] = self.post_processing_score.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -106,6 +114,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "searchScores": SearchScores.from_dict(obj["searchScores"]) if obj.get("searchScores") is not None else None, "postProcessingScore": Score.from_dict(obj["postProcessingScore"]) if obj.get("postProcessingScore") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py index a6deb470..d4dce8f4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py @@ -29,6 +29,7 @@ class RetrievalDataRepositorySearchResult(BaseModel): RetrievalDataRepositorySearchResult """ # noqa: E501 data_repository: DataRepositoryWithDocuments = Field(alias="dataRepository") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepository"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of data_repository if self.data_repository: _dict['dataRepository'] = self.data_repository.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py index 14f64d4b..4fd73ce7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py @@ -32,6 +32,7 @@ class RetrievalDocumentKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -89,6 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "matchMode": obj.get("matchMode") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py index ec2cb084..2e231d3d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py @@ -30,6 +30,7 @@ class RetrievalKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -86,6 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "key": obj.get("key"), "value": obj.get("value") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py index 46a27abd..2b31ca6a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py @@ -31,6 +31,7 @@ class RetrievalPerFilterSearchResult(BaseModel): filter_id: StrictStr = Field(alias="filterId") results: Optional[List[RetrievalDataRepositorySearchResult]] = Field(default=None, description="List of returned results.") remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly Destination Name of remote instance (grounding.name). Only present if dataRepositoryType = remote:dg.", alias="remoteGroundingName") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results", "remoteGroundingName"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if remote_grounding_name (nullable) is None # and model_fields_set contains the field if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: @@ -99,6 +107,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "results": [RetrievalDataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, "remoteGroundingName": obj.get("remoteGroundingName") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py index f2ca28a2..af0f11fb 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py @@ -28,6 +28,7 @@ class RetrievalPerFilterSearchResultError(BaseModel): Error message if any. """ # noqa: E501 message: StrictStr + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["message"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "message": obj.get("message") if obj.get("message") is not None else 'Unknown Error Occurred' }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py index e5cc642b..3cfda5ad 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py @@ -30,6 +30,7 @@ class RetrievalPerFilterSearchResultWithError(BaseModel): """ # noqa: E501 filter_id: StrictStr = Field(alias="filterId") error: Optional[RetrievalPerFilterSearchResultError] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "error"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -74,6 +77,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of error if self.error: _dict['error'] = self.error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -89,6 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "filterId": obj.get("filterId"), "error": RetrievalPerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py index 48735814..6b5a8297 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py @@ -31,6 +31,7 @@ class RetrievalScopedKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] scope: Optional[StrictStr] = 'document' + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "scope"] @field_validator('scope') @@ -73,8 +74,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -82,6 +85,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "scope": obj.get("scope") if obj.get("scope") is not None else 'document' }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py index 492b7708..c54200f2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py @@ -30,6 +30,7 @@ class RetrievalSearchConfiguration(BaseModel): """ # noqa: E501 max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if max_chunk_count (nullable) is None # and model_fields_set contains the field if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: @@ -96,6 +104,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "maxChunkCount": obj.get("maxChunkCount"), "maxDocumentCount": obj.get("maxDocumentCount") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py index 759ceb20..0f0a9373 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py @@ -32,6 +32,7 @@ class RetrievalSearchDocumentKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] select_mode: Optional[List[RetrievalSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if select_mode (nullable) is None # and model_fields_set contains the field if self.select_mode is None and "select_mode" in self.model_fields_set: @@ -94,6 +102,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "selectMode": obj.get("selectMode") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py index f7c45cb1..cef065fa 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py @@ -39,6 +39,7 @@ class RetrievalSearchFilter(BaseModel): data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", alias="dataRepositoryMetadata") document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata"] model_config = ConfigDict( @@ -71,8 +72,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -101,6 +104,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_chunk_metadata in self.chunk_metadata: _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) _dict['chunkMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if search_configuration (nullable) is None # and model_fields_set contains the field if self.search_configuration is None and "search_configuration" in self.model_fields_set: @@ -132,6 +140,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "documentMetadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, "chunkMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py index 85908186..57642540 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py @@ -33,6 +33,7 @@ class RetrievalSearchInput(BaseModel): query: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(description="Query string") filters: List[FiltersInner] post_processing: Optional[List[RetrievalSearchInputPostProcessingInner]] = Field(default=None, description="List of operations to be performed across PerFilterSearchResults.", alias="postProcessing") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["query", "filters", "postProcessing"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -86,6 +89,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_post_processing in self.post_processing: _items.append(_item_post_processing.to_dict() if _item_post_processing is not None else None) _dict['postProcessing'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if query (nullable) is None # and model_fields_set contains the field if self.query is None and "query" in self.model_fields_set: @@ -107,6 +115,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "filters": [FiltersInner.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None, "postProcessing": [RetrievalSearchInputPostProcessingInner.from_dict(_item) for _item in obj["postProcessing"]] if obj.get("postProcessing") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py index b129576c..bbbfa52a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py @@ -34,6 +34,7 @@ class RetrievalSearchInputPostProcessingInner(BaseModel): max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", alias="maxChunkCount") strategy: RetrievalSearchInputPostProcessingInnerStrategy inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] model_config = ConfigDict( @@ -66,8 +67,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -84,6 +87,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_inputs in self.inputs: _items.append(_item_inputs.to_dict() if _item_inputs is not None else None) _dict['inputs'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if id (nullable) is None # and model_fields_set contains the field if self.id is None and "id" in self.model_fields_set: @@ -111,6 +119,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "strategy": RetrievalSearchInputPostProcessingInnerStrategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py index ce50ad33..03453344 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py @@ -29,6 +29,7 @@ class RetrievalSearchResults(BaseModel): RetrievalSearchResults """ # noqa: E501 results: List[ResultsInner1] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "results": [ResultsInner1.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py index 4e53a26d..f5857e19 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py @@ -43,6 +43,7 @@ class RetrievalVectorSearchFilter(BaseModel): chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") filter: Optional[RetrievalVectorSearchFilterFilter] = None scoring_configuration: Optional[VectorScoringConfiguration] = Field(default=None, alias="scoringConfiguration") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata", "filter", "scoringConfiguration"] model_config = ConfigDict( @@ -75,8 +76,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -111,6 +114,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of scoring_configuration if self.scoring_configuration: _dict['scoringConfiguration'] = self.scoring_configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if search_configuration (nullable) is None # and model_fields_set contains the field if self.search_configuration is None and "search_configuration" in self.model_fields_set: @@ -149,6 +157,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "filter": RetrievalVectorSearchFilterFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, "scoringConfiguration": VectorScoringConfiguration.from_dict(obj["scoringConfiguration"]) if obj.get("scoringConfiguration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py index 09b78d63..4c0a9ff6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py @@ -18,7 +18,7 @@ import json from pydantic import BaseModel, ConfigDict -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow from typing import Optional, Set from typing_extensions import Self diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py index 0575e4fc..e222fb8d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py @@ -33,6 +33,7 @@ class S3PipelineGetResponse(BaseModel): type: StrictStr metadata: Optional[MetaData] = None configuration: S3Configuration + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] @field_validator('type') @@ -72,8 +73,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -87,6 +90,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -104,6 +112,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, "configuration": S3Configuration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py index 03f9cb9f..d57e24f9 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py @@ -34,6 +34,7 @@ class S3PipelineMinimalResponse(BaseModel): type: StrictStr configuration: Optional[S3ConfigurationMinimal] = None metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] @field_validator('type') @@ -73,8 +74,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -85,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -108,6 +116,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "configuration": S3ConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, "metadata": obj.get("metadata") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py index ae037ecb..5a21ab75 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py @@ -31,6 +31,7 @@ class ScopedKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] scope: Optional[StrictStr] = Field(default='document', description="Scope of the metadata filter (e.g., collection, document, chunk)") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "scope"] @field_validator('scope') @@ -73,8 +74,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -82,6 +85,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "scope": obj.get("scope") if obj.get("scope") is not None else 'document' }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py index dbb8398b..2aea571f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py @@ -28,6 +28,7 @@ class Score(BaseModel): Score """ # noqa: E501 value: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["value"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "value": obj.get("value") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py index b6418521..836e2040 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py @@ -31,6 +31,7 @@ class SDMPipelineGetResponse(BaseModel): id: StrictStr type: StrictStr metadata: MetaData + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata"] @field_validator('type') @@ -70,8 +71,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -82,6 +85,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of metadata if self.metadata: _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py index 578e1187..036e1777 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py @@ -32,6 +32,7 @@ class SDMPipelineMinimalResponse(BaseModel): status: Optional[PipelineExecutionStatus] type: StrictStr metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] @field_validator('type') @@ -71,8 +72,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -80,6 +83,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "metadata": obj.get("metadata") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py index a909b072..b9640c31 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py @@ -30,6 +30,7 @@ class SearchConfiguration(BaseModel): """ # noqa: E501 max_chunk_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") max_document_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if max_chunk_count (nullable) is None # and model_fields_set contains the field if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: @@ -96,6 +104,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "maxChunkCount": obj.get("maxChunkCount"), "maxDocumentCount": obj.get("maxDocumentCount") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py index 24011973..931337e3 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py @@ -32,6 +32,7 @@ class SearchDocumentKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] select_mode: Optional[List[Optional[SearchSelectOptionEnum]]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -89,6 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "selectMode": obj.get("selectMode") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py index 5c4583c0..1d29a9ce 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py @@ -37,6 +37,7 @@ class SearchFilter(BaseModel): collection_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", alias="collectionMetadata") document_metadata: Optional[Annotated[List[SearchDocumentKeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") chunk_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata"] model_config = ConfigDict( @@ -69,8 +70,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -99,6 +102,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_chunk_metadata in self.chunk_metadata: _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) _dict['chunkMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -118,6 +126,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "documentMetadata": [SearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, "chunkMetadata": [KeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py index ed1e0699..cd10b010 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py @@ -29,6 +29,7 @@ class SearchPipeline(BaseModel): SearchPipeline """ # noqa: E501 data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Search for metadata happens at key level. Pipelines matching the search criteria will be returned.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_data_repository_metadata in self.data_repository_metadata: _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py index e953ba64..5f4b7068 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py @@ -30,6 +30,7 @@ class SearchPipelinesResponse(BaseModel): """ # noqa: E501 count: Optional[StrictInt] = None resources: List[PipelineMinimalResponse] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_resources in self.resources: _items.append(_item_resources.to_dict() if _item_resources is not None else None) _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "count": obj.get("count"), "resources": [PipelineMinimalResponse.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py index 8b6d6f88..00225e3e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py @@ -29,6 +29,7 @@ class SearchResults(BaseModel): SearchResults """ # noqa: E501 results: List[ResultsInner] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "results": [ResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py index 994a2337..42813130 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py @@ -30,6 +30,7 @@ class SearchScores(BaseModel): """ # noqa: E501 aggregated_score: SearchScoresAggregatedScore = Field(alias="aggregatedScore") dense_retrieval_score: SearchScoresAggregatedScore = Field(alias="denseRetrievalScore") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["aggregatedScore", "denseRetrievalScore"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of dense_retrieval_score if self.dense_retrieval_score: _dict['denseRetrievalScore'] = self.dense_retrieval_score.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "aggregatedScore": SearchScoresAggregatedScore.from_dict(obj["aggregatedScore"]) if obj.get("aggregatedScore") is not None else None, "denseRetrievalScore": SearchScoresAggregatedScore.from_dict(obj["denseRetrievalScore"]) if obj.get("denseRetrievalScore") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py index 01e55ebc..8b2a8340 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py @@ -28,6 +28,7 @@ class SearchScoresAggregatedScore(BaseModel): SearchScoresAggregatedScore """ # noqa: E501 value: Optional[Union[StrictFloat, StrictInt]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["value"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "value": obj.get("value") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py index 7b9e725f..a492b78e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py @@ -18,7 +18,7 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, Optional from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow from typing import Optional, Set from typing_extensions import Self diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py index d9861f72..ba79955f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py @@ -28,6 +28,7 @@ class ServiceNowConfigurationMinimalServiceNow(BaseModel): ServiceNowConfigurationMinimalServiceNow """ # noqa: E501 include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["includePaths"] model_config = ConfigDict( @@ -60,8 +61,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -69,6 +72,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -83,6 +91,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "includePaths": obj.get("includePaths") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py index 543113cb..aa43a987 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py @@ -33,6 +33,7 @@ class ServiceNowPipelineGetResponse(BaseModel): type: StrictStr metadata: Optional[MetaData] = None configuration: ServiceNowConfigurationMinimal + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] @field_validator('type') @@ -72,8 +73,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -87,6 +90,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -104,6 +112,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, "configuration": ServiceNowConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py index f2c70703..b52e3bf1 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py @@ -32,6 +32,7 @@ class ServiceNowPipelineMinimalResponse(BaseModel): status: Optional[PipelineExecutionStatus] type: StrictStr metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] @field_validator('type') @@ -71,8 +72,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -80,6 +83,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "metadata": obj.get("metadata") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py index 2150c856..af6b5cf3 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py @@ -18,7 +18,7 @@ import json from pydantic import BaseModel, ConfigDict -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow from typing import Optional, Set from typing_extensions import Self diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py index bc04e535..2e7df6af 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py @@ -33,6 +33,7 @@ class SFTPPipelineGetResponse(BaseModel): type: StrictStr metadata: Optional[MetaData] = None configuration: SFTPConfiguration + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] @field_validator('type') @@ -72,8 +73,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -87,6 +90,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -104,6 +112,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, "configuration": SFTPConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py index 25436e38..1fd38018 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py @@ -34,6 +34,7 @@ class SFTPPipelineMinimalResponse(BaseModel): type: StrictStr configuration: Optional[SFTPConfigurationMinimal] = None metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] @field_validator('type') @@ -73,8 +74,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -85,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of configuration if self.configuration: _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -108,6 +116,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "configuration": SFTPConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, "metadata": obj.get("metadata") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py index 809b82d2..3b6992af 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py @@ -29,6 +29,7 @@ class SharePointConfigGetResponse(BaseModel): SharePointConfigGetResponse """ # noqa: E501 site: SharePointSiteGetResponse + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["site"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of site if self.site: _dict['site'] = self.site.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "site": SharePointSiteGetResponse.from_dict(obj["site"]) if obj.get("site") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py index afc908a8..913f465e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py @@ -30,6 +30,7 @@ class SharePointSiteDetail(BaseModel): id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["sharepoint-site-id"]}) name: StrictStr = Field(json_schema_extra={"examples": ["sharepoint-site-name"]}) include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "includePaths": obj.get("includePaths") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py index b4ff0d74..45411d5e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py @@ -30,6 +30,7 @@ class SharePointSiteGetResponse(BaseModel): id: Optional[StrictStr] = None name: StrictStr include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,6 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "includePaths": obj.get("includePaths") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py index 676e490d..b16fe6a1 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py @@ -32,6 +32,7 @@ class TextOnlyBaseChunk(BaseModel): content: StrictStr metadata: Optional[List[VectorKeyValueListPair]] = None id: UUID = Field(description="Unique identifier of a chuk.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["content", "metadata", "id"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -79,6 +82,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -95,6 +103,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, "id": obj.get("id") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py index 4a391496..504e89c5 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py @@ -30,6 +30,7 @@ class TextOnlyBaseChunkCreate(BaseModel): """ # noqa: E501 content: StrictStr metadata: Optional[List[VectorKeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["content", "metadata"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "content": obj.get("content"), "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py index fd74b28c..a93c7340 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py @@ -31,6 +31,7 @@ class TextSearchRequest(BaseModel): """ # noqa: E501 query: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=2000)]] = Field(description="Query string") filters: List[VectorSearchFilter] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["query", "filters"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_filters in self.filters: _items.append(_item_filters.to_dict() if _item_filters is not None else None) _dict['filters'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if query (nullable) is None # and model_fields_set contains the field if self.query is None and "query" in self.model_fields_set: @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "query": obj.get("query"), "filters": [VectorSearchFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py index 11fb83aa..cb315551 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py @@ -33,6 +33,7 @@ class ValidationError(BaseModel): type: StrictStr input: Optional[Any] = None ctx: Optional[Dict[str, Any]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"] model_config = ConfigDict( @@ -65,8 +66,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -80,6 +83,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_loc in self.loc: _items.append(_item_loc.to_dict() if _item_loc is not None else None) _dict['loc'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if input (nullable) is None # and model_fields_set contains the field if self.input is None and "input" in self.model_fields_set: @@ -103,6 +111,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "input": obj.get("input"), "ctx": obj.get("ctx") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py index abb8ac45..5dd9b599 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py @@ -31,6 +31,7 @@ class VectorChunk(BaseModel): id: StrictStr content: StrictStr metadata: Optional[List[VectorKeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "content", "metadata"] model_config = ConfigDict( @@ -63,8 +64,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -78,6 +81,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_metadata in self.metadata: _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -94,6 +102,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "content": obj.get("content"), "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py index 26de54e7..f506871c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py @@ -32,6 +32,7 @@ class VectorDocumentKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -89,6 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "matchMode": obj.get("matchMode") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py index cecb792c..0e8b8044 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py @@ -30,6 +30,7 @@ class VectorKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -86,6 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "key": obj.get("key"), "value": obj.get("value") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py index 796a8982..7afeb435 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py @@ -30,6 +30,7 @@ class VectorPerFilterSearchResult(BaseModel): """ # noqa: E501 filter_id: StrictStr = Field(alias="filterId") results: List[DocumentsChunk] + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -77,6 +80,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -92,6 +100,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "filterId": obj.get("filterId"), "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py index cd8969bc..2a3e73c2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py @@ -36,6 +36,7 @@ class VectorScoringConfiguration(BaseModel): boosting: Optional[BoostingScoringConfiguration] = None score_threshold: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum chunk score threshold.", alias="scoreThreshold") aggregation_strategy: Optional[ScoresAggregationStrategy] = Field(default=None, alias="aggregationStrategy") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["denseRetrieval", "keywordRetrieval", "boosting", "scoreThreshold", "aggregationStrategy"] model_config = ConfigDict( @@ -68,8 +69,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -86,6 +89,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of boosting if self.boosting: _dict['boosting'] = self.boosting.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if score_threshold (nullable) is None # and model_fields_set contains the field if self.score_threshold is None and "score_threshold" in self.model_fields_set: @@ -109,6 +117,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "scoreThreshold": obj.get("scoreThreshold"), "aggregationStrategy": obj.get("aggregationStrategy") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py index 9f7f7b83..cfab2a1a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py @@ -30,6 +30,7 @@ class VectorSearchConfiguration(BaseModel): """ # noqa: E501 max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] model_config = ConfigDict( @@ -62,8 +63,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -71,6 +74,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if max_chunk_count (nullable) is None # and model_fields_set contains the field if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: @@ -96,6 +104,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "maxChunkCount": obj.get("maxChunkCount"), "maxDocumentCount": obj.get("maxDocumentCount") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py index 6e902c3a..58d7eb2f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py @@ -32,6 +32,7 @@ class VectorSearchDocumentKeyValueListPair(BaseModel): key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] select_mode: Optional[List[VectorSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] model_config = ConfigDict( @@ -64,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -73,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if select_mode (nullable) is None # and model_fields_set contains the field if self.select_mode is None and "select_mode" in self.model_fields_set: @@ -94,6 +102,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "value": obj.get("value"), "selectMode": obj.get("selectMode") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py index d2c1db4c..dfa5cd5a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py @@ -38,6 +38,7 @@ class VectorSearchFilter(BaseModel): document_metadata: Optional[List[VectorSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") chunk_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") filter: Optional[Filter] = None + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata", "filter"] model_config = ConfigDict( @@ -70,8 +71,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -103,6 +106,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of filter if self.filter: _dict['filter'] = self.filter.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if collection_metadata (nullable) is None # and model_fields_set contains the field if self.collection_metadata is None and "collection_metadata" in self.model_fields_set: @@ -138,6 +146,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "chunkMetadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None, "filter": Filter.from_dict(obj["filter"]) if obj.get("filter") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py index eba65266..19ef9047 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py @@ -29,6 +29,7 @@ class VectorSearchResults(BaseModel): VectorSearchResults """ # noqa: E501 results: List[VectorPerFilterSearchResult] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( @@ -61,8 +62,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -76,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: for _item_results in self.results: _items.append(_item_results.to_dict() if _item_results is not None else None) _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "results": [VectorPerFilterSearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py index 75b30a91..a879b2ef 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py @@ -31,6 +31,7 @@ class WorkZonePipelineGetResponse(BaseModel): id: StrictStr type: StrictStr metadata: MetaData + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "type", "metadata"] @field_validator('type') @@ -70,8 +71,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -82,6 +85,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of metadata if self.metadata: _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -98,6 +106,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py index 2bfdb09c..3051d0a7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py @@ -32,6 +32,7 @@ class WorkZonePipelineMinimalResponse(BaseModel): status: Optional[PipelineExecutionStatus] type: StrictStr metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] @field_validator('type') @@ -71,8 +72,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -80,6 +83,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -102,6 +110,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "metadata": obj.get("metadata") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py index 052a4b84..e6b72c68 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py @@ -12,180 +12,83 @@ """ # noqa: E501 -import ipaddress import io import json import re import ssl -from urllib.parse import urlparse +from typing import Optional, Union -import urllib3 +import httpx from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiException, ApiValueError -SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} -RESTResponseType = urllib3.HTTPResponse - - -def is_socks_proxy_url(url): - if url is None: - return False - split_section = url.split("://") - if len(split_section) < 2: - return False - else: - return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES - -def contenttype_matches(contenttype, maintype, subtype): - """Matches the given contenttype against the given type and subtype - - :param contenttype: the content type to match - :param maintype: the expected maintype - :param subtype: the expected subtype - :return: `true` when the given content type matches the given type and subtype, - regardless of the presence of mime type parameters, otherwise returns `false`. - :rtype: bool - """ - pattern = '{type}/(?:[^+;]+\\+)?{subtype}(?:[ \t]*;.*)?'.format( - type = re.escape(maintype), - subtype = re.escape(subtype), - ) - return re.fullmatch(pattern, contenttype, re.IGNORECASE) is not None - -def should_bypass_proxies(url: str, no_proxy: str) -> bool: - """Return whether ``url`` matches the comma-separated ``no_proxy`` rules.""" - parsed_url = urlparse(url) - if not parsed_url.hostname: - return True - - host = parsed_url.hostname.lower() - host_and_port = parsed_url.netloc.lower() - try: - host_ip = ipaddress.ip_address(host) - except ValueError: - host_ip = None - - for entry in (entry.strip().lower() for entry in no_proxy.split(',')): - if not entry: - continue - if entry == '*': - return True - - if host_ip is not None: - try: - if host_ip in ipaddress.ip_network(entry, strict=False): - return True - except ValueError: - pass - - entry = entry.lstrip('.') - if ( - host == entry - or host.endswith('.' + entry) - or host_and_port == entry - or host_and_port.endswith('.' + entry) - ): - return True - - return False - +RESTResponseType = httpx.Response class RESTResponse(io.IOBase): def __init__(self, resp) -> None: self.response = resp - self.status = resp.status - self.reason = resp.reason + self.status = resp.status_code + self.reason = resp.reason_phrase self.data = None - def read(self): + async def read(self): if self.data is None: - self.data = self.response.data + self.data = await self.response.aread() return self.data @property def headers(self): - """Returns a dictionary of response headers.""" + """Returns a CIMultiDictProxy of response headers.""" return self.response.headers def getheaders(self): - """Returns a dictionary of the response headers; use ``headers`` instead.""" + """Returns a CIMultiDictProxy of the response headers; use ``headers`` instead.""" return self.response.headers def getheader(self, name, default=None): - """Returns a given response header; use ``headers.get()`` instead.""" + """Returns a given response header; use ``headers`` instead.""" return self.response.headers.get(name, default) class RESTClientObject: def __init__(self, configuration) -> None: - # urllib3.PoolManager will pass all kw parameters to connectionpool - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 - - # cert_reqs - if configuration.verify_ssl: - cert_reqs = ssl.CERT_REQUIRED - else: - cert_reqs = ssl.CERT_NONE - - pool_args = { - "cert_reqs": cert_reqs, - "ca_certs": configuration.ssl_ca_cert, - "cert_file": configuration.cert_file, - "key_file": configuration.key_file, - "ca_cert_data": configuration.ca_cert_data, - } - if configuration.assert_hostname is not None: - pool_args['assert_hostname'] = ( - configuration.assert_hostname - ) - if configuration.retries is not None: - pool_args['retries'] = configuration.retries + # maxsize is number of requests to host that are allowed in parallel + self.maxsize = configuration.connection_pool_maxsize - if configuration.tls_server_name: - pool_args['server_hostname'] = configuration.tls_server_name + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, + ) + if configuration.cert_file: + self.ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + if not configuration.verify_ssl: + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE - if configuration.socket_options is not None: - pool_args['socket_options'] = configuration.socket_options + self.proxy = configuration.proxy + self.proxy_headers = configuration.proxy_headers - if configuration.connection_pool_maxsize is not None: - pool_args['maxsize'] = configuration.connection_pool_maxsize + self.pool_manager: Optional[httpx.AsyncClient] = None - # https pool manager - self.pool_manager: urllib3.PoolManager + async def close(self): + if self.pool_manager is not None: + await self.pool_manager.aclose() - if configuration.proxy and not should_bypass_proxies( - configuration.host, configuration.no_proxy or '' - ): - if is_socks_proxy_url(configuration.proxy): - from urllib3.contrib.socks import SOCKSProxyManager - pool_args["proxy_url"] = configuration.proxy - pool_args["headers"] = configuration.proxy_headers - self.pool_manager = SOCKSProxyManager(**pool_args) - else: - pool_args["proxy_url"] = configuration.proxy - pool_args["proxy_headers"] = configuration.proxy_headers - if configuration.proxy_ssl_context is not None: - pool_args["proxy_ssl_context"] = configuration.proxy_ssl_context - self.pool_manager = urllib3.ProxyManager(**pool_args) - else: - self.pool_manager = urllib3.PoolManager(**pool_args) - - def request( - self, - method, - url, - headers=None, - body=None, - post_params=None, - _request_timeout=None - ): - """Perform requests. + async def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None): + """Execute request :param method: http request method :param url: http request url @@ -217,118 +120,82 @@ def request( post_params = post_params or {} headers = headers or {} + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' - timeout = None - if _request_timeout: - if isinstance(_request_timeout, (int, float)): - timeout = urllib3.Timeout(total=_request_timeout) - elif ( - isinstance(_request_timeout, tuple) - and len(_request_timeout) == 2 - ): - timeout = urllib3.Timeout( - connect=_request_timeout[0], - read=_request_timeout[1] - ) - - try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - - content_type = headers.get('Content-Type') - is_json = ( - not content_type - or contenttype_matches(content_type, 'application', 'json') - ) - # JSON is valid YAML 1.2, so structured YAML bodies can use - # the existing JSON serializer: - # https://yaml.org/spec/1.2.2/#13-relation-to-json - is_structured_yaml = ( - content_type - and ( - contenttype_matches(content_type, 'application', 'yaml') - or contenttype_matches(content_type, 'text', 'yaml') - or contenttype_matches(content_type, 'text', 'x-yaml') - ) - and not isinstance(body, (str, bytes)) - ) - if is_json or is_structured_yaml: - request_body = None - if body is not None: - request_body = json.dumps(body) - r = self.pool_manager.request( - method, - url, - body=request_body, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=False, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif contenttype_matches(content_type, 'multipart', 'form-data'): - # must del headers['Content-Type'], or the correct - # Content-Type which generated by urllib3 will be - # overwritten. - del headers['Content-Type'] - # Ensures that dict objects are serialized - post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=True, - timeout=timeout, - headers=headers, - preload_content=False - ) - # Pass a `string` parameter directly in the body to support - # other content types than JSON when `body` argument is - # provided in serialized form. - elif isinstance(body, str) or isinstance(body, bytes): - r = self.pool_manager.request( - method, - url, - body=body, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif content_type.startswith('text/') and isinstance(body, bool): - request_body = "true" if body else "false" - r = self.pool_manager.request( - method, - url, - body=request_body, - preload_content=False, - timeout=timeout, - headers=headers) - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise ApiException(status=0, reason=msg) - # For `GET`, `HEAD` + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + args["json"] = body + if body is None and post_params: + args["json"] = dict(post_params) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + args["data"] = dict(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by httpx + del headers['Content-Type'] + + files = [] + data = {} + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + files.append((k, v)) + else: + # Ensures that dict objects are serialized + if isinstance(v, dict): + v = json.dumps(v) + elif isinstance(v, int): + v = str(v) + data[k] = v + + if files: + args["files"] = files + if data: + args["data"] = data + + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + args["data"] = body else: - r = self.pool_manager.request( - method, - url, - fields={}, - timeout=timeout, - headers=headers, - preload_content=False - ) - except urllib3.exceptions.SSLError as e: - msg = "\n".join([type(e).__name__, str(e)]) - raise ApiException(status=0, reason=msg) + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + if self.pool_manager is None: + self.pool_manager = self._create_pool_manager() + r = await self.pool_manager.request(**args) return RESTResponse(r) + + def _create_pool_manager(self) -> httpx.AsyncClient: + limits = httpx.Limits(max_connections=self.maxsize) + + proxy = None + if self.proxy: + proxy = httpx.Proxy( + url=self.proxy, + headers=self.proxy_headers + ) + + return httpx.AsyncClient( + limits=limits, + proxy=proxy, + verify=self.ssl_context, + trust_env=True + ) diff --git a/packages/gen/openapitools.json b/packages/gen/openapitools.json new file mode 100644 index 00000000..8dd0d745 --- /dev/null +++ b/packages/gen/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.25.0" + } +} diff --git a/packages/openapi-generator/specs/document-grounding/api.yaml b/packages/gen/specs/document-grounding/api.yaml similarity index 100% rename from packages/openapi-generator/specs/document-grounding/api.yaml rename to packages/gen/specs/document-grounding/api.yaml diff --git a/packages/openapi-generator/specs/document-grounding/options-per-service.json b/packages/gen/specs/document-grounding/options-per-service.json similarity index 100% rename from packages/openapi-generator/specs/document-grounding/options-per-service.json rename to packages/gen/specs/document-grounding/options-per-service.json diff --git a/packages/openapi-generator/Makefile b/packages/openapi-generator/Makefile index 89f28eb3..8914136c 100644 --- a/packages/openapi-generator/Makefile +++ b/packages/openapi-generator/Makefile @@ -1,41 +1,6 @@ -PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -SPEC_DIR := $(PKG_DIR)specs/document-grounding -OPTIONS_FILE := $(SPEC_DIR)/options-per-service.json -SPEC_KEY := src/spec/api.yaml -SPEC_INPUT := $(SPEC_DIR)/api.yaml -PROCESSED := $(PKG_DIR).cache/processed.yaml -MAPPINGS := $(PKG_DIR).cache/mappings.yaml -GEN_TMP := $(PKG_DIR).cache/gen-tmp -GEN_OUT := $(PKG_DIR)../../gen/gen_ai_hub/document_grounding_generation/generated -CONFIG := $(PKG_DIR)config/python-config.yaml -# Fully-qualified import prefix used inside the generated files after rewriting -GEN_PKG := gen_ai_hub.document_grounding_generation.generated +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -.PHONY: generate test - -generate: - mkdir -p $(PKG_DIR).cache - uv run --package sap-openapi-generator python -m sap_openapi_generator.preprocess_spec \ - --input $(SPEC_INPUT) \ - --output $(PROCESSED) \ - --options $(OPTIONS_FILE) \ - --spec-key "$(SPEC_KEY)" \ - --mappings-output $(MAPPINGS) - npx --yes @openapitools/openapi-generator-cli generate \ - -g python \ - -i $(PROCESSED) \ - -o $(GEN_TMP) \ - -c $(CONFIG) \ - $$([ -f $(MAPPINGS) ] && echo "--config $(MAPPINGS)") \ - --additional-properties packageName=generated - rm -rf $(GEN_OUT) - mv $(GEN_TMP)/generated $(GEN_OUT) - rm -rf $(GEN_TMP) $(PROCESSED) $(MAPPINGS) - # Rewrite bare 'generated' imports to fully-qualified package path - find $(GEN_OUT) -name "*.py" -exec \ - sed -i '' \ - 's/from generated\./from $(GEN_PKG)./g; s/import generated\./import $(GEN_PKG)./g; s/from generated import /from $(GEN_PKG) import /g' \ - {} + +.PHONY: test test: uv run --package sap-openapi-generator pytest $(PKG_DIR)tests/ -v diff --git a/packages/openapi-generator/config/python-config.yaml b/packages/openapi-generator/config/python-config.yaml index 39f2dc80..220c9ddc 100644 --- a/packages/openapi-generator/config/python-config.yaml +++ b/packages/openapi-generator/config/python-config.yaml @@ -17,8 +17,6 @@ generatorName: python -# Override at call site with --additional-properties packageName= -packageName: generated_client packageVersion: "1.0.0" # HTTP backend: urllib3 (sync, default), asyncio (async), httpx (sync+async) @@ -34,6 +32,12 @@ additionalProperties: # Emit only Python source files; the parent package owns pyproject.toml/setup.py generateSourceCodeOnly: true +globalProperties: + apiDocs: "false" + modelDocs: "false" + apiTests: "false" + modelTests: "false" + # Ensure only the first tag drives API class assignment. # The pre-processor sets exactly one tag per operation, so this is a safety net. openapiNormalizer: diff --git a/packages/openapi-generator/pyproject.toml b/packages/openapi-generator/pyproject.toml index 39695398..e582bd15 100644 --- a/packages/openapi-generator/pyproject.toml +++ b/packages/openapi-generator/pyproject.toml @@ -16,6 +16,7 @@ dependencies = [ [project.scripts] sap-preprocess-spec = "sap_openapi_generator.preprocess_spec:main" +sap-generate = "sap_openapi_generator.generate:main" [dependency-groups] dev = [ diff --git a/packages/openapi-generator/src/sap_openapi_generator/generate.py b/packages/openapi-generator/src/sap_openapi_generator/generate.py new file mode 100644 index 00000000..20427f5f --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/generate.py @@ -0,0 +1,152 @@ +"""End-to-end OpenAPI generation pipeline for SAP Cloud SDK Python packages. + +Runs the full pipeline in one command: + 1. Pre-process the spec (vendor extension resolution, base-path injection) + 2. Invoke openapi-generator-cli via npx + 3. Rewrite bare `generated.*` imports to a fully-qualified package path + 4. Touch py.typed (httpx template omits it) + +Usage: + sap-generate \\ + --spec path/to/api.yaml \\ + --output path/to/output/dir \\ + --package-name my_pkg.sub.generated \\ + [--options path/to/options-per-service.json] \\ + [--spec-key src/spec/api.yaml] \\ + [--config path/to/python-config.yaml] +""" + +from __future__ import annotations + +import argparse +import os +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +from sap_openapi_generator.preprocess_spec import preprocess + +_DEFAULT_CONFIG = Path(__file__).parent.parent.parent / "config" / "python-config.yaml" + + +def _build_opid_flags(mappings_path: Path) -> list[str]: + if not mappings_path.exists() or not mappings_path.stat().st_size: + return [] + flags = [] + for line in mappings_path.read_text().splitlines(): + line = line.strip() + if line: + flags += ["--operation-id-name-mappings", line] + return flags + + +def _rewrite_imports(output_dir: Path, package_name: str) -> None: + """Rewrite bare 'generated' imports to the fully-qualified package path.""" + for py_file in output_dir.rglob("*.py"): + src = py_file.read_text() + updated = ( + src + .replace("from generated.", f"from {package_name}.") + .replace("import generated.", f"import {package_name}.") + .replace("from generated import ", f"from {package_name} import ") + ) + if updated != src: + py_file.write_text(updated) + + +def generate( + spec_path: Path, + output_dir: Path, + package_name: str, + options_path: Path | None = None, + spec_key: str | None = None, + config_path: Path | None = None, +) -> None: + config_path = config_path or _DEFAULT_CONFIG + # The leaf package name used internally by the generator (always "generated") + leaf = "generated" + + with tempfile.TemporaryDirectory(prefix="sap-openapi-") as tmp: + tmp_path = Path(tmp) + processed = tmp_path / "processed.yaml" + mappings = tmp_path / "mappings.txt" + gen_tmp = tmp_path / "gen-tmp" + + preprocess( + input_path=spec_path, + output_path=processed, + options_path=options_path, + spec_key=spec_key, + mappings_output_path=mappings, + ) + + cmd = [ + "npx", "--yes", "@openapitools/openapi-generator-cli", "generate", + "-g", "python", + "-i", str(processed), + "-o", str(gen_tmp), + "-c", str(config_path), + "--additional-properties", f"packageName={leaf}", + ] + cmd += _build_opid_flags(mappings) + + result = subprocess.run(cmd, check=False) + if result.returncode != 0: + sys.exit(result.returncode) + + generated_src = gen_tmp / leaf + if not generated_src.exists(): + print( + f"ERROR: expected generated output at {generated_src} but it was not found.", + file=sys.stderr, + ) + sys.exit(1) + + if output_dir.exists(): + shutil.rmtree(output_dir) + shutil.move(str(generated_src), str(output_dir)) + + _rewrite_imports(output_dir, package_name) + (output_dir / "py.typed").touch() + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Run the full SAP OpenAPI generation pipeline." + ) + parser.add_argument("--spec", required=True, type=Path, help="Source spec file (.yaml or .json)") + parser.add_argument( + "--output", required=True, type=Path, + help="Output directory for generated Python files", + ) + parser.add_argument( + "--package-name", required=True, + help="Fully-qualified Python package name for import rewriting (e.g. my_pkg.sub.generated)", + ) + parser.add_argument( + "--options", type=Path, default=None, + help="Path to options-per-service.json", + ) + parser.add_argument( + "--spec-key", default=None, + help="Key in options-per-service.json for this spec (e.g. 'src/spec/api.yaml')", + ) + parser.add_argument( + "--config", type=Path, default=None, + help=f"openapi-generator config YAML (default: {_DEFAULT_CONFIG})", + ) + args = parser.parse_args() + generate( + spec_path=args.spec, + output_dir=args.output, + package_name=args.package_name, + options_path=args.options, + spec_key=args.spec_key, + config_path=args.config, + ) + + +if __name__ == "__main__": + main() diff --git a/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py index decbb48c..64400a9e 100644 --- a/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py +++ b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py @@ -77,12 +77,13 @@ def _snake_case(name: str) -> str: def apply_operation_name_extension(spec: dict) -> dict: """Overwrite operationId with x-sap-cloud-sdk-operation-name when present. - When two operations share the same desired name (valid in JS since they live in - different API classes), disambiguates by prefixing with the operation's tag: - e.g. both want "search" → "vector_search" and "retrieval_search" + When two operations in different tags share the same desired name (e.g. both + VectorApi and RetrievalApi want a method called "search"), the OAS spec requires + globally unique operationIds. The operationId is scoped to tag+name to satisfy + this, and operationIdNameMappings are returned so the generator renames the + Python method back to the desired short name within its class. - Returns an operationIdNameMappings dict (may be empty) that the generator config - should merge in, mapping the scoped operationId back to the desired method name. + Returns an operationIdNameMappings dict (may be empty). """ # First pass: collect all desired (tag, name) pairs to detect cross-tag collisions desired: list[tuple[dict, str, str]] = [] # (op_dict, desired_name, tag) @@ -193,10 +194,14 @@ def preprocess( mappings = apply_operation_name_extension(spec) validate_unique_operation_ids(spec) dump_spec(spec, output_path) - if mappings and mappings_output_path: + if mappings_output_path: mappings_output_path.parent.mkdir(parents=True, exist_ok=True) - with mappings_output_path.open("w") as f: - yaml.dump({"operationIdNameMappings": mappings}, f, sort_keys=True) + # Write as newline-separated key=value pairs for --operation-id-name-mappings. + lines = "\n".join( + f"{scoped}={desired}" + for scoped, desired in sorted(mappings.items()) + ) + mappings_output_path.write_text(lines) def main() -> None: diff --git a/uv.lock b/uv.lock index d28b26af..145a119b 100644 --- a/uv.lock +++ b/uv.lock @@ -23,6 +23,7 @@ members = [ "sap-ai-sdk-base", "sap-ai-sdk-core", "sap-ai-sdk-gen", + "sap-openapi-generator", ] [[package]] @@ -4270,6 +4271,29 @@ dev = [ { name = "sphinxawesome-theme" }, ] +[[package]] +name = "sap-openapi-generator" +version = "0.1.0" +source = { editable = "packages/openapi-generator" } +dependencies = [ + { name = "pyyaml" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-cov" }, +] + +[package.metadata] +requires-dist = [{ name = "pyyaml", specifier = ">=6.0" }] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.0" }, + { name = "pytest-cov", specifier = ">=5.0" }, +] + [[package]] name = "six" version = "1.17.0" From 94a0fd24cfb37639878f50d5e26305606fd1a8dd Mon Sep 17 00:00:00 2001 From: Zhongpin Wang Date: Mon, 31 Aug 2026 14:02:50 +0800 Subject: [PATCH 3/6] Support sync and align overall setup similar to JS --- Makefile | 7 +- .../openapitools.json => openapitools.json | 0 packages/gen/Makefile | 16 +- .../api/metadata_configurations_api.py | 763 +++++++ .../generated/api/pipelines_api.py | 1721 ++++++++++++++- .../generated/api/retrieval_api.py | 343 +++ .../generated/api/vector_api.py | 1897 ++++++++++++++++- .../generated/sync_helper.py | 57 + .../options-per-service.json | 5 +- .../config/openapitools.json | 7 - .../config/python-config.yaml | 2 + .../src/sap_openapi_generator/generate.py | 136 +- 12 files changed, 4800 insertions(+), 154 deletions(-) rename packages/openapi-generator/openapitools.json => openapitools.json (100%) create mode 100644 packages/gen/gen_ai_hub/document_grounding_generation/generated/sync_helper.py delete mode 100644 packages/openapi-generator/config/openapitools.json diff --git a/Makefile b/Makefile index 04a4a0ce..d268f7cd 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,13 @@ -.PHONY: install docs lint license-check test test-integration test-pkg test-pkg-integration +.PHONY: install generate docs lint license-check test test-integration test-pkg test-pkg-integration install: uv sync --all-packages --all-extras +GENERATE_PACKAGES := $(dir $(shell grep -rl "^generate:" packages/*/Makefile 2>/dev/null)) + +generate: + $(foreach pkg,$(GENERATE_PACKAGES),$(MAKE) -C $(pkg) generate;) + docs: uv run sphinx-apidoc -e -M -f -T \ -o docs/sphinx/_autogen/base \ diff --git a/packages/openapi-generator/openapitools.json b/openapitools.json similarity index 100% rename from packages/openapi-generator/openapitools.json rename to openapitools.json diff --git a/packages/gen/Makefile b/packages/gen/Makefile index 825d44e5..9092db86 100644 --- a/packages/gen/Makefile +++ b/packages/gen/Makefile @@ -1,12 +1,12 @@ -PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -SPEC_DIR := $(PKG_DIR)specs/document-grounding +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +SPECS := $(wildcard $(PKG_DIR)specs/*) .PHONY: generate generate: - uv run --package sap-openapi-generator sap-generate \ - --spec $(SPEC_DIR)/api.yaml \ - --output $(PKG_DIR)gen_ai_hub/document_grounding_generation/generated \ - --package-name gen_ai_hub.document_grounding_generation.generated \ - --options $(SPEC_DIR)/options-per-service.json \ - --spec-key src/spec/api.yaml + $(foreach spec,$(SPECS), \ + uv run --package sap-openapi-generator sap-generate \ + -i $(spec) \ + -o $(PKG_DIR) \ + -s $(spec)/options-per-service.json; \ + ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py index 14b72879..4eb8aa50 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py @@ -29,6 +29,7 @@ from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync class MetadataConfigurationsApi: @@ -256,6 +257,114 @@ async def batch_update_documents_metadata_without_preload_content( return response_data.response + @validate_call + def batch_update_documents_metadata_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BatchUpdateDocumentsResponseInner]: + """Batch update metadata for multiple documents (synchronous) + + Synchronous variant of :meth:`batch_update_documents_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.batch_update_documents_metadata( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def batch_update_documents_metadata_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BatchUpdateDocumentsResponseInner]]: + """Batch update metadata for multiple documents (synchronous) + + Synchronous variant of :meth:`batch_update_documents_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.batch_update_documents_metadata_with_http_info( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def batch_update_documents_metadata_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Batch update metadata for multiple documents (synchronous) + + Synchronous variant of :meth:`batch_update_documents_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.batch_update_documents_metadata_without_preload_content( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _batch_update_documents_metadata_serialize( self, metadata_config_id, @@ -535,6 +644,108 @@ async def create_metadata_configuration_without_preload_content( return response_data.response + @validate_call + def create_metadata_configuration_sync( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create a metadata configuration (synchronous) + + Synchronous variant of :meth:`create_metadata_configuration`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_metadata_configuration( + metadata_configuration_request=metadata_configuration_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_metadata_configuration_sync_with_http_info( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create a metadata configuration (synchronous) + + Synchronous variant of :meth:`create_metadata_configuration_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_metadata_configuration_with_http_info( + metadata_configuration_request=metadata_configuration_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_metadata_configuration_sync_without_preload_content( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a metadata configuration (synchronous) + + Synchronous variant of :meth:`create_metadata_configuration_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_metadata_configuration_without_preload_content( + metadata_configuration_request=metadata_configuration_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _create_metadata_configuration_serialize( self, metadata_configuration_request, @@ -817,6 +1028,108 @@ async def delete_metadata_configuration_by_id_without_preload_content( return response_data.response + @validate_call + def delete_metadata_configuration_by_id_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a configuration by ID (synchronous) + + Synchronous variant of :meth:`delete_metadata_configuration_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_metadata_configuration_by_id( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_metadata_configuration_by_id_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a configuration by ID (synchronous) + + Synchronous variant of :meth:`delete_metadata_configuration_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_metadata_configuration_by_id_with_http_info( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_metadata_configuration_by_id_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a configuration by ID (synchronous) + + Synchronous variant of :meth:`delete_metadata_configuration_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_metadata_configuration_by_id_without_preload_content( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _delete_metadata_configuration_by_id_serialize( self, metadata_config_id, @@ -1083,6 +1396,108 @@ async def get_metadata_configuration_by_id_without_preload_content( return response_data.response + @validate_call + def get_metadata_configuration_by_id_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataConfigurationResponse: + """Get a configuration by ID (synchronous) + + Synchronous variant of :meth:`get_metadata_configuration_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_configuration_by_id( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_configuration_by_id_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataConfigurationResponse]: + """Get a configuration by ID (synchronous) + + Synchronous variant of :meth:`get_metadata_configuration_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_configuration_by_id_with_http_info( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_configuration_by_id_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a configuration by ID (synchronous) + + Synchronous variant of :meth:`get_metadata_configuration_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_configuration_by_id_without_preload_content( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_metadata_configuration_by_id_serialize( self, metadata_config_id, @@ -1361,6 +1776,114 @@ async def get_metadata_document_details_without_preload_content( return response_data.response + @validate_call + def get_metadata_document_details_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ConfigurationDocument: + """Get document details (synchronous) + + Synchronous variant of :meth:`get_metadata_document_details`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_document_details( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_document_details_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ConfigurationDocument]: + """Get document details (synchronous) + + Synchronous variant of :meth:`get_metadata_document_details_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_document_details_with_http_info( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_document_details_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document details (synchronous) + + Synchronous variant of :meth:`get_metadata_document_details_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_document_details_without_preload_content( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_metadata_document_details_serialize( self, metadata_config_id, @@ -1672,6 +2195,132 @@ async def list_metadata_configuration_documents_without_preload_content( return response_data.response + @validate_call + def list_metadata_configuration_documents_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListConfigurationDocuments: + """List documents of a configuration (synchronous) + + Synchronous variant of :meth:`list_metadata_configuration_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configuration_documents( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configuration_documents_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListConfigurationDocuments]: + """List documents of a configuration (synchronous) + + Synchronous variant of :meth:`list_metadata_configuration_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configuration_documents_with_http_info( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configuration_documents_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List documents of a configuration (synchronous) + + Synchronous variant of :meth:`list_metadata_configuration_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configuration_documents_without_preload_content( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _list_metadata_configuration_documents_serialize( self, metadata_config_id, @@ -1979,6 +2628,120 @@ async def list_metadata_configurations_without_preload_content( return response_data.response + @validate_call + def list_metadata_configurations_sync( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListMetadataConfigurations: + """List metadata configurations (synchronous) + + Synchronous variant of :meth:`list_metadata_configurations`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configurations( + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configurations_sync_with_http_info( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListMetadataConfigurations]: + """List metadata configurations (synchronous) + + Synchronous variant of :meth:`list_metadata_configurations_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configurations_with_http_info( + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configurations_sync_without_preload_content( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List metadata configurations (synchronous) + + Synchronous variant of :meth:`list_metadata_configurations_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configurations_without_preload_content( + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _list_metadata_configurations_serialize( self, top, diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py index e9d50464..3df1aa4a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py @@ -35,6 +35,7 @@ from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync class PipelinesApi: @@ -262,6 +263,114 @@ async def create_pipeline_without_preload_content( return response_data.response + @validate_call + def create_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineId: + """Pipeline Creation (synchronous) + + Synchronous variant of :meth:`create_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_pipeline( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineId]: + """Pipeline Creation (synchronous) + + Synchronous variant of :meth:`create_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Creation (synchronous) + + Synchronous variant of :meth:`create_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _create_pipeline_serialize( self, ai_resource_group, @@ -553,6 +662,114 @@ async def delete_pipeline_by_id_without_preload_content( return response_data.response + @validate_call + def delete_pipeline_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete pipeline (synchronous) + + Synchronous variant of :meth:`delete_pipeline_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_pipeline_by_id( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_pipeline_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete pipeline (synchronous) + + Synchronous variant of :meth:`delete_pipeline_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_pipeline_by_id_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_pipeline_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete pipeline (synchronous) + + Synchronous variant of :meth:`delete_pipeline_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_pipeline_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _delete_pipeline_by_id_serialize( self, ai_resource_group, @@ -864,6 +1081,132 @@ async def get_all_documents_for_pipeline_without_preload_content( return response_data.response + @validate_call + def get_all_documents_for_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_all_documents_for_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_for_pipeline( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_for_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_all_documents_for_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_for_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_for_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_all_documents_for_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_for_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_all_documents_for_pipeline_serialize( self, ai_resource_group, @@ -1202,27 +1545,159 @@ async def get_all_executions_for_pipeline_without_preload_content( return response_data.response - def _get_all_executions_for_pipeline_serialize( + @validate_call + def get_all_executions_for_pipeline_sync( self, - ai_resource_group, - pipeline_id, - last_execution, - top, - skip, - count, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutions: + """Get Pipeline Executions (synchronous) - _host = None + Synchronous variant of :meth:`get_all_executions_for_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_executions_for_pipeline( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) - _collection_formats: Dict[str, str] = { - } - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] + @validate_call + def get_all_executions_for_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutions]: + """Get Pipeline Executions (synchronous) + + Synchronous variant of :meth:`get_all_executions_for_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_executions_for_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_executions_for_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Executions (synchronous) + + Synchronous variant of :meth:`get_all_executions_for_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_executions_for_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_all_executions_for_pipeline_serialize( + self, + ai_resource_group, + pipeline_id, + last_execution, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] _files: Dict[ @@ -1536,6 +2011,132 @@ async def get_all_pipelines_without_preload_content( return response_data.response + @validate_call + def get_all_pipelines_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelines: + """Get Pipelines (synchronous) + + Synchronous variant of :meth:`get_all_pipelines`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_pipelines( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_pipelines_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelines]: + """Get Pipelines (synchronous) + + Synchronous variant of :meth:`get_all_pipelines_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_pipelines_with_http_info( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_pipelines_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipelines (synchronous) + + Synchronous variant of :meth:`get_all_pipelines_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_pipelines_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_all_pipelines_serialize( self, ai_resource_group, @@ -1840,6 +2441,120 @@ async def get_document_by_id_for_pipeline_without_preload_content( return response_data.response + @validate_call + def get_document_by_id_for_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_document_by_id_for_pipeline_serialize( self, ai_resource_group, @@ -2142,21 +2857,141 @@ async def get_document_by_id_for_pipeline_execution_without_preload_content( return response_data.response - def _get_document_by_id_for_pipeline_execution_serialize( + @validate_call + def get_document_by_id_for_pipeline_execution_sync( self, - ai_resource_group, - pipeline_id, - execution_id, - document_id, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline Execution (synchronous) - _collection_formats: Dict[str, str] = { + Synchronous variant of :meth:`get_document_by_id_for_pipeline_execution`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_execution( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_execution_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_execution_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_execution_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_execution_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_execution_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_execution_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_document_by_id_for_pipeline_execution_serialize( + self, + ai_resource_group, + pipeline_id, + execution_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { } _path_params: Dict[str, str] = {} @@ -2471,6 +3306,138 @@ async def get_documents_for_pipeline_execution_without_preload_content( return response_data.response + @validate_call + def get_documents_for_pipeline_execution_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_documents_for_pipeline_execution`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_documents_for_pipeline_execution( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_documents_for_pipeline_execution_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_documents_for_pipeline_execution_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_documents_for_pipeline_execution_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_documents_for_pipeline_execution_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_documents_for_pipeline_execution_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_documents_for_pipeline_execution_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_documents_for_pipeline_execution_serialize( self, ai_resource_group, @@ -2776,6 +3743,120 @@ async def get_execution_details_by_id_for_pipeline_execution_without_preload_con return response_data.response + @validate_call + def get_execution_details_by_id_for_pipeline_execution_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutionById: + """Get Pipeline Execution by ID (synchronous) + + Synchronous variant of :meth:`get_execution_details_by_id_for_pipeline_execution`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_execution_details_by_id_for_pipeline_execution( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutionById]: + """Get Pipeline Execution by ID (synchronous) + + Synchronous variant of :meth:`get_execution_details_by_id_for_pipeline_execution_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_execution_details_by_id_for_pipeline_execution_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Execution by ID (synchronous) + + Synchronous variant of :meth:`get_execution_details_by_id_for_pipeline_execution_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_execution_details_by_id_for_pipeline_execution_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_execution_details_by_id_for_pipeline_execution_serialize( self, ai_resource_group, @@ -3057,6 +4138,114 @@ async def get_pipeline_by_id_without_preload_content( return response_data.response + @validate_call + def get_pipeline_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipeline: + """Get details of a Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_by_id( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipeline]: + """Get details of a Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_by_id_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get details of a Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_pipeline_by_id_serialize( self, ai_resource_group, @@ -3324,15 +4513,123 @@ async def get_pipeline_status_without_preload_content( _host_index=_host_index ) - _response_types_map: Dict[str, Optional[str]] = { - '200': "GetPipelineStatus", - '400': "GetAllPipelines400Response", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineStatus", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_pipeline_status_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineStatus: + """Get status of Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_status`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_status( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_status_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineStatus]: + """Get status of Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_status_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_status_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_status_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get status of Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_status_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_status_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) ) - return response_data.response def _get_pipeline_status_serialize( @@ -3613,6 +4910,114 @@ async def manual_trigger_pipeline_without_preload_content( return response_data.response + @validate_call + def manual_trigger_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Pipeline Trigger (synchronous) + + Synchronous variant of :meth:`manual_trigger_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.manual_trigger_pipeline( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def manual_trigger_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Pipeline Trigger (synchronous) + + Synchronous variant of :meth:`manual_trigger_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.manual_trigger_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def manual_trigger_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Trigger (synchronous) + + Synchronous variant of :meth:`manual_trigger_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.manual_trigger_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _manual_trigger_pipeline_serialize( self, ai_resource_group, @@ -3916,6 +5321,120 @@ async def patch_pipeline_by_id_without_preload_content( return response_data.response + @validate_call + def patch_pipeline_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Patch pipeline (synchronous) + + Synchronous variant of :meth:`patch_pipeline_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.patch_pipeline_by_id( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def patch_pipeline_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Patch pipeline (synchronous) + + Synchronous variant of :meth:`patch_pipeline_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.patch_pipeline_by_id_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def patch_pipeline_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch pipeline (synchronous) + + Synchronous variant of :meth:`patch_pipeline_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.patch_pipeline_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _patch_pipeline_by_id_serialize( self, ai_resource_group, @@ -4246,6 +5765,132 @@ async def search_pipelines_by_metadata_without_preload_content( return response_data.response + @validate_call + def search_pipelines_by_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SearchPipelinesResponse: + """Pipeline Search by Metadata (synchronous) + + Synchronous variant of :meth:`search_pipelines_by_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_pipelines_by_metadata( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_pipelines_by_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SearchPipelinesResponse]: + """Pipeline Search by Metadata (synchronous) + + Synchronous variant of :meth:`search_pipelines_by_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_pipelines_by_metadata_with_http_info( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_pipelines_by_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Search by Metadata (synchronous) + + Synchronous variant of :meth:`search_pipelines_by_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_pipelines_by_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _search_pipelines_by_metadata_serialize( self, ai_resource_group, diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py index 307c6f34..e8ad827d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py @@ -27,6 +27,7 @@ from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync class RetrievalApi: @@ -278,6 +279,126 @@ async def get_data_repositories_without_preload_content( return response_data.response + @validate_call + def get_data_repositories_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepositories: + """List all DataRepository objects. (synchronous) + + Synchronous variant of :meth:`get_data_repositories`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repositories( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repositories_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepositories]: + """List all DataRepository objects. (synchronous) + + Synchronous variant of :meth:`get_data_repositories_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repositories_with_http_info( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repositories_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all DataRepository objects. (synchronous) + + Synchronous variant of :meth:`get_data_repositories_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repositories_without_preload_content( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_data_repositories_serialize( self, ai_resource_group, @@ -586,6 +707,120 @@ async def get_data_repository_by_id_without_preload_content( return response_data.response + @validate_call + def get_data_repository_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepository: + """List single DataRepository object. (synchronous) + + Synchronous variant of :meth:`get_data_repository_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repository_by_id( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repository_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepository]: + """List single DataRepository object. (synchronous) + + Synchronous variant of :meth:`get_data_repository_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repository_by_id_with_http_info( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repository_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List single DataRepository object. (synchronous) + + Synchronous variant of :meth:`get_data_repository_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repository_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_data_repository_by_id_serialize( self, ai_resource_group, @@ -872,6 +1107,114 @@ async def search_without_preload_content( return response_data.response + @validate_call + def search_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RetrievalSearchResults: + """Retrieve relevant content (synchronous) + + Synchronous variant of :meth:`search`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RetrievalSearchResults]: + """Retrieve relevant content (synchronous) + + Synchronous variant of :meth:`search_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_with_http_info( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve relevant content (synchronous) + + Synchronous variant of :meth:`search_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_without_preload_content( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _search_serialize( self, ai_resource_group, diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py index b2fd9d97..dbfd50cf 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py @@ -39,6 +39,7 @@ from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync class VectorApi: @@ -269,6 +270,114 @@ async def create_collection_without_preload_content( return response_data.response + @validate_call + def create_collection_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create collection (synchronous) + + Synchronous variant of :meth:`create_collection`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_collection( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_collection_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create collection (synchronous) + + Synchronous variant of :meth:`create_collection_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_collection_with_http_info( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_collection_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create collection (synchronous) + + Synchronous variant of :meth:`create_collection_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_collection_without_preload_content( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _create_collection_serialize( self, ai_resource_group, @@ -578,6 +687,120 @@ async def create_documents_without_preload_content( return response_data.response + @validate_call + def create_documents_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Create documents in collection (synchronous) + + Synchronous variant of :meth:`create_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_documents( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Create documents in collection (synchronous) + + Synchronous variant of :meth:`create_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_documents_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create documents in collection (synchronous) + + Synchronous variant of :meth:`create_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_documents_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _create_documents_serialize( self, ai_resource_group, @@ -878,6 +1101,114 @@ async def delete_all_documents_without_preload_content( return response_data.response + @validate_call + def delete_all_documents_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentBulkDeleteResponse: + """Delete list of documents across collections (synchronous) + + Synchronous variant of :meth:`delete_all_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_all_documents( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_all_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentBulkDeleteResponse]: + """Delete list of documents across collections (synchronous) + + Synchronous variant of :meth:`delete_all_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_all_documents_with_http_info( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_all_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete list of documents across collections (synchronous) + + Synchronous variant of :meth:`delete_all_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_all_documents_without_preload_content( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _delete_all_documents_serialize( self, ai_resource_group, @@ -1175,37 +1506,145 @@ async def delete_collection_by_id_without_preload_content( return response_data.response - def _delete_collection_by_id_serialize( + @validate_call + def delete_collection_by_id_sync( self, - ai_resource_group, - collection_id, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete collection by ID (synchronous) - _collection_formats: Dict[str, str] = { - } + Synchronous variant of :meth:`delete_collection_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_collection_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[ - str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] - ] = {} - _body_params: Optional[bytes] = None - # process the path parameters - if collection_id is not None: - _path_params['collectionId'] = collection_id - # process the query parameters - # process the header parameters - if ai_resource_group is not None: - _header_params['AI-Resource-Group'] = ai_resource_group + @validate_call + def delete_collection_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete collection by ID (synchronous) + + Synchronous variant of :meth:`delete_collection_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_collection_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_collection_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete collection by ID (synchronous) + + Synchronous variant of :meth:`delete_collection_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_collection_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _delete_collection_by_id_serialize( + self, + ai_resource_group, + collection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group # process the form parameters # process the body parameter @@ -1471,6 +1910,120 @@ async def delete_document_by_id_without_preload_content( return response_data.response + @validate_call + def delete_document_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a document (synchronous) + + Synchronous variant of :meth:`delete_document_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_document_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_document_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a document (synchronous) + + Synchronous variant of :meth:`delete_document_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_document_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_document_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a document (synchronous) + + Synchronous variant of :meth:`delete_document_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_document_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _delete_document_by_id_serialize( self, ai_resource_group, @@ -1776,6 +2329,126 @@ async def get_all_collections_without_preload_content( return response_data.response + @validate_call + def get_all_collections_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CollectionsListResponse: + """Get collections (synchronous) + + Synchronous variant of :meth:`get_all_collections`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_collections( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_collections_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CollectionsListResponse]: + """Get collections (synchronous) + + Synchronous variant of :meth:`get_all_collections_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_collections_with_http_info( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_collections_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collections (synchronous) + + Synchronous variant of :meth:`get_all_collections_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_collections_without_preload_content( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_all_collections_serialize( self, ai_resource_group, @@ -2108,20 +2781,146 @@ async def get_all_documents_without_preload_content( return response_data.response - def _get_all_documents_serialize( + @validate_call + def get_all_documents_sync( self, - ai_resource_group, - collection_id, - top, - skip, - count, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Documents: + """Get documents (synchronous) + + Synchronous variant of :meth:`get_all_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Documents]: + """Get documents (synchronous) + + Synchronous variant of :meth:`get_all_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get documents (synchronous) + + Synchronous variant of :meth:`get_all_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_all_documents_serialize( + self, + ai_resource_group, + collection_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None _collection_formats: Dict[str, str] = { } @@ -2407,6 +3206,114 @@ async def get_collection_by_id_without_preload_content( return response_data.response + @validate_call + def get_collection_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Get collection by ID (synchronous) + + Synchronous variant of :meth:`get_collection_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Get collection by ID (synchronous) + + Synchronous variant of :meth:`get_collection_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection by ID (synchronous) + + Synchronous variant of :meth:`get_collection_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_collection_by_id_serialize( self, ai_resource_group, @@ -2691,6 +3598,114 @@ async def get_collection_creation_status_without_preload_content( return response_data.response + @validate_call + def get_collection_creation_status_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionCreationStatus200Response: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_creation_status`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_creation_status( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_creation_status_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionCreationStatus200Response]: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_creation_status_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_creation_status_with_http_info( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_creation_status_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_creation_status_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_creation_status_without_preload_content( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_collection_creation_status_serialize( self, ai_resource_group, @@ -2975,6 +3990,114 @@ async def get_collection_deletion_status_without_preload_content( return response_data.response + @validate_call + def get_collection_deletion_status_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionDeletionStatus200Response: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_deletion_status`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_deletion_status( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_deletion_status_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionDeletionStatus200Response]: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_deletion_status_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_deletion_status_with_http_info( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_deletion_status_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_deletion_status_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_deletion_status_without_preload_content( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_collection_deletion_status_serialize( self, ai_resource_group, @@ -3271,6 +4394,120 @@ async def get_document_by_id_without_preload_content( return response_data.response + @validate_call + def get_document_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentResponse: + """Get document by ID (synchronous) + + Synchronous variant of :meth:`get_document_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentResponse]: + """Get document by ID (synchronous) + + Synchronous variant of :meth:`get_document_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document by ID (synchronous) + + Synchronous variant of :meth:`get_document_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _get_document_by_id_serialize( self, ai_resource_group, @@ -3558,6 +4795,114 @@ async def search_without_preload_content( return response_data.response + @validate_call + def search_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VectorSearchResults: + """Search chunk by vector (synchronous) + + Synchronous variant of :meth:`search`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VectorSearchResults]: + """Search chunk by vector (synchronous) + + Synchronous variant of :meth:`search_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_with_http_info( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search chunk by vector (synchronous) + + Synchronous variant of :meth:`search_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_without_preload_content( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _search_serialize( self, ai_resource_group, @@ -3833,26 +5178,134 @@ async def update_chunks_metadata_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_chunks_metadata_serialize( - ai_resource_group=ai_resource_group, - metadata_updates=metadata_updates, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index + _param = self._update_chunks_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def update_chunks_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch chunks metadata (synchronous) + + Synchronous variant of :meth:`update_chunks_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_chunks_metadata( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_chunks_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch chunks metadata (synchronous) + + Synchronous variant of :meth:`update_chunks_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_chunks_metadata_with_http_info( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) ) - _response_types_map: Dict[str, Optional[str]] = { - '200': "MetadataResponse", - '400': "GetAllPipelines400Response", - '404': "GetAllPipelines400Response", - '422': "GetAllPipelines400Response", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout + + @validate_call + def update_chunks_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch chunks metadata (synchronous) + + Synchronous variant of :meth:`update_chunks_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_chunks_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) ) - return response_data.response def _update_chunks_metadata_serialize( @@ -4152,6 +5605,114 @@ async def update_collections_metadata_without_preload_content( return response_data.response + @validate_call + def update_collections_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch collections metadata (synchronous) + + Synchronous variant of :meth:`update_collections_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_collections_metadata( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_collections_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch collections metadata (synchronous) + + Synchronous variant of :meth:`update_collections_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_collections_metadata_with_http_info( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_collections_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch collections metadata (synchronous) + + Synchronous variant of :meth:`update_collections_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_collections_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _update_collections_metadata_serialize( self, ai_resource_group, @@ -4461,6 +6022,120 @@ async def update_documents_without_preload_content( return response_data.response + @validate_call + def update_documents_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Upsert documents in collection (synchronous) + + Synchronous variant of :meth:`update_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Upsert documents in collection (synchronous) + + Synchronous variant of :meth:`update_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upsert documents in collection (synchronous) + + Synchronous variant of :meth:`update_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _update_documents_serialize( self, ai_resource_group, @@ -4761,6 +6436,114 @@ async def update_documents_metadata_without_preload_content( return response_data.response + @validate_call + def update_documents_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch documents metadata (synchronous) + + Synchronous variant of :meth:`update_documents_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_metadata( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch documents metadata (synchronous) + + Synchronous variant of :meth:`update_documents_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_metadata_with_http_info( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch documents metadata (synchronous) + + Synchronous variant of :meth:`update_documents_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + def _update_documents_metadata_serialize( self, ai_resource_group, diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/sync_helper.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/sync_helper.py new file mode 100644 index 00000000..dd7a6300 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/sync_helper.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import threading +from typing import Any, Coroutine, Optional, TypeVar + +T = TypeVar("T") + +_loop: Optional[asyncio.AbstractEventLoop] = None +_loop_lock = threading.Lock() + + +def _get_sync_loop() -> asyncio.AbstractEventLoop: + """Return a dedicated event loop running in a background daemon thread. + + A single, long-lived loop is reused for every synchronous call so that the + underlying ``httpx.AsyncClient`` (and its connection pool) stays bound to one + event loop across calls. The loop is created lazily and in a thread-safe way. + """ + global _loop + if _loop is None: + with _loop_lock: + if _loop is None: + loop = asyncio.new_event_loop() + thread = threading.Thread( + target=loop.run_forever, + name="generated-sync-runner", + daemon=True, + ) + thread.start() + _loop = loop + return _loop + + +def run_sync(coro: Coroutine[Any, Any, T]) -> T: + """Run an async coroutine to completion and return its result synchronously. + + The coroutine is scheduled on a dedicated background event loop and the + calling thread blocks until it finishes. This is used to expose synchronous + ``_sync`` variants of the asynchronous API methods. + + Note: this must not be called from within a running event loop (i.e. from + ``async`` code) as it would block that loop; use the ``await``-able async + methods directly in that case. + """ + return asyncio.run_coroutine_threadsafe(coro, _get_sync_loop()).result() diff --git a/packages/gen/specs/document-grounding/options-per-service.json b/packages/gen/specs/document-grounding/options-per-service.json index b233246f..908bb77e 100644 --- a/packages/gen/specs/document-grounding/options-per-service.json +++ b/packages/gen/specs/document-grounding/options-per-service.json @@ -1,7 +1,6 @@ { - "src/spec/api.yaml": { - "packageName": "document_grounding", - "directoryName": "document_grounding", + "api.yaml": { + "directoryName": "gen_ai_hub/document_grounding_generation/generated", "basePath": "/lm/document-grounding" } } diff --git a/packages/openapi-generator/config/openapitools.json b/packages/openapi-generator/config/openapitools.json deleted file mode 100644 index b11fef7d..00000000 --- a/packages/openapi-generator/config/openapitools.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "spaces": 2, - "generator-cli": { - "version": "7.8.0" - } -} diff --git a/packages/openapi-generator/config/python-config.yaml b/packages/openapi-generator/config/python-config.yaml index 220c9ddc..ab3b1af0 100644 --- a/packages/openapi-generator/config/python-config.yaml +++ b/packages/openapi-generator/config/python-config.yaml @@ -31,6 +31,8 @@ additionalProperties: useOneOfDiscriminatorLookup: true # Emit only Python source files; the parent package owns pyproject.toml/setup.py generateSourceCodeOnly: true + # Emit _sync variants of each async method (httpx library only) + supportHttpxSync: true globalProperties: apiDocs: "false" diff --git a/packages/openapi-generator/src/sap_openapi_generator/generate.py b/packages/openapi-generator/src/sap_openapi_generator/generate.py index 20427f5f..00a4994b 100644 --- a/packages/openapi-generator/src/sap_openapi_generator/generate.py +++ b/packages/openapi-generator/src/sap_openapi_generator/generate.py @@ -1,34 +1,61 @@ """End-to-end OpenAPI generation pipeline for SAP Cloud SDK Python packages. -Runs the full pipeline in one command: - 1. Pre-process the spec (vendor extension resolution, base-path injection) - 2. Invoke openapi-generator-cli via npx - 3. Rewrite bare `generated.*` imports to a fully-qualified package path - 4. Touch py.typed (httpx template omits it) - -Usage: - sap-generate \\ - --spec path/to/api.yaml \\ - --output path/to/output/dir \\ - --package-name my_pkg.sub.generated \\ - [--options path/to/options-per-service.json] \\ - [--spec-key src/spec/api.yaml] \\ - [--config path/to/python-config.yaml] +Mirrors the SAP Cloud SDK JS generator interface: + + sap-generate -i -o [-s ] + +For each spec file found under : + 1. Reads per-service options from options-per-service.json (directoryName, basePath) + 2. Pre-processes the spec (vendor extension resolution, base-path injection) + 3. Invokes openapi-generator-cli via npx + 4. Rewrites bare 'generated.*' imports to the fully-qualified package path + 5. Touches py.typed (httpx template omits it) + +options-per-service.json keys are paths relative to . Supported fields: + directoryName - output subdirectory under (required) + basePath - overrides the servers[0].url baked into Configuration (optional) + packageName - ignored (JS npm name, not used in Python) """ from __future__ import annotations import argparse -import os +import json import shutil import subprocess import sys import tempfile -from pathlib import Path +from pathlib import Path, PurePosixPath from sap_openapi_generator.preprocess_spec import preprocess _DEFAULT_CONFIG = Path(__file__).parent.parent.parent / "config" / "python-config.yaml" +_SPEC_EXTENSIONS = {".yaml", ".yml", ".json"} + + +_EXCLUDED_FILENAMES = {"options-per-service.json"} + + +def _find_specs(input_path: Path) -> list[Path]: + if input_path.is_file(): + return [input_path] + return sorted( + p for p in input_path.rglob("*") + if p.suffix in _SPEC_EXTENSIONS and p.is_file() and p.name not in _EXCLUDED_FILENAMES + ) + + +def _load_options_per_service(options_path: Path) -> dict: + if options_path.is_dir(): + options_path = options_path / "options-per-service.json" + if not options_path.exists(): + return {} + return json.loads(options_path.read_text()) + + +def _service_key(spec_path: Path, input_dir: Path) -> str: + """Return the options-per-service.json key for a spec (POSIX relative path from input_dir).""" + return PurePosixPath(spec_path.relative_to(input_dir)).as_posix() def _build_opid_flags(mappings_path: Path) -> list[str]: @@ -43,7 +70,6 @@ def _build_opid_flags(mappings_path: Path) -> list[str]: def _rewrite_imports(output_dir: Path, package_name: str) -> None: - """Rewrite bare 'generated' imports to the fully-qualified package path.""" for py_file in output_dir.rglob("*.py"): src = py_file.read_text() updated = ( @@ -56,7 +82,7 @@ def _rewrite_imports(output_dir: Path, package_name: str) -> None: py_file.write_text(updated) -def generate( +def generate_one( spec_path: Path, output_dir: Path, package_name: str, @@ -65,7 +91,6 @@ def generate( config_path: Path | None = None, ) -> None: config_path = config_path or _DEFAULT_CONFIG - # The leaf package name used internally by the generator (always "generated") leaf = "generated" with tempfile.TemporaryDirectory(prefix="sap-openapi-") as tmp: @@ -98,10 +123,7 @@ def generate( generated_src = gen_tmp / leaf if not generated_src.exists(): - print( - f"ERROR: expected generated output at {generated_src} but it was not found.", - file=sys.stderr, - ) + print(f"ERROR: expected generated output at {generated_src}", file=sys.stderr) sys.exit(1) if output_dir.exists(): @@ -112,26 +134,62 @@ def generate( (output_dir / "py.typed").touch() +def generate( + input_path: Path, + output_dir: Path, + options_per_service_path: Path | None = None, + config_path: Path | None = None, +) -> None: + specs = _find_specs(input_path) + if not specs: + print(f"ERROR: no spec files found under {input_path}", file=sys.stderr) + sys.exit(1) + + input_dir = input_path if input_path.is_dir() else input_path.parent + service_options = _load_options_per_service(options_per_service_path) if options_per_service_path else {} + + for spec in specs: + key = _service_key(spec, input_dir) + opts = service_options.get(key, {}) + + directory_name = opts.get("directoryName") + if not directory_name: + print( + f"ERROR: no 'directoryName' for spec '{key}' in options-per-service.json.", + file=sys.stderr, + ) + sys.exit(1) + + service_output = output_dir / directory_name + # Derive the Python import path from directoryName (slashes → dots) + python_package_name = directory_name.replace("/", ".") + + generate_one( + spec_path=spec, + output_dir=service_output, + package_name=python_package_name, + options_path=options_per_service_path, + spec_key=key, + config_path=config_path, + ) + print(f"Generated: {key} → {service_output}") + + def main() -> None: parser = argparse.ArgumentParser( - description="Run the full SAP OpenAPI generation pipeline." - ) - parser.add_argument("--spec", required=True, type=Path, help="Source spec file (.yaml or .json)") - parser.add_argument( - "--output", required=True, type=Path, - help="Output directory for generated Python files", + description="Generate Python API clients from OpenAPI specs (SAP Cloud SDK style)." ) parser.add_argument( - "--package-name", required=True, - help="Fully-qualified Python package name for import rewriting (e.g. my_pkg.sub.generated)", + "-i", "--input", required=True, type=Path, + help="Input directory or spec file (.yaml/.yml/.json)", ) parser.add_argument( - "--options", type=Path, default=None, - help="Path to options-per-service.json", + "-o", "--outputDir", required=True, type=Path, + help="Output base directory; each service is placed in a subdirectory per directoryName", ) parser.add_argument( - "--spec-key", default=None, - help="Key in options-per-service.json for this spec (e.g. 'src/spec/api.yaml')", + "-s", "--optionsPerService", type=Path, default=None, + help="Path to options-per-service.json (or directory containing it)", ) parser.add_argument( "--config", type=Path, default=None, @@ -139,11 +197,9 @@ def main() -> None: ) args = parser.parse_args() generate( - spec_path=args.spec, - output_dir=args.output, - package_name=args.package_name, - options_path=args.options, - spec_key=args.spec_key, + input_path=args.input, + output_dir=args.outputDir, + options_per_service_path=args.optionsPerService, config_path=args.config, ) From 9fb3c2cc8ba3700a288ff7f90dd29248149baf07 Mon Sep 17 00:00:00 2001 From: Zhongpin Wang Date: Fri, 4 Sep 2026 16:10:15 +0800 Subject: [PATCH 4/6] adapt generator and sample code --- .../generated/models/api_error.py | 5 +- .../generated/models/base_document.py | 3 +- .../models/base_pipeline_minimal_response.py | 3 +- .../models/base_pipeline_response.py | 3 +- .../models/batch_update_document_success.py | 3 +- .../generated/models/binary_boolean_filter.py | 3 +- .../models/boosting_scoring_configuration.py | 5 +- ...ng_scoring_configuration_metadata_inner.py | 3 +- .../generated/models/chunk.py | 3 +- .../generated/models/collection.py | 5 +- .../models/collection_created_response.py | 5 +- .../models/collection_deleted_response.py | 5 +- .../models/collection_pending_response.py | 5 +- .../generated/models/collection_request.py | 5 +- .../models/collections_list_response.py | 3 +- .../models/configuration_document.py | 7 +- .../configuration_document_full_details.py | 23 +- .../generated/models/data_repositories.py | 3 +- .../generated/models/data_repository.py | 5 +- ...ata_repository_per_filter_search_result.py | 5 +- .../models/data_repository_search_result.py | 5 +- .../models/data_repository_search_results.py | 3 +- .../models/data_repository_with_documents.py | 5 +- .../dense_retrieval_scoring_configuration.py | 3 +- .../models/details_error_response.py | 3 +- .../generated/models/document.py | 3 +- .../models/document_bulk_delete_request.py | 3 +- .../models/document_bulk_delete_response.py | 5 +- .../models/document_create_request.py | 3 +- .../generated/models/document_input.py | 3 +- .../models/document_key_value_list_pair.py | 5 +- .../generated/models/document_metadata.py | 5 +- .../models/document_metadata_batch_request.py | 3 +- .../models/document_metadata_update.py | 3 +- .../models/document_metadata_update_error.py | 3 +- .../generated/models/document_output.py | 3 +- .../generated/models/document_response.py | 3 +- .../models/document_update_request.py | 3 +- .../models/document_without_chunks.py | 3 +- .../generated/models/documents.py | 3 +- .../generated/models/documents_chunk.py | 3 +- .../models/documents_list_response.py | 3 +- .../models/documents_status_response.py | 3 +- ...cuments_status_response_resources_inner.py | 15 +- .../generated/models/embedding_config.py | 5 +- .../generated/models/error_response.py | 3 +- .../generated/models/generic_error.py | 3 +- .../models/get_all_pipelines400_response.py | 3 +- .../models/get_pipeline_execution_by_id.py | 7 +- .../models/get_pipeline_executions.py | 3 +- .../generated/models/get_pipeline_status.py | 9 +- .../generated/models/get_pipelines.py | 3 +- .../generated/models/google_drive_config.py | 9 +- .../google_drive_configuration_minimal.py | 5 +- .../google_drive_configuration_struct.py | 9 +- .../google_drive_pipeline_create_request.py | 3 +- .../google_drive_pipeline_get_response.py | 3 +- .../google_drive_pipeline_minimal_response.py | 3 +- .../models/google_drive_resource_detail.py | 9 +- .../generated/models/http_validation_error.py | 3 +- .../generated/models/key_value_list_pair.py | 3 +- ...ey_word_retrieval_scoring_configuration.py | 5 +- .../models/list_configuration_documents.py | 3 +- ...st_configuration_documents_full_details.py | 3 +- .../models/list_metadata_configurations.py | 3 +- .../models/manual_pipeline_trigger.py | 7 +- .../models/merge_strategy_reranker.py | 5 +- .../merge_strategy_reranker_boosting_inner.py | 3 +- .../models/merge_strategy_score_reuse.py | 3 +- .../generated/models/message_response.py | 3 +- .../generated/models/meta_data.py | 5 +- ...eta_data_data_repository_metadata_inner.py | 3 +- .../models/meta_data_key_value_pair_strict.py | 3 +- .../models/metadata_configuration.py | 3 +- .../models/metadata_configuration_metadata.py | 5 +- .../models/metadata_configuration_request.py | 9 +- ...data_configuration_request_labels_inner.py | 3 +- .../models/metadata_configuration_response.py | 11 +- .../models/metadata_configuration_struct.py | 7 +- .../generated/models/metadata_item.py | 3 +- .../generated/models/metadata_key_update.py | 3 +- .../generated/models/metadata_operation.py | 3 +- .../generated/models/metadata_response.py | 3 +- .../generated/models/metadata_update_item.py | 5 +- .../generated/models/metadata_updates.py | 3 +- .../models/ms_share_point_configuration.py | 7 +- ..._share_point_configuration_get_response.py | 5 +- .../ms_share_point_configuration_minimal.py | 5 +- .../ms_share_point_pipeline_create_request.py | 3 +- .../ms_share_point_pipeline_get_response.py | 3 +- ...s_share_point_pipeline_minimal_response.py | 3 +- .../generated/models/patch_pipeline.py | 3 +- .../models/patch_pipeline_configuration.py | 5 +- .../models/patch_pipeline_metadata.py | 5 +- .../models/per_filter_search_result.py | 5 +- .../models/per_filter_search_result_error.py | 3 +- .../per_filter_search_result_with_error.py | 5 +- .../models/pipeline_document_response.py | 15 +- .../models/pipeline_execution_data.py | 7 +- .../generated/models/pipeline_id.py | 5 +- .../post_processing_object_reference.py | 3 +- .../models/post_processing_operation.py | 5 +- .../models/retrieval_binary_boolean_filter.py | 3 +- .../generated/models/retrieval_chunk.py | 7 +- ...retrieval_data_repository_search_result.py | 5 +- .../retrieval_document_key_value_list_pair.py | 5 +- .../models/retrieval_key_value_list_pair.py | 3 +- .../retrieval_per_filter_search_result.py | 7 +- ...etrieval_per_filter_search_result_error.py | 3 +- ...val_per_filter_search_result_with_error.py | 5 +- .../retrieval_scoped_key_value_list_pair.py | 3 +- .../models/retrieval_search_configuration.py | 7 +- ...val_search_document_key_value_list_pair.py | 5 +- .../models/retrieval_search_filter.py | 17 +- .../models/retrieval_search_input.py | 5 +- ...eval_search_input_post_processing_inner.py | 5 +- .../models/retrieval_search_results.py | 3 +- .../models/retrieval_vector_search_filter.py | 19 +- .../generated/models/s3_configuration.py | 5 +- .../models/s3_configuration_minimal.py | 3 +- .../models/s3_pipeline_create_request.py | 3 +- .../models/s3_pipeline_get_response.py | 3 +- .../models/s3_pipeline_minimal_response.py | 3 +- .../models/scoped_key_value_list_pair.py | 3 +- .../generated/models/score.py | 3 +- .../models/sdm_pipeline_create_request.py | 3 +- .../models/sdm_pipeline_get_response.py | 3 +- .../models/sdm_pipeline_minimal_response.py | 3 +- .../generated/models/search_configuration.py | 7 +- .../search_document_key_value_list_pair.py | 5 +- .../generated/models/search_filter.py | 11 +- .../generated/models/search_pipeline.py | 5 +- .../models/search_pipelines_response.py | 3 +- .../generated/models/search_results.py | 3 +- .../generated/models/search_scores.py | 7 +- .../models/search_scores_aggregated_score.py | 3 +- .../generated/models/service_now_config.py | 5 +- .../service_now_configuration_minimal.py | 5 +- ...e_now_configuration_minimal_service_now.py | 5 +- .../service_now_configuration_struct.py | 9 +- .../service_now_pipeline_create_request.py | 3 +- .../service_now_pipeline_get_response.py | 3 +- .../service_now_pipeline_minimal_response.py | 3 +- .../generated/models/sftp_configuration.py | 5 +- .../models/sftp_configuration_minimal.py | 3 +- .../models/sftp_pipeline_create_request.py | 3 +- .../models/sftp_pipeline_get_response.py | 3 +- .../models/sftp_pipeline_minimal_response.py | 3 +- .../generated/models/share_point_config.py | 3 +- .../models/share_point_config_get_response.py | 3 +- .../generated/models/share_point_site.py | 5 +- .../models/share_point_site_detail.py | 5 +- .../models/share_point_site_get_response.py | 5 +- .../generated/models/text_only_base_chunk.py | 3 +- .../models/text_only_base_chunk_create.py | 3 +- .../generated/models/text_search_request.py | 3 +- .../generated/models/validation_error.py | 3 +- .../generated/models/vector_chunk.py | 3 +- .../vector_document_key_value_list_pair.py | 5 +- .../models/vector_key_value_list_pair.py | 3 +- .../models/vector_per_filter_search_result.py | 5 +- .../models/vector_scoring_configuration.py | 11 +- .../models/vector_search_configuration.py | 7 +- ...tor_search_document_key_value_list_pair.py | 5 +- .../generated/models/vector_search_filter.py | 11 +- .../generated/models/vector_search_results.py | 3 +- .../work_zone_pipeline_create_request.py | 3 +- .../models/work_zone_pipeline_get_response.py | 3 +- .../work_zone_pipeline_minimal_response.py | 3 +- .../tab_ai_orchestration/__init__.py | 5 + .../gen_ai_hub/tab_ai_orchestration/client.py | 134 +++ .../generated/__init__.py | 98 ++ .../generated/api/__init__.py | 5 + .../generated/api/predict_api.py | 456 ++++++++++ .../generated/api_client.py | 836 ++++++++++++++++++ .../generated/api_response.py | 21 + .../generated/configuration.py | 595 +++++++++++++ .../generated/exceptions.py | 218 +++++ .../generated/models/__init__.py | 41 + .../generated/models/conditions_inner.py | 136 +++ .../models/context_selection_config.py | 138 +++ .../models/context_selection_strategy_enum.py | 39 + .../generated/models/filter_condition.py | 109 +++ .../generated/models/filter_conditions.py | 111 +++ .../generated/models/filterconditions.py | 140 +++ .../generated/models/http_validation_error.py | 107 +++ .../generated/models/location_inner.py | 138 +++ .../generated/models/model_rpt1.py | 114 +++ .../generated/models/model_rpt15.py | 120 +++ .../models/model_rpt15_explanations.py | 108 +++ .../models/model_rpt15_prediction_config.py | 104 +++ .../generated/models/modelconfig.py | 137 +++ .../generated/models/predict_metadata.py | 106 +++ .../generated/models/predict_request.py | 154 ++++ .../generated/models/predict_response.py | 116 +++ .../generated/models/predict_status.py | 102 +++ .../generated/models/prediction_config.py | 95 ++ .../models/sampling_heuristic_config.py | 117 +++ .../models/sampling_random_config.py | 100 +++ .../generated/models/strategyconfig.py | 140 +++ .../generated/models/target_column.py | 112 +++ .../generated/models/task_type_enum.py | 37 + .../generated/models/tfm_enum.py | 39 + .../generated/models/validation_error.py | 120 +++ .../tab_ai_orchestration/generated/py.typed | 0 .../tab_ai_orchestration/generated/rest.py | 201 +++++ .../generated/sync_helper.py | 57 ++ .../gen/specs/tab-ai-orchestration/api.yaml | 572 ++++++++++++ .../options-per-service.json | 6 + .../custom-templates/model_generic.mustache | 664 ++++++++++++++ .../src/sap_openapi_generator/generate.py | 50 ++ pyproject.toml | 2 +- pyrightconfig.json | 9 + sample_code/Makefile | 2 +- sample_code/README.md | 2 +- sample_code/pyproject.toml | 7 +- sample_code/src/sample_code/__init__.py | 0 sample_code/src/{ => sample_code}/amazon.py | 0 sample_code/src/{ => sample_code}/core.py | 0 .../document_grounding_generation.py | 0 sample_code/src/{ => sample_code}/google.py | 0 sample_code/src/{ => sample_code}/openai.py | 8 +- .../src/{ => sample_code}/orchestration.py | 0 sample_code/src/{ => sample_code}/server.py | 32 +- .../src/sample_code/tab_ai_orchestration.py | 112 +++ uv.lock | 70 ++ 226 files changed, 7245 insertions(+), 490 deletions(-) create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/__init__.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/client.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/__init__.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/__init__.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/predict_api.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_response.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/configuration.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/exceptions.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/__init__.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/conditions_inner.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_config.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_strategy_enum.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_condition.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_conditions.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filterconditions.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/http_validation_error.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/location_inner.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt1.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_explanations.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_prediction_config.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/modelconfig.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_metadata.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_request.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_response.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_status.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/prediction_config.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_heuristic_config.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_random_config.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/strategyconfig.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/target_column.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/task_type_enum.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/tfm_enum.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/validation_error.py rename sample_code/src/__init__.py => packages/gen/gen_ai_hub/tab_ai_orchestration/generated/py.typed (100%) create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/rest.py create mode 100644 packages/gen/gen_ai_hub/tab_ai_orchestration/generated/sync_helper.py create mode 100644 packages/gen/specs/tab-ai-orchestration/api.yaml create mode 100644 packages/gen/specs/tab-ai-orchestration/options-per-service.json create mode 100644 packages/openapi-generator/config/custom-templates/model_generic.mustache create mode 100644 pyrightconfig.json create mode 100644 sample_code/src/sample_code/__init__.py rename sample_code/src/{ => sample_code}/amazon.py (100%) rename sample_code/src/{ => sample_code}/core.py (100%) rename sample_code/src/{ => sample_code}/document_grounding_generation.py (100%) rename sample_code/src/{ => sample_code}/google.py (100%) rename sample_code/src/{ => sample_code}/openai.py (92%) rename sample_code/src/{ => sample_code}/orchestration.py (100%) rename sample_code/src/{ => sample_code}/server.py (76%) create mode 100644 sample_code/src/sample_code/tab_ai_orchestration.py diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py index 53cdb827..8b713d3e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py @@ -30,15 +30,14 @@ class ApiError(BaseModel): """ # noqa: E501 code: StrictStr = Field(description="Descriptive error code (not http status code).") message: StrictStr = Field(description="plaintext error description") - request_id: Optional[StrictStr] = Field(default=None, description="id of individual request", alias="requestId") + request_id: Optional[StrictStr] = Field(default=None, description="id of individual request", serialization_alias="requestId") target: Optional[StrictStr] = Field(default=None, description="url that has been called") details: Optional[List[DetailsErrorResponse]] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["code", "message", "requestId", "target", "details"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py index 30beaa95..924e366f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py @@ -35,8 +35,7 @@ class BaseDocument(BaseModel): __properties: ClassVar[List[str]] = ["chunks", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py index 409b64f5..daa9f76f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py @@ -34,8 +34,7 @@ class BasePipelineMinimalResponse(BaseModel): __properties: ClassVar[List[str]] = ["id", "status"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py index 15dad5d6..83dd6134 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py @@ -35,8 +35,7 @@ class BasePipelineResponse(BaseModel): __properties: ClassVar[List[str]] = ["id", "type", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py index 78953448..44503d5e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py @@ -35,8 +35,7 @@ class BatchUpdateDocumentSuccess(BaseModel): __properties: ClassVar[List[str]] = ["id", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py index 08af2681..8fa468af 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py @@ -41,8 +41,7 @@ def operator_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py index bfa4f4c6..02218b96 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py @@ -32,13 +32,12 @@ class BoostingScoringConfiguration(BaseModel): enabled: Optional[StrictBool] = Field(default=True, description="Enable metadata-based boosting.") metadata: Optional[List[BoostingScoringConfigurationMetadataInner]] = None weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") - score_computation_strategy: Optional[BoostingScoreComputationStrategy] = Field(default=None, alias="scoreComputationStrategy") + score_computation_strategy: Optional[BoostingScoreComputationStrategy] = Field(default=None, serialization_alias="scoreComputationStrategy") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["enabled", "metadata", "weight", "scoreComputationStrategy"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py index 9fe3cceb..7b645b8d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py @@ -46,8 +46,7 @@ def scope_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py index ffa8faf4..47219342 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py @@ -35,8 +35,7 @@ class Chunk(BaseModel): __properties: ClassVar[List[str]] = ["id", "content", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py index a0d47d38..25544aa2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py @@ -31,15 +31,14 @@ class Collection(BaseModel): A logical grouping of content. """ # noqa: E501 title: Optional[StrictStr] = None - embedding_config: EmbeddingConfig = Field(alias="embeddingConfig") + embedding_config: EmbeddingConfig = Field(serialization_alias="embeddingConfig") metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") id: UUID = Field(description="Unique identifier of a collection.") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py index 47a21795..d7dcc4a6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py @@ -27,14 +27,13 @@ class CollectionCreatedResponse(BaseModel): """ CollectionCreatedResponse """ # noqa: E501 - collection_url: StrictStr = Field(alias="collectionURL") + collection_url: StrictStr = Field(serialization_alias="collectionURL") status: StrictStr additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["collectionURL", "status"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py index f0000b61..20e61625 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py @@ -27,14 +27,13 @@ class CollectionDeletedResponse(BaseModel): """ CollectionDeletedResponse """ # noqa: E501 - collection_url: StrictStr = Field(alias="collectionURL") + collection_url: StrictStr = Field(serialization_alias="collectionURL") status: StrictStr additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["collectionURL", "status"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py index 44aa735d..c65b30a0 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py @@ -27,13 +27,12 @@ class CollectionPendingResponse(BaseModel): """ CollectionPendingResponse """ # noqa: E501 - monitor_url: StrictStr = Field(alias="monitorURL") + monitor_url: StrictStr = Field(serialization_alias="monitorURL") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["monitorURL"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py index 056a72e4..c82d5867 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py @@ -31,15 +31,14 @@ class CollectionRequest(BaseModel): A request for creating a new, single collection. """ # noqa: E501 title: Optional[StrictStr] = None - embedding_config: EmbeddingConfig = Field(alias="embeddingConfig") + embedding_config: EmbeddingConfig = Field(serialization_alias="embeddingConfig") metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") id: Optional[UUID] = Field(default=None, description="Unique identifier of a collection.") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py index ffeda67a..7dd6df8b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py @@ -34,8 +34,7 @@ class CollectionsListResponse(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py index 1b9bca9b..177c530c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py @@ -31,8 +31,8 @@ class ConfigurationDocument(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the document.", json_schema_extra={"examples": ["3cba7512-b07a-58e6-a442-c83996a0b3bb"]}) title: Optional[StrictStr] = Field(default=None, description="Title of the document.", json_schema_extra={"examples": ["Quarterly Report"]}) - absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) - created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) + absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", serialization_alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) + created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) type: Optional[StrictStr] = Field(default=None, description="Type of the resource. Can be FOLDER, DOCUMENT.") metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") additional_properties: Dict[str, Any] = {} @@ -49,8 +49,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py index 17410c2a..87f9039f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py @@ -31,23 +31,22 @@ class ConfigurationDocumentFullDetails(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the document.", json_schema_extra={"examples": ["3cba7512-b07a-58e6-a442-c83996a0b3bb"]}) title: Optional[StrictStr] = Field(default=None, description="Title of the document.", json_schema_extra={"examples": ["Quarterly Report"]}) - absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) - created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) - resource_uri: Optional[StrictStr] = Field(default=None, description="URI of the resource.", alias="resourceUri", json_schema_extra={"examples": ["https://example.com/resource/123"]}) - web_url: Optional[StrictStr] = Field(default=None, description="Web URL of the document.", alias="webUrl", json_schema_extra={"examples": ["https://example.com/web/123"]}) - document_etag: Optional[StrictStr] = Field(default=None, description="ETag of the document.", alias="documentEtag", json_schema_extra={"examples": ["abc123etag"]}) - file_suffix: Optional[StrictStr] = Field(default=None, description="File suffix of the document.", alias="fileSuffix", json_schema_extra={"examples": [".pdf"]}) - view_location: Optional[StrictStr] = Field(default=None, description="View location of the document.", alias="viewLocation", json_schema_extra={"examples": ["https://example.com/view/123"]}) - download_location: Optional[StrictStr] = Field(default=None, description="Download location of the document.", alias="downloadLocation", json_schema_extra={"examples": ["https://example.com/download/123"]}) - mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the document.", alias="mimeType", json_schema_extra={"examples": ["application/pdf"]}) - file_size_mb: Optional[StrictStr] = Field(default=None, description="File size of the document in megabytes.", alias="fileSizeMb", json_schema_extra={"examples": ["1.5"]}) + absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", serialization_alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) + created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) + resource_uri: Optional[StrictStr] = Field(default=None, description="URI of the resource.", serialization_alias="resourceUri", json_schema_extra={"examples": ["https://example.com/resource/123"]}) + web_url: Optional[StrictStr] = Field(default=None, description="Web URL of the document.", serialization_alias="webUrl", json_schema_extra={"examples": ["https://example.com/web/123"]}) + document_etag: Optional[StrictStr] = Field(default=None, description="ETag of the document.", serialization_alias="documentEtag", json_schema_extra={"examples": ["abc123etag"]}) + file_suffix: Optional[StrictStr] = Field(default=None, description="File suffix of the document.", serialization_alias="fileSuffix", json_schema_extra={"examples": [".pdf"]}) + view_location: Optional[StrictStr] = Field(default=None, description="View location of the document.", serialization_alias="viewLocation", json_schema_extra={"examples": ["https://example.com/view/123"]}) + download_location: Optional[StrictStr] = Field(default=None, description="Download location of the document.", serialization_alias="downloadLocation", json_schema_extra={"examples": ["https://example.com/download/123"]}) + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the document.", serialization_alias="mimeType", json_schema_extra={"examples": ["application/pdf"]}) + file_size_mb: Optional[StrictStr] = Field(default=None, description="File size of the document in megabytes.", serialization_alias="fileSizeMb", json_schema_extra={"examples": ["1.5"]}) metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "resourceUri", "webUrl", "documentEtag", "fileSuffix", "viewLocation", "downloadLocation", "mimeType", "fileSizeMb", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py index 9a51830a..832e608c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py @@ -34,8 +34,7 @@ class DataRepositories(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py index cfe7bbfd..f508fae5 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py @@ -33,15 +33,14 @@ class DataRepository(BaseModel): id: UUID = Field(description="Unique identifier of this DataRepository.") title: StrictStr metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories.") - remote_grounding_name: Optional[StrictStr] = Field(default=None, alias="remoteGroundingName") + remote_grounding_name: Optional[StrictStr] = Field(default=None, serialization_alias="remoteGroundingName") message: Optional[StrictStr] = None type: DataRepositoryType additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "type"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py index c4ba208b..8a1fd3e8 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py @@ -28,14 +28,13 @@ class DataRepositoryPerFilterSearchResult(BaseModel): """ DataRepositoryPerFilterSearchResult """ # noqa: E501 - filter_id: StrictStr = Field(alias="filterId") + filter_id: StrictStr = Field(serialization_alias="filterId") results: Optional[List[DataRepositorySearchResult]] = Field(default=None, description="List of returned results.") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py index 4aaf7d98..3270bd26 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py @@ -28,13 +28,12 @@ class DataRepositorySearchResult(BaseModel): """ DataRepositorySearchResult """ # noqa: E501 - data_repository: DataRepositoryWithDocuments = Field(alias="dataRepository") + data_repository: DataRepositoryWithDocuments = Field(serialization_alias="dataRepository") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepository"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py index 518ac373..d61f5525 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py @@ -33,8 +33,7 @@ class DataRepositorySearchResults(BaseModel): __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py index dd06dd52..6a96eed8 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py @@ -33,15 +33,14 @@ class DataRepositoryWithDocuments(BaseModel): id: UUID = Field(description="Unique identifier of this DataRepository.") title: StrictStr metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories.") - remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly destination Name (grounding.name) of remote instance.", alias="remoteGroundingName") + remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly destination Name (grounding.name) of remote instance.", serialization_alias="remoteGroundingName") message: Optional[StrictStr] = Field(default=None, description="Optional message.") documents: List[Document] additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "documents"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py index 086e9b7b..f1918997 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py @@ -33,8 +33,7 @@ class DenseRetrievalScoringConfiguration(BaseModel): __properties: ClassVar[List[str]] = ["enabled", "weight"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py index d12c2136..c5fc742c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py @@ -33,8 +33,7 @@ class DetailsErrorResponse(BaseModel): __properties: ClassVar[List[str]] = ["code", "message"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py index 736672e5..ed450fd0 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py @@ -36,8 +36,7 @@ class Document(BaseModel): __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py index 1d6f8fb7..dfe650e7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py @@ -34,8 +34,7 @@ class DocumentBulkDeleteRequest(BaseModel): __properties: ClassVar[List[str]] = ["ids"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py index 2b0da6da..97c8eb02 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py @@ -29,13 +29,12 @@ class DocumentBulkDeleteResponse(BaseModel): Response after deleting documents in bulk. """ # noqa: E501 deleted: List[UUID] = Field(description="List of successfully deleted document IDs") - not_found: List[UUID] = Field(description="List of document IDs that were not found", alias="notFound") + not_found: List[UUID] = Field(description="List of document IDs that were not found", serialization_alias="notFound") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["deleted", "notFound"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py index 42896d74..e3d7c20d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py @@ -33,8 +33,7 @@ class DocumentCreateRequest(BaseModel): __properties: ClassVar[List[str]] = ["documents"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py index 5250757e..8d084203 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py @@ -37,8 +37,7 @@ class DocumentInput(BaseModel): __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py index d55247c4..5846b993 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py @@ -31,13 +31,12 @@ class DocumentKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] - match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, serialization_alias="matchMode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py index e49550af..4532c528 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py @@ -29,7 +29,7 @@ class DocumentMetadata(BaseModel): """ # noqa: E501 key: StrictStr = Field(description="Metadata key name.", json_schema_extra={"examples": ["contentObjectId"]}) value: Optional[List[StrictStr]] = Field(description="An array of string values associated with the metadata key. If the key already exists, its values will be overwritten. Setting the value to null will delete the metadata key-value pair.") - match_mode: Optional[StrictStr] = Field(default=None, description="Match mode for the metadata key (ANY or ALL).", alias="matchMode") + match_mode: Optional[StrictStr] = Field(default=None, description="Match mode for the metadata key (ANY or ALL).", serialization_alias="matchMode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] @@ -44,8 +44,7 @@ def match_mode_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py index e62a21e2..6e698cd0 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py @@ -34,8 +34,7 @@ class DocumentMetadataBatchRequest(BaseModel): __properties: ClassVar[List[str]] = ["value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py index ca813ea9..548c88b5 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py @@ -36,8 +36,7 @@ class DocumentMetadataUpdate(BaseModel): __properties: ClassVar[List[str]] = ["id", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py index 2006daf4..38a555cd 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py @@ -34,8 +34,7 @@ class DocumentMetadataUpdateError(BaseModel): __properties: ClassVar[List[str]] = ["target", "code", "message"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py index b3653635..1b11251f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py @@ -37,8 +37,7 @@ class DocumentOutput(BaseModel): __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py index 712f681f..bd057d1d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py @@ -37,8 +37,7 @@ class DocumentResponse(BaseModel): __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py index b3f0061b..249fc270 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py @@ -33,8 +33,7 @@ class DocumentUpdateRequest(BaseModel): __properties: ClassVar[List[str]] = ["documents"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py index 305042cc..b69b4691 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py @@ -35,8 +35,7 @@ class DocumentWithoutChunks(BaseModel): __properties: ClassVar[List[str]] = ["metadata", "id"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py index e680a550..00803d32 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py @@ -34,8 +34,7 @@ class Documents(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py index 98d6ed77..5f53cf8c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py @@ -38,8 +38,7 @@ class DocumentsChunk(BaseModel): __properties: ClassVar[List[str]] = ["id", "title", "metadata", "documents"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py index 02a92cd6..5086d8af 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py @@ -33,8 +33,7 @@ class DocumentsListResponse(BaseModel): __properties: ClassVar[List[str]] = ["documents"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py index c6ca0670..c4e871a6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py @@ -34,8 +34,7 @@ class DocumentsStatusResponse(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py index 75021e1c..616f3503 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py @@ -30,19 +30,18 @@ class DocumentsStatusResponseResourcesInner(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) status: Optional[DocumentStatus] = None - view_location: Optional[StrictStr] = Field(default=None, alias="viewLocation", json_schema_extra={"examples": ["location"]}) - download_location: Optional[StrictStr] = Field(default=None, alias="downloadLocation", json_schema_extra={"examples": ["location"]}) - absolute_url: Optional[StrictStr] = Field(default=None, alias="absoluteUrl") + view_location: Optional[StrictStr] = Field(default=None, serialization_alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, serialization_alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, serialization_alias="absoluteUrl") title: Optional[StrictStr] = None - metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") - created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) - last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + metadata_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py index 59650cfb..4d8e433b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py @@ -28,13 +28,12 @@ class EmbeddingConfig(BaseModel): """ EmbeddingConfig """ # noqa: E501 - model_name: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(default='text-embedding-ada-002', alias="modelName") + model_name: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(default='text-embedding-ada-002', serialization_alias="modelName") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["modelName"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py index 871aca4a..5c7cd6bf 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py @@ -32,8 +32,7 @@ class ErrorResponse(BaseModel): __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py index 387ebc67..65e4e932 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py @@ -32,8 +32,7 @@ class GenericError(BaseModel): __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py index 6cb256ea..165811d2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py @@ -33,8 +33,7 @@ class GetAllPipelines400Response(BaseModel): __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py index 25ab9e48..805806e6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py @@ -29,15 +29,14 @@ class GetPipelineExecutionById(BaseModel): GetPipelineExecutionById """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) - created_at: Optional[StrictStr] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) - modified_at: Optional[StrictStr] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + created_at: Optional[StrictStr] = Field(default=None, serialization_alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[StrictStr] = Field(default=None, serialization_alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) status: Optional[PipelineExecutionStatus] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "createdAt", "modifiedAt", "status"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py index fcffe94f..75c79fc7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py @@ -34,8 +34,7 @@ class GetPipelineExecutions(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py index 7a6813ab..e6fd411c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py @@ -29,9 +29,9 @@ class GetPipelineStatus(BaseModel): """ GetPipelineStatus """ # noqa: E501 - last_started: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="lastStarted", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) - created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) - last_completed_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="lastCompletedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + last_started: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="lastStarted", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + last_completed_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="lastCompletedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) status: Optional[PipelineExecutionStatus] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["lastStarted", "createdAt", "lastCompletedAt", "status"] @@ -67,8 +67,7 @@ def last_completed_at_validate_regular_expression(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py index c957803c..efd6e62c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py @@ -34,8 +34,7 @@ class GetPipelines(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py index cb1ff0a7..a089ad0b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py @@ -27,9 +27,9 @@ class GoogleDriveConfig(BaseModel): """ GoogleDriveConfig """ # noqa: E501 - resource_type: StrictStr = Field(alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) - resource_id: Optional[StrictStr] = Field(default=None, alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) - include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + resource_type: StrictStr = Field(serialization_alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, serialization_alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["resourceType", "resourceId", "includePaths"] @@ -41,8 +41,7 @@ def resource_type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py index 984b4b9f..0bcdf6d6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py @@ -28,12 +28,11 @@ class GoogleDriveConfigurationMinimal(BaseModel): """ GoogleDriveConfigurationMinimal """ # noqa: E501 - google_drive: GoogleDriveResourceDetail = Field(alias="googleDrive") + google_drive: GoogleDriveResourceDetail = Field(serialization_alias="googleDrive") __properties: ClassVar[List[str]] = ["googleDrive"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py index 762ffce7..09dc60ae 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py @@ -29,15 +29,14 @@ class GoogleDriveConfigurationStruct(BaseModel): GoogleDriveConfigurationStruct """ # noqa: E501 destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) - google_drive: GoogleDriveConfig = Field(alias="googleDrive") - cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) - metadata_config_id: Optional[StrictStr] = Field(default=None, alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + google_drive: GoogleDriveConfig = Field(serialization_alias="googleDrive") + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", serialization_alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + metadata_config_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "googleDrive", "cronExpression", "metadataConfigId"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py index 29033084..3667fc20 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py index 32710be9..f1875866 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py @@ -44,8 +44,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py index 9871af77..357bc53a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py @@ -45,8 +45,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py index f3a1ac8c..9c360f5d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py @@ -27,9 +27,9 @@ class GoogleDriveResourceDetail(BaseModel): """ GoogleDriveResourceDetail """ # noqa: E501 - resource_type: Optional[StrictStr] = Field(default=None, alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) - resource_id: Optional[StrictStr] = Field(default=None, alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) - include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + resource_type: Optional[StrictStr] = Field(default=None, serialization_alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, serialization_alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["resourceType", "resourceId", "includePaths"] @@ -44,8 +44,7 @@ def resource_type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py index ba3b1ab4..10e9fc33 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py @@ -33,8 +33,7 @@ class HTTPValidationError(BaseModel): __properties: ClassVar[List[str]] = ["detail"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py index 0010e027..1a5f7169 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py @@ -34,8 +34,7 @@ class KeyValueListPair(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py index 4267d5bc..e56a83de 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py @@ -29,13 +29,12 @@ class KeyWordRetrievalScoringConfiguration(BaseModel): """ # noqa: E501 enabled: Optional[StrictBool] = Field(default=True, description="Enable dense retrieval.") weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") - extract_key_words_from_query: Optional[StrictBool] = Field(default=False, description="Extract Keywords from Query.", alias="extractKeyWordsFromQuery") + extract_key_words_from_query: Optional[StrictBool] = Field(default=False, description="Extract Keywords from Query.", serialization_alias="extractKeyWordsFromQuery") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["enabled", "weight", "extractKeyWordsFromQuery"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py index 039ccbc8..8f3c87b7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py @@ -34,8 +34,7 @@ class ListConfigurationDocuments(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py index 8668822b..99bfc329 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py @@ -34,8 +34,7 @@ class ListConfigurationDocumentsFullDetails(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py index 29879a78..0a5f37be 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py @@ -34,8 +34,7 @@ class ListMetadataConfigurations(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py index 0bb642cd..69db704a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py @@ -27,14 +27,13 @@ class ManualPipelineTrigger(BaseModel): """ ManualPipelineTrigger """ # noqa: E501 - pipeline_id: Optional[StrictStr] = Field(default=None, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) - metadata_only: Optional[StrictBool] = Field(default=None, alias="metadataOnly", json_schema_extra={"examples": [True]}) + pipeline_id: Optional[StrictStr] = Field(default=None, serialization_alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + metadata_only: Optional[StrictBool] = Field(default=None, serialization_alias="metadataOnly", json_schema_extra={"examples": [True]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["pipelineId", "metadataOnly"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py index 1ebb166d..c60ece85 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py @@ -32,7 +32,7 @@ class MergeStrategyReranker(BaseModel): type: Optional[MergeStrategyType] = None model: Optional[StrictStr] = Field(default='cohere-3.5', description="The RerankerModel to use.") boosting: Optional[List[MergeStrategyRerankerBoostingInner]] = Field(default=None, description="Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.") - include_all_meta_data: Optional[StrictBool] = Field(default=False, description="If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.", alias="includeAllMetaData") + include_all_meta_data: Optional[StrictBool] = Field(default=False, description="If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.", serialization_alias="includeAllMetaData") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["type", "model", "boosting", "includeAllMetaData"] @@ -47,8 +47,7 @@ def model_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py index 70e9077b..63a2d07d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py @@ -35,8 +35,7 @@ class MergeStrategyRerankerBoostingInner(BaseModel): __properties: ClassVar[List[str]] = ["key", "value", "scope"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py index f3d8ded2..2ba34999 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py @@ -33,8 +33,7 @@ class MergeStrategyScoreReuse(BaseModel): __properties: ClassVar[List[str]] = ["type"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py index a55cf5e6..7464e90f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py @@ -32,8 +32,7 @@ class MessageResponse(BaseModel): __properties: ClassVar[List[str]] = ["message"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py index ac391ef9..685321c8 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py @@ -29,13 +29,12 @@ class MetaData(BaseModel): MetaData """ # noqa: E501 destination: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["destination-name"]}) - data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "dataRepositoryMetadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py index d024351b..e423d2ca 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py @@ -34,8 +34,7 @@ class MetaDataDataRepositoryMetadataInner(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py index e20d10b3..450d2376 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py @@ -34,8 +34,7 @@ class MetaDataKeyValuePairStrict(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py index d3e13d0c..13c414be 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py index 02620c93..011051f3 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py @@ -28,13 +28,12 @@ class MetadataConfigurationMetadata(BaseModel): """ MetadataConfigurationMetadata """ # noqa: E501 - data_repository_metadata: List[MetaDataKeyValuePairStrict] = Field(alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + data_repository_metadata: List[MetaDataKeyValuePairStrict] = Field(serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py index 47212656..ee9cb4e8 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py @@ -31,9 +31,9 @@ class MetadataConfigurationRequest(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be generated.") name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") - destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", alias="destinationName") - data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) - include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) + destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", serialization_alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", serialization_alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels"] @@ -46,8 +46,7 @@ def data_repository_type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py index 3a03331a..14c27d51 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py @@ -33,8 +33,7 @@ class MetadataConfigurationRequestLabelsInner(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py index 46b05bbf..0b6a381e 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py @@ -31,11 +31,11 @@ class MetadataConfigurationResponse(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be generated.") name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") - destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", alias="destinationName") - data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) - include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) + destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", serialization_alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", serialization_alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None - enumeration_status: Optional[StrictStr] = Field(default=None, description="Status of metadata enumeration for the configuration.", alias="enumerationStatus") + enumeration_status: Optional[StrictStr] = Field(default=None, description="Status of metadata enumeration for the configuration.", serialization_alias="enumerationStatus") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels", "enumerationStatus"] @@ -57,8 +57,7 @@ def enumeration_status_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py index 804545fc..c5079a94 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py @@ -28,14 +28,13 @@ class MetadataConfigurationStruct(BaseModel): """ MetadataConfigurationStruct """ # noqa: E501 - metadata_config_id: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) - cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + metadata_config_id: Annotated[str, Field(min_length=1, strict=True)] = Field(serialization_alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", serialization_alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["metadataConfigId", "cronExpression"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py index 0fd7e94e..2c4670f7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py @@ -35,8 +35,7 @@ class MetadataItem(BaseModel): __properties: ClassVar[List[str]] = ["id", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py index 70b4c662..5b0e1a22 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py @@ -35,8 +35,7 @@ class MetadataKeyUpdate(BaseModel): __properties: ClassVar[List[str]] = ["key", "operations"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py index e1fea570..6d44f8a1 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py @@ -34,8 +34,7 @@ class MetadataOperation(BaseModel): __properties: ClassVar[List[str]] = ["op", "values"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py index 92106380..b492b491 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py @@ -33,8 +33,7 @@ class MetadataResponse(BaseModel): __properties: ClassVar[List[str]] = ["current_metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py index fa687c74..88b42b54 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py @@ -30,13 +30,12 @@ class MetadataUpdateItem(BaseModel): MetadataUpdateItem """ # noqa: E501 ids: List[UUID] = Field(description="List of collection or document or chunk ids for which the metadata should be updated") - metadata_updates: List[MetadataKeyUpdate] = Field(description="List of metadata updates for the given resource ids", alias="metadataUpdates") + metadata_updates: List[MetadataKeyUpdate] = Field(description="List of metadata updates for the given resource ids", serialization_alias="metadataUpdates") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["ids", "metadataUpdates"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py index 50c0059f..99b4f71a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py @@ -33,8 +33,7 @@ class MetadataUpdates(BaseModel): __properties: ClassVar[List[str]] = ["updates"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py index aaa86e48..719d672d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py @@ -29,14 +29,13 @@ class MSSharePointConfiguration(BaseModel): MSSharePointConfiguration """ # noqa: E501 destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) - share_point: SharePointConfig = Field(alias="sharePoint") - cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + share_point: SharePointConfig = Field(serialization_alias="sharePoint") + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "sharePoint", "cronExpression"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py index 34261d61..59e1f6c8 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py @@ -29,13 +29,12 @@ class MSSharePointConfigurationGetResponse(BaseModel): MSSharePointConfigurationGetResponse """ # noqa: E501 destination: StrictStr - share_point: SharePointConfigGetResponse = Field(alias="sharePoint") + share_point: SharePointConfigGetResponse = Field(serialization_alias="sharePoint") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "sharePoint"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py index 3514710b..4465c001 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py @@ -28,13 +28,12 @@ class MSSharePointConfigurationMinimal(BaseModel): """ MSSharePointConfigurationMinimal """ # noqa: E501 - share_point: SharePointSiteDetail = Field(alias="sharePoint") + share_point: SharePointSiteDetail = Field(serialization_alias="sharePoint") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["sharePoint"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py index a05ca764..c7296688 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py index 0b306eb9..84aa8199 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py @@ -44,8 +44,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py index 44d3168e..385c21ce 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py @@ -45,8 +45,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py index 9d5f0033..404cf1a1 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py @@ -35,8 +35,7 @@ class PatchPipeline(BaseModel): __properties: ClassVar[List[str]] = ["metadata", "configuration"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py index 98930f34..7f577783 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py @@ -27,13 +27,12 @@ class PatchPipelineConfiguration(BaseModel): """ PatchPipelineConfiguration """ # noqa: E501 - cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["cronExpression"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py index fb7bc7b2..7d4a412b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py @@ -28,13 +28,12 @@ class PatchPipelineMetadata(BaseModel): """ PatchPipelineMetadata """ # noqa: E501 - data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Patch for metadata happens at key level. Value for the specific key would be inserted/replaced.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Patch for metadata happens at key level. Value for the specific key would be inserted/replaced.", serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py index 39c770a0..24778e1d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py @@ -28,14 +28,13 @@ class PerFilterSearchResult(BaseModel): """ PerFilterSearchResult """ # noqa: E501 - filter_id: StrictStr = Field(alias="filterId") + filter_id: StrictStr = Field(serialization_alias="filterId") results: List[DocumentsChunk] additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py index e1a53a52..86628c87 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py @@ -32,8 +32,7 @@ class PerFilterSearchResultError(BaseModel): __properties: ClassVar[List[str]] = ["message"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py index 193592b6..7ef91f3f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py @@ -28,14 +28,13 @@ class PerFilterSearchResultWithError(BaseModel): """ PerFilterSearchResultWithError """ # noqa: E501 - filter_id: StrictStr = Field(alias="filterId") + filter_id: StrictStr = Field(serialization_alias="filterId") error: Optional[PerFilterSearchResultError] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "error"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py index 19f7d009..5158f44b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py @@ -30,19 +30,18 @@ class PipelineDocumentResponse(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) status: Optional[DocumentStatus] = None - view_location: Optional[StrictStr] = Field(default=None, alias="viewLocation", json_schema_extra={"examples": ["location"]}) - download_location: Optional[StrictStr] = Field(default=None, alias="downloadLocation", json_schema_extra={"examples": ["location"]}) - absolute_url: Optional[StrictStr] = Field(default=None, alias="absoluteUrl") + view_location: Optional[StrictStr] = Field(default=None, serialization_alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, serialization_alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, serialization_alias="absoluteUrl") title: Optional[StrictStr] = None - metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") - created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) - last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + metadata_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py index 36ecf1fc..688b57e7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py @@ -31,8 +31,8 @@ class PipelineExecutionData(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) status: Optional[PipelineExecutionStatus] = None - created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) - modified_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "status", "createdAt", "modifiedAt"] @@ -57,8 +57,7 @@ def modified_at_validate_regular_expression(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py index a818e9cd..66f260eb 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py @@ -27,13 +27,12 @@ class PipelineId(BaseModel): """ PipelineId """ # noqa: E501 - pipeline_id: Optional[StrictStr] = Field(default=None, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + pipeline_id: Optional[StrictStr] = Field(default=None, serialization_alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["pipelineId"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py index 4a45ed49..0fd66251 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py @@ -32,8 +32,7 @@ class PostProcessingObjectReference(BaseModel): __properties: ClassVar[List[str]] = ["id"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py index 8e0d8dae..b131cccc 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py @@ -30,15 +30,14 @@ class PostProcessingOperation(BaseModel): PostProcessingOperation """ # noqa: E501 id: Optional[StrictStr] = Field(default='ae9eee48-4671-4321-a3e5-640adaaf26ae', description="New ID for each PostProcessingOperation.") - max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", alias="maxChunkCount") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", serialization_alias="maxChunkCount") strategy: Strategy inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py index cc6c0389..72ab68e3 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py @@ -41,8 +41,7 @@ def operator_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py index 48240de4..bed4a276 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py @@ -33,14 +33,13 @@ class RetrievalChunk(BaseModel): id: StrictStr content: StrictStr metadata: Optional[List[RetrievalKeyValueListPair]] = None - search_scores: Optional[SearchScores] = Field(default=None, alias="searchScores") - post_processing_score: Optional[Score] = Field(default=None, alias="postProcessingScore") + search_scores: Optional[SearchScores] = Field(default=None, serialization_alias="searchScores") + post_processing_score: Optional[Score] = Field(default=None, serialization_alias="postProcessingScore") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "content", "metadata", "searchScores", "postProcessingScore"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py index d4dce8f4..047ed724 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py @@ -28,13 +28,12 @@ class RetrievalDataRepositorySearchResult(BaseModel): """ RetrievalDataRepositorySearchResult """ # noqa: E501 - data_repository: DataRepositoryWithDocuments = Field(alias="dataRepository") + data_repository: DataRepositoryWithDocuments = Field(serialization_alias="dataRepository") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepository"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py index 4fd73ce7..3253ebf7 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py @@ -31,13 +31,12 @@ class RetrievalDocumentKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] - match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, serialization_alias="matchMode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py index 2e231d3d..56b36add 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py @@ -34,8 +34,7 @@ class RetrievalKeyValueListPair(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py index 2b31ca6a..79d19a80 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py @@ -28,15 +28,14 @@ class RetrievalPerFilterSearchResult(BaseModel): """ RetrievalPerFilterSearchResult """ # noqa: E501 - filter_id: StrictStr = Field(alias="filterId") + filter_id: StrictStr = Field(serialization_alias="filterId") results: Optional[List[RetrievalDataRepositorySearchResult]] = Field(default=None, description="List of returned results.") - remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly Destination Name of remote instance (grounding.name). Only present if dataRepositoryType = remote:dg.", alias="remoteGroundingName") + remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly Destination Name of remote instance (grounding.name). Only present if dataRepositoryType = remote:dg.", serialization_alias="remoteGroundingName") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results", "remoteGroundingName"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py index af0f11fb..6f712924 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py @@ -32,8 +32,7 @@ class RetrievalPerFilterSearchResultError(BaseModel): __properties: ClassVar[List[str]] = ["message"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py index 3cfda5ad..2f8da513 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py @@ -28,14 +28,13 @@ class RetrievalPerFilterSearchResultWithError(BaseModel): """ RetrievalPerFilterSearchResultWithError """ # noqa: E501 - filter_id: StrictStr = Field(alias="filterId") + filter_id: StrictStr = Field(serialization_alias="filterId") error: Optional[RetrievalPerFilterSearchResultError] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "error"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py index 6b5a8297..1cf9bb93 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py @@ -45,8 +45,7 @@ def scope_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py index c54200f2..a606bc6d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py @@ -28,14 +28,13 @@ class RetrievalSearchConfiguration(BaseModel): """ RetrievalSearchConfiguration """ # noqa: E501 - max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") - max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", serialization_alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", serialization_alias="maxDocumentCount") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py index 0f0a9373..d2fade06 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py @@ -31,13 +31,12 @@ class RetrievalSearchDocumentKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] - select_mode: Optional[List[RetrievalSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + select_mode: Optional[List[RetrievalSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", serialization_alias="selectMode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py index cef065fa..c63c1b6f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py @@ -32,19 +32,18 @@ class RetrievalSearchFilter(BaseModel): Limit scope of search to certain DataRepositories, Documents or Chunks. """ # noqa: E501 id: StrictStr = Field(description="Identifier of this RetrievalSearchFilter - unique per request.") - search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, alias="searchConfiguration") - data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", alias="dataRepositories") - data_repository_type: DataRepositoryType = Field(alias="dataRepositoryType") - remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", alias="remoteName") - data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", alias="dataRepositoryMetadata") - document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") - chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, serialization_alias="searchConfiguration") + data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", serialization_alias="dataRepositories") + data_repository_type: DataRepositoryType = Field(serialization_alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", serialization_alias="remoteName") + data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", serialization_alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py index 57642540..d4472a51 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py @@ -32,13 +32,12 @@ class RetrievalSearchInput(BaseModel): """ # noqa: E501 query: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(description="Query string") filters: List[FiltersInner] - post_processing: Optional[List[RetrievalSearchInputPostProcessingInner]] = Field(default=None, description="List of operations to be performed across PerFilterSearchResults.", alias="postProcessing") + post_processing: Optional[List[RetrievalSearchInputPostProcessingInner]] = Field(default=None, description="List of operations to be performed across PerFilterSearchResults.", serialization_alias="postProcessing") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["query", "filters", "postProcessing"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py index bbbfa52a..5164f456 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py @@ -31,15 +31,14 @@ class RetrievalSearchInputPostProcessingInner(BaseModel): RetrievalSearchInputPostProcessingInner """ # noqa: E501 id: Optional[StrictStr] = Field(default='ae9eee48-4671-4321-a3e5-640adaaf26ae', description="New ID for each PostProcessingOperation.") - max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", alias="maxChunkCount") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", serialization_alias="maxChunkCount") strategy: RetrievalSearchInputPostProcessingInnerStrategy inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py index 03453344..02c4a54c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py @@ -33,8 +33,7 @@ class RetrievalSearchResults(BaseModel): __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py index f5857e19..735bba42 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py @@ -34,21 +34,20 @@ class RetrievalVectorSearchFilter(BaseModel): RetrievalVectorSearchFilter """ # noqa: E501 id: StrictStr = Field(description="Identifier of this RetrievalSearchFilter - unique per request.") - search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, alias="searchConfiguration") - data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", alias="dataRepositories") - data_repository_type: Optional[DataRepositoryType] = Field(default=None, alias="dataRepositoryType") - remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", alias="remoteName") - data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", alias="dataRepositoryMetadata") - document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") - chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, serialization_alias="searchConfiguration") + data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", serialization_alias="dataRepositories") + data_repository_type: Optional[DataRepositoryType] = Field(default=None, serialization_alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", serialization_alias="remoteName") + data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", serialization_alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") filter: Optional[RetrievalVectorSearchFilterFilter] = None - scoring_configuration: Optional[VectorScoringConfiguration] = Field(default=None, alias="scoringConfiguration") + scoring_configuration: Optional[VectorScoringConfiguration] = Field(default=None, serialization_alias="scoringConfiguration") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata", "filter", "scoringConfiguration"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py index 25cac469..e4222c3d 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py @@ -30,13 +30,12 @@ class S3Configuration(BaseModel): """ # noqa: E501 destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) s3: Optional[ServiceNowConfigurationMinimalServiceNow] = None - cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "s3", "cronExpression"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py index 4c0a9ff6..9b836acf 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py @@ -32,8 +32,7 @@ class S3ConfigurationMinimal(BaseModel): __properties: ClassVar[List[str]] = ["s3"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py index a76250aa..23d35387 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py index e222fb8d..7cbcad76 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py @@ -44,8 +44,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py index d57e24f9..51fa3ce5 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py @@ -45,8 +45,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py index 5a21ab75..0cb6288c 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py @@ -45,8 +45,7 @@ def scope_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py index 2aea571f..f360da30 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py @@ -32,8 +32,7 @@ class Score(BaseModel): __properties: ClassVar[List[str]] = ["value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py index e1d74c6a..899fb815 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py @@ -41,8 +41,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py index 836e2040..d7d08933 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py @@ -42,8 +42,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py index 036e1777..c321e850 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py index b9640c31..de68186a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py @@ -28,14 +28,13 @@ class SearchConfiguration(BaseModel): """ SearchConfiguration """ # noqa: E501 - max_chunk_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") - max_document_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + max_chunk_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", serialization_alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", serialization_alias="maxDocumentCount") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py index 931337e3..12cc6631 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py @@ -31,13 +31,12 @@ class SearchDocumentKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] - select_mode: Optional[List[Optional[SearchSelectOptionEnum]]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + select_mode: Optional[List[Optional[SearchSelectOptionEnum]]] = Field(default=None, description="Select mode for search filters", serialization_alias="selectMode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py index 1d29a9ce..ab99bd47 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py @@ -32,17 +32,16 @@ class SearchFilter(BaseModel): SearchFilter """ # noqa: E501 id: StrictStr = Field(description="Identifier of this SearchFilter - unique per request.") - collection_ids: List[StrictStr] = Field(alias="collectionIds") + collection_ids: List[StrictStr] = Field(serialization_alias="collectionIds") configuration: SearchConfiguration - collection_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", alias="collectionMetadata") - document_metadata: Optional[Annotated[List[SearchDocumentKeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") - chunk_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + collection_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", serialization_alias="collectionMetadata") + document_metadata: Optional[Annotated[List[SearchDocumentKeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py index cd10b010..4985173b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py @@ -28,13 +28,12 @@ class SearchPipeline(BaseModel): """ SearchPipeline """ # noqa: E501 - data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Search for metadata happens at key level. Pipelines matching the search criteria will be returned.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Search for metadata happens at key level. Pipelines matching the search criteria will be returned.", serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py index 5f4b7068..47d6766b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py @@ -34,8 +34,7 @@ class SearchPipelinesResponse(BaseModel): __properties: ClassVar[List[str]] = ["count", "resources"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py index 00225e3e..93be5eaf 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py @@ -33,8 +33,7 @@ class SearchResults(BaseModel): __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py index 42813130..5c1915fc 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py @@ -28,14 +28,13 @@ class SearchScores(BaseModel): """ SearchScores """ # noqa: E501 - aggregated_score: SearchScoresAggregatedScore = Field(alias="aggregatedScore") - dense_retrieval_score: SearchScoresAggregatedScore = Field(alias="denseRetrievalScore") + aggregated_score: SearchScoresAggregatedScore = Field(serialization_alias="aggregatedScore") + dense_retrieval_score: SearchScoresAggregatedScore = Field(serialization_alias="denseRetrievalScore") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["aggregatedScore", "denseRetrievalScore"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py index 8b2a8340..bb8b78f2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py @@ -32,8 +32,7 @@ class SearchScoresAggregatedScore(BaseModel): __properties: ClassVar[List[str]] = ["value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py index 0b8f7326..8fbc34c5 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py @@ -28,13 +28,12 @@ class ServiceNowConfig(BaseModel): """ ServiceNowConfig """ # noqa: E501 - include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["active=true", "sys_domain_path=/health"]]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["active=true", "sys_domain_path=/health"]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["includePaths"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py index a492b78e..ed8ee749 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py @@ -29,12 +29,11 @@ class ServiceNowConfigurationMinimal(BaseModel): ServiceNowConfigurationMinimal """ # noqa: E501 destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) - service_now: Optional[ServiceNowConfigurationMinimalServiceNow] = Field(default=None, alias="serviceNow") + service_now: Optional[ServiceNowConfigurationMinimalServiceNow] = Field(default=None, serialization_alias="serviceNow") __properties: ClassVar[List[str]] = ["destination", "serviceNow"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py index ba79955f..2849fe14 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py @@ -27,13 +27,12 @@ class ServiceNowConfigurationMinimalServiceNow(BaseModel): """ ServiceNowConfigurationMinimalServiceNow """ # noqa: E501 - include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["includePaths"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py index 1ef22c80..411517b4 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py @@ -29,15 +29,14 @@ class ServiceNowConfigurationStruct(BaseModel): ServiceNowConfigurationStruct """ # noqa: E501 destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) - service_now: Optional[ServiceNowConfig] = Field(default=None, alias="serviceNow") - metadata_config_id: Optional[StrictStr] = Field(default=None, alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) - cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + service_now: Optional[ServiceNowConfig] = Field(default=None, serialization_alias="serviceNow") + metadata_config_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", serialization_alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "serviceNow", "metadataConfigId", "cronExpression"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py index a586f443..0f237908 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py index aa43a987..df6ee8f8 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py @@ -44,8 +44,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py index b52e3bf1..65cc2105 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py index 0d32c5e0..4567bb1f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py @@ -30,13 +30,12 @@ class SFTPConfiguration(BaseModel): """ # noqa: E501 destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) sftp: Optional[ServiceNowConfigurationMinimalServiceNow] = None - cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["destination", "sftp", "cronExpression"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py index af6b5cf3..e4f7bd18 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py @@ -32,8 +32,7 @@ class SFTPConfigurationMinimal(BaseModel): __properties: ClassVar[List[str]] = ["sftp"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py index cada6615..849cbdbc 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py index 2e7df6af..78947aa0 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py @@ -44,8 +44,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py index 1fd38018..15d79fa6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py @@ -45,8 +45,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py index d145dcba..2c9b7dff 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py @@ -33,8 +33,7 @@ class SharePointConfig(BaseModel): __properties: ClassVar[List[str]] = ["site"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py index 3b6992af..49a9688b 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py @@ -33,8 +33,7 @@ class SharePointConfigGetResponse(BaseModel): __properties: ClassVar[List[str]] = ["site"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py index 1ee43f62..137f7950 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py @@ -28,13 +28,12 @@ class SharePointSite(BaseModel): SharePointSite """ # noqa: E501 name: StrictStr = Field(json_schema_extra={"examples": ["sharepoint-site-name"]}) - include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["name", "includePaths"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py index 913f465e..c745e0dc 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py @@ -29,13 +29,12 @@ class SharePointSiteDetail(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["sharepoint-site-id"]}) name: StrictStr = Field(json_schema_extra={"examples": ["sharepoint-site-name"]}) - include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py index 45411d5e..10378070 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py @@ -29,13 +29,12 @@ class SharePointSiteGetResponse(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = None name: StrictStr - include_paths: Optional[List[StrictStr]] = Field(default=None, alias="includePaths") + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py index b16fe6a1..6a919db0 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py @@ -36,8 +36,7 @@ class TextOnlyBaseChunk(BaseModel): __properties: ClassVar[List[str]] = ["content", "metadata", "id"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py index 504e89c5..7c84155a 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py @@ -34,8 +34,7 @@ class TextOnlyBaseChunkCreate(BaseModel): __properties: ClassVar[List[str]] = ["content", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py index a93c7340..a680f913 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py @@ -35,8 +35,7 @@ class TextSearchRequest(BaseModel): __properties: ClassVar[List[str]] = ["query", "filters"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py index cb315551..590429d2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py @@ -37,8 +37,7 @@ class ValidationError(BaseModel): __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py index 5dd9b599..c41018a1 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py @@ -35,8 +35,7 @@ class VectorChunk(BaseModel): __properties: ClassVar[List[str]] = ["id", "content", "metadata"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py index f506871c..399e6571 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py @@ -31,13 +31,12 @@ class VectorDocumentKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] - match_mode: Optional[FilterMatchModeEnum] = Field(default=None, alias="matchMode") + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, serialization_alias="matchMode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py index 0e8b8044..05daa4ee 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py @@ -34,8 +34,7 @@ class VectorKeyValueListPair(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py index 7afeb435..448bec0f 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py @@ -28,14 +28,13 @@ class VectorPerFilterSearchResult(BaseModel): """ VectorPerFilterSearchResult """ # noqa: E501 - filter_id: StrictStr = Field(alias="filterId") + filter_id: StrictStr = Field(serialization_alias="filterId") results: List[DocumentsChunk] additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["filterId", "results"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py index 2a3e73c2..88877a56 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py @@ -31,17 +31,16 @@ class VectorScoringConfiguration(BaseModel): """ VectorScoringConfiguration """ # noqa: E501 - dense_retrieval: Optional[DenseRetrievalScoringConfiguration] = Field(default=None, alias="denseRetrieval") - keyword_retrieval: Optional[KeyWordRetrievalScoringConfiguration] = Field(default=None, alias="keywordRetrieval") + dense_retrieval: Optional[DenseRetrievalScoringConfiguration] = Field(default=None, serialization_alias="denseRetrieval") + keyword_retrieval: Optional[KeyWordRetrievalScoringConfiguration] = Field(default=None, serialization_alias="keywordRetrieval") boosting: Optional[BoostingScoringConfiguration] = None - score_threshold: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum chunk score threshold.", alias="scoreThreshold") - aggregation_strategy: Optional[ScoresAggregationStrategy] = Field(default=None, alias="aggregationStrategy") + score_threshold: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum chunk score threshold.", serialization_alias="scoreThreshold") + aggregation_strategy: Optional[ScoresAggregationStrategy] = Field(default=None, serialization_alias="aggregationStrategy") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["denseRetrieval", "keywordRetrieval", "boosting", "scoreThreshold", "aggregationStrategy"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py index cfab2a1a..156f89de 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py @@ -28,14 +28,13 @@ class VectorSearchConfiguration(BaseModel): """ VectorSearchConfiguration """ # noqa: E501 - max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", alias="maxChunkCount") - max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", alias="maxDocumentCount") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", serialization_alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", serialization_alias="maxDocumentCount") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py index 58d7eb2f..bf715478 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py @@ -31,13 +31,12 @@ class VectorSearchDocumentKeyValueListPair(BaseModel): """ # noqa: E501 key: Annotated[str, Field(strict=True, max_length=1024)] value: List[Annotated[str, Field(strict=True, max_length=1024)]] - select_mode: Optional[List[VectorSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", alias="selectMode") + select_mode: Optional[List[VectorSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", serialization_alias="selectMode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py index dfa5cd5a..3f4ac207 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py @@ -32,18 +32,17 @@ class VectorSearchFilter(BaseModel): VectorSearchFilter """ # noqa: E501 id: StrictStr = Field(description="Identifier of this VectorSearchFilter - unique per request.") - collection_ids: List[StrictStr] = Field(alias="collectionIds") + collection_ids: List[StrictStr] = Field(serialization_alias="collectionIds") configuration: VectorSearchConfiguration - collection_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", alias="collectionMetadata") - document_metadata: Optional[List[VectorSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") - chunk_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + collection_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", serialization_alias="collectionMetadata") + document_metadata: Optional[List[VectorSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") filter: Optional[Filter] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata", "filter"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py index 19ef9047..a45c0416 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py @@ -33,8 +33,7 @@ class VectorSearchResults(BaseModel): __properties: ClassVar[List[str]] = ["results"] model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py index c05c956d..53da7ec2 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py @@ -41,8 +41,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py index a879b2ef..f720f1e6 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py @@ -42,8 +42,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py index 3051d0a7..c91e0fab 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py @@ -43,8 +43,7 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - validate_by_name=True, - validate_by_alias=True, + populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/__init__.py new file mode 100644 index 00000000..cec90368 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/__init__.py @@ -0,0 +1,5 @@ +"""Tabular AI Orchestration client for SAP AI Core.""" + +from gen_ai_hub.tab_ai_orchestration.client import TabAiOrchestrationClient + +__all__ = ["TabAiOrchestrationClient"] diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/client.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/client.py new file mode 100644 index 00000000..27027c2d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/client.py @@ -0,0 +1,134 @@ +"""Typed async client for the Tabular AI Orchestration service.""" +from __future__ import annotations + +from typing import Any, Optional, Self, Union + +import httpx + +from gen_ai_hub.tab_ai_orchestration.generated.api.predict_api import PredictApi +from gen_ai_hub.tab_ai_orchestration.generated.api_client import ApiClient +from gen_ai_hub.tab_ai_orchestration.generated.configuration import Configuration +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse +from gen_ai_hub.tab_ai_orchestration.generated.rest import RESTClientObject + +from gen_ai_hub import GenAIHubProxyClient +from gen_ai_hub.proxy import get_proxy_client + + +def _get_proxy(proxy_client: Optional[GenAIHubProxyClient]) -> GenAIHubProxyClient: + return proxy_client or get_proxy_client(proxy_version="gen-ai-hub") + + +def _resolve_deployment_url(proxy: GenAIHubProxyClient, model_name: str, model_version: Optional[str]) -> str: + from ai_core_sdk.models import Status + query = proxy.ai_core_client.deployment.query( + status=Status.RUNNING, + scenario_id="tabular-orchestration", + resource_group=proxy.resource_group or "default", + ) + if not query.resources: + raise ValueError("No running tabular-orchestration deployment found.") + return query.resources[0].deployment_url + + +def _make_auth_hook(proxy: GenAIHubProxyClient): + async def inject_auth(request: httpx.Request) -> None: + for key, value in proxy.request_header.items(): + request.headers[key] = value + return inject_auth + + +class _SapRESTClientObject(RESTClientObject): + def __init__(self, configuration: Configuration, proxy: GenAIHubProxyClient, timeout: Any) -> None: + super().__init__(configuration) + self._proxy = proxy + self._timeout = timeout + + def _create_pool_manager(self) -> httpx.AsyncClient: + kwargs: dict[str, Any] = {"event_hooks": {"request": [_make_auth_hook(self._proxy)]}} + if self._timeout is not None: + kwargs["timeout"] = self._timeout + return httpx.AsyncClient(**kwargs) + + +class _SapApiClient(ApiClient): + def __init__(self, configuration: Configuration, proxy: GenAIHubProxyClient, timeout: Any) -> None: + super().__init__(configuration=configuration) + self.rest_client = _SapRESTClientObject(configuration, proxy, timeout) + + def sanitize_for_serialization(self, obj: Any) -> Any: + # The base class calls obj.to_dict() which includes additional_properties. + # Override to strip it at all levels while preserving camelCase aliases. + from pydantic import BaseModel + if obj is None: + return None + if isinstance(obj, BaseModel): + d = obj.model_dump(by_alias=True, exclude_none=True, exclude={"additional_properties"}) + return self.sanitize_for_serialization(d) + if isinstance(obj, dict): + return {k: self.sanitize_for_serialization(v) for k, v in obj.items() if k != "additional_properties"} + if isinstance(obj, list): + return [self.sanitize_for_serialization(i) for i in obj] + return super().sanitize_for_serialization(obj) + + +class TabAiOrchestrationClient: + """Async client for the Tabular AI Orchestration service. + + Resolves the deployment URL from the proxy client credentials using + ``model_name`` and optional ``model_version``. Auth headers are injected + automatically via the SAP proxy client. + + Usage:: + + async with TabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + response = await client.predict( + ai_resource_group="default", + predict_request=PredictRequest(...), + ) + + # or without context manager + client = TabAiOrchestrationClient(model_name="sap-rpt-1.5") + response = await client.predict(...) + await client.close() + """ + + def __init__( + self, + model_name: str, + model_version: Optional[str] = None, + proxy_client: Optional[GenAIHubProxyClient] = None, + timeout: Union[float, None] = None, + ) -> None: + proxy = _get_proxy(proxy_client) + base_url = _resolve_deployment_url(proxy, model_name, model_version) + config = Configuration(host=base_url) + self._api_client = _SapApiClient(config, proxy, timeout) + self._predict_api = PredictApi(self._api_client) + + async def close(self) -> None: + """Close the underlying HTTP client.""" + await self._api_client.close() + + async def __aenter__(self) -> Self: + return self + + async def __aexit__(self, *_: object) -> None: + await self.close() + + async def predict( + self, + predict_request: PredictRequest, + ai_resource_group: str, + ) -> PredictResponse: + """Make predictions using a Tabular Foundation Model. + + :param predict_request: The prediction request payload. + :param ai_resource_group: AI Core resource group identifier. + :returns: Prediction response from the model. + """ + return await self._predict_api.predict( # type: ignore[no-any-return] + ai_resource_group=ai_resource_group, + predict_request=predict_request, + ) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/__init__.py new file mode 100644 index 00000000..7495576b --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/__init__.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# Define package exports +__all__ = [ + "PredictApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "ConditionsInner", + "ContextSelectionConfig", + "ContextSelectionStrategyEnum", + "FilterCondition", + "FilterConditions", + "Filterconditions", + "HTTPValidationError", + "LocationInner", + "ModelRpt1", + "ModelRpt15", + "ModelRpt15Explanations", + "ModelRpt15PredictionConfig", + "Modelconfig", + "PredictMetadata", + "PredictRequest", + "PredictResponse", + "PredictStatus", + "PredictionConfig", + "SamplingHeuristicConfig", + "SamplingRandomConfig", + "Strategyconfig", + "TFMEnum", + "TargetColumn", + "TaskTypeEnum", + "ValidationError", +] + +# import apis into sdk package +from gen_ai_hub.tab_ai_orchestration.generated.api.predict_api import PredictApi as PredictApi + +# import ApiClient +from gen_ai_hub.tab_ai_orchestration.generated.api_response import ApiResponse as ApiResponse +from gen_ai_hub.tab_ai_orchestration.generated.api_client import ApiClient as ApiClient +from gen_ai_hub.tab_ai_orchestration.generated.configuration import Configuration as Configuration +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import OpenApiException as OpenApiException +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiTypeError as ApiTypeError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiValueError as ApiValueError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiKeyError as ApiKeyError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiAttributeError as ApiAttributeError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiException as ApiException + +# import models into sdk package +from gen_ai_hub.tab_ai_orchestration.generated.models.conditions_inner import ConditionsInner as ConditionsInner +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig as ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum as ContextSelectionStrategyEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition as FilterCondition +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions as FilterConditions +from gen_ai_hub.tab_ai_orchestration.generated.models.filterconditions import Filterconditions as Filterconditions +from gen_ai_hub.tab_ai_orchestration.generated.models.http_validation_error import HTTPValidationError as HTTPValidationError +from gen_ai_hub.tab_ai_orchestration.generated.models.location_inner import LocationInner as LocationInner +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt1 import ModelRpt1 as ModelRpt1 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 as ModelRpt15 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations as ModelRpt15Explanations +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig as ModelRpt15PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig as Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_metadata import PredictMetadata as PredictMetadata +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest as PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse as PredictResponse +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_status import PredictStatus as PredictStatus +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig as PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_heuristic_config import SamplingHeuristicConfig as SamplingHeuristicConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_random_config import SamplingRandomConfig as SamplingRandomConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.strategyconfig import Strategyconfig as Strategyconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum as TFMEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn as TargetColumn +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum as TaskTypeEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.validation_error import ValidationError as ValidationError + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/__init__.py new file mode 100644 index 00000000..0b1ce141 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/__init__.py @@ -0,0 +1,5 @@ +# flake8: noqa + +# import apis into api package +from gen_ai_hub.tab_ai_orchestration.generated.api.predict_api import PredictApi + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/predict_api.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/predict_api.py new file mode 100644 index 00000000..9de4e57d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/predict_api.py @@ -0,0 +1,456 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse + +from gen_ai_hub.tab_ai_orchestration.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.tab_ai_orchestration.generated.api_response import ApiResponse +from gen_ai_hub.tab_ai_orchestration.generated.rest import RESTResponseType +from gen_ai_hub.tab_ai_orchestration.generated.sync_helper import run_sync + + +class PredictApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def predict( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PredictResponse: + """Make predictions using a Tabular Foundation Model + + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + + :param ai_resource_group: AI Core resource group identifier (required) + :type ai_resource_group: str + :param predict_request: (required) + :type predict_request: PredictRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._predict_serialize( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PredictResponse", + '400': None, + '401': None, + '404': None, + '422': "HTTPValidationError", + '500': None, + '502': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def predict_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PredictResponse]: + """Make predictions using a Tabular Foundation Model + + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + + :param ai_resource_group: AI Core resource group identifier (required) + :type ai_resource_group: str + :param predict_request: (required) + :type predict_request: PredictRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._predict_serialize( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PredictResponse", + '400': None, + '401': None, + '404': None, + '422': "HTTPValidationError", + '500': None, + '502': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def predict_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Make predictions using a Tabular Foundation Model + + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + + :param ai_resource_group: AI Core resource group identifier (required) + :type ai_resource_group: str + :param predict_request: (required) + :type predict_request: PredictRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._predict_serialize( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PredictResponse", + '400': None, + '401': None, + '404': None, + '422': "HTTPValidationError", + '500': None, + '502': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def predict_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PredictResponse: + """Make predictions using a Tabular Foundation Model (synchronous) + + Synchronous variant of :meth:`predict`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.predict( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def predict_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PredictResponse]: + """Make predictions using a Tabular Foundation Model (synchronous) + + Synchronous variant of :meth:`predict_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.predict_with_http_info( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def predict_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Make predictions using a Tabular Foundation Model (synchronous) + + Synchronous variant of :meth:`predict_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.predict_without_preload_content( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _predict_serialize( + self, + ai_resource_group, + predict_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['ai-resource-group'] = ai_resource_group + # process the form parameters + # process the body parameter + if predict_request is not None: + _body_params = predict_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/predict', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py new file mode 100644 index 00000000..c012f7a2 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py @@ -0,0 +1,836 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile +import uuid + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from gen_ai_hub.tab_ai_orchestration.generated.configuration import Configuration +from gen_ai_hub.tab_ai_orchestration.generated.api_response import ApiResponse, T as ApiResponseT +import gen_ai_hub.tab_ai_orchestration.generated.models +from gen_ai_hub.tab_ai_orchestration.generated import rest +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + async def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = await self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it. + if response_type is None and str(response_data.status) not in response_types_map \ + and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \ + and 'default' in response_types_map: + response_type = response_types_map['default'] + + # deserialize response data + response_text = None + return_data = None + try: + if response_type in ("bytearray", "bytes"): + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.headers.get('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.headers, + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, uuid.UUID): + return str(obj) + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + elif isinstance(obj, dict): + return { + key: self.sanitize_for_serialization(val) + for key, val in obj.items() + } + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return self.sanitize_for_serialization(obj_dict) + + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('Optional['): + m = re.match(r'Optional\[(.*)]', klass) + assert m is not None, "Malformed Optional type definition" + # data is not None here, so the optionality is already resolved + return self.__deserialize(data, m.group(1)) + + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(generated.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, str(value).lower() if isinstance(value, bool) else value) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + str(value).lower() if isinstance(value, bool) else str(value) + for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, quote(str(value).lower() if isinstance(value, bool) else str(value))) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + quote(str(value).lower() if isinstance(value, bool) else str(value)) + for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters, excluding base64 delimiters + cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=") + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.headers.get("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_response.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_response.py new file mode 100644 index 00000000..9bc7c11f --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/configuration.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/configuration.py new file mode 100644 index 00000000..27ae67da --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/configuration.py @@ -0,0 +1,595 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import base64 +import copy +import http.client as httplib +import logging +from logging import FileHandler +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self + + + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: int - Retry configuration. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param proxy_headers: Proxy headers. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. + + """ + + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "/v1" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("generated") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = verify_ssl + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file + """client certificate file + """ + self.key_file = key_file + """client key file + """ + self.assert_hostname = assert_hostname + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = tls_server_name + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100 + """This value is passed to the aiohttp to limit simultaneous connections. + None in the constructor is coerced to default 100. + """ + + self.proxy = proxy + """Proxy URL + """ + self.proxy_headers = proxy_headers + """Proxy headers + """ + self.safe_chars_for_path_param = safe_chars_for_path_param + """Safe chars for path_param + """ + self.retries = retries + """Retry configuration + """ + # Enable client side validation + self.client_side_validation = client_side_validation + + self.socket_options = socket_options + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = datetime_format + """datetime format + """ + + self.date_format = date_format + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setter to re-create the file handler (excluded from __dict__ copy) + result.logger_file = self.logger_file + + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default + + @property + def logger_file(self) -> Optional[str]: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value: Optional[str]) -> None: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self) -> bool: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value: bool) -> None: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self) -> str: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value: str) -> None: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + + return "Basic " + base64.b64encode( + (username + ":" + password).encode('utf-8') + ).decode('utf-8') + + def auth_settings(self)-> AuthSettings: + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth: AuthSettings = {} + return auth + + def to_debug_report(self) -> str: + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.8.1\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "/v1", + 'description': "No description provided", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and variable['enum_values'] \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/exceptions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/exceptions.py new file mode 100644 index 00000000..98cc5e85 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/exceptions.py @@ -0,0 +1,218 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/__init__.py new file mode 100644 index 00000000..6c0eae60 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/__init__.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +# flake8: noqa +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from gen_ai_hub.tab_ai_orchestration.generated.models.conditions_inner import ConditionsInner +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions +from gen_ai_hub.tab_ai_orchestration.generated.models.filterconditions import Filterconditions +from gen_ai_hub.tab_ai_orchestration.generated.models.http_validation_error import HTTPValidationError +from gen_ai_hub.tab_ai_orchestration.generated.models.location_inner import LocationInner +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt1 import ModelRpt1 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_metadata import PredictMetadata +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_status import PredictStatus +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_heuristic_config import SamplingHeuristicConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_random_config import SamplingRandomConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.strategyconfig import Strategyconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.validation_error import ValidationError + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/conditions_inner.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/conditions_inner.py new file mode 100644 index 00000000..67e5933d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/conditions_inner.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +CONDITIONSINNER_ANY_OF_SCHEMAS = ["FilterCondition", "FilterConditions"] + +class ConditionsInner(BaseModel): + """ + ConditionsInner + """ + + # data type: FilterCondition + anyof_schema_1_validator: Optional[FilterCondition] = None + # data type: FilterConditions + anyof_schema_2_validator: Optional[FilterConditions] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[FilterCondition, FilterConditions]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "FilterCondition", "FilterConditions" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ConditionsInner.model_construct() + error_messages = [] + # validate data type: FilterCondition + if not isinstance(v, FilterCondition): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterCondition`") + else: + return v + + # validate data type: FilterConditions + if not isinstance(v, FilterConditions): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterConditions`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ConditionsInner with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[FilterCondition] = None + try: + instance.actual_instance = FilterCondition.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[FilterConditions] = None + try: + instance.actual_instance = FilterConditions.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ConditionsInner with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], FilterCondition, FilterConditions]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions +# TODO: Rewrite to not use raise_errors +ConditionsInner.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_config.py new file mode 100644 index 00000000..67f818d9 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_config.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.filterconditions import Filterconditions +from gen_ai_hub.tab_ai_orchestration.generated.models.strategyconfig import Strategyconfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ContextSelectionConfig(BaseModel): + """ + Configuration for context selection. + """ # noqa: E501 + index_column: Optional[StrictStr] = Field(default=None, description="Name of the unique row-identifier column (e.g. 'ROW_INDEX'). Required for 'heuristic', and deterministic 'random' strategies.", serialization_alias="indexColumn") + num_rows: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Number of rows to select for context. If not provided or set to 0, context selection is skipped.", serialization_alias="numRows") + strategy: Optional[ContextSelectionStrategyEnum] = Field(default=None, description="Sampling strategy for context selection.") + strategy_config: Optional[Strategyconfig] = Field(default=None, serialization_alias="strategyConfig") + filter_conditions: Optional[Filterconditions] = Field(default=None, serialization_alias="filterConditions") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["indexColumn", "numRows", "strategy", "strategyConfig", "filterConditions"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ContextSelectionConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of strategy_config + if self.strategy_config: + _dict['strategyConfig'] = self.strategy_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of filter_conditions + if self.filter_conditions: + _dict['filterConditions'] = self.filter_conditions.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if index_column (nullable) is None + # and model_fields_set contains the field + if self.index_column is None and "index_column" in self.model_fields_set: + _dict['indexColumn'] = None + + # set to None if num_rows (nullable) is None + # and model_fields_set contains the field + if self.num_rows is None and "num_rows" in self.model_fields_set: + _dict['numRows'] = None + + # set to None if strategy_config (nullable) is None + # and model_fields_set contains the field + if self.strategy_config is None and "strategy_config" in self.model_fields_set: + _dict['strategyConfig'] = None + + # set to None if filter_conditions (nullable) is None + # and model_fields_set contains the field + if self.filter_conditions is None and "filter_conditions" in self.model_fields_set: + _dict['filterConditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ContextSelectionConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "indexColumn": obj.get("indexColumn"), + "numRows": obj.get("numRows"), + "strategy": obj.get("strategy"), + "strategyConfig": Strategyconfig.from_dict(obj["strategyConfig"]) if obj.get("strategyConfig") is not None else None, + "filterConditions": Filterconditions.from_dict(obj["filterConditions"]) if obj.get("filterConditions") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_strategy_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_strategy_enum.py new file mode 100644 index 00000000..38f4f0cd --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_strategy_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ContextSelectionStrategyEnum(str, Enum): + """ + Context selection strategies for data sampling. + """ + + """ + allowed enum values + """ + NONE = 'none' + RANDOM = 'random' + HEURISTIC = 'heuristic' + AUTO = 'auto' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ContextSelectionStrategyEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_condition.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_condition.py new file mode 100644 index 00000000..55ee4eae --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_condition.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FilterCondition(BaseModel): + """ + A single filter condition for context selection. + """ # noqa: E501 + var_field: StrictStr = Field(description="Field name to filter on", serialization_alias="field") + op: StrictStr = Field(description="Filter operator (e.g., 'eq', 'gte', 'lte')") + value: Optional[Any] = Field(description="Value to compare against") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["field", "op", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FilterCondition from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if value (nullable) is None + # and model_fields_set contains the field + if self.value is None and "value" in self.model_fields_set: + _dict['value'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FilterCondition from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "field": obj.get("field"), + "op": obj.get("op"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_conditions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_conditions.py new file mode 100644 index 00000000..e8cb464e --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_conditions.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FilterConditions(BaseModel): + """ + Filter conditions for context selection. + """ # noqa: E501 + logic: StrictStr = Field(description="Logical operator to combine conditions ('and' or 'or')") + conditions: List[ConditionsInner] = Field(description="List of filter conditions") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["logic", "conditions"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FilterConditions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in conditions (list) + _items = [] + if self.conditions: + for _item_conditions in self.conditions: + _items.append(_item_conditions.to_dict() if _item_conditions is not None else None) + _dict['conditions'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FilterConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "logic": obj.get("logic"), + "conditions": [ConditionsInner.from_dict(_item) for _item in obj["conditions"]] if obj.get("conditions") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +from gen_ai_hub.tab_ai_orchestration.generated.models.conditions_inner import ConditionsInner +# TODO: Rewrite to not use raise_errors +FilterConditions.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filterconditions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filterconditions.py new file mode 100644 index 00000000..f3f4b5bc --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filterconditions.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTERCONDITIONS_ANY_OF_SCHEMAS = ["FilterCondition", "FilterConditions"] + +class Filterconditions(BaseModel): + """ + Filter conditions for context selection + """ + + # data type: FilterConditions + anyof_schema_1_validator: Optional[FilterConditions] = None + # data type: FilterCondition + anyof_schema_2_validator: Optional[FilterCondition] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[FilterCondition, FilterConditions]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "FilterCondition", "FilterConditions" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = Filterconditions.model_construct() + error_messages = [] + # validate data type: FilterConditions + if not isinstance(v, FilterConditions): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterConditions`") + else: + return v + + # validate data type: FilterCondition + if not isinstance(v, FilterCondition): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterCondition`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Filterconditions with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[FilterConditions] = None + try: + instance.actual_instance = FilterConditions.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[FilterCondition] = None + try: + instance.actual_instance = FilterCondition.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Filterconditions with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], FilterCondition, FilterConditions]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/http_validation_error.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/http_validation_error.py new file mode 100644 index 00000000..e37f3a19 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/http_validation_error.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.validation_error import ValidationError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class HTTPValidationError(BaseModel): + """ + HTTPValidationError + """ # noqa: E501 + detail: Optional[List[ValidationError]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["detail"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HTTPValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in detail (list) + _items = [] + if self.detail: + for _item_detail in self.detail: + _items.append(_item_detail.to_dict() if _item_detail is not None else None) + _dict['detail'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HTTPValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/location_inner.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/location_inner.py new file mode 100644 index 00000000..da4b6a3a --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/location_inner.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"] + +class LocationInner(BaseModel): + """ + LocationInner + """ + + # data type: str + anyof_schema_1_validator: Optional[StrictStr] = None + # data type: int + anyof_schema_2_validator: Optional[StrictInt] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[int, str]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "int", "str" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = LocationInner.model_construct() + error_messages = [] + # validate data type: str + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: int + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into str + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into int + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt1.py new file mode 100644 index 00000000..695448d7 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt1.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt1(BaseModel): + """ + RPT1 Reference: https://help.sap.com/docs/sap-ai-core/generative-ai/example-payloads-for-inferencing-sap-rpt-1?locale=en-US#parameters + """ # noqa: E501 + index_column: Optional[StrictStr] = Field(default=None, description="(Optional) The name of the column used to identify the row. This column isn't used as an input feature for the model, and is returned in the response objects.") + data_schema: Optional[Dict[str, Dict[str, StrictStr]]] = Field(default=None, description="(Optional) A schema definition for data types of all columns. Possible values: string, numeric, or date.") + parse_data_types: Optional[StrictBool] = Field(default=True, description="(Optional, RPT default: True) Relevant when data_schema isn't passed. Whether or not to parse data types, such as interpreting strings as numbers or dates.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index_column", "data_schema", "parse_data_types"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt1 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if index_column (nullable) is None + # and model_fields_set contains the field + if self.index_column is None and "index_column" in self.model_fields_set: + _dict['index_column'] = None + + # set to None if data_schema (nullable) is None + # and model_fields_set contains the field + if self.data_schema is None and "data_schema" in self.model_fields_set: + _dict['data_schema'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index_column": obj.get("index_column"), + "data_schema": obj.get("data_schema"), + "parse_data_types": obj.get("parse_data_types") if obj.get("parse_data_types") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15.py new file mode 100644 index 00000000..d6f7c784 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt15(BaseModel): + """ + ModelRpt15 + """ # noqa: E501 + index_column: Optional[StrictStr] = Field(default=None, description="(Optional) The name of the column used to identify the row. This column isn't used as an input feature for the model, and is returned in the response objects.") + data_schema: Optional[Dict[str, Dict[str, StrictStr]]] = Field(default=None, description="(Optional) A schema definition for data types of all columns. Possible values: string, numeric, or date.") + parse_data_types: Optional[StrictBool] = Field(default=True, description="(Optional, RPT Default: True) Relevant when data_schema isn't passed. Whether or not to parse data types, such as interpreting strings as numbers or dates.") + prediction_config: Optional[ModelRpt15PredictionConfig] = Field(default=None, description="(Optional) An object for configuring predictions.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index_column", "data_schema", "parse_data_types", "prediction_config"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt15 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of prediction_config + if self.prediction_config: + _dict['prediction_config'] = self.prediction_config.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if index_column (nullable) is None + # and model_fields_set contains the field + if self.index_column is None and "index_column" in self.model_fields_set: + _dict['index_column'] = None + + # set to None if data_schema (nullable) is None + # and model_fields_set contains the field + if self.data_schema is None and "data_schema" in self.model_fields_set: + _dict['data_schema'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt15 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index_column": obj.get("index_column"), + "data_schema": obj.get("data_schema"), + "parse_data_types": obj.get("parse_data_types") if obj.get("parse_data_types") is not None else True, + "prediction_config": ModelRpt15PredictionConfig.from_dict(obj["prediction_config"]) if obj.get("prediction_config") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_explanations.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_explanations.py new file mode 100644 index 00000000..a204190c --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_explanations.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt15Explanations(BaseModel): + """ + ModelRpt15Explanations + """ # noqa: E501 + top_column_scores: Optional[Annotated[int, Field(le=20, strict=True, ge=0)]] = Field(default=0, description="(Optional, RPT Default: 0) Number of top column scores to return. A value of 0 disables explainability.") + top_relevant_context_rows: Optional[Annotated[int, Field(le=20, strict=True)]] = Field(default=None, description="(Optional) Number of most relevant context rows to return for each query row.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["top_column_scores", "top_relevant_context_rows"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt15Explanations from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if top_relevant_context_rows (nullable) is None + # and model_fields_set contains the field + if self.top_relevant_context_rows is None and "top_relevant_context_rows" in self.model_fields_set: + _dict['top_relevant_context_rows'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt15Explanations from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "top_column_scores": obj.get("top_column_scores") if obj.get("top_column_scores") is not None else 0, + "top_relevant_context_rows": obj.get("top_relevant_context_rows") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_prediction_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_prediction_config.py new file mode 100644 index 00000000..401176d9 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_prediction_config.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt15PredictionConfig(BaseModel): + """ + ModelRpt15PredictionConfig + """ # noqa: E501 + explanations: Optional[ModelRpt15Explanations] = Field(default=None, description="(Optional) Configuration used to request explanations.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["explanations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt15PredictionConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of explanations + if self.explanations: + _dict['explanations'] = self.explanations.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt15PredictionConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "explanations": ModelRpt15Explanations.from_dict(obj["explanations"]) if obj.get("explanations") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/modelconfig.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/modelconfig.py new file mode 100644 index 00000000..1fc1a72f --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/modelconfig.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt1 import ModelRpt1 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +MODELCONFIG_ONE_OF_SCHEMAS = ["ModelRpt1", "ModelRpt15"] + +class Modelconfig(BaseModel): + """ + (Optional) Any additional TFM-specific configurations that will be passed to the selected TFM. + """ + # data type: ModelRpt15 + oneof_schema_1_validator: Optional[ModelRpt15] = None + # data type: ModelRpt1 + oneof_schema_2_validator: Optional[ModelRpt1] = None + actual_instance: Optional[Union[ModelRpt1, ModelRpt15]] = None + one_of_schemas: Set[str] = { "ModelRpt1", "ModelRpt15" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = Modelconfig.model_construct() + error_messages = [] + match = 0 + # validate data type: ModelRpt15 + if not isinstance(v, ModelRpt15): + error_messages.append(f"Error! Input type `{type(v)}` is not `ModelRpt15`") + else: + match += 1 + # validate data type: ModelRpt1 + if not isinstance(v, ModelRpt1): + error_messages.append(f"Error! Input type `{type(v)}` is not `ModelRpt1`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into ModelRpt15 + try: + instance.actual_instance = ModelRpt15.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ModelRpt1 + try: + instance.actual_instance = ModelRpt1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], ModelRpt1, ModelRpt15]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_metadata.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_metadata.py new file mode 100644 index 00000000..890fb3cb --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_metadata.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictMetadata(BaseModel): + """ + Metadata about the prediction. + """ # noqa: E501 + num_columns: StrictInt + num_rows: StrictInt + num_predictions: StrictInt + num_query_rows: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["num_columns", "num_rows", "num_predictions", "num_query_rows"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "num_columns": obj.get("num_columns"), + "num_rows": obj.get("num_rows"), + "num_predictions": obj.get("num_predictions"), + "num_query_rows": obj.get("num_query_rows") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_request.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_request.py new file mode 100644 index 00000000..f6da1929 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictRequest(BaseModel): + """ + Request schema for prediction endpoint. + """ # noqa: E501 + model_name: TFMEnum = Field(description="Name of the deployed model", serialization_alias="modelName") + scenario_config_name: StrictStr = Field(description="Scenario configuration identifier", serialization_alias="scenarioConfigName") + context_selection_config: Optional[ContextSelectionConfig] = Field(default=None, description="Context selection configuration", serialization_alias="contextSelectionConfig") + prediction_config: PredictionConfig = Field(description="Prediction configuration", serialization_alias="predictionConfig") + var_model_config: Optional[Modelconfig] = Field(default=None, serialization_alias="modelConfig") + columns: Optional[Dict[str, List[Any]]] = Field(default=None, description="Query-only rows in columnar form. An object mapping from column name to array of column values.") + context_columns: Optional[Dict[str, List[Any]]] = Field(default=None, description="(Optional) Context rows in columnar form, only relevant if 'columns' is provided. An object mapping from column name to array of column values.", serialization_alias="contextColumns") + rows: Optional[List[Dict[str, Any]]] = Field(default=None, description="Query-only rows in row form. An array of objects representing table rows.") + context_rows: Optional[List[Dict[str, Any]]] = Field(default=None, description="(Optional) Context rows in row form, only relevant if 'rows' is provided. An array of objects representing table rows.", serialization_alias="contextRows") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["modelName", "scenarioConfigName", "contextSelectionConfig", "predictionConfig", "modelConfig", "columns", "contextColumns", "rows", "contextRows"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context_selection_config + if self.context_selection_config: + _dict['contextSelectionConfig'] = self.context_selection_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of prediction_config + if self.prediction_config: + _dict['predictionConfig'] = self.prediction_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of var_model_config + if self.var_model_config: + _dict['modelConfig'] = self.var_model_config.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if context_selection_config (nullable) is None + # and model_fields_set contains the field + if self.context_selection_config is None and "context_selection_config" in self.model_fields_set: + _dict['contextSelectionConfig'] = None + + # set to None if columns (nullable) is None + # and model_fields_set contains the field + if self.columns is None and "columns" in self.model_fields_set: + _dict['columns'] = None + + # set to None if context_columns (nullable) is None + # and model_fields_set contains the field + if self.context_columns is None and "context_columns" in self.model_fields_set: + _dict['contextColumns'] = None + + # set to None if rows (nullable) is None + # and model_fields_set contains the field + if self.rows is None and "rows" in self.model_fields_set: + _dict['rows'] = None + + # set to None if context_rows (nullable) is None + # and model_fields_set contains the field + if self.context_rows is None and "context_rows" in self.model_fields_set: + _dict['contextRows'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modelName": obj.get("modelName"), + "scenarioConfigName": obj.get("scenarioConfigName"), + "contextSelectionConfig": ContextSelectionConfig.from_dict(obj["contextSelectionConfig"]) if obj.get("contextSelectionConfig") is not None else None, + "predictionConfig": PredictionConfig.from_dict(obj["predictionConfig"]) if obj.get("predictionConfig") is not None else None, + "modelConfig": Modelconfig.from_dict(obj["modelConfig"]) if obj.get("modelConfig") is not None else None, + "columns": obj.get("columns"), + "contextColumns": obj.get("contextColumns"), + "rows": obj.get("rows"), + "contextRows": obj.get("contextRows") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_response.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_response.py new file mode 100644 index 00000000..3ba90a74 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_response.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_metadata import PredictMetadata +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_status import PredictStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictResponse(BaseModel): + """ + Response schema for prediction endpoint. + """ # noqa: E501 + id: StrictStr + metadata: PredictMetadata + predictions: List[Dict[str, Any]] + status: PredictStatus + additional_information: Optional[List[StrictStr]] = Field(default=None, description="Warnings or informational messages from context selection") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "metadata", "predictions", "status", "additional_information"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of status + if self.status: + _dict['status'] = self.status.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": PredictMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "predictions": obj.get("predictions"), + "status": PredictStatus.from_dict(obj["status"]) if obj.get("status") is not None else None, + "additional_information": obj.get("additional_information") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_status.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_status.py new file mode 100644 index 00000000..a25981ff --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_status.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictStatus(BaseModel): + """ + Status of the prediction. + """ # noqa: E501 + code: StrictInt + message: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/prediction_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/prediction_config.py new file mode 100644 index 00000000..b36a1391 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/prediction_config.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictionConfig(BaseModel): + """ + Configuration for what to predict. Model-agnostic prediction config. Only contains fields shared across all TFMs. Model-specific fields belong in `PredictRequest.modelConfig`. + """ # noqa: E501 + target_columns: Annotated[List[TargetColumn], Field(min_length=1)] = Field(description="List of target columns with prediction configuration", serialization_alias="targetColumns") + __properties: ClassVar[List[str]] = ["targetColumns"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictionConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in target_columns (list) + _items = [] + if self.target_columns: + for _item_target_columns in self.target_columns: + _items.append(_item_target_columns.to_dict() if _item_target_columns is not None else None) + _dict['targetColumns'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictionConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "targetColumns": [TargetColumn.from_dict(_item) for _item in obj["targetColumns"]] if obj.get("targetColumns") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_heuristic_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_heuristic_config.py new file mode 100644 index 00000000..623f20da --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_heuristic_config.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SamplingHeuristicConfig(BaseModel): + """ + SamplingHeuristicConfig + """ # noqa: E501 + method_ratio: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.67, description="Fraction of numRows filled by scoring method (remainder is random fill). Must be between 0 and 1.", serialization_alias="methodRatio") + fuzzy_num_pct: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.1, description="Numeric fuzzy threshold as a fraction of the absolute query value. E.g. 0.1 = +/-10%.", serialization_alias="fuzzyNumPct") + chunk_size: Optional[StrictInt] = Field(default=100, description="Max CASE WHEN expressions per subquery chunk (avoids HANA parse-tree depth limit).", serialization_alias="chunkSize") + chunk_threshold: Optional[StrictInt] = Field(default=150, description="Column count above which chunked SQL is used instead of a flat query.", serialization_alias="chunkThreshold") + pool_size: Optional[StrictInt] = Field(default=None, description="If set, scoring runs against a random subsample of this many rows instead of the full table. None = full table scan.", serialization_alias="poolSize") + fuzzy_date_days: Optional[StrictInt] = Field(default=30, description="Day window for fuzzy date matching. A date column scores 1 if abs(DAYS_BETWEEN(row_date, query_date)) <= dateFuzzyDays. Set to 0 for exact date match.", serialization_alias="fuzzyDateDays") + allow_timeout_fallback: Optional[StrictBool] = Field(default=False, description="When true, heuristic sampling falls back to random on timeout instead of raising an error. Set by the orchestrator when strategy=AUTO.", serialization_alias="allowTimeoutFallback") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["methodRatio", "fuzzyNumPct", "chunkSize", "chunkThreshold", "poolSize", "fuzzyDateDays", "allowTimeoutFallback"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SamplingHeuristicConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if pool_size (nullable) is None + # and model_fields_set contains the field + if self.pool_size is None and "pool_size" in self.model_fields_set: + _dict['poolSize'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SamplingHeuristicConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "methodRatio": obj.get("methodRatio") if obj.get("methodRatio") is not None else 0.67, + "fuzzyNumPct": obj.get("fuzzyNumPct") if obj.get("fuzzyNumPct") is not None else 0.1, + "chunkSize": obj.get("chunkSize") if obj.get("chunkSize") is not None else 100, + "chunkThreshold": obj.get("chunkThreshold") if obj.get("chunkThreshold") is not None else 150, + "poolSize": obj.get("poolSize"), + "fuzzyDateDays": obj.get("fuzzyDateDays") if obj.get("fuzzyDateDays") is not None else 30, + "allowTimeoutFallback": obj.get("allowTimeoutFallback") if obj.get("allowTimeoutFallback") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_random_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_random_config.py new file mode 100644 index 00000000..10b782b1 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_random_config.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SamplingRandomConfig(BaseModel): + """ + SamplingRandomConfig + """ # noqa: E501 + deterministic: Optional[StrictBool] = Field(default=False, description="When true, uses HASH_SHA256 of indexColumn for ordering instead of RAND(), producing the same row order on every call for the same data.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deterministic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SamplingRandomConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SamplingRandomConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deterministic": obj.get("deterministic") if obj.get("deterministic") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/strategyconfig.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/strategyconfig.py new file mode 100644 index 00000000..6b35ad48 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/strategyconfig.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_heuristic_config import SamplingHeuristicConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_random_config import SamplingRandomConfig +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +STRATEGYCONFIG_ANY_OF_SCHEMAS = ["SamplingHeuristicConfig", "SamplingRandomConfig"] + +class Strategyconfig(BaseModel): + """ + Strategy-specific configuration parameters. + """ + + # data type: SamplingRandomConfig + anyof_schema_1_validator: Optional[SamplingRandomConfig] = None + # data type: SamplingHeuristicConfig + anyof_schema_2_validator: Optional[SamplingHeuristicConfig] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[SamplingHeuristicConfig, SamplingRandomConfig]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "SamplingHeuristicConfig", "SamplingRandomConfig" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = Strategyconfig.model_construct() + error_messages = [] + # validate data type: SamplingRandomConfig + if not isinstance(v, SamplingRandomConfig): + error_messages.append(f"Error! Input type `{type(v)}` is not `SamplingRandomConfig`") + else: + return v + + # validate data type: SamplingHeuristicConfig + if not isinstance(v, SamplingHeuristicConfig): + error_messages.append(f"Error! Input type `{type(v)}` is not `SamplingHeuristicConfig`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Strategyconfig with anyOf schemas: SamplingHeuristicConfig, SamplingRandomConfig. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[SamplingRandomConfig] = None + try: + instance.actual_instance = SamplingRandomConfig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[SamplingHeuristicConfig] = None + try: + instance.actual_instance = SamplingHeuristicConfig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Strategyconfig with anyOf schemas: SamplingHeuristicConfig, SamplingRandomConfig. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], SamplingHeuristicConfig, SamplingRandomConfig]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/target_column.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/target_column.py new file mode 100644 index 00000000..681f95c0 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/target_column.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TargetColumn(BaseModel): + """ + Configuration for a target column to predict. + """ # noqa: E501 + name: StrictStr = Field(description="Name of the column to predict") + prediction_placeholder: Optional[StrictStr] = Field(default='[PREDICT]', description="(Optional) Placeholder value indicating cells to predict") + task_type: Optional[TaskTypeEnum] = Field(default=None, description="(Optional) Type of prediction task (classification or regression)") + top_k: Optional[StrictInt] = Field(default=None, description="(Optional) Controls how many labels to predict for each column in each row. Only applicable to 'classification' task type.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "prediction_placeholder", "task_type", "top_k"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TargetColumn from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if top_k (nullable) is None + # and model_fields_set contains the field + if self.top_k is None and "top_k" in self.model_fields_set: + _dict['top_k'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TargetColumn from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "prediction_placeholder": obj.get("prediction_placeholder") if obj.get("prediction_placeholder") is not None else '[PREDICT]', + "task_type": obj.get("task_type"), + "top_k": obj.get("top_k") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/task_type_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/task_type_enum.py new file mode 100644 index 00000000..69871872 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/task_type_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TaskTypeEnum(str, Enum): + """ + ML task types for predictions. + """ + + """ + allowed enum values + """ + CLASSIFICATION = 'classification' + REGRESSION = 'regression' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TaskTypeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/tfm_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/tfm_enum.py new file mode 100644 index 00000000..af3c5258 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/tfm_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TFMEnum(str, Enum): + """ + Supported Tabular Foundation Models. + """ + + """ + allowed enum values + """ + SAP_MINUS_RPT_MINUS_1_MINUS_SMALL = 'sap-rpt-1-small' + SAP_MINUS_RPT_MINUS_1_MINUS_LARGE = 'sap-rpt-1-large' + SAP_MINUS_RPT_MINUS_1_DOT_5 = 'sap-rpt-1.5' + SAP_MINUS_RPT_MINUS_1_DOT_5_MINUS_LARGE = 'sap-rpt-1.5-large' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TFMEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/validation_error.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/validation_error.py new file mode 100644 index 00000000..2ab7b7cf --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/validation_error.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.location_inner import LocationInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ValidationError(BaseModel): + """ + ValidationError + """ # noqa: E501 + loc: List[LocationInner] + msg: StrictStr + type: StrictStr + input: Optional[Any] = None + ctx: Optional[Dict[str, Any]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in loc (list) + _items = [] + if self.loc: + for _item_loc in self.loc: + _items.append(_item_loc.to_dict() if _item_loc is not None else None) + _dict['loc'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if input (nullable) is None + # and model_fields_set contains the field + if self.input is None and "input" in self.model_fields_set: + _dict['input'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loc": [LocationInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None, + "msg": obj.get("msg"), + "type": obj.get("type"), + "input": obj.get("input"), + "ctx": obj.get("ctx") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/sample_code/src/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/py.typed similarity index 100% rename from sample_code/src/__init__.py rename to packages/gen/gen_ai_hub/tab_ai_orchestration/generated/py.typed diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/rest.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/rest.py new file mode 100644 index 00000000..bf2e4fb7 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/rest.py @@ -0,0 +1,201 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl +from typing import Optional, Union + +import httpx + +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiException, ApiValueError + +RESTResponseType = httpx.Response + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status_code + self.reason = resp.reason_phrase + self.data = None + + async def read(self): + if self.data is None: + self.data = await self.response.aread() + return self.data + + @property + def headers(self): + """Returns a CIMultiDictProxy of response headers.""" + return self.response.headers + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers; use ``headers`` instead.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header; use ``headers`` instead.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + + # maxsize is number of requests to host that are allowed in parallel + self.maxsize = configuration.connection_pool_maxsize + + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, + ) + if configuration.cert_file: + self.ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + if not configuration.verify_ssl: + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE + + self.proxy = configuration.proxy + self.proxy_headers = configuration.proxy_headers + + self.pool_manager: Optional[httpx.AsyncClient] = None + + async def close(self): + if self.pool_manager is not None: + await self.pool_manager.aclose() + + async def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None): + """Execute request + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + args["json"] = body + if body is None and post_params: + args["json"] = dict(post_params) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + args["data"] = dict(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by httpx + del headers['Content-Type'] + + files = [] + data = {} + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + files.append((k, v)) + else: + # Ensures that dict objects are serialized + if isinstance(v, dict): + v = json.dumps(v) + elif isinstance(v, int): + v = str(v) + data[k] = v + + if files: + args["files"] = files + if data: + args["data"] = data + + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + if self.pool_manager is None: + self.pool_manager = self._create_pool_manager() + + r = await self.pool_manager.request(**args) + return RESTResponse(r) + + def _create_pool_manager(self) -> httpx.AsyncClient: + limits = httpx.Limits(max_connections=self.maxsize) + + proxy = None + if self.proxy: + proxy = httpx.Proxy( + url=self.proxy, + headers=self.proxy_headers + ) + + return httpx.AsyncClient( + limits=limits, + proxy=proxy, + verify=self.ssl_context, + trust_env=True + ) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/sync_helper.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/sync_helper.py new file mode 100644 index 00000000..e5e47f08 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/sync_helper.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import threading +from typing import Any, Coroutine, Optional, TypeVar + +T = TypeVar("T") + +_loop: Optional[asyncio.AbstractEventLoop] = None +_loop_lock = threading.Lock() + + +def _get_sync_loop() -> asyncio.AbstractEventLoop: + """Return a dedicated event loop running in a background daemon thread. + + A single, long-lived loop is reused for every synchronous call so that the + underlying ``httpx.AsyncClient`` (and its connection pool) stays bound to one + event loop across calls. The loop is created lazily and in a thread-safe way. + """ + global _loop + if _loop is None: + with _loop_lock: + if _loop is None: + loop = asyncio.new_event_loop() + thread = threading.Thread( + target=loop.run_forever, + name="generated-sync-runner", + daemon=True, + ) + thread.start() + _loop = loop + return _loop + + +def run_sync(coro: Coroutine[Any, Any, T]) -> T: + """Run an async coroutine to completion and return its result synchronously. + + The coroutine is scheduled on a dedicated background event loop and the + calling thread blocks until it finishes. This is used to expose synchronous + ``_sync`` variants of the asynchronous API methods. + + Note: this must not be called from within a running event loop (i.e. from + ``async`` code) as it would block that loop; use the ``await``-able async + methods directly in that case. + """ + return asyncio.run_coroutine_threadsafe(coro, _get_sync_loop()).result() diff --git a/packages/gen/specs/tab-ai-orchestration/api.yaml b/packages/gen/specs/tab-ai-orchestration/api.yaml new file mode 100644 index 00000000..80227263 --- /dev/null +++ b/packages/gen/specs/tab-ai-orchestration/api.yaml @@ -0,0 +1,572 @@ +openapi: 3.1.0 +info: + title: Tabular AI Orchestrator + version: 1.8.1 +servers: + - url: /v1 +paths: + /predict: + post: + tags: + - predict + summary: Make predictions using a Tabular Foundation Model + description: >- + Make predictions for tabular data using a deployed Tabular Foundation + Model. + + Required Headers: + - ai-resource-group: AI Core resource group identifier + operationId: predict + parameters: + - name: ai-resource-group + in: header + required: true + schema: + type: string + description: AI Core resource group identifier + title: Ai-Resource-Group + description: AI Core resource group identifier + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/PredictRequest" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + $ref: "#/components/schemas/PredictResponse" + "400": + description: Invalid request data + "401": + description: Authentication failed + "404": + description: Model not found + "422": + description: Validation Error + content: + application/json: + schema: + $ref: "#/components/schemas/HTTPValidationError" + "500": + description: Internal server error + "502": + description: External service error + "504": + description: Request timeout +components: + schemas: + ColumnarData: + additionalProperties: + items: {} + type: array + type: object + title: ColumnarData + description: |- + Columnar data format where each key is a column name + and the value is a list of values for that column. + + Example: + { + "code": ["new_code1", "new_code2"], + "category": ["Electronics", "Clothing"], + "price": [100, 50] + } + ContextSelectionConfig: + properties: + indexColumn: + anyOf: + - type: string + - type: "null" + title: Indexcolumn + description: Name of the unique row-identifier column (e.g. 'ROW_INDEX'). + Required for 'heuristic', and deterministic 'random' strategies. + numRows: + anyOf: + - type: integer + minimum: 0 + - type: "null" + title: Numrows + description: Number of rows to select for context. If not provided or set to 0, + context selection is skipped. + strategy: + $ref: "#/components/schemas/ContextSelectionStrategyEnum" + description: Sampling strategy for context selection. + default: random + strategyConfig: + anyOf: + - $ref: "#/components/schemas/SamplingRandomConfig" + - $ref: "#/components/schemas/SamplingHeuristicConfig" + - type: "null" + title: Strategyconfig + description: Strategy-specific configuration parameters. + filterConditions: + anyOf: + - $ref: "#/components/schemas/FilterConditions" + - $ref: "#/components/schemas/FilterCondition" + - type: "null" + title: Filterconditions + description: Filter conditions for context selection + type: object + title: ContextSelectionConfig + description: Configuration for context selection. + ContextSelectionStrategyEnum: + type: string + enum: + - none + - random + - heuristic + - auto + title: ContextSelectionStrategyEnum + description: Context selection strategies for data sampling. + FilterCondition: + properties: + field: + type: string + title: Field + description: Field name to filter on + op: + type: string + title: Op + description: Filter operator (e.g., 'eq', 'gte', 'lte') + value: + title: Value + description: Value to compare against + type: object + required: + - field + - op + - value + title: FilterCondition + description: A single filter condition for context selection. + FilterConditions: + properties: + logic: + type: string + title: Logic + description: Logical operator to combine conditions ('and' or 'or') + conditions: + items: + anyOf: + - $ref: "#/components/schemas/FilterCondition" + - $ref: "#/components/schemas/FilterConditions" + type: array + title: Conditions + description: List of filter conditions + type: object + required: + - logic + - conditions + title: FilterConditions + description: Filter conditions for context selection. + HTTPValidationError: + properties: + detail: + items: + $ref: "#/components/schemas/ValidationError" + type: array + title: Detail + type: object + title: HTTPValidationError + ModelRpt1: + properties: + index_column: + anyOf: + - type: string + - type: "null" + title: Index Column + description: (Optional) The name of the column used to identify the row. This + column isn't used as an input feature for the model, and is returned + in the response objects. + data_schema: + anyOf: + - additionalProperties: + additionalProperties: + type: string + type: object + type: object + - type: "null" + title: Data Schema + description: "(Optional) A schema definition for data types of all columns. + Possible values: string, numeric, or date." + examples: + - data_schema: + ORDERDATE: + dtype: date + PRICE: + dtype: numeric + PRODUCT: + dtype: string + parse_data_types: + type: boolean + title: Parse Data Types + description: "(Optional, RPT default: True) Relevant when data_schema isn't + passed. Whether or not to parse data types, such as interpreting + strings as numbers or dates." + default: true + additionalProperties: true + type: object + title: ModelRpt1 + description: "RPT1 Reference: + https://help.sap.com/docs/sap-ai-core/generative-ai/example-payloads-fo\ + r-inferencing-sap-rpt-1?locale=en-US#parameters" + ModelRpt1_5: + properties: + index_column: + anyOf: + - type: string + - type: "null" + title: Index Column + description: (Optional) The name of the column used to identify the row. This + column isn't used as an input feature for the model, and is returned + in the response objects. + data_schema: + anyOf: + - additionalProperties: + additionalProperties: + type: string + type: object + type: object + - type: "null" + title: Data Schema + description: "(Optional) A schema definition for data types of all columns. + Possible values: string, numeric, or date." + examples: + - data_schema: + ORDERDATE: + dtype: date + PRICE: + dtype: numeric + PRODUCT: + dtype: string + parse_data_types: + type: boolean + title: Parse Data Types + description: "(Optional, RPT Default: True) Relevant when data_schema isn't + passed. Whether or not to parse data types, such as interpreting + strings as numbers or dates." + default: true + prediction_config: + $ref: "#/components/schemas/ModelRpt1_5PredictionConfig" + description: (Optional) An object for configuring predictions. + additionalProperties: true + type: object + title: ModelRpt1_5 + ModelRpt1_5Explanations: + properties: + top_column_scores: + type: integer + maximum: 20 + minimum: 0 + title: Top Column Scores + description: "(Optional, RPT Default: 0) Number of top column scores to return. + A value of 0 disables explainability." + default: 0 + top_relevant_context_rows: + anyOf: + - type: integer + maximum: 20 + - type: "null" + title: Top Relevant Context Rows + description: (Optional) Number of most relevant context rows to return for each + query row. + additionalProperties: true + type: object + title: ModelRpt1_5Explanations + ModelRpt1_5PredictionConfig: + properties: + explanations: + $ref: "#/components/schemas/ModelRpt1_5Explanations" + description: (Optional) Configuration used to request explanations. + additionalProperties: true + type: object + title: ModelRpt1_5PredictionConfig + PredictMetadata: + properties: + num_columns: + type: integer + title: Num Columns + num_rows: + type: integer + title: Num Rows + num_predictions: + type: integer + title: Num Predictions + num_query_rows: + type: integer + title: Num Query Rows + type: object + required: + - num_columns + - num_rows + - num_predictions + - num_query_rows + title: PredictMetadata + description: Metadata about the prediction. + PredictRequest: + properties: + modelName: + $ref: "#/components/schemas/TFMEnum" + description: Name of the deployed model + scenarioConfigName: + type: string + title: Scenarioconfigname + description: Scenario configuration identifier + contextSelectionConfig: + anyOf: + - $ref: "#/components/schemas/ContextSelectionConfig" + - type: "null" + description: Context selection configuration + predictionConfig: + $ref: "#/components/schemas/PredictionConfig" + description: Prediction configuration + modelConfig: + oneOf: + - $ref: "#/components/schemas/ModelRpt1_5" + - $ref: "#/components/schemas/ModelRpt1" + title: Modelconfig + description: (Optional) Any additional TFM-specific configurations that will be + passed to the selected TFM. + columns: + anyOf: + - $ref: "#/components/schemas/ColumnarData" + - type: "null" + description: Query-only rows in columnar form. An object mapping from column + name to array of column values. + contextColumns: + anyOf: + - $ref: "#/components/schemas/ColumnarData" + - type: "null" + description: (Optional) Context rows in columnar form, only relevant if + 'columns' is provided. An object mapping from column name to array + of column values. + rows: + anyOf: + - $ref: "#/components/schemas/RowData" + - type: "null" + description: Query-only rows in row form. An array of objects representing table + rows. + contextRows: + anyOf: + - $ref: "#/components/schemas/RowData" + - type: "null" + description: (Optional) Context rows in row form, only relevant if 'rows' is + provided. An array of objects representing table rows. + type: object + required: + - modelName + - scenarioConfigName + - predictionConfig + title: PredictRequest + description: Request schema for prediction endpoint. + PredictResponse: + properties: + id: + type: string + title: Id + metadata: + $ref: "#/components/schemas/PredictMetadata" + predictions: + items: + additionalProperties: true + type: object + type: array + title: Predictions + status: + $ref: "#/components/schemas/PredictStatus" + additional_information: + items: + type: string + type: array + title: Additional Information + description: Warnings or informational messages from context selection + default: [] + type: object + required: + - id + - metadata + - predictions + - status + title: PredictResponse + description: Response schema for prediction endpoint. + PredictStatus: + properties: + code: + type: integer + title: Code + message: + type: string + title: Message + type: object + required: + - code + - message + title: PredictStatus + description: Status of the prediction. + PredictionConfig: + properties: + targetColumns: + items: + $ref: "#/components/schemas/TargetColumn" + type: array + minItems: 1 + title: Targetcolumns + description: List of target columns with prediction configuration + additionalProperties: false + type: object + required: + - targetColumns + title: PredictionConfig + description: |- + Configuration for what to predict. + + Model-agnostic prediction config. Only contains fields shared across + all TFMs. Model-specific fields belong in `PredictRequest.modelConfig`. + RowData: + items: + additionalProperties: true + type: object + type: array + title: RowData + description: |- + Row-wise data format where each element is a dictionary + representing a single row with column names as keys. + + Example: + [ + {"code": "new_code1", "category": "Electronics", "price": 100}, + {"code": "new_code2", "category": "Clothing", "price": 50}, + ] + SamplingHeuristicConfig: + properties: + methodRatio: + type: number + title: Methodratio + description: Fraction of numRows filled by scoring method (remainder is random + fill). Must be between 0 and 1. + default: 0.67 + fuzzyNumPct: + type: number + title: Fuzzynumpct + description: Numeric fuzzy threshold as a fraction of the absolute query value. + E.g. 0.1 = +/-10%. + default: 0.1 + chunkSize: + type: integer + title: Chunksize + description: Max CASE WHEN expressions per subquery chunk (avoids HANA + parse-tree depth limit). + default: 100 + chunkThreshold: + type: integer + title: Chunkthreshold + description: Column count above which chunked SQL is used instead of a flat query. + default: 150 + poolSize: + anyOf: + - type: integer + - type: "null" + title: Poolsize + description: If set, scoring runs against a random subsample of this many rows + instead of the full table. None = full table scan. + fuzzyDateDays: + type: integer + title: Fuzzydatedays + description: Day window for fuzzy date matching. A date column scores 1 if + abs(DAYS_BETWEEN(row_date, query_date)) <= dateFuzzyDays. Set to 0 + for exact date match. + default: 30 + allowTimeoutFallback: + type: boolean + title: Allowtimeoutfallback + description: When true, heuristic sampling falls back to random on timeout + instead of raising an error. Set by the orchestrator when + strategy=AUTO. + default: false + additionalProperties: true + type: object + title: SamplingHeuristicConfig + SamplingRandomConfig: + properties: + deterministic: + type: boolean + title: Deterministic + description: When true, uses HASH_SHA256 of indexColumn for ordering instead of + RAND(), producing the same row order on every call for the same + data. + default: false + additionalProperties: true + type: object + title: SamplingRandomConfig + TFMEnum: + type: string + enum: + - sap-rpt-1-small + - sap-rpt-1-large + - sap-rpt-1.5 + - sap-rpt-1.5-large + title: TFMEnum + description: Supported Tabular Foundation Models. + TargetColumn: + properties: + name: + type: string + title: Name + description: Name of the column to predict + prediction_placeholder: + type: string + title: Prediction Placeholder + description: (Optional) Placeholder value indicating cells to predict + default: "[PREDICT]" + task_type: + $ref: "#/components/schemas/TaskTypeEnum" + description: (Optional) Type of prediction task (classification or regression) + default: classification + top_k: + anyOf: + - type: integer + - type: "null" + title: Top K + description: (Optional) Controls how many labels to predict for each column in + each row. Only applicable to 'classification' task type. + type: object + required: + - name + title: TargetColumn + description: Configuration for a target column to predict. + TaskTypeEnum: + type: string + enum: + - classification + - regression + title: TaskTypeEnum + description: ML task types for predictions. + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + msg: + type: string + title: Message + type: + type: string + title: Error Type + input: + title: Input + ctx: + type: object + title: Context + type: object + required: + - loc + - msg + - type + title: ValidationError diff --git a/packages/gen/specs/tab-ai-orchestration/options-per-service.json b/packages/gen/specs/tab-ai-orchestration/options-per-service.json new file mode 100644 index 00000000..4fdb69bb --- /dev/null +++ b/packages/gen/specs/tab-ai-orchestration/options-per-service.json @@ -0,0 +1,6 @@ +{ + "api.yaml": { + "directoryName": "gen_ai_hub/tab_ai_orchestration/generated", + "basePath": "/v1" + } +} diff --git a/packages/openapi-generator/config/custom-templates/model_generic.mustache b/packages/openapi-generator/config/custom-templates/model_generic.mustache new file mode 100644 index 00000000..eb7b1c99 --- /dev/null +++ b/packages/openapi-generator/config/custom-templates/model_generic.mustache @@ -0,0 +1,664 @@ +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +{{#vendorExtensions.x-py-other-imports}} +{{{.}}} +{{/vendorExtensions.x-py-other-imports}} +{{#vendorExtensions.x-py-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-model-imports}} +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +{{#vendorExtensions.x-py-has-public-name-properties}} +from typing import TYPE_CHECKING +{{/vendorExtensions.x-py-has-public-name-properties}} + +{{^vendorExtensions.x-py-has-public-name-properties}} +{{#hasChildren}} +{{#discriminator}} +from typing import TYPE_CHECKING +{{/discriminator}} +{{/hasChildren}} +{{/vendorExtensions.x-py-has-public-name-properties}} +{{#hasChildren}} +{{#discriminator}} +{{! If this model is a super class, importlib is used. So import the necessary modules for the type here. }} +if TYPE_CHECKING: +{{#mappedModels}} + from {{packageName}}.models.{{model.classFilename}} import {{modelName}} +{{/mappedModels}} + +{{/discriminator}} +{{/hasChildren}} +{{#compatibleWithPythonLegacy}} + +{{>_legacy_model_dict_helpers}} + + +{{/compatibleWithPythonLegacy}} +class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): + """ + {{#description}}{{{description}}}{{/description}}{{^description}}{{{classname}}}{{/description}} +{{#compatibleWithPythonLegacy}} +{{! +python-legacy generic models exposed metadata and value helpers: +https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L37-L55 +https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L203-L255 +}} + + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. +{{/compatibleWithPythonLegacy}} + """ # noqa: E501 +{{#vars}} + {{name}}: {{{vendorExtensions.x-py-typing}}} +{{/vars}} +{{#isAdditionalPropertiesTrue}} + additional_properties: Dict[str, Any] = {} +{{/isAdditionalPropertiesTrue}} +{{#compatibleWithPythonLegacy}} + openapi_types: ClassVar[Dict[str, str]] = { +{{#allVars}} + {{#vendorExtensions.x-py-public-name-literal}}{{{vendorExtensions.x-py-public-name-literal}}}{{/vendorExtensions.x-py-public-name-literal}}{{^vendorExtensions.x-py-public-name-literal}}{{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}{{/vendorExtensions.x-py-public-name-literal}}: {{#lambda.pythonStringLiteral}}{{{dataType}}}{{/lambda.pythonStringLiteral}}{{^-last}},{{/-last}} +{{/allVars}} + } + + attribute_map: ClassVar[Dict[str, str]] = { +{{#allVars}} + {{#vendorExtensions.x-py-public-name-literal}}{{{vendorExtensions.x-py-public-name-literal}}}{{/vendorExtensions.x-py-public-name-literal}}{{^vendorExtensions.x-py-public-name-literal}}{{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}{{/vendorExtensions.x-py-public-name-literal}}: {{{vendorExtensions.x-py-wire-name-literal}}}{{^-last}},{{/-last}} +{{/allVars}} + } +{{/compatibleWithPythonLegacy}} + __properties: ClassVar[List[str]] = [{{#allVars}}{{{vendorExtensions.x-py-wire-name-literal}}}{{^-last}}, {{/-last}}{{/allVars}}] +{{#vars}} + {{#vendorExtensions.x-regex}} + + @field_validator('{{{name}}}', mode="before") + def {{{name}}}_validate_regular_expression(cls, value): + """Validates the regular expression""" + {{^required}} + if value is None: + return value + + {{/required}} + {{#required}} + {{#isNullable}} + if value is None: + return value + + {{/isNullable}} + {{/required}} + if isinstance(value, str) and not re.match(r"{{{.}}}", value{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}): + raise ValueError(r"must validate the regular expression {{{vendorExtensions.x-pattern}}}") + return value + {{/vendorExtensions.x-regex}} + {{#isEnum}} + + @field_validator('{{{name}}}') + def {{{name}}}_validate_enum(cls, value): + """Validates the enum""" + {{^required}} + if value is None: + return value + + {{/required}} + {{#required}} + {{#isNullable}} + if value is None: + return value + + {{/isNullable}} + {{/required}} + {{#isContainer}} + {{#isArray}} + for i in value: + if i not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]): + raise ValueError("each list item must be one of ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") + {{/isArray}} + {{#isMap}} + for i in value.values(): + if i not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]): + raise ValueError("dict values must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + if value not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]): + raise ValueError("must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") + {{/isContainer}} + return value + {{/isEnum}} +{{/vars}} + +{{#vendorExtensions.x-py-preprocesses-input-names}} + @classmethod + def __preprocess_input_names( + cls, + obj: Any, + remove_hidden_storage_names: bool = True, + ) -> Any: + if not isinstance(obj, _Mapping): + return obj + obj = dict(obj) +{{#vendorExtensions.x-py-input-name-properties}} +{{#vendorExtensions.x-py-public-name-differs-from-wire}} +{{#vendorExtensions.x-py-explicit-public-name}} + if ( + {{{vendorExtensions.x-py-wire-name-literal}}} in obj + and {{{vendorExtensions.x-py-public-name-literal}}} in obj + ): + raise ValueError( + "%s received both %r and %r" + % ( + cls.__name__, + {{{vendorExtensions.x-py-wire-name-literal}}}, + {{{vendorExtensions.x-py-public-name-literal}}}, + ) + ) +{{/vendorExtensions.x-py-explicit-public-name}} + if {{{vendorExtensions.x-py-wire-name-literal}}} not in obj and {{{vendorExtensions.x-py-public-name-literal}}} in obj: + obj[{{{vendorExtensions.x-py-wire-name-literal}}}] = obj[{{{vendorExtensions.x-py-public-name-literal}}}] + obj.pop({{{vendorExtensions.x-py-public-name-literal}}}, None) +{{/vendorExtensions.x-py-public-name-differs-from-wire}} +{{/vendorExtensions.x-py-input-name-properties}} +{{#vendorExtensions.x-py-hidden-storage-names.size}} + if remove_hidden_storage_names: +{{#vendorExtensions.x-py-hidden-storage-names}} + obj.pop({{#lambda.pythonStringLiteral}}{{{.}}}{{/lambda.pythonStringLiteral}}, None) +{{/vendorExtensions.x-py-hidden-storage-names}} +{{/vendorExtensions.x-py-hidden-storage-names.size}} + return obj + +{{/vendorExtensions.x-py-preprocesses-input-names}} +{{#vendorExtensions.x-py-validates-input-names}} + # Pydantic passes the model instance to wrap validators during assignment: + # https://docs.pydantic.dev/2.11/migration/#changes-to-validators + # Private names also keep inherited model validators distinct: + # https://docs.pydantic.dev/2.11/concepts/validators/#on-inheritance + @_model_validator(mode="wrap") + @classmethod + def __validate_input_names( + cls, + obj: Any, + handler: _ModelWrapValidatorHandler[Self], + ) -> Self: + if not isinstance(obj, cls): + obj = cls.__preprocess_input_names(obj) + return handler(obj) + +{{/vendorExtensions.x-py-validates-input-names}} + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, +{{#compatibleWithPythonLegacy}} +{{! +python-legacy generated explicit constructor parameters, so unknown kwargs failed: +https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L64-L100 +}} + extra="forbid", +{{/compatibleWithPythonLegacy}} + protected_namespaces=(), + ) + + +{{#hasChildren}} +{{#discriminator}} + # JSON field name that stores the object type + __discriminator_property_name: ClassVar[str] = {{#lambda.pythonSingleQuotedStringLiteral}}{{{discriminator.propertyBaseName}}}{{/lambda.pythonSingleQuotedStringLiteral}} + + # discriminator mappings + __discriminator_value_class_map: ClassVar[Dict[str, str]] = { + {{#mappedModels}}{{#lambda.pythonSingleQuotedStringLiteral}}{{{mappingName}}}{{/lambda.pythonSingleQuotedStringLiteral}}: '{{{modelName}}}'{{^-last}},{{/-last}}{{/mappedModels}} + } + + @classmethod + def get_discriminator_value(cls, obj: Dict[str, Any]) -> Optional[str]: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj.get(cls.__discriminator_property_name) + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + +{{/discriminator}} +{{/hasChildren}} + def to_str(self) -> str: +{{#compatibleWithPythonLegacy}} + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) +{{/compatibleWithPythonLegacy}} +{{^compatibleWithPythonLegacy}} + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) +{{/compatibleWithPythonLegacy}} +{{#compatibleWithPythonLegacy}} + + def __repr__(self) -> str: + """For print and pprint""" + return self.to_str() + + def __eq__(self, other: object) -> bool: + """Returns true if both objects are equal""" + if not isinstance(other, {{classname}}): + return False + +{{#isAdditionalPropertiesTrue}} + return ( + self.to_dict() == other.to_dict() + and self.additional_properties == other.additional_properties + ) +{{/isAdditionalPropertiesTrue}} +{{^isAdditionalPropertiesTrue}} + return self.to_dict() == other.to_dict() +{{/isAdditionalPropertiesTrue}} + + def __ne__(self, other: object) -> bool: + """Returns true if both objects are not equal""" + if not isinstance(other, {{classname}}): + return True + + return not (self == other) + +{{/compatibleWithPythonLegacy}} + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" +{{#compatibleWithPythonLegacy}} + to_openapi_dict = _get_openapi_to_dict(self) + if to_openapi_dict is not None: + return json.dumps(to_jsonable_python(to_openapi_dict(self))) + return json.dumps(to_jsonable_python(self.to_dict())) +{{/compatibleWithPythonLegacy}} +{{^compatibleWithPythonLegacy}} + return json.dumps(to_jsonable_python(self.to_dict())) +{{/compatibleWithPythonLegacy}} + + @classmethod + def from_json(cls, json_str: str) -> Optional[{{^hasChildren}}Self{{/hasChildren}}{{#hasChildren}}{{#discriminator}}Union[{{#mappedModels}}{{{modelName}}}{{^-last}}, {{/-last}}{{/mappedModels}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}{{/hasChildren}}]: + """Create an instance of {{{classname}}} from a JSON string""" + return cls.from_dict(json.loads(json_str)) + +{{#compatibleWithPythonLegacy}} + def to_dict(self, serialize: bool = False) -> Dict[str, Any]: + """Return all declared model fields using public or wire names.""" + return { +{{#allVars}} + ({{{vendorExtensions.x-py-wire-name-literal}}} if serialize else {{#vendorExtensions.x-py-public-name-literal}}{{{vendorExtensions.x-py-public-name-literal}}}{{/vendorExtensions.x-py-public-name-literal}}{{^vendorExtensions.x-py-public-name-literal}}{{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}{{/vendorExtensions.x-py-public-name-literal}}): _to_legacy_value(getattr(self, {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}, None), serialize), +{{/allVars}} + } + + def __openapi_generator_modern_projection(self) -> Dict[str, Any]: +{{/compatibleWithPythonLegacy}} +{{^compatibleWithPythonLegacy}} + def to_dict(self) -> Dict[str, Any]: +{{/compatibleWithPythonLegacy}} + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + {{#vendorExtensions.x-py-readonly}} + * OpenAPI `readOnly` fields are excluded. + {{/vendorExtensions.x-py-readonly}} + {{#isAdditionalPropertiesTrue}} + * Fields in `self.additional_properties` are added to the output dict. + {{/isAdditionalPropertiesTrue}} + """ + excluded_fields: Set[str] = set([ + {{#vendorExtensions.x-py-readonly}} + "{{{.}}}", + {{/vendorExtensions.x-py-readonly}} + {{#isAdditionalPropertiesTrue}} + "additional_properties", + {{/isAdditionalPropertiesTrue}} + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + {{#allVars}} + {{#isContainer}} + {{#isArray}} + {{#items.isArray}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list of list) + _items = [] + if self.{{{name}}}: + for _item_{{{name}}} in self.{{{name}}}: + _items.append( + [{{#compatibleWithPythonLegacy}}_to_openapi_value(_inner_item){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_inner_item.to_dict(){{/compatibleWithPythonLegacy}} if _inner_item is not None else None for _inner_item in _item_{{{name}}}] if _item_{{{name}}} is not None else None + ) + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _items + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{#items.isMap}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list of dict) + _items = [] + if self.{{{name}}}: + for _item_{{{name}}} in self.{{{name}}}: + _items.append( + {_inner_key: {{#compatibleWithPythonLegacy}}_to_openapi_value(_inner_value){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_inner_value.to_dict(){{/compatibleWithPythonLegacy}} if _inner_value is not None else None for _inner_key, _inner_value in _item_{{{name}}}.items()} if _item_{{{name}}} is not None else None + ) + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _items + {{/items.items.isPrimitiveType}} + {{/items.isMap}} + {{^items.isArray}} + {{^items.isMap}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list) + _items = [] + if self.{{{name}}}: + for _item_{{{name}}} in self.{{{name}}}: + _items.append({{#compatibleWithPythonLegacy}}_to_openapi_value(_item_{{{name}}}){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_item_{{{name}}}.to_dict(){{/compatibleWithPythonLegacy}} if _item_{{{name}}} is not None else None) + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _items + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{/items.isMap}} + {{/items.isArray}} + {{/isArray}} + {{#isMap}} + {{#items.isArray}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict of array) + _field_dict_of_array = {} + if self.{{{name}}}: + for _key_{{{name}}} in self.{{{name}}}: + _field_dict_of_array[_key_{{{name}}}] = [ + {{#compatibleWithPythonLegacy}}_to_openapi_value(_item){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_item.to_dict(){{/compatibleWithPythonLegacy}} if _item is not None else None for _item in self.{{{name}}}[_key_{{{name}}}] + ] if self.{{{name}}}[_key_{{{name}}}] is not None else None + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _field_dict_of_array + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{#items.isMap}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict of dict) + _field_dict_of_dict = {} + if self.{{{name}}}: + for _key_{{{name}}}, _value_{{{name}}} in self.{{{name}}}.items(): + _field_dict_of_dict[_key_{{{name}}}] = { + _key: {{#compatibleWithPythonLegacy}}_to_openapi_value(_value){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_value.to_dict(){{/compatibleWithPythonLegacy}} if _value is not None else None for _key, _value in _value_{{{name}}}.items() + } if _value_{{{name}}} is not None else None + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _field_dict_of_dict + {{/items.items.isPrimitiveType}} + {{/items.isMap}} + {{^items.isMap}} + {{^items.isArray}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict) + _field_dict = {} + if self.{{{name}}}: + for _key_{{{name}}} in self.{{{name}}}: + _field_dict[_key_{{{name}}}] = {{#compatibleWithPythonLegacy}}_to_openapi_value(self.{{{name}}}[_key_{{{name}}}]){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}self.{{{name}}}[_key_{{{name}}}].to_dict(){{/compatibleWithPythonLegacy}} if self.{{{name}}}[_key_{{{name}}}] is not None else None + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _field_dict + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{/items.isArray}} + {{/items.isMap}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of {{{name}}} + if self.{{{name}}}: + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = {{#compatibleWithPythonLegacy}}_to_openapi_value(self.{{{name}}}){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}self.{{{name}}}.to_dict(){{/compatibleWithPythonLegacy}} + {{/isEnumOrRef}} + {{/isPrimitiveType}} + {{/isContainer}} + {{/allVars}} + {{#isAdditionalPropertiesTrue}} + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + {{/isAdditionalPropertiesTrue}} + {{#allVars}} + {{#isNullable}} + # set to None if {{{name}}} (nullable) is None + # and model_fields_set contains the field + if self.{{name}} is None and "{{{name}}}" in self.model_fields_set: + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = None + + {{/isNullable}} + {{/allVars}} + return _dict + +{{#compatibleWithPythonLegacy}} +{{>_legacy_model_dict_registration}} + +{{/compatibleWithPythonLegacy}} + {{#hasChildren}} + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Optional[{{#discriminator}}Union[{{#mappedModels}}{{{modelName}}}{{^-last}}, {{/-last}}{{/mappedModels}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}]: + """Create an instance of {{{classname}}} from a dict""" + {{/hasChildren}} + {{^hasChildren}} + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of {{{classname}}} from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + {{/hasChildren}} +{{#vendorExtensions.x-py-preprocesses-input-names}} + + obj = _cast( + Dict[str, Any], + cls.__preprocess_input_names( + obj, + remove_hidden_storage_names={{#hasChildren}}{{#discriminator}}False{{/discriminator}}{{^discriminator}}True{{/discriminator}}{{/hasChildren}}{{^hasChildren}}True{{/hasChildren}}, + ), + ) + +{{/vendorExtensions.x-py-preprocesses-input-names}} + {{#hasChildren}} + {{#discriminator}} + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + {{#mappedModels}} + if object_type == '{{{modelName}}}': + return import_module("{{packageName}}.models.{{model.classFilename}}").{{modelName}}.from_dict(obj) + {{/mappedModels}} + + raise ValueError("{{{classname}}} failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + {{/discriminator}} + {{/hasChildren}} + {{^hasChildren}} +{{^vendorExtensions.x-py-preprocesses-input-names}} + +{{/vendorExtensions.x-py-preprocesses-input-names}} + {{#disallowAdditionalPropertiesIfNotPresent}} + {{^isAdditionalPropertiesTrue}} + # raise errors for additional fields in the input + for _key in obj.keys(): + if _key not in cls.__properties: + raise ValueError("Error due to additional fields (not defined in {{classname}}) in the input: " + _key) + + {{/isAdditionalPropertiesTrue}} + {{/disallowAdditionalPropertiesIfNotPresent}} + _obj = cls.model_validate({ + {{#allVars}} + {{#isContainer}} + {{#isArray}} + {{#items.isContainer}} + {{#items.isArray}} + {{#items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{^items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: [ + [{{{items.items.dataType}}}.from_dict(_inner_item) for _inner_item in _item] if _item is not None else None + for _item in obj[{{{vendorExtensions.x-py-wire-name-literal}}}] + ] if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{#items.isMap}} + {{#items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{^items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: [ + {_inner_key: {{{items.items.dataType}}}.from_dict(_inner_value) for _inner_key, _inner_value in _item.items()} if _item is not None else None + for _item in obj[{{{vendorExtensions.x-py-wire-name-literal}}}] + ] if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{/items.isMap}} + {{/items.isContainer}} + {{^items.isContainer}} + {{^items.isPrimitiveType}} + {{#items.isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{^items.isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: [{{{items.dataType}}}.from_dict(_item) for _item in obj[{{{vendorExtensions.x-py-wire-name-literal}}}]] if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{#items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/items.isContainer}} + {{/isArray}} + {{#isMap}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + {{#items.isContainer}} + {{#items.isMap}} + {{{vendorExtensions.x-py-wire-name-literal}}}: dict( + (_k, dict( + (_ik, {{{items.items.dataType}}}.from_dict(_iv)) + for _ik, _iv in _v.items() + ) + if _v is not None + else None + ) + for _k, _v in obj[{{{vendorExtensions.x-py-wire-name-literal}}}].items() + ) + if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None + else None{{^-last}},{{/-last}} + {{/items.isMap}} + {{#items.isArray}} + {{{vendorExtensions.x-py-wire-name-literal}}}: { + _k: [{{{items.items.dataType}}}.from_dict(_item) for _item in _v] if _v is not None else None + for _k, _v in obj[{{{vendorExtensions.x-py-wire-name-literal}}}].items() + } + if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None + else None{{^-last}},{{/-last}} + {{/items.isArray}} + {{/items.isContainer}} + {{^items.isContainer}} + {{{vendorExtensions.x-py-wire-name-literal}}}: dict( + (_k, {{{items.dataType}}}.from_dict(_v)) + for _k, _v in obj[{{{vendorExtensions.x-py-wire-name-literal}}}].items() + ) + if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None + else None{{^-last}},{{/-last}} + {{/items.isContainer}} + {{/items.isEnumOrRef}} + {{#items.isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: dict((_k, _v) for _k, _v in obj.get({{{vendorExtensions.x-py-wire-name-literal}}}).items()) if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{#items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: {{{dataType}}}.from_dict(obj[{{{vendorExtensions.x-py-wire-name-literal}}}]) if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/isEnumOrRef}} + {{#isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{#defaultValue}} if {{#isNullable}}{{{vendorExtensions.x-py-wire-name-literal}}} in obj{{/isNullable}}{{^isNullable}}obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None{{/isNullable}} else {{{defaultValue}}}{{/defaultValue}}{{^-last}},{{/-last}} + {{/isEnumOrRef}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#defaultValue}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) if {{#isNullable}}{{{vendorExtensions.x-py-wire-name-literal}}} in obj{{/isNullable}}{{^isNullable}}obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None{{/isNullable}} else {{{defaultValue}}}{{^-last}},{{/-last}} + {{/defaultValue}} + {{^defaultValue}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/defaultValue}} + {{/isPrimitiveType}} + {{/isContainer}} + {{/allVars}} + }) + {{#isAdditionalPropertiesTrue}} + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + {{/isAdditionalPropertiesTrue}} + return _obj + {{/hasChildren}} +{{#vendorExtensions.x-py-has-public-name-properties}} + + if TYPE_CHECKING: +{{#vars}} + {{#vendorExtensions.x-py-public-name-differs-from-storage}} + + @property{{#vendorExtensions.x-py-public-name-overrides-base-model}} # type: ignore[override]{{/vendorExtensions.x-py-public-name-overrides-base-model}} + def {{{vendorExtensions.x-py-public-name}}}(self) -> _{{classname}}_{{name}}_public_type: + return self.{{{name}}} + + @{{{vendorExtensions.x-py-public-name}}}.setter + def {{{vendorExtensions.x-py-public-name}}}(self, value: _{{classname}}_{{name}}_public_type) -> None:{{#vendorExtensions.x-py-public-name-overrides-base-model}} # pyright: ignore[reportIncompatibleMethodOverride]{{/vendorExtensions.x-py-public-name-overrides-base-model}} + self.{{{name}}} = value + {{/vendorExtensions.x-py-public-name-differs-from-storage}} +{{/vars}} +{{/vendorExtensions.x-py-has-public-name-properties}} + +{{#vendorExtensions.x-py-postponed-model-imports.size}} +{{#vendorExtensions.x-py-postponed-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-postponed-model-imports}} +# TODO: Rewrite to not use raise_errors +{{classname}}.model_rebuild(raise_errors=False) +{{/vendorExtensions.x-py-postponed-model-imports.size}} +{{#vendorExtensions.x-py-has-public-name-properties}} + +if TYPE_CHECKING: +{{#vars}} +{{#vendorExtensions.x-py-public-name-differs-from-storage}} + _{{classname}}_{{name}}_public_type = {{{vendorExtensions.x-py-public-name-typing}}} +{{/vendorExtensions.x-py-public-name-differs-from-storage}} +{{/vars}} + +# Install forwarding properties after Pydantic has consumed the class +# namespace and resolved any postponed model annotations. +{{#vars}} +{{#vendorExtensions.x-py-public-name-differs-from-storage}} +setattr( + {{classname}}, + {{{vendorExtensions.x-py-public-name-literal}}}, + property( + lambda self: self.{{{name}}}, + lambda self, value: setattr( + self, + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}, + value, + ), + ), +) +{{/vendorExtensions.x-py-public-name-differs-from-storage}} +{{/vars}} +{{/vendorExtensions.x-py-has-public-name-properties}} diff --git a/packages/openapi-generator/src/sap_openapi_generator/generate.py b/packages/openapi-generator/src/sap_openapi_generator/generate.py index 00a4994b..fa2f0e99 100644 --- a/packages/openapi-generator/src/sap_openapi_generator/generate.py +++ b/packages/openapi-generator/src/sap_openapi_generator/generate.py @@ -69,6 +69,50 @@ def _build_opid_flags(mappings_path: Path) -> list[str]: return flags +def _fix_numbered_duplicates(output_dir: Path) -> None: + """Rename fileN.py → file.py when the generator appends a digit to avoid collisions. + + The openapi-generator appends '0', '1', … to a filename when its snake_case + version collides with another file (e.g. filterconditions0.py vs filter_conditions.py). + The generated imports reference the un-suffixed name, so we rename the file to match. + Only renames when the un-suffixed target does not already exist. + """ + import re + for numbered in sorted(output_dir.rglob("*.py")): + m = re.fullmatch(r"(.+?)(0)\.py", numbered.name) + if not m: + continue + canonical = numbered.with_name(m.group(1) + ".py") + if not canonical.exists(): + numbered.rename(canonical) + + +def _fix_field_aliases(output_dir: Path) -> None: + """Replace Field(alias="camelCase") with serialization_alias="camelCase". + + The openapi-generator emits alias= which makes Pydantic use the camelCase name + as the __init__ parameter, hiding the snake_case field name from type checkers. + Replacing with serialization_alias= keeps camelCase JSON output while letting + the __init__ use the natural snake_case field name. + """ + import re + + ALIAS_RE = re.compile( + r'(Field\((?:[^"\')\n]|"[^"]*"|\'[^\']*\')*?)(? None: for py_file in output_dir.rglob("*.py"): src = py_file.read_text() @@ -107,6 +151,8 @@ def generate_one( mappings_output_path=mappings, ) + template_dir = config_path.parent / "custom-templates" + cmd = [ "npx", "--yes", "@openapitools/openapi-generator-cli", "generate", "-g", "python", @@ -115,6 +161,8 @@ def generate_one( "-c", str(config_path), "--additional-properties", f"packageName={leaf}", ] + if template_dir.is_dir(): + cmd += ["--template-dir", str(template_dir)] cmd += _build_opid_flags(mappings) result = subprocess.run(cmd, check=False) @@ -130,6 +178,8 @@ def generate_one( shutil.rmtree(output_dir) shutil.move(str(generated_src), str(output_dir)) + _fix_numbered_duplicates(output_dir) + _fix_field_aliases(output_dir) _rewrite_imports(output_dir, package_name) (output_dir / "py.typed").touch() diff --git a/pyproject.toml b/pyproject.toml index 4aaa5f88..e7711944 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ sap-ai-sdk-core = { workspace = true } sap-ai-sdk-gen = { workspace = true } [tool.uv.workspace] -members = ["packages/*"] +members = ["packages/*", "sample_code"] [tool.pip-licenses] # Blue Oak Council Bronze+ permissive licenses (https://blueoakcouncil.org/list) diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 00000000..eae4dd63 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,9 @@ +{ + "venvPath": ".", + "venv": ".venv", + "extraPaths": [ + "packages/base", + "packages/core", + "packages/gen" + ] +} diff --git a/sample_code/Makefile b/sample_code/Makefile index c9fe416a..ab5f2fb3 100644 --- a/sample_code/Makefile +++ b/sample_code/Makefile @@ -1,2 +1,2 @@ server: - uv run uvicorn sample_code.server:app --app-dir src --env-file .env --reload + uv run uvicorn sample_code.server:app --env-file .env --reload diff --git a/sample_code/README.md b/sample_code/README.md index 6b9ffe89..34735b80 100644 --- a/sample_code/README.md +++ b/sample_code/README.md @@ -31,7 +31,7 @@ Optionally, you can add the `AICORE_RESOURCE_GROUP` environment variable to spec The server can be started with ```bash -uv run uvicorn sample_code.server:app --app-dir src --env-file .env --reload +uv run uvicorn sample_code.server:app --env-file .env --reload ``` or by running ```make```. diff --git a/sample_code/pyproject.toml b/sample_code/pyproject.toml index ed4b3737..55f484da 100644 --- a/sample_code/pyproject.toml +++ b/sample_code/pyproject.toml @@ -15,11 +15,10 @@ requires = ["setuptools>=68"] build-backend = "setuptools.build_meta" [tool.setuptools.packages.find] -where = ["."] -include = ["src*"] +where = ["src"] [tool.setuptools.package-dir] -"sample_code" = "src" +"" = "src" [tool.uv.sources] -sap-ai-sdk-gen = { workspace = true, editable = true } +sap-ai-sdk-gen = { workspace = true } diff --git a/sample_code/src/sample_code/__init__.py b/sample_code/src/sample_code/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sample_code/src/amazon.py b/sample_code/src/sample_code/amazon.py similarity index 100% rename from sample_code/src/amazon.py rename to sample_code/src/sample_code/amazon.py diff --git a/sample_code/src/core.py b/sample_code/src/sample_code/core.py similarity index 100% rename from sample_code/src/core.py rename to sample_code/src/sample_code/core.py diff --git a/sample_code/src/document_grounding_generation.py b/sample_code/src/sample_code/document_grounding_generation.py similarity index 100% rename from sample_code/src/document_grounding_generation.py rename to sample_code/src/sample_code/document_grounding_generation.py diff --git a/sample_code/src/google.py b/sample_code/src/sample_code/google.py similarity index 100% rename from sample_code/src/google.py rename to sample_code/src/sample_code/google.py diff --git a/sample_code/src/openai.py b/sample_code/src/sample_code/openai.py similarity index 92% rename from sample_code/src/openai.py rename to sample_code/src/sample_code/openai.py index 934acf9c..a3f783f5 100644 --- a/sample_code/src/openai.py +++ b/sample_code/src/sample_code/openai.py @@ -1,5 +1,5 @@ from fastapi.responses import StreamingResponse -from gen_ai_hub.proxy.native.openai import AsyncOpenAI, chat, embeddings, responses +from gen_ai_hub.proxy.native.openai import AsyncOpenAI from openai.types.responses import Response from pydantic import BaseModel @@ -11,6 +11,7 @@ def chat_completion(): Returns: JSON object containing the model response as result. """ + from gen_ai_hub.proxy.native.openai import chat messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"}, @@ -61,6 +62,7 @@ def chat_completion_structured(): Returns: JSON object response from the model. """ + from gen_ai_hub.proxy.native.openai import chat class Person(BaseModel): name: str @@ -81,6 +83,7 @@ def chat_completion_stream(): Returns: Streaming response emitting the produced text. """ + from gen_ai_hub.proxy.native.openai import chat messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Count from 1 to 10, one number per line."}, @@ -108,6 +111,7 @@ def responses_simple(): Returns: JSON object containing the model response as result. """ + from gen_ai_hub.proxy.native.openai import responses response = responses.create( model="gpt-5.4-nano", instructions="You are a helpful assistant.", @@ -140,6 +144,7 @@ def responses_structured(): Returns: JSON object response from the model. """ + from gen_ai_hub.proxy.native.openai import responses class Person(BaseModel): name: str @@ -160,6 +165,7 @@ def embedding(): Returns: JSON object containing the embedding. """ + from gen_ai_hub.proxy.native.openai import embeddings result = embeddings.create( model_name="text-embedding-3-small", input="The quick brown fox jumps over the lazy dog.", diff --git a/sample_code/src/orchestration.py b/sample_code/src/sample_code/orchestration.py similarity index 100% rename from sample_code/src/orchestration.py rename to sample_code/src/sample_code/orchestration.py diff --git a/sample_code/src/server.py b/sample_code/src/sample_code/server.py similarity index 76% rename from sample_code/src/server.py rename to sample_code/src/sample_code/server.py index 168b51a4..6643eb66 100644 --- a/sample_code/src/server.py +++ b/sample_code/src/sample_code/server.py @@ -1,7 +1,33 @@ +import json +import os + from fastapi import FastAPI, Request from fastapi.responses import JSONResponse -from sample_code import openai, amazon, core, google, orchestration, document_grounding_generation +from sample_code import openai, amazon, core, google, orchestration, document_grounding_generation, tab_ai_orchestration + + +def _load_service_key() -> None: + """Parse AICORE_SERVICE_KEY into individual AICORE_* env vars if not already set.""" + service_key = os.environ.get("AICORE_SERVICE_KEY") + if not service_key: + return + try: + d = json.loads(service_key) + except json.JSONDecodeError: + return + mapping = { + "AICORE_CLIENT_ID": d.get("clientid"), + "AICORE_CLIENT_SECRET": d.get("clientsecret"), + "AICORE_AUTH_URL": (d.get("url", "").rstrip("/") + "/oauth/token") if d.get("url") else None, + "AICORE_BASE_URL": (d.get("serviceurls", {}).get("AI_API_URL", "").rstrip("/") + "/v2") if d.get("serviceurls", {}).get("AI_API_URL") else None, + } + for key, value in mapping.items(): + if value and not os.environ.get(key): + os.environ[key] = value + + +_load_service_key() app = FastAPI(title="SAP AI Core Python SDK Sample Application") @@ -75,3 +101,7 @@ async def health(): app.post("/document-grounding-generation/collection/create")(document_grounding_generation.create_collection) app.get("/document-grounding-generation/pipelines")(document_grounding_generation.get_all_pipelines) app.post("/document-grounding-generation/retrieval/search")(document_grounding_generation.retrieval_search) + +# Tabular AI Orchestration +app.get("/tab-ai-orchestration/predict")(tab_ai_orchestration.predict) +app.get("/tab-ai-orchestration/predict-with-explanations")(tab_ai_orchestration.predict_with_explanations) diff --git a/sample_code/src/sample_code/tab_ai_orchestration.py b/sample_code/src/sample_code/tab_ai_orchestration.py new file mode 100644 index 00000000..dac7309e --- /dev/null +++ b/sample_code/src/sample_code/tab_ai_orchestration.py @@ -0,0 +1,112 @@ +from gen_ai_hub.tab_ai_orchestration import TabAiOrchestrationClient +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum + + +async def predict(): + """ + Make a tabular prediction using the Tabular AI Orchestration service. + + Returns: + JSON object containing the prediction response. + """ + request = PredictRequest( + model_name=TFMEnum.SAP_MINUS_RPT_MINUS_1_MINUS_SMALL, + scenario_config_name="product-prediction-scenario-lowercase", + context_selection_config=ContextSelectionConfig( + num_rows=3, + strategy="random", + index_column="id", + ), + prediction_config=PredictionConfig( + target_columns=[ + TargetColumn( + name="salesgroup", + prediction_placeholder="[PREDICT]", + task_type=TaskTypeEnum.CLASSIFICATION, + ) + ] + ), + columns={ + "product": ["Laptop", "Office Chair"], + "price": [999.99, 142.99], + "date": ["2025-01-15", "2025-07-12"], + "id": ["35", "571"], + "salesgroup": ["[PREDICT]", "[PREDICT]"], + }, + ) + + async with TabAiOrchestrationClient(model_name="sap-rpt-1-small") as client: + response = await client.predict( + ai_resource_group="default", + predict_request=request, + ) + + return response.to_dict() + + +async def predict_with_explanations(): + """ + Make a tabular prediction with explanations using the Tabular AI Orchestration service. + + Returns: + JSON object containing the prediction response with top column scores and + relevant context rows for each prediction. + """ + request = PredictRequest( + model_name=TFMEnum.SAP_MINUS_RPT_MINUS_1_DOT_5, + scenario_config_name="product-prediction-scenario-lowercase", + context_selection_config=ContextSelectionConfig( + num_rows=3, + strategy="random", + index_column="id", + ), + prediction_config=PredictionConfig( + target_columns=[ + TargetColumn( + name="salesgroup", + prediction_placeholder="[PREDICT]", + task_type=TaskTypeEnum.CLASSIFICATION, + ) + ] + ), + var_model_config=Modelconfig(ModelRpt15( + index_column="id", + data_schema={ + "product": {"dtype": "string"}, + "price": {"dtype": "numeric"}, + "date": {"dtype": "date"}, + "id": {"dtype": "string"}, + "salesgroup": {"dtype": "string"}, + }, + prediction_config=ModelRpt15PredictionConfig( + explanations=ModelRpt15Explanations( + top_column_scores=3, + top_relevant_context_rows=2, + ) + ), + )), + columns={ + "product": ["Laptop", "Office Chair"], + "price": [999.99, 142.99], + "date": ["2025-01-15", "2025-07-12"], + "id": ["35", "571"], + "salesgroup": ["[PREDICT]", "[PREDICT]"], + }, + ) + + async with TabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + response = await client.predict( + ai_resource_group="default", + predict_request=request, + ) + + return response.to_dict() diff --git a/uv.lock b/uv.lock index d0582ec8..cc57f44a 100644 --- a/uv.lock +++ b/uv.lock @@ -20,6 +20,7 @@ resolution-markers = [ [manifest] members = [ "ai-sdk-python", + "sample-code", "sap-ai-sdk-base", "sap-ai-sdk-core", "sap-ai-sdk-gen", @@ -267,6 +268,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/b3/6b4067be973ae96ba0d615946e314c5ae35f9f993eca561b356540bb0c2b/alabaster-1.0.0-py3-none-any.whl", hash = "sha256:fc6786402dc3fcb2de3cabd5fe455a2db534b371124f1f21de8731783dec828b", size = 13929, upload-time = "2024-07-26T18:15:02.05Z" }, ] +[[package]] +name = "annotated-doc" +version = "0.0.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5a/8e/38aa427ed5402449e226975b649c5dc73ccadfefeb95e6aecb8f8ea4b6b6/annotated_doc-0.0.5.tar.gz", hash = "sha256:c7e58ce09192557605d8bbd92836d7e1d520ac9580096042c0bfd197efacf1bb", size = 10758, upload-time = "2026-07-28T13:50:58.129Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3e/30/e900b21425a860e195f32e37657aa1f7c7f2b1bfb26f03ca209b90933c06/annotated_doc-0.0.5-py3-none-any.whl", hash = "sha256:117bac03a25ede5df5440e855b32d556049ca169ead221505badf432fed4b101", size = 5302, upload-time = "2026-07-28T13:50:57.239Z" }, +] + [[package]] name = "annotated-types" version = "0.8.0" @@ -942,6 +952,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c1/ea/53f2148663b321f21b5a606bd5f191517cf40b7072c0497d3c92c4a13b1e/executing-2.2.1-py2.py3-none-any.whl", hash = "sha256:760643d3452b4d777d295bb167ccc74c64a81df23fb5e08eff250c425a4b2017", size = 28317, upload-time = "2025-09-01T09:48:08.5Z" }, ] +[[package]] +name = "fastapi" +version = "0.141.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-doc" }, + { name = "pydantic" }, + { name = "starlette" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8a/02/91e3416a8fdd715abb903a952a6bec7cdd8d14eed55d415fc8595524c319/fastapi-0.141.1.tar.gz", hash = "sha256:e8822fc40db1e1858054d7a949a888695bc9bdce70139178e33bd2871a453ca1", size = 425799, upload-time = "2026-07-29T17:18:05.568Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/03/10388a42375ee7e4ac9b94eb2c5c569c8b5795e377e701c9ac3ad63de890/fastapi-0.141.1-py3-none-any.whl", hash = "sha256:bfb91aa2d334c61cb35ba9a116fc123b3d3df31640b801cf57a7a78ec3f603b3", size = 131954, upload-time = "2026-07-29T17:18:04.364Z" }, +] + [[package]] name = "fastjsonschema" version = "2.22.1" @@ -4105,6 +4131,23 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/bc/e7/5c595c75e9f41a44f30e526eda465ea0b4eec93470e074e4a111b253f13a/s3transfer-0.19.2-py3-none-any.whl", hash = "sha256:d8168eccca828cbb2cd573675333f3bddd254313a9c42494b84c76b539e8ba25", size = 90216, upload-time = "2026-07-22T19:30:43.251Z" }, ] +[[package]] +name = "sample-code" +version = "0.1.0" +source = { editable = "sample_code" } +dependencies = [ + { name = "fastapi" }, + { name = "sap-ai-sdk-gen" }, + { name = "uvicorn" }, +] + +[package.metadata] +requires-dist = [ + { name = "fastapi", specifier = ">=0.141.1" }, + { name = "sap-ai-sdk-gen", editable = "packages/gen" }, + { name = "uvicorn", specifier = ">=0.52.1" }, +] + [[package]] name = "sap-ai-sdk-base" version = "3.4.1" @@ -4553,6 +4596,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f1/7b/ce1eafaf1a76852e2ec9b22edecf1daa58175c090266e9f6c64afcd81d91/stack_data-0.6.3-py3-none-any.whl", hash = "sha256:d5558e0c25a4cb0853cddad3d77da9891a08cb85dd9f9f91b9f8cd66e511e695", size = 24521, upload-time = "2023-09-30T13:58:03.53Z" }, ] +[[package]] +name = "starlette" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b5/b4/205b0d5241d934e8add0c38aa924c4f9fb7330834ff11e5444db964ec3f9/starlette-1.6.0.tar.gz", hash = "sha256:d4e3ac5e546444960c710297a3c9fc3f7ebae1b7e963f3d36173b49da535be9b", size = 2716969, upload-time = "2026-08-08T18:27:57.512Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c8/cb/6a6a47d5b464bd08695d254f3da6e7986cc70c9fa5d778eda57538edfe56/starlette-1.6.0-py3-none-any.whl", hash = "sha256:a86dd39d14bb45f85a3d18525215a9ef0cfd1f192ac793220e72598c90335f0c", size = 75969, upload-time = "2026-08-08T18:27:56.196Z" }, +] + [[package]] name = "tabulate" version = "0.10.0" @@ -4882,6 +4938,20 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9d/8e/86ce2c03a1d9674530f6649e49067f7c69929600127077731de590d12132/uuid_utils-0.17.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:2db386941cfdecdd0b5a8ceeed5cf7479c83d1730dcf64a48d43cfa018cc3310", size = 178681, upload-time = "2026-07-09T13:49:57.096Z" }, ] +[[package]] +name = "uvicorn" +version = "0.52.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "h11" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f2/0f/3f86e61397dd33bf2ccf28188c40db6a740658aeebbbf6e7dbc101a1f487/uvicorn-0.52.4.tar.gz", hash = "sha256:73acfee47a0b133c5de13d219492d62d8a31e935f4fe6e41a232451a15379f86", size = 100627, upload-time = "2026-08-19T06:27:41.821Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f1/79/4a20b54ab0491485ccd8c077db2d39187c7f12b3e15485d38a7be37c81b4/uvicorn-0.52.4-py3-none-any.whl", hash = "sha256:f86e41a149d7d05a9969337e3946a9c171c06a5d42680896daaba624aeac8da1", size = 79871, upload-time = "2026-08-19T06:27:40.36Z" }, +] + [[package]] name = "wcwidth" version = "0.8.2" From 53a3dc1b6ee52fc1f8299c732d34b7839584819d Mon Sep 17 00:00:00 2001 From: Zhongpin Wang Date: Fri, 4 Sep 2026 16:21:40 +0800 Subject: [PATCH 5/6] fix small type issue --- sample-code/sample_code/tab_ai_orchestration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sample-code/sample_code/tab_ai_orchestration.py b/sample-code/sample_code/tab_ai_orchestration.py index dac7309e..bd08d19e 100644 --- a/sample-code/sample_code/tab_ai_orchestration.py +++ b/sample-code/sample_code/tab_ai_orchestration.py @@ -1,5 +1,6 @@ from gen_ai_hub.tab_ai_orchestration import TabAiOrchestrationClient from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig @@ -23,7 +24,7 @@ async def predict(): scenario_config_name="product-prediction-scenario-lowercase", context_selection_config=ContextSelectionConfig( num_rows=3, - strategy="random", + strategy=ContextSelectionStrategyEnum.RANDOM, index_column="id", ), prediction_config=PredictionConfig( @@ -66,7 +67,7 @@ async def predict_with_explanations(): scenario_config_name="product-prediction-scenario-lowercase", context_selection_config=ContextSelectionConfig( num_rows=3, - strategy="random", + strategy=ContextSelectionStrategyEnum.RANDOM, index_column="id", ), prediction_config=PredictionConfig( From a4df1f0ba52e6a0c906fb55325cc45256274e24e Mon Sep 17 00:00:00 2001 From: Zhongpin Wang Date: Fri, 4 Sep 2026 16:38:33 +0800 Subject: [PATCH 6/6] fix some generation issue --- .../generated/api/vector_api.py | 6 ++--- .../generated/api_client.py | 2 +- .../models/metadata_configuration_request.py | 2 +- .../models/metadata_configuration_response.py | 2 +- .../generated/api_client.py | 2 +- .../src/sap_openapi_generator/generate.py | 7 ++++++ .../document_grounding_generation.py | 25 +++++++++---------- uv.lock | 24 ++++++++++++++++++ 8 files changed, 50 insertions(+), 20 deletions(-) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py index dbfd50cf..87c910d3 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py @@ -478,7 +478,7 @@ async def create_documents( ) -> DocumentsListResponse: """Create documents in collection - Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-gen_ai_hub.document_grounding_generation.generated. :param ai_resource_group: Resource Group ID (required) :type ai_resource_group: str @@ -556,7 +556,7 @@ async def create_documents_with_http_info( ) -> ApiResponse[DocumentsListResponse]: """Create documents in collection - Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-gen_ai_hub.document_grounding_generation.generated. :param ai_resource_group: Resource Group ID (required) :type ai_resource_group: str @@ -634,7 +634,7 @@ async def create_documents_without_preload_content( ) -> RESTResponseType: """Create documents in collection - Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-gen_ai_hub.document_grounding_generation.generated. :param ai_resource_group: Resource Group ID (required) :type ai_resource_group: str diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py index f371e3af..04e24783 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py @@ -466,7 +466,7 @@ def __deserialize(self, data, klass): if klass in self.NATIVE_TYPES_MAPPING: klass = self.NATIVE_TYPES_MAPPING[klass] else: - klass = getattr(generated.models, klass) + klass = getattr(gen_ai_hub.document_grounding_generation.generated.models, klass) if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py index ee9cb4e8..6d48a491 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py @@ -29,7 +29,7 @@ class MetadataConfigurationRequest(BaseModel): """ MetadataConfigurationRequest """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be generated.") + id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be gen_ai_hub.document_grounding_generation.generated.") name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", serialization_alias="destinationName") data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", serialization_alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py index 0b6a381e..a9b2decd 100644 --- a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py @@ -29,7 +29,7 @@ class MetadataConfigurationResponse(BaseModel): """ MetadataConfigurationResponse """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be generated.") + id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be gen_ai_hub.document_grounding_generation.generated.") name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", serialization_alias="destinationName") data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", serialization_alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py index c012f7a2..b4b057f1 100644 --- a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py @@ -466,7 +466,7 @@ def __deserialize(self, data, klass): if klass in self.NATIVE_TYPES_MAPPING: klass = self.NATIVE_TYPES_MAPPING[klass] else: - klass = getattr(generated.models, klass) + klass = getattr(gen_ai_hub.tab_ai_orchestration.generated.models, klass) if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) diff --git a/packages/openapi-generator/src/sap_openapi_generator/generate.py b/packages/openapi-generator/src/sap_openapi_generator/generate.py index fa2f0e99..8e834508 100644 --- a/packages/openapi-generator/src/sap_openapi_generator/generate.py +++ b/packages/openapi-generator/src/sap_openapi_generator/generate.py @@ -114,6 +114,10 @@ def _fix_field_aliases(output_dir: Path) -> None: def _rewrite_imports(output_dir: Path, package_name: str) -> None: + import re + # Matches bare 'generated.' not preceded by a dot or word char (i.e. not already + # part of a fully-qualified path like 'gen_ai_hub.tab_ai_orchestration.generated.'). + _bare_generated_re = re.compile(r'(? None: .replace("import generated.", f"import {package_name}.") .replace("from generated import ", f"from {package_name} import ") ) + # Catch expression-level uses of the bare 'generated' name (e.g. getattr(generated.models, ...)) + # that the string replacements above don't cover. + updated = _bare_generated_re.sub(f"{package_name}.", updated) if updated != src: py_file.write_text(updated) diff --git a/sample-code/sample_code/document_grounding_generation.py b/sample-code/sample_code/document_grounding_generation.py index 00299d6f..5209ab13 100644 --- a/sample-code/sample_code/document_grounding_generation.py +++ b/sample-code/sample_code/document_grounding_generation.py @@ -2,13 +2,14 @@ from gen_ai_hub.document_grounding_generation import ( GroundingApiClient, CollectionRequest, + DataRepositoryType, EmbeddingConfig, + FiltersInner, PipelinesApi, RetrievalApi, RetrievalSearchConfiguration, RetrievalSearchFilter, RetrievalSearchInput, - TextSearchRequest, VectorApi, ) @@ -27,14 +28,14 @@ async def create_collection(): JSON object containing the created collection details. """ client = _client() - result = await VectorApi(client).create_collection( + await VectorApi(client).create_collection( + ai_resource_group=RESOURCE_GROUP, collection_request=CollectionRequest( title="my-collection", - embeddingConfig=EmbeddingConfig(modelName="text-embedding-3-small"), + embedding_config=EmbeddingConfig(model_name="text-embedding-3-small"), ), - header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, ) - return {"result": result.to_dict()} + return {"result": "collection creation initiated"} async def get_all_pipelines(): @@ -46,7 +47,7 @@ async def get_all_pipelines(): """ client = _client() result = await PipelinesApi(client).get_all_pipelines( - header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, + ai_resource_group=RESOURCE_GROUP, ) return {"result": result.to_dict()} @@ -60,20 +61,18 @@ async def retrieval_search(): """ client = _client() result = await RetrievalApi(client).search( - text_search_request=TextSearchRequest( + ai_resource_group=RESOURCE_GROUP, + retrieval_search_input=RetrievalSearchInput( query="What is SAP BTP?", filters=[ - RetrievalSearchFilter( + FiltersInner(RetrievalSearchFilter( id="my-data-repository-id", + data_repository_type=DataRepositoryType.VECTOR, search_configuration=RetrievalSearchConfiguration( max_chunk_count=5, ), - ) + )) ], - search_configuration=RetrievalSearchInput( - max_chunk_count=10, - ), ), - header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, ) return {"result": result.to_dict()} diff --git a/uv.lock b/uv.lock index e7b0f3e3..93ba7f4f 100644 --- a/uv.lock +++ b/uv.lock @@ -24,6 +24,7 @@ members = [ "sap-ai-sdk-base", "sap-ai-sdk-core", "sap-ai-sdk-gen", + "sap-openapi-generator", ] [[package]] @@ -4313,6 +4314,29 @@ dev = [ { name = "sphinxawesome-theme" }, ] +[[package]] +name = "sap-openapi-generator" +version = "0.1.0" +source = { editable = "packages/openapi-generator" } +dependencies = [ + { name = "pyyaml" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-cov" }, +] + +[package.metadata] +requires-dist = [{ name = "pyyaml", specifier = ">=6.0" }] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.0" }, + { name = "pytest-cov", specifier = ">=5.0" }, +] + [[package]] name = "six" version = "1.17.0"