qanswer_sdk 3.1193.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qanswer_sdk/__init__.py +366 -0
- qanswer_sdk/api/__init__.py +47 -0
- qanswer_sdk/api/admin_api.py +11207 -0
- qanswer_sdk/api/ai_assistant_access_rights_api.py +5331 -0
- qanswer_sdk/api/ai_assistant_api.py +4377 -0
- qanswer_sdk/api/bot_slack_api.py +814 -0
- qanswer_sdk/api/chat_completion_api.py +309 -0
- qanswer_sdk/api/chatbot_api.py +1091 -0
- qanswer_sdk/api/connector_document_api.py +1406 -0
- qanswer_sdk/api/connector_e_consilium_api.py +326 -0
- qanswer_sdk/api/connector_e_consilium_search_index_connector_api.py +1215 -0
- qanswer_sdk/api/connector_google_drive_api.py +1870 -0
- qanswer_sdk/api/connector_one_drive_api.py +1559 -0
- qanswer_sdk/api/connector_onenote_api.py +1576 -0
- qanswer_sdk/api/connector_pinecone_api.py +892 -0
- qanswer_sdk/api/connector_publication_office_controller_api.py +1215 -0
- qanswer_sdk/api/connector_qn_a_api.py +1538 -0
- qanswer_sdk/api/connector_rdf_answer_api.py +1445 -0
- qanswer_sdk/api/connector_rdf_api.py +5318 -0
- qanswer_sdk/api/connector_sharepoint_api.py +2584 -0
- qanswer_sdk/api/connector_websearch_api.py +326 -0
- qanswer_sdk/api/connector_website_api.py +2068 -0
- qanswer_sdk/api/connectors_api.py +1497 -0
- qanswer_sdk/api/connectors_data_api.py +3697 -0
- qanswer_sdk/api/conversation_logs_api.py +6668 -0
- qanswer_sdk/api/dataset_config_api.py +2178 -0
- qanswer_sdk/api/debug_api.py +282 -0
- qanswer_sdk/api/llm_api.py +563 -0
- qanswer_sdk/api/llm_consumption_controller_api.py +310 -0
- qanswer_sdk/api/organizations_teams_api.py +8465 -0
- qanswer_sdk/api/payment_api.py +1546 -0
- qanswer_sdk/api/socket_api.py +2975 -0
- qanswer_sdk/api/speech_to_text_api.py +734 -0
- qanswer_sdk/api/tag_api.py +2396 -0
- qanswer_sdk/api/task_chat_api.py +2064 -0
- qanswer_sdk/api/task_rdf_linker_api.py +4382 -0
- qanswer_sdk/api/task_rdf_sparql_endpoint_api.py +3522 -0
- qanswer_sdk/api/task_rdf_text_linker_api.py +1346 -0
- qanswer_sdk/api/task_relation_extraction_api.py +2977 -0
- qanswer_sdk/api/task_report_copilot_api.py +2980 -0
- qanswer_sdk/api/task_search_api.py +1784 -0
- qanswer_sdk/api/task_sparql2text_api.py +326 -0
- qanswer_sdk/api/task_text2sparql_api.py +908 -0
- qanswer_sdk/api/task_text_classification_api.py +914 -0
- qanswer_sdk/api/user_api.py +7098 -0
- qanswer_sdk/api_client.py +797 -0
- qanswer_sdk/api_response.py +21 -0
- qanswer_sdk/configuration.py +487 -0
- qanswer_sdk/exceptions.py +199 -0
- qanswer_sdk/models/__init__.py +307 -0
- qanswer_sdk/models/access_pdf_payload_model.py +109 -0
- qanswer_sdk/models/add_qn_a_request.py +103 -0
- qanswer_sdk/models/add_synonyms.py +91 -0
- qanswer_sdk/models/add_synonyms_resp.py +89 -0
- qanswer_sdk/models/aggregate.py +97 -0
- qanswer_sdk/models/aggregation.py +112 -0
- qanswer_sdk/models/aggregations_group.py +102 -0
- qanswer_sdk/models/ai_assistant_dto.py +103 -0
- qanswer_sdk/models/ai_assistant_shared_access.py +113 -0
- qanswer_sdk/models/allowed_file_extensions.py +98 -0
- qanswer_sdk/models/api_response.py +87 -0
- qanswer_sdk/models/applied_metadata_filter.py +98 -0
- qanswer_sdk/models/assistant_message_stop.py +93 -0
- qanswer_sdk/models/auth_link_response.py +91 -0
- qanswer_sdk/models/autocompletion_config.py +93 -0
- qanswer_sdk/models/available_connectors_response.py +99 -0
- qanswer_sdk/models/available_embedding_models_response.py +95 -0
- qanswer_sdk/models/available_endpoints_response.py +95 -0
- qanswer_sdk/models/available_logs_visibility_policy.py +103 -0
- qanswer_sdk/models/available_space_quota_for_dataset.py +91 -0
- qanswer_sdk/models/available_storage_preference.py +103 -0
- qanswer_sdk/models/base_connectors_response.py +89 -0
- qanswer_sdk/models/base_conversation_response.py +89 -0
- qanswer_sdk/models/base_feedback_response.py +89 -0
- qanswer_sdk/models/branding_data.py +87 -0
- qanswer_sdk/models/cell.py +89 -0
- qanswer_sdk/models/change_password.py +89 -0
- qanswer_sdk/models/change_password_admin.py +89 -0
- qanswer_sdk/models/change_role.py +96 -0
- qanswer_sdk/models/chat_task_settings.py +135 -0
- qanswer_sdk/models/chat_task_settings_update_payload.py +95 -0
- qanswer_sdk/models/chat_task_update.py +129 -0
- qanswer_sdk/models/chatbot_chat_payload.py +115 -0
- qanswer_sdk/models/chatbot_conversation_model.py +141 -0
- qanswer_sdk/models/chatbot_response.py +119 -0
- qanswer_sdk/models/check_mode_response.py +100 -0
- qanswer_sdk/models/class_info.py +89 -0
- qanswer_sdk/models/connector_model.py +112 -0
- qanswer_sdk/models/content_item.py +130 -0
- qanswer_sdk/models/conversation_message.py +186 -0
- qanswer_sdk/models/conversation_model.py +131 -0
- qanswer_sdk/models/conversation_statistics.py +95 -0
- qanswer_sdk/models/conversation_update.py +93 -0
- qanswer_sdk/models/conversation_users_stats.py +99 -0
- qanswer_sdk/models/conversation_users_stats_response.py +99 -0
- qanswer_sdk/models/coordinates.py +89 -0
- qanswer_sdk/models/cost_summary.py +99 -0
- qanswer_sdk/models/create_connector_request.py +93 -0
- qanswer_sdk/models/create_connector_response.py +95 -0
- qanswer_sdk/models/create_pinecone_connector_request.py +95 -0
- qanswer_sdk/models/create_sharepoint_connector_from_certificate_request.py +103 -0
- qanswer_sdk/models/create_sharepoint_connector_request.py +101 -0
- qanswer_sdk/models/dataset_config_request.py +187 -0
- qanswer_sdk/models/dataset_default_values_model.py +141 -0
- qanswer_sdk/models/dataset_description.py +91 -0
- qanswer_sdk/models/dataset_detail.py +133 -0
- qanswer_sdk/models/dataset_detail_kg.py +158 -0
- qanswer_sdk/models/dataset_schema.py +207 -0
- qanswer_sdk/models/dataset_update_object.py +195 -0
- qanswer_sdk/models/dataset_users_response.py +87 -0
- qanswer_sdk/models/default_prompt.py +106 -0
- qanswer_sdk/models/delete_connector_model.py +96 -0
- qanswer_sdk/models/delete_connector_request.py +99 -0
- qanswer_sdk/models/delete_connectors_response.py +91 -0
- qanswer_sdk/models/delete_qn_a_pair_request.py +95 -0
- qanswer_sdk/models/delete_qn_a_pair_response.py +89 -0
- qanswer_sdk/models/delete_synonym.py +91 -0
- qanswer_sdk/models/delete_synonym_resp.py +89 -0
- qanswer_sdk/models/diarization_segment.py +93 -0
- qanswer_sdk/models/document_content_response.py +91 -0
- qanswer_sdk/models/document_content_update_model.py +95 -0
- qanswer_sdk/models/document_file_delete_by_connector_model.py +99 -0
- qanswer_sdk/models/document_metadata.py +107 -0
- qanswer_sdk/models/document_metadata_list_wrapper.py +95 -0
- qanswer_sdk/models/document_status_response.py +89 -0
- qanswer_sdk/models/e_consilium_search_index_search_response.py +113 -0
- qanswer_sdk/models/econsilium_file_metadata.py +105 -0
- qanswer_sdk/models/econsilium_search_index_add_payload.py +105 -0
- qanswer_sdk/models/econsilium_search_index_additional_fields.py +101 -0
- qanswer_sdk/models/email_request.py +87 -0
- qanswer_sdk/models/embedding_endpoint.py +139 -0
- qanswer_sdk/models/embedding_endpoint_create.py +137 -0
- qanswer_sdk/models/embedding_endpoint_update.py +131 -0
- qanswer_sdk/models/embedding_endpoint_validation_response.py +96 -0
- qanswer_sdk/models/embedding_model.py +96 -0
- qanswer_sdk/models/entity.py +97 -0
- qanswer_sdk/models/entity_linker_response.py +99 -0
- qanswer_sdk/models/entity_model.py +99 -0
- qanswer_sdk/models/extra_body.py +91 -0
- qanswer_sdk/models/extract_hyper_links_payload.py +102 -0
- qanswer_sdk/models/extract_robot_links_payload.py +88 -0
- qanswer_sdk/models/extract_robot_links_response.py +88 -0
- qanswer_sdk/models/fact.py +96 -0
- qanswer_sdk/models/feedback_model.py +107 -0
- qanswer_sdk/models/feedback_update.py +103 -0
- qanswer_sdk/models/file_es_meta_data.py +89 -0
- qanswer_sdk/models/file_folder_model.py +113 -0
- qanswer_sdk/models/file_model.py +134 -0
- qanswer_sdk/models/files_by_connector_model.py +89 -0
- qanswer_sdk/models/format_return.py +87 -0
- qanswer_sdk/models/g_drive_connector_info.py +95 -0
- qanswer_sdk/models/g_drive_download_by_ids.py +89 -0
- qanswer_sdk/models/g_drive_download_request.py +101 -0
- qanswer_sdk/models/generation_params.py +89 -0
- qanswer_sdk/models/get_connector_by_id_response.py +91 -0
- qanswer_sdk/models/get_conversation_response.py +95 -0
- qanswer_sdk/models/guardrail_endpoint.py +121 -0
- qanswer_sdk/models/has_lucene_index_result.py +87 -0
- qanswer_sdk/models/index_config.py +95 -0
- qanswer_sdk/models/install_response.py +89 -0
- qanswer_sdk/models/is_enabled_response.py +87 -0
- qanswer_sdk/models/is_merging_result.py +87 -0
- qanswer_sdk/models/json_nullable_file_failure_reason.py +87 -0
- qanswer_sdk/models/json_nullable_source_metadata.py +87 -0
- qanswer_sdk/models/jwt_authentication_response.py +93 -0
- qanswer_sdk/models/label.py +89 -0
- qanswer_sdk/models/labeled_node.py +89 -0
- qanswer_sdk/models/link.py +103 -0
- qanswer_sdk/models/link_extraction_response.py +97 -0
- qanswer_sdk/models/link_result_paginated.py +97 -0
- qanswer_sdk/models/linker.py +103 -0
- qanswer_sdk/models/linking_result.py +95 -0
- qanswer_sdk/models/links.py +99 -0
- qanswer_sdk/models/list_chatbot_conversation_response.py +105 -0
- qanswer_sdk/models/list_connectors_response.py +95 -0
- qanswer_sdk/models/list_conversation_response.py +105 -0
- qanswer_sdk/models/list_feedback_response.py +105 -0
- qanswer_sdk/models/list_files_connector_response.py +101 -0
- qanswer_sdk/models/list_socket_events.py +95 -0
- qanswer_sdk/models/list_synonyms_model.py +89 -0
- qanswer_sdk/models/llm_context_ranges_response.py +93 -0
- qanswer_sdk/models/llm_cost.py +108 -0
- qanswer_sdk/models/llm_details.py +111 -0
- qanswer_sdk/models/llm_endpoint.py +167 -0
- qanswer_sdk/models/llm_endpoint_create.py +165 -0
- qanswer_sdk/models/llm_endpoint_default_prompts.py +93 -0
- qanswer_sdk/models/llm_endpoint_update.py +163 -0
- qanswer_sdk/models/llm_endpoint_validation_response.py +96 -0
- qanswer_sdk/models/login_request.py +89 -0
- qanswer_sdk/models/logo.py +89 -0
- qanswer_sdk/models/lucene_index_request_result.py +87 -0
- qanswer_sdk/models/merge_request_result.py +87 -0
- qanswer_sdk/models/messages_stats_per_day_response.py +99 -0
- qanswer_sdk/models/modify_connector_request.py +111 -0
- qanswer_sdk/models/o_auth_service.py +89 -0
- qanswer_sdk/models/one_drive_download_by_ids.py +89 -0
- qanswer_sdk/models/one_drive_download_request.py +101 -0
- qanswer_sdk/models/one_note_download_by_ids.py +91 -0
- qanswer_sdk/models/one_note_download_request.py +101 -0
- qanswer_sdk/models/organization.py +93 -0
- qanswer_sdk/models/organization_creation.py +91 -0
- qanswer_sdk/models/organization_filter.py +87 -0
- qanswer_sdk/models/organization_shared.py +105 -0
- qanswer_sdk/models/page_organization.py +123 -0
- qanswer_sdk/models/page_team_with_count.py +123 -0
- qanswer_sdk/models/pageable.py +92 -0
- qanswer_sdk/models/pageable_object.py +101 -0
- qanswer_sdk/models/password.py +89 -0
- qanswer_sdk/models/pinecone_index_model.py +91 -0
- qanswer_sdk/models/plan.py +123 -0
- qanswer_sdk/models/predicted_class.py +89 -0
- qanswer_sdk/models/prompt_token_count_details.py +99 -0
- qanswer_sdk/models/provider.py +87 -0
- qanswer_sdk/models/publication_add_payload.py +103 -0
- qanswer_sdk/models/publication_file_metadata.py +105 -0
- qanswer_sdk/models/publication_office_additional_fields.py +111 -0
- qanswer_sdk/models/publication_search_index_search_response.py +113 -0
- qanswer_sdk/models/qa_context.py +129 -0
- qanswer_sdk/models/qa_contexts.py +116 -0
- qanswer_sdk/models/qa_metadata_payload.py +123 -0
- qanswer_sdk/models/qa_table.py +102 -0
- qanswer_sdk/models/qn_a_pair_model.py +103 -0
- qanswer_sdk/models/qn_a_pair_response.py +95 -0
- qanswer_sdk/models/question_completion.py +89 -0
- qanswer_sdk/models/rag_params.py +89 -0
- qanswer_sdk/models/rag_payload.py +154 -0
- qanswer_sdk/models/rag_response.py +150 -0
- qanswer_sdk/models/ranker_config.py +93 -0
- qanswer_sdk/models/reference_model.py +95 -0
- qanswer_sdk/models/refresh_token_request.py +87 -0
- qanswer_sdk/models/refresh_website_connector_payload.py +94 -0
- qanswer_sdk/models/register_pinecone_connector_request.py +95 -0
- qanswer_sdk/models/relation_extraction_configuration.py +105 -0
- qanswer_sdk/models/relation_extraction_payload.py +111 -0
- qanswer_sdk/models/relation_extraction_result.py +101 -0
- qanswer_sdk/models/relation_extraction_schema.py +101 -0
- qanswer_sdk/models/relation_extraction_task_settings.py +123 -0
- qanswer_sdk/models/relation_extraction_task_settings_update_payload.py +95 -0
- qanswer_sdk/models/relation_extraction_task_update.py +117 -0
- qanswer_sdk/models/relation_extraction_template_payload.py +97 -0
- qanswer_sdk/models/relation_extraction_template_update_payload.py +95 -0
- qanswer_sdk/models/relation_model.py +89 -0
- qanswer_sdk/models/report_copilot_create_payload.py +103 -0
- qanswer_sdk/models/report_copilot_export_template_as_docx_payload_simplified.py +91 -0
- qanswer_sdk/models/report_copilot_generation_from_slots_payload.py +95 -0
- qanswer_sdk/models/report_copilot_generation_from_slots_response.py +95 -0
- qanswer_sdk/models/report_copilot_refinement_payload.py +104 -0
- qanswer_sdk/models/report_copilot_refinement_response.py +87 -0
- qanswer_sdk/models/report_copilot_slot_task_settings.py +125 -0
- qanswer_sdk/models/report_copilot_slot_task_update.py +119 -0
- qanswer_sdk/models/report_copilot_task_settings.py +123 -0
- qanswer_sdk/models/report_copilot_task_settings_update_payload.py +95 -0
- qanswer_sdk/models/report_copilot_task_update.py +117 -0
- qanswer_sdk/models/report_copilot_template.py +107 -0
- qanswer_sdk/models/report_copilot_template_simplified.py +95 -0
- qanswer_sdk/models/report_copilot_update_payload.py +101 -0
- qanswer_sdk/models/reset_password.py +87 -0
- qanswer_sdk/models/response_audit_model.py +99 -0
- qanswer_sdk/models/response_audit_stats_response.py +101 -0
- qanswer_sdk/models/retreive_all_synonyms_resp.py +99 -0
- qanswer_sdk/models/retry_params.py +89 -0
- qanswer_sdk/models/role.py +99 -0
- qanswer_sdk/models/search_document_response.py +105 -0
- qanswer_sdk/models/search_index_payload.py +114 -0
- qanswer_sdk/models/search_metadata_filter.py +89 -0
- qanswer_sdk/models/search_payload.py +124 -0
- qanswer_sdk/models/search_response.py +113 -0
- qanswer_sdk/models/search_task_settings.py +131 -0
- qanswer_sdk/models/search_task_settings_update_payload.py +95 -0
- qanswer_sdk/models/search_task_update.py +123 -0
- qanswer_sdk/models/set_logo1_request.py +87 -0
- qanswer_sdk/models/share_point_download_by_ids.py +99 -0
- qanswer_sdk/models/share_point_download_request.py +101 -0
- qanswer_sdk/models/shared_organization_access.py +109 -0
- qanswer_sdk/models/shared_team_access.py +107 -0
- qanswer_sdk/models/shared_user.py +99 -0
- qanswer_sdk/models/sign_up_request.py +96 -0
- qanswer_sdk/models/signout_request.py +87 -0
- qanswer_sdk/models/slot.py +138 -0
- qanswer_sdk/models/slot_in_prompt.py +91 -0
- qanswer_sdk/models/slot_update.py +138 -0
- qanswer_sdk/models/socket_conversation_message.py +207 -0
- qanswer_sdk/models/socket_data_extraction.py +109 -0
- qanswer_sdk/models/socket_file_metadata.py +172 -0
- qanswer_sdk/models/socket_join_conversation.py +97 -0
- qanswer_sdk/models/socket_join_dataset.py +93 -0
- qanswer_sdk/models/socket_report_continuation_response.py +106 -0
- qanswer_sdk/models/socket_report_copilot_generation_from_slots_response.py +120 -0
- qanswer_sdk/models/socket_report_copilot_refinement_response.py +108 -0
- qanswer_sdk/models/socket_speech2_text_response.py +99 -0
- qanswer_sdk/models/socket_stop_conversation.py +97 -0
- qanswer_sdk/models/sort_object.py +91 -0
- qanswer_sdk/models/source.py +125 -0
- qanswer_sdk/models/sparql2_text_payload.py +97 -0
- qanswer_sdk/models/speech2_text_response.py +87 -0
- qanswer_sdk/models/speech2_text_with_diarization_response.py +106 -0
- qanswer_sdk/models/stat_per_date.py +89 -0
- qanswer_sdk/models/status_response.py +89 -0
- qanswer_sdk/models/subject_model.py +91 -0
- qanswer_sdk/models/suggestion_list_response.py +87 -0
- qanswer_sdk/models/summa_server.py +101 -0
- qanswer_sdk/models/tag_payload.py +87 -0
- qanswer_sdk/models/tag_qa_list_payload.py +100 -0
- qanswer_sdk/models/tag_qa_payload.py +91 -0
- qanswer_sdk/models/team.py +93 -0
- qanswer_sdk/models/team_creation.py +89 -0
- qanswer_sdk/models/team_filter.py +91 -0
- qanswer_sdk/models/team_shared.py +105 -0
- qanswer_sdk/models/team_with_count.py +95 -0
- qanswer_sdk/models/terms_bucket.py +89 -0
- qanswer_sdk/models/text2_sparql_payload.py +156 -0
- qanswer_sdk/models/text2_sparql_task_settings.py +123 -0
- qanswer_sdk/models/text2_sparql_task_settings_update_payload.py +95 -0
- qanswer_sdk/models/text2_sparql_task_update.py +117 -0
- qanswer_sdk/models/text_classification_payload.py +99 -0
- qanswer_sdk/models/text_classification_response.py +87 -0
- qanswer_sdk/models/text_classification_v2_payload.py +99 -0
- qanswer_sdk/models/text_classification_v2_response.py +95 -0
- qanswer_sdk/models/total_stat.py +96 -0
- qanswer_sdk/models/ui_mappings.py +141 -0
- qanswer_sdk/models/update_metadata_model.py +95 -0
- qanswer_sdk/models/update_qn_a_pair_request.py +101 -0
- qanswer_sdk/models/update_qn_a_pair_response.py +89 -0
- qanswer_sdk/models/update_synonyms.py +93 -0
- qanswer_sdk/models/update_synonyms_resp.py +89 -0
- qanswer_sdk/models/uri_mapping.py +89 -0
- qanswer_sdk/models/user.py +91 -0
- qanswer_sdk/models/user_chatbot_setting_payload.py +106 -0
- qanswer_sdk/models/user_chatbot_setting_response.py +105 -0
- qanswer_sdk/models/user_dataset.py +144 -0
- qanswer_sdk/models/user_dataset_api_key.py +116 -0
- qanswer_sdk/models/user_filter.py +101 -0
- qanswer_sdk/models/user_identity_availability.py +87 -0
- qanswer_sdk/models/user_list_dto.py +101 -0
- qanswer_sdk/models/user_oauth_token.py +96 -0
- qanswer_sdk/models/user_profile.py +184 -0
- qanswer_sdk/models/user_profile_list_dto.py +101 -0
- qanswer_sdk/models/user_profile_paginated.py +101 -0
- qanswer_sdk/models/website_add_payload.py +98 -0
- qanswer_sdk/models/website_connector_settings.py +160 -0
- qanswer_sdk/models/widget_configs.py +105 -0
- qanswer_sdk/py.typed +0 -0
- qanswer_sdk/rest.py +257 -0
- qanswer_sdk-3.1193.0.dist-info/METADATA +125 -0
- qanswer_sdk-3.1193.0.dist-info/RECORD +346 -0
- qanswer_sdk-3.1193.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from qanswer_sdk.models.prompt_token_count_details import PromptTokenCountDetails
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class CheckModeResponse(BaseModel):
|
27
|
+
"""
|
28
|
+
CheckModeResponse
|
29
|
+
""" # noqa: E501
|
30
|
+
mode: StrictStr
|
31
|
+
prompt_token_count_details: PromptTokenCountDetails
|
32
|
+
__properties: ClassVar[List[str]] = ["mode", "prompt_token_count_details"]
|
33
|
+
|
34
|
+
@field_validator('mode')
|
35
|
+
def mode_validate_enum(cls, value):
|
36
|
+
"""Validates the enum"""
|
37
|
+
if value not in set(['rag', 'full-context']):
|
38
|
+
raise ValueError("must be one of enum values ('rag', 'full-context')")
|
39
|
+
return value
|
40
|
+
|
41
|
+
model_config = ConfigDict(
|
42
|
+
populate_by_name=True,
|
43
|
+
validate_assignment=True,
|
44
|
+
protected_namespaces=(),
|
45
|
+
)
|
46
|
+
|
47
|
+
|
48
|
+
def to_str(self) -> str:
|
49
|
+
"""Returns the string representation of the model using alias"""
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
51
|
+
|
52
|
+
def to_json(self) -> str:
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
55
|
+
return json.dumps(self.to_dict())
|
56
|
+
|
57
|
+
@classmethod
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
59
|
+
"""Create an instance of CheckModeResponse from a JSON string"""
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
61
|
+
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
64
|
+
|
65
|
+
This has the following differences from calling pydantic's
|
66
|
+
`self.model_dump(by_alias=True)`:
|
67
|
+
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
69
|
+
were set at model initialization. Other fields with value `None`
|
70
|
+
are ignored.
|
71
|
+
"""
|
72
|
+
excluded_fields: Set[str] = set([
|
73
|
+
])
|
74
|
+
|
75
|
+
_dict = self.model_dump(
|
76
|
+
by_alias=True,
|
77
|
+
exclude=excluded_fields,
|
78
|
+
exclude_none=True,
|
79
|
+
)
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of prompt_token_count_details
|
81
|
+
if self.prompt_token_count_details:
|
82
|
+
_dict['prompt_token_count_details'] = self.prompt_token_count_details.to_dict()
|
83
|
+
return _dict
|
84
|
+
|
85
|
+
@classmethod
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
87
|
+
"""Create an instance of CheckModeResponse from a dict"""
|
88
|
+
if obj is None:
|
89
|
+
return None
|
90
|
+
|
91
|
+
if not isinstance(obj, dict):
|
92
|
+
return cls.model_validate(obj)
|
93
|
+
|
94
|
+
_obj = cls.model_validate({
|
95
|
+
"mode": obj.get("mode"),
|
96
|
+
"prompt_token_count_details": PromptTokenCountDetails.from_dict(obj["prompt_token_count_details"]) if obj.get("prompt_token_count_details") is not None else None
|
97
|
+
})
|
98
|
+
return _obj
|
99
|
+
|
100
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class ClassInfo(BaseModel):
|
26
|
+
"""
|
27
|
+
ClassInfo
|
28
|
+
""" # noqa: E501
|
29
|
+
name: StrictStr
|
30
|
+
description: Optional[StrictStr] = None
|
31
|
+
__properties: ClassVar[List[str]] = ["name", "description"]
|
32
|
+
|
33
|
+
model_config = ConfigDict(
|
34
|
+
populate_by_name=True,
|
35
|
+
validate_assignment=True,
|
36
|
+
protected_namespaces=(),
|
37
|
+
)
|
38
|
+
|
39
|
+
|
40
|
+
def to_str(self) -> str:
|
41
|
+
"""Returns the string representation of the model using alias"""
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
43
|
+
|
44
|
+
def to_json(self) -> str:
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
47
|
+
return json.dumps(self.to_dict())
|
48
|
+
|
49
|
+
@classmethod
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
51
|
+
"""Create an instance of ClassInfo from a JSON string"""
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
53
|
+
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
56
|
+
|
57
|
+
This has the following differences from calling pydantic's
|
58
|
+
`self.model_dump(by_alias=True)`:
|
59
|
+
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
61
|
+
were set at model initialization. Other fields with value `None`
|
62
|
+
are ignored.
|
63
|
+
"""
|
64
|
+
excluded_fields: Set[str] = set([
|
65
|
+
])
|
66
|
+
|
67
|
+
_dict = self.model_dump(
|
68
|
+
by_alias=True,
|
69
|
+
exclude=excluded_fields,
|
70
|
+
exclude_none=True,
|
71
|
+
)
|
72
|
+
return _dict
|
73
|
+
|
74
|
+
@classmethod
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
76
|
+
"""Create an instance of ClassInfo from a dict"""
|
77
|
+
if obj is None:
|
78
|
+
return None
|
79
|
+
|
80
|
+
if not isinstance(obj, dict):
|
81
|
+
return cls.model_validate(obj)
|
82
|
+
|
83
|
+
_obj = cls.model_validate({
|
84
|
+
"name": obj.get("name"),
|
85
|
+
"description": obj.get("description")
|
86
|
+
})
|
87
|
+
return _obj
|
88
|
+
|
89
|
+
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class ConnectorModel(BaseModel):
|
26
|
+
"""
|
27
|
+
ConnectorModel
|
28
|
+
""" # noqa: E501
|
29
|
+
connector_id: StrictInt
|
30
|
+
connector_name: StrictStr
|
31
|
+
connector_type: StrictStr
|
32
|
+
embedding_model: StrictStr
|
33
|
+
number_of_files: StrictInt
|
34
|
+
refresh_frequency: StrictStr
|
35
|
+
last_refreshed: StrictStr
|
36
|
+
next_refresh: StrictStr
|
37
|
+
is_indexing: Optional[StrictBool] = None
|
38
|
+
n_tokens: Optional[StrictInt] = None
|
39
|
+
__properties: ClassVar[List[str]] = ["connector_id", "connector_name", "connector_type", "embedding_model", "number_of_files", "refresh_frequency", "last_refreshed", "next_refresh", "is_indexing", "n_tokens"]
|
40
|
+
|
41
|
+
@field_validator('connector_type')
|
42
|
+
def connector_type_validate_enum(cls, value):
|
43
|
+
"""Validates the enum"""
|
44
|
+
if value not in set(['document', 'website', 'qna', 'pinecone', 'rdf', 'websearch', 'econsilium', 'econsilium_search_index', 'publication_office', 'onedrive', 'sharepoint', 'gdrive', 'onenote']):
|
45
|
+
raise ValueError("must be one of enum values ('document', 'website', 'qna', 'pinecone', 'rdf', 'websearch', 'econsilium', 'econsilium_search_index', 'publication_office', 'onedrive', 'sharepoint', 'gdrive', 'onenote')")
|
46
|
+
return value
|
47
|
+
|
48
|
+
model_config = ConfigDict(
|
49
|
+
populate_by_name=True,
|
50
|
+
validate_assignment=True,
|
51
|
+
protected_namespaces=(),
|
52
|
+
)
|
53
|
+
|
54
|
+
|
55
|
+
def to_str(self) -> str:
|
56
|
+
"""Returns the string representation of the model using alias"""
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
58
|
+
|
59
|
+
def to_json(self) -> str:
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
62
|
+
return json.dumps(self.to_dict())
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
66
|
+
"""Create an instance of ConnectorModel from a JSON string"""
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
68
|
+
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
71
|
+
|
72
|
+
This has the following differences from calling pydantic's
|
73
|
+
`self.model_dump(by_alias=True)`:
|
74
|
+
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
76
|
+
were set at model initialization. Other fields with value `None`
|
77
|
+
are ignored.
|
78
|
+
"""
|
79
|
+
excluded_fields: Set[str] = set([
|
80
|
+
])
|
81
|
+
|
82
|
+
_dict = self.model_dump(
|
83
|
+
by_alias=True,
|
84
|
+
exclude=excluded_fields,
|
85
|
+
exclude_none=True,
|
86
|
+
)
|
87
|
+
return _dict
|
88
|
+
|
89
|
+
@classmethod
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
91
|
+
"""Create an instance of ConnectorModel from a dict"""
|
92
|
+
if obj is None:
|
93
|
+
return None
|
94
|
+
|
95
|
+
if not isinstance(obj, dict):
|
96
|
+
return cls.model_validate(obj)
|
97
|
+
|
98
|
+
_obj = cls.model_validate({
|
99
|
+
"connector_id": obj.get("connector_id"),
|
100
|
+
"connector_name": obj.get("connector_name"),
|
101
|
+
"connector_type": obj.get("connector_type"),
|
102
|
+
"embedding_model": obj.get("embedding_model"),
|
103
|
+
"number_of_files": obj.get("number_of_files"),
|
104
|
+
"refresh_frequency": obj.get("refresh_frequency"),
|
105
|
+
"last_refreshed": obj.get("last_refreshed"),
|
106
|
+
"next_refresh": obj.get("next_refresh"),
|
107
|
+
"is_indexing": obj.get("is_indexing"),
|
108
|
+
"n_tokens": obj.get("n_tokens")
|
109
|
+
})
|
110
|
+
return _obj
|
111
|
+
|
112
|
+
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class ContentItem(BaseModel):
|
26
|
+
"""
|
27
|
+
ContentItem
|
28
|
+
""" # noqa: E501
|
29
|
+
content_item_type: StrictStr
|
30
|
+
text: Optional[StrictStr] = None
|
31
|
+
url: Optional[StrictStr] = None
|
32
|
+
image_detail: Optional[StrictStr] = None
|
33
|
+
audio_data: Optional[StrictStr] = None
|
34
|
+
audio_format: Optional[StrictStr] = None
|
35
|
+
file_id: Optional[StrictStr] = None
|
36
|
+
file_data: Optional[StrictStr] = None
|
37
|
+
file_name: Optional[StrictStr] = None
|
38
|
+
__properties: ClassVar[List[str]] = ["content_item_type", "text", "url", "image_detail", "audio_data", "audio_format", "file_id", "file_data", "file_name"]
|
39
|
+
|
40
|
+
@field_validator('content_item_type')
|
41
|
+
def content_item_type_validate_enum(cls, value):
|
42
|
+
"""Validates the enum"""
|
43
|
+
if value not in set(['text', 'image_url', 'file', 'input_audio']):
|
44
|
+
raise ValueError("must be one of enum values ('text', 'image_url', 'file', 'input_audio')")
|
45
|
+
return value
|
46
|
+
|
47
|
+
@field_validator('image_detail')
|
48
|
+
def image_detail_validate_enum(cls, value):
|
49
|
+
"""Validates the enum"""
|
50
|
+
if value is None:
|
51
|
+
return value
|
52
|
+
|
53
|
+
if value not in set(['low', 'high', 'auto']):
|
54
|
+
raise ValueError("must be one of enum values ('low', 'high', 'auto')")
|
55
|
+
return value
|
56
|
+
|
57
|
+
@field_validator('audio_format')
|
58
|
+
def audio_format_validate_enum(cls, value):
|
59
|
+
"""Validates the enum"""
|
60
|
+
if value is None:
|
61
|
+
return value
|
62
|
+
|
63
|
+
if value not in set(['wav', 'mp3']):
|
64
|
+
raise ValueError("must be one of enum values ('wav', 'mp3')")
|
65
|
+
return value
|
66
|
+
|
67
|
+
model_config = ConfigDict(
|
68
|
+
populate_by_name=True,
|
69
|
+
validate_assignment=True,
|
70
|
+
protected_namespaces=(),
|
71
|
+
)
|
72
|
+
|
73
|
+
|
74
|
+
def to_str(self) -> str:
|
75
|
+
"""Returns the string representation of the model using alias"""
|
76
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
77
|
+
|
78
|
+
def to_json(self) -> str:
|
79
|
+
"""Returns the JSON representation of the model using alias"""
|
80
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
81
|
+
return json.dumps(self.to_dict())
|
82
|
+
|
83
|
+
@classmethod
|
84
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
85
|
+
"""Create an instance of ContentItem from a JSON string"""
|
86
|
+
return cls.from_dict(json.loads(json_str))
|
87
|
+
|
88
|
+
def to_dict(self) -> Dict[str, Any]:
|
89
|
+
"""Return the dictionary representation of the model using alias.
|
90
|
+
|
91
|
+
This has the following differences from calling pydantic's
|
92
|
+
`self.model_dump(by_alias=True)`:
|
93
|
+
|
94
|
+
* `None` is only added to the output dict for nullable fields that
|
95
|
+
were set at model initialization. Other fields with value `None`
|
96
|
+
are ignored.
|
97
|
+
"""
|
98
|
+
excluded_fields: Set[str] = set([
|
99
|
+
])
|
100
|
+
|
101
|
+
_dict = self.model_dump(
|
102
|
+
by_alias=True,
|
103
|
+
exclude=excluded_fields,
|
104
|
+
exclude_none=True,
|
105
|
+
)
|
106
|
+
return _dict
|
107
|
+
|
108
|
+
@classmethod
|
109
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
110
|
+
"""Create an instance of ContentItem from a dict"""
|
111
|
+
if obj is None:
|
112
|
+
return None
|
113
|
+
|
114
|
+
if not isinstance(obj, dict):
|
115
|
+
return cls.model_validate(obj)
|
116
|
+
|
117
|
+
_obj = cls.model_validate({
|
118
|
+
"content_item_type": obj.get("content_item_type"),
|
119
|
+
"text": obj.get("text"),
|
120
|
+
"url": obj.get("url"),
|
121
|
+
"image_detail": obj.get("image_detail"),
|
122
|
+
"audio_data": obj.get("audio_data"),
|
123
|
+
"audio_format": obj.get("audio_format"),
|
124
|
+
"file_id": obj.get("file_id"),
|
125
|
+
"file_data": obj.get("file_data"),
|
126
|
+
"file_name": obj.get("file_name")
|
127
|
+
})
|
128
|
+
return _obj
|
129
|
+
|
130
|
+
|
@@ -0,0 +1,186 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from qanswer_sdk.models.aggregations_group import AggregationsGroup
|
23
|
+
from qanswer_sdk.models.content_item import ContentItem
|
24
|
+
from qanswer_sdk.models.question_completion import QuestionCompletion
|
25
|
+
from qanswer_sdk.models.source import Source
|
26
|
+
from typing import Optional, Set
|
27
|
+
from typing_extensions import Self
|
28
|
+
|
29
|
+
class ConversationMessage(BaseModel):
|
30
|
+
"""
|
31
|
+
ConversationMessage
|
32
|
+
""" # noqa: E501
|
33
|
+
role: StrictStr
|
34
|
+
contents: List[ContentItem]
|
35
|
+
message_id: StrictStr
|
36
|
+
parent_message_id: Optional[StrictStr] = None
|
37
|
+
timestamp: Optional[StrictStr] = None
|
38
|
+
feedback: Optional[StrictInt] = None
|
39
|
+
origin: Optional[StrictStr] = None
|
40
|
+
sources: Optional[List[Source]] = Field(default=None, description="All sources referenced in the response")
|
41
|
+
all_sources: Optional[List[Source]] = Field(default=None, description="All retrieved sources passed to the llm")
|
42
|
+
task_category: StrictStr
|
43
|
+
interface_origin: Optional[StrictStr] = None
|
44
|
+
comment: Optional[StrictStr] = None
|
45
|
+
llm_choice: Optional[StrictStr] = None
|
46
|
+
training_examples: Optional[List[QuestionCompletion]] = None
|
47
|
+
prompt_used: Optional[StrictStr] = None
|
48
|
+
mode: Optional[StrictStr] = None
|
49
|
+
is_input_data_cropped: Optional[StrictBool] = None
|
50
|
+
aggs: Optional[List[AggregationsGroup]] = None
|
51
|
+
expanded_question: Optional[StrictStr] = None
|
52
|
+
__properties: ClassVar[List[str]] = ["role", "contents", "message_id", "parent_message_id", "timestamp", "feedback", "origin", "sources", "all_sources", "task_category", "interface_origin", "comment", "llm_choice", "training_examples", "prompt_used", "mode", "is_input_data_cropped", "aggs", "expanded_question"]
|
53
|
+
|
54
|
+
@field_validator('role')
|
55
|
+
def role_validate_enum(cls, value):
|
56
|
+
"""Validates the enum"""
|
57
|
+
if value not in set(['assistant', 'user']):
|
58
|
+
raise ValueError("must be one of enum values ('assistant', 'user')")
|
59
|
+
return value
|
60
|
+
|
61
|
+
@field_validator('task_category')
|
62
|
+
def task_category_validate_enum(cls, value):
|
63
|
+
"""Validates the enum"""
|
64
|
+
if value not in set(['text', 'sparql', 'sql', 'sparql2text', 'sparqlvisualize', 'undefined', 'typing', 'user_joined', 'user_left', 'human_takeover_proposed', 'human_takeover_accepted', 'human_takeover_rejected', 'thinking']):
|
65
|
+
raise ValueError("must be one of enum values ('text', 'sparql', 'sql', 'sparql2text', 'sparqlvisualize', 'undefined', 'typing', 'user_joined', 'user_left', 'human_takeover_proposed', 'human_takeover_accepted', 'human_takeover_rejected', 'thinking')")
|
66
|
+
return value
|
67
|
+
|
68
|
+
@field_validator('mode')
|
69
|
+
def mode_validate_enum(cls, value):
|
70
|
+
"""Validates the enum"""
|
71
|
+
if value is None:
|
72
|
+
return value
|
73
|
+
|
74
|
+
if value not in set(['rag', 'full-context']):
|
75
|
+
raise ValueError("must be one of enum values ('rag', 'full-context')")
|
76
|
+
return value
|
77
|
+
|
78
|
+
model_config = ConfigDict(
|
79
|
+
populate_by_name=True,
|
80
|
+
validate_assignment=True,
|
81
|
+
protected_namespaces=(),
|
82
|
+
)
|
83
|
+
|
84
|
+
|
85
|
+
def to_str(self) -> str:
|
86
|
+
"""Returns the string representation of the model using alias"""
|
87
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
88
|
+
|
89
|
+
def to_json(self) -> str:
|
90
|
+
"""Returns the JSON representation of the model using alias"""
|
91
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
92
|
+
return json.dumps(self.to_dict())
|
93
|
+
|
94
|
+
@classmethod
|
95
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
96
|
+
"""Create an instance of ConversationMessage from a JSON string"""
|
97
|
+
return cls.from_dict(json.loads(json_str))
|
98
|
+
|
99
|
+
def to_dict(self) -> Dict[str, Any]:
|
100
|
+
"""Return the dictionary representation of the model using alias.
|
101
|
+
|
102
|
+
This has the following differences from calling pydantic's
|
103
|
+
`self.model_dump(by_alias=True)`:
|
104
|
+
|
105
|
+
* `None` is only added to the output dict for nullable fields that
|
106
|
+
were set at model initialization. Other fields with value `None`
|
107
|
+
are ignored.
|
108
|
+
"""
|
109
|
+
excluded_fields: Set[str] = set([
|
110
|
+
])
|
111
|
+
|
112
|
+
_dict = self.model_dump(
|
113
|
+
by_alias=True,
|
114
|
+
exclude=excluded_fields,
|
115
|
+
exclude_none=True,
|
116
|
+
)
|
117
|
+
# override the default output from pydantic by calling `to_dict()` of each item in contents (list)
|
118
|
+
_items = []
|
119
|
+
if self.contents:
|
120
|
+
for _item_contents in self.contents:
|
121
|
+
if _item_contents:
|
122
|
+
_items.append(_item_contents.to_dict())
|
123
|
+
_dict['contents'] = _items
|
124
|
+
# override the default output from pydantic by calling `to_dict()` of each item in sources (list)
|
125
|
+
_items = []
|
126
|
+
if self.sources:
|
127
|
+
for _item_sources in self.sources:
|
128
|
+
if _item_sources:
|
129
|
+
_items.append(_item_sources.to_dict())
|
130
|
+
_dict['sources'] = _items
|
131
|
+
# override the default output from pydantic by calling `to_dict()` of each item in all_sources (list)
|
132
|
+
_items = []
|
133
|
+
if self.all_sources:
|
134
|
+
for _item_all_sources in self.all_sources:
|
135
|
+
if _item_all_sources:
|
136
|
+
_items.append(_item_all_sources.to_dict())
|
137
|
+
_dict['all_sources'] = _items
|
138
|
+
# override the default output from pydantic by calling `to_dict()` of each item in training_examples (list)
|
139
|
+
_items = []
|
140
|
+
if self.training_examples:
|
141
|
+
for _item_training_examples in self.training_examples:
|
142
|
+
if _item_training_examples:
|
143
|
+
_items.append(_item_training_examples.to_dict())
|
144
|
+
_dict['training_examples'] = _items
|
145
|
+
# override the default output from pydantic by calling `to_dict()` of each item in aggs (list)
|
146
|
+
_items = []
|
147
|
+
if self.aggs:
|
148
|
+
for _item_aggs in self.aggs:
|
149
|
+
if _item_aggs:
|
150
|
+
_items.append(_item_aggs.to_dict())
|
151
|
+
_dict['aggs'] = _items
|
152
|
+
return _dict
|
153
|
+
|
154
|
+
@classmethod
|
155
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
156
|
+
"""Create an instance of ConversationMessage from a dict"""
|
157
|
+
if obj is None:
|
158
|
+
return None
|
159
|
+
|
160
|
+
if not isinstance(obj, dict):
|
161
|
+
return cls.model_validate(obj)
|
162
|
+
|
163
|
+
_obj = cls.model_validate({
|
164
|
+
"role": obj.get("role"),
|
165
|
+
"contents": [ContentItem.from_dict(_item) for _item in obj["contents"]] if obj.get("contents") is not None else None,
|
166
|
+
"message_id": obj.get("message_id"),
|
167
|
+
"parent_message_id": obj.get("parent_message_id"),
|
168
|
+
"timestamp": obj.get("timestamp"),
|
169
|
+
"feedback": obj.get("feedback"),
|
170
|
+
"origin": obj.get("origin"),
|
171
|
+
"sources": [Source.from_dict(_item) for _item in obj["sources"]] if obj.get("sources") is not None else None,
|
172
|
+
"all_sources": [Source.from_dict(_item) for _item in obj["all_sources"]] if obj.get("all_sources") is not None else None,
|
173
|
+
"task_category": obj.get("task_category"),
|
174
|
+
"interface_origin": obj.get("interface_origin"),
|
175
|
+
"comment": obj.get("comment"),
|
176
|
+
"llm_choice": obj.get("llm_choice"),
|
177
|
+
"training_examples": [QuestionCompletion.from_dict(_item) for _item in obj["training_examples"]] if obj.get("training_examples") is not None else None,
|
178
|
+
"prompt_used": obj.get("prompt_used"),
|
179
|
+
"mode": obj.get("mode"),
|
180
|
+
"is_input_data_cropped": obj.get("is_input_data_cropped"),
|
181
|
+
"aggs": [AggregationsGroup.from_dict(_item) for _item in obj["aggs"]] if obj.get("aggs") is not None else None,
|
182
|
+
"expanded_question": obj.get("expanded_question")
|
183
|
+
})
|
184
|
+
return _obj
|
185
|
+
|
186
|
+
|