musubi-client 0.2.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.
Files changed (395) hide show
  1. musubi/__init__.py +43 -0
  2. musubi/_base.py +65 -0
  3. musubi/_cli_shared.py +39 -0
  4. musubi/_generated/__init__.py +0 -0
  5. musubi/_generated/policyai/__init__.py +8 -0
  6. musubi/_generated/policyai/api/__init__.py +1 -0
  7. musubi/_generated/policyai/api/application_information/__init__.py +1 -0
  8. musubi/_generated/policyai/api/application_information/get_version_api_version_get.py +125 -0
  9. musubi/_generated/policyai/api/decisions/__init__.py +1 -0
  10. musubi/_generated/policyai/api/decisions/evaluate_content_against_policy_version_api_v_1_decisions_policies_policy_id_versions_policy_version_id_post.py +197 -0
  11. musubi/_generated/policyai/api/decisions/evaluate_content_against_tagged_policy_versions_api_v1_decisions_evaluate_tag_name_post.py +182 -0
  12. musubi/_generated/policyai/api/decisions/get_decision_counts_api_v1_decisions_stats_get.py +288 -0
  13. musubi/_generated/policyai/api/decisions/get_decisions_api_v1_decisions_get.py +313 -0
  14. musubi/_generated/policyai/api/evaluations/__init__.py +1 -0
  15. musubi/_generated/policyai/api/evaluations/get_evaluation_groups_api_v1_evaluations_groups_get.py +217 -0
  16. musubi/_generated/policyai/api/evaluations/get_evaluation_run_api_v_1_evaluations_run_evaluation_run_id_get.py +161 -0
  17. musubi/_generated/policyai/api/evaluations/run_evaluation_api_v1_evaluations_run_post.py +166 -0
  18. musubi/_generated/policyai/api/labeling_endpoints_v_2/__init__.py +1 -0
  19. musubi/_generated/policyai/api/labeling_endpoints_v_2/create_labeling_endpoint_v2_api_v2_endpoints_post.py +166 -0
  20. musubi/_generated/policyai/api/labeling_endpoints_v_2/get_labeling_endpoint_v_2_api_v_2_endpoints_endpoint_id_get.py +161 -0
  21. musubi/_generated/policyai/api/labeling_endpoints_v_2/list_labeling_endpoint_v2_api_v2_endpoints_get.py +203 -0
  22. musubi/_generated/policyai/api/labeling_endpoints_v_2/update_labeling_endpoint_v_2_api_v_2_endpoints_endpoint_id_patch.py +183 -0
  23. musubi/_generated/policyai/api/labels_v_2/__init__.py +1 -0
  24. musubi/_generated/policyai/api/labels_v_2/get_v2_label_groups_api_v2_labels_get.py +331 -0
  25. musubi/_generated/policyai/api/labels_v_2/label_content_api_v2_labels_post.py +166 -0
  26. musubi/_generated/policyai/api/labels_v_2/label_content_by_endpoint_api_v_2_labels_by_endpoint_organization_id_endpoint_name_post.py +197 -0
  27. musubi/_generated/policyai/api/manage_datasets/__init__.py +1 -0
  28. musubi/_generated/policyai/api/manage_datasets/add_dataset_items_api_v1_datasets_dataset_id_data_post.py +183 -0
  29. musubi/_generated/policyai/api/manage_datasets/archive_dataset_api_v1_datasets_dataset_id_delete.py +161 -0
  30. musubi/_generated/policyai/api/manage_datasets/bulk_delete_dataset_items_api_v1_datasets_dataset_id_data_delete.py +183 -0
  31. musubi/_generated/policyai/api/manage_datasets/create_dataset_api_v1_datasets_post.py +166 -0
  32. musubi/_generated/policyai/api/manage_datasets/delete_dataset_item_api_v1_datasets_dataset_id_dataset_item_id_delete.py +175 -0
  33. musubi/_generated/policyai/api/manage_datasets/get_dataset_api_v1_datasets_dataset_id_get.py +161 -0
  34. musubi/_generated/policyai/api/manage_datasets/get_dataset_data_api_v1_datasets_dataset_id_data_get.py +161 -0
  35. musubi/_generated/policyai/api/manage_datasets/get_datasets_api_v1_datasets_get.py +222 -0
  36. musubi/_generated/policyai/api/manage_datasets/update_dataset_item_api_v1_datasets_dataset_id_dataset_item_id_put.py +197 -0
  37. musubi/_generated/policyai/api/manage_policies/__init__.py +1 -0
  38. musubi/_generated/policyai/api/manage_policies/create_policy_api_v1_policies_post.py +168 -0
  39. musubi/_generated/policyai/api/manage_policies/get_policy_api_v_1_policies_policy_id_get.py +163 -0
  40. musubi/_generated/policyai/api/manage_policies/get_policy_list_api_v1_policies_get.py +234 -0
  41. musubi/_generated/policyai/api/manage_policies/get_policy_version_api_v_1_policies_policy_id_versions_version_id_get.py +175 -0
  42. musubi/_generated/policyai/api/manage_policies/update_policy_api_v_1_policies_policy_id_patch.py +185 -0
  43. musubi/_generated/policyai/api/manage_policies/update_policy_version_api_v_1_policies_policy_id_versions_version_id_patch.py +197 -0
  44. musubi/_generated/policyai/api/manage_policies_v_2/__init__.py +1 -0
  45. musubi/_generated/policyai/api/manage_policies_v_2/create_draft_v_2_policy_version_api_v_2_policies_by_key_organization_id_policy_key_versions_draft_post.py +203 -0
  46. musubi/_generated/policyai/api/manage_policies_v_2/create_new_v_2_policy_version_api_v_2_policies_by_key_organization_id_policy_key_versions_post.py +203 -0
  47. musubi/_generated/policyai/api/manage_policies_v_2/create_v2_policy_api_v2_policies_post.py +166 -0
  48. musubi/_generated/policyai/api/manage_policies_v_2/finalize_v_2_policy_draft_version_api_v_2_policies_by_key_organization_id_policy_key_versions_draft_finalize_post.py +175 -0
  49. musubi/_generated/policyai/api/manage_policies_v_2/get_v2_policy_list_api_v2_policies_get.py +227 -0
  50. musubi/_generated/policyai/api/manage_policies_v_2/get_v_2_policy_draft_version_api_v_2_policies_by_key_organization_id_policy_key_versions_draft_get.py +175 -0
  51. musubi/_generated/policyai/api/manage_policies_v_2/get_v_2_policy_version_api_v_2_policies_by_key_organization_id_policy_key_versions_version_number_get.py +189 -0
  52. musubi/_generated/policyai/api/manage_policies_v_2/update_draft_v_2_policy_version_api_v_2_policies_by_key_organization_id_policy_key_versions_draft_patch.py +203 -0
  53. musubi/_generated/policyai/api/manage_policies_v_2/update_v_2_policy_api_v_2_policies_by_key_organization_id_policy_key_patch.py +197 -0
  54. musubi/_generated/policyai/api/manage_policy_version_tags/__init__.py +1 -0
  55. musubi/_generated/policyai/api/manage_policy_version_tags/create_tag_api_v1_tags_post.py +166 -0
  56. musubi/_generated/policyai/api/manage_policy_version_tags/get_tag_api_v_1_tags_tag_id_get.py +161 -0
  57. musubi/_generated/policyai/api/manage_policy_version_tags/list_tags_api_v1_tags_get.py +222 -0
  58. musubi/_generated/policyai/api/manage_policy_version_tags/update_tag_api_v1_tags_tag_id_put.py +183 -0
  59. musubi/_generated/policyai/api/manage_prompt_templates/__init__.py +1 -0
  60. musubi/_generated/policyai/api/manage_prompt_templates/create_prompt_template_api_v_1_prompt_templates_post.py +166 -0
  61. musubi/_generated/policyai/api/manage_prompt_templates/get_prompt_template_api_v_1_prompt_templates_prompt_template_id_get.py +161 -0
  62. musubi/_generated/policyai/api/manage_prompt_templates/get_prompt_templates_api_v_1_prompt_templates_get.py +203 -0
  63. musubi/_generated/policyai/api/manage_prompt_templates/update_prompt_template_api_v_1_prompt_templates_prompt_template_id_patch.py +183 -0
  64. musubi/_generated/policyai/api/manage_settings/__init__.py +1 -0
  65. musubi/_generated/policyai/api/manage_settings/get_organization_settings_api_v_1_settings_organizations_organization_id_get.py +161 -0
  66. musubi/_generated/policyai/api/manage_settings/get_organization_settings_list_api_v1_settings_organizations_get.py +180 -0
  67. musubi/_generated/policyai/api/models/__init__.py +1 -0
  68. musubi/_generated/policyai/api/models/get_default_llm_api_v1_models_default_get.py +127 -0
  69. musubi/_generated/policyai/api/models/get_default_llm_tier_api_v1_models_tiers_default_get.py +127 -0
  70. musubi/_generated/policyai/api/models/get_llm_list_api_v1_models_get.py +173 -0
  71. musubi/_generated/policyai/api/models/get_llm_tier_list_api_v1_models_tiers_get.py +127 -0
  72. musubi/_generated/policyai/api/models_v_2/__init__.py +1 -0
  73. musubi/_generated/policyai/api/models_v_2/get_llm_list_api_v2_models_get.py +133 -0
  74. musubi/_generated/policyai/client.py +268 -0
  75. musubi/_generated/policyai/errors.py +16 -0
  76. musubi/_generated/policyai/models/__init__.py +603 -0
  77. musubi/_generated/policyai/models/additional_labeler_output_field_enum.py +11 -0
  78. musubi/_generated/policyai/models/assessment_enum.py +9 -0
  79. musubi/_generated/policyai/models/assessment_v2_enum.py +9 -0
  80. musubi/_generated/policyai/models/attach_policy_to_scope_request_model.py +62 -0
  81. musubi/_generated/policyai/models/audio_as_url_content_model.py +121 -0
  82. musubi/_generated/policyai/models/audio_as_url_content_model_data_type_0.py +8 -0
  83. musubi/_generated/policyai/models/audio_as_url_content_model_format.py +8 -0
  84. musubi/_generated/policyai/models/audio_as_url_content_model_type.py +8 -0
  85. musubi/_generated/policyai/models/audio_as_url_content_response_model.py +193 -0
  86. musubi/_generated/policyai/models/audio_as_url_content_response_model_data_type_0.py +8 -0
  87. musubi/_generated/policyai/models/audio_as_url_content_response_model_format.py +8 -0
  88. musubi/_generated/policyai/models/audio_as_url_content_response_model_messages_item_type_1.py +46 -0
  89. musubi/_generated/policyai/models/audio_as_url_content_response_model_type.py +8 -0
  90. musubi/_generated/policyai/models/base_64_image_content.py +71 -0
  91. musubi/_generated/policyai/models/base_64_image_content_type.py +8 -0
  92. musubi/_generated/policyai/models/content_key_model.py +71 -0
  93. musubi/_generated/policyai/models/content_type_v2_enum.py +12 -0
  94. musubi/_generated/policyai/models/create_dataset_item_request_model.py +93 -0
  95. musubi/_generated/policyai/models/create_dataset_item_request_model_metadata.py +46 -0
  96. musubi/_generated/policyai/models/create_dataset_items_request_model.py +75 -0
  97. musubi/_generated/policyai/models/create_dataset_request_model.py +113 -0
  98. musubi/_generated/policyai/models/create_draft_v2_policy_version_api_v2_policies_by_key_organization_id_policy_key_versions_draft_post_create_policy_v2_version_request_model.py +81 -0
  99. musubi/_generated/policyai/models/create_evaluation_run_request_model.py +94 -0
  100. musubi/_generated/policyai/models/create_labeling_endpoint_request_model.py +103 -0
  101. musubi/_generated/policyai/models/create_new_v2_policy_version_api_v2_policies_by_key_organization_id_policy_key_versions_post_create_policy_v2_version_request_model.py +81 -0
  102. musubi/_generated/policyai/models/create_organization_settings_request_model.py +144 -0
  103. musubi/_generated/policyai/models/create_policy_request_model.py +233 -0
  104. musubi/_generated/policyai/models/create_policy_v2_data_request_model.py +222 -0
  105. musubi/_generated/policyai/models/create_policy_v2_request_model.py +81 -0
  106. musubi/_generated/policyai/models/create_policy_v2_version_request_model.py +78 -0
  107. musubi/_generated/policyai/models/create_policy_version_tag_request_model.py +97 -0
  108. musubi/_generated/policyai/models/create_prompt_template_request_model.py +86 -0
  109. musubi/_generated/policyai/models/create_scope_request_model.py +92 -0
  110. musubi/_generated/policyai/models/data_type_enum.py +10 -0
  111. musubi/_generated/policyai/models/dataset_envelope_response_model.py +118 -0
  112. musubi/_generated/policyai/models/dataset_envelope_response_model_messages_item_type_1.py +46 -0
  113. musubi/_generated/policyai/models/dataset_item_envelope_response_model.py +118 -0
  114. musubi/_generated/policyai/models/dataset_item_envelope_response_model_messages_item_type_1.py +46 -0
  115. musubi/_generated/policyai/models/dataset_item_model.py +105 -0
  116. musubi/_generated/policyai/models/dataset_item_model_metadata.py +46 -0
  117. musubi/_generated/policyai/models/dataset_items_envelope_response_model.py +118 -0
  118. musubi/_generated/policyai/models/dataset_items_envelope_response_model_messages_item_type_1.py +46 -0
  119. musubi/_generated/policyai/models/dataset_items_model.py +75 -0
  120. musubi/_generated/policyai/models/dataset_response_list_model.py +120 -0
  121. musubi/_generated/policyai/models/dataset_response_list_model_messages_item_type_1.py +46 -0
  122. musubi/_generated/policyai/models/dataset_response_model.py +199 -0
  123. musubi/_generated/policyai/models/dataset_response_model_messages_item_type_1.py +46 -0
  124. musubi/_generated/policyai/models/dataset_type_enum.py +9 -0
  125. musubi/_generated/policyai/models/dataset_upload_status_enum.py +10 -0
  126. musubi/_generated/policyai/models/decision_group_by_enum.py +11 -0
  127. musubi/_generated/policyai/models/decision_group_stats_model.py +75 -0
  128. musubi/_generated/policyai/models/decision_stats_bin_model.py +90 -0
  129. musubi/_generated/policyai/models/decision_stats_model.py +61 -0
  130. musubi/_generated/policyai/models/decision_stats_response_model.py +195 -0
  131. musubi/_generated/policyai/models/decision_stats_response_model_messages_item_type_1.py +46 -0
  132. musubi/_generated/policyai/models/delete_dataset_items_request_model.py +61 -0
  133. musubi/_generated/policyai/models/evaluate_content_request_model.py +113 -0
  134. musubi/_generated/policyai/models/evaluation_group_response_list_model.py +126 -0
  135. musubi/_generated/policyai/models/evaluation_group_response_list_model_messages_item_type_1.py +46 -0
  136. musubi/_generated/policyai/models/evaluation_group_response_model.py +214 -0
  137. musubi/_generated/policyai/models/evaluation_group_response_model_messages_item_type_1.py +46 -0
  138. musubi/_generated/policyai/models/evaluation_run_envelope_response_model.py +118 -0
  139. musubi/_generated/policyai/models/evaluation_run_envelope_response_model_messages_item_type_1.py +46 -0
  140. musubi/_generated/policyai/models/evaluation_run_item_model.py +174 -0
  141. musubi/_generated/policyai/models/evaluation_run_item_model_extra.py +46 -0
  142. musubi/_generated/policyai/models/evaluation_run_item_model_itemmetadata.py +46 -0
  143. musubi/_generated/policyai/models/evaluation_run_model.py +167 -0
  144. musubi/_generated/policyai/models/evaluation_run_model_policysnapshot.py +46 -0
  145. musubi/_generated/policyai/models/evaluation_run_response_model.py +215 -0
  146. musubi/_generated/policyai/models/evaluation_run_response_model_messages_item_type_1.py +46 -0
  147. musubi/_generated/policyai/models/evaluation_run_response_model_policysnapshot.py +46 -0
  148. musubi/_generated/policyai/models/evaluation_run_status_enum.py +11 -0
  149. musubi/_generated/policyai/models/http_validation_error.py +79 -0
  150. musubi/_generated/policyai/models/image_as_base_64_content_request_model.py +106 -0
  151. musubi/_generated/policyai/models/image_as_base_64_content_request_model_format.py +8 -0
  152. musubi/_generated/policyai/models/image_as_base_64_content_request_model_type.py +8 -0
  153. musubi/_generated/policyai/models/image_as_base_64_content_response_model.py +176 -0
  154. musubi/_generated/policyai/models/image_as_base_64_content_response_model_format.py +8 -0
  155. musubi/_generated/policyai/models/image_as_base_64_content_response_model_messages_item_type_1.py +46 -0
  156. musubi/_generated/policyai/models/image_as_base_64_content_response_model_type.py +8 -0
  157. musubi/_generated/policyai/models/image_as_url_content_model.py +121 -0
  158. musubi/_generated/policyai/models/image_as_url_content_model_data_type_0.py +8 -0
  159. musubi/_generated/policyai/models/image_as_url_content_model_format.py +8 -0
  160. musubi/_generated/policyai/models/image_as_url_content_model_type.py +8 -0
  161. musubi/_generated/policyai/models/image_as_url_content_response_model.py +193 -0
  162. musubi/_generated/policyai/models/image_as_url_content_response_model_data_type_0.py +8 -0
  163. musubi/_generated/policyai/models/image_as_url_content_response_model_format.py +8 -0
  164. musubi/_generated/policyai/models/image_as_url_content_response_model_messages_item_type_1.py +46 -0
  165. musubi/_generated/policyai/models/image_as_url_content_response_model_type.py +8 -0
  166. musubi/_generated/policyai/models/image_url_content.py +71 -0
  167. musubi/_generated/policyai/models/image_url_content_type.py +8 -0
  168. musubi/_generated/policyai/models/label_content_by_endpoint_request_model.py +169 -0
  169. musubi/_generated/policyai/models/label_content_request_model.py +220 -0
  170. musubi/_generated/policyai/models/label_group_envelope_response_model.py +118 -0
  171. musubi/_generated/policyai/models/label_group_envelope_response_model_messages_item_type_1.py +46 -0
  172. musubi/_generated/policyai/models/label_group_response_list_model.py +126 -0
  173. musubi/_generated/policyai/models/label_group_response_list_model_messages_item_type_1.py +46 -0
  174. musubi/_generated/policyai/models/label_group_response_model.py +234 -0
  175. musubi/_generated/policyai/models/label_response_model.py +188 -0
  176. musubi/_generated/policyai/models/label_response_model_extra.py +46 -0
  177. musubi/_generated/policyai/models/label_status_enum.py +8 -0
  178. musubi/_generated/policyai/models/labeler_output_integer_field_model.py +167 -0
  179. musubi/_generated/policyai/models/labeler_output_integer_field_model_type.py +8 -0
  180. musubi/_generated/policyai/models/labeler_output_model.py +61 -0
  181. musubi/_generated/policyai/models/labeler_output_string_field_model.py +127 -0
  182. musubi/_generated/policyai/models/labeler_output_string_field_model_type.py +8 -0
  183. musubi/_generated/policyai/models/labeling_endpoint_envelope_response_model.py +118 -0
  184. musubi/_generated/policyai/models/labeling_endpoint_envelope_response_model_messages_item_type_1.py +46 -0
  185. musubi/_generated/policyai/models/labeling_endpoint_response_list_model.py +126 -0
  186. musubi/_generated/policyai/models/labeling_endpoint_response_list_model_messages_item_type_1.py +46 -0
  187. musubi/_generated/policyai/models/labeling_endpoint_response_model.py +131 -0
  188. musubi/_generated/policyai/models/llm_id_enum.py +26 -0
  189. musubi/_generated/policyai/models/llm_model.py +138 -0
  190. musubi/_generated/policyai/models/llm_response_envelope_model.py +112 -0
  191. musubi/_generated/policyai/models/llm_response_envelope_model_messages_item_type_1.py +46 -0
  192. musubi/_generated/policyai/models/llm_response_list_model.py +120 -0
  193. musubi/_generated/policyai/models/llm_response_list_model_messages_item_type_1.py +46 -0
  194. musubi/_generated/policyai/models/llm_response_model.py +206 -0
  195. musubi/_generated/policyai/models/llm_response_model_messages_item_type_1.py +46 -0
  196. musubi/_generated/policyai/models/llm_status_enum.py +8 -0
  197. musubi/_generated/policyai/models/llm_tier_id_enum.py +9 -0
  198. musubi/_generated/policyai/models/llm_tier_response_envelope_model.py +118 -0
  199. musubi/_generated/policyai/models/llm_tier_response_envelope_model_messages_item_type_1.py +46 -0
  200. musubi/_generated/policyai/models/llm_tier_response_list_model.py +120 -0
  201. musubi/_generated/policyai/models/llm_tier_response_list_model_messages_item_type_1.py +46 -0
  202. musubi/_generated/policyai/models/llm_tier_response_model.py +126 -0
  203. musubi/_generated/policyai/models/llm_tier_response_model_messages_item_type_1.py +46 -0
  204. musubi/_generated/policyai/models/llm_v2_model_response_model.py +240 -0
  205. musubi/_generated/policyai/models/llm_v2_model_response_model_extra.py +46 -0
  206. musubi/_generated/policyai/models/llm_v2_model_response_model_extraparamvalues.py +46 -0
  207. musubi/_generated/policyai/models/llm_v2_model_response_model_messages_item_type_1.py +46 -0
  208. musubi/_generated/policyai/models/llm_v2_model_response_model_paramvalues.py +46 -0
  209. musubi/_generated/policyai/models/llm_v2_response_envelope_model.py +124 -0
  210. musubi/_generated/policyai/models/llm_v2_response_envelope_model_messages_item_type_1.py +46 -0
  211. musubi/_generated/policyai/models/llm_v2_status_enum.py +8 -0
  212. musubi/_generated/policyai/models/model_param_enum.py +13 -0
  213. musubi/_generated/policyai/models/moderation_error_model.py +69 -0
  214. musubi/_generated/policyai/models/moderation_results_envelope_response_model.py +118 -0
  215. musubi/_generated/policyai/models/moderation_results_envelope_response_model_messages_item_type_1.py +46 -0
  216. musubi/_generated/policyai/models/moderation_results_response_list_model.py +126 -0
  217. musubi/_generated/policyai/models/moderation_results_response_list_model_messages_item_type_1.py +46 -0
  218. musubi/_generated/policyai/models/moderation_results_response_model.py +304 -0
  219. musubi/_generated/policyai/models/moderation_results_response_model_extra.py +46 -0
  220. musubi/_generated/policyai/models/moderation_results_response_model_messages_item_type_1.py +46 -0
  221. musubi/_generated/policyai/models/multiple_decision_results_response_model.py +150 -0
  222. musubi/_generated/policyai/models/multiple_decision_results_response_model_messages_item_type_1.py +46 -0
  223. musubi/_generated/policyai/models/organization_settings_content_model.py +139 -0
  224. musubi/_generated/policyai/models/organization_settings_envelope_response_model.py +122 -0
  225. musubi/_generated/policyai/models/organization_settings_envelope_response_model_messages_item_type_1.py +46 -0
  226. musubi/_generated/policyai/models/organization_settings_response_list_model.py +126 -0
  227. musubi/_generated/policyai/models/organization_settings_response_list_model_messages_item_type_1.py +46 -0
  228. musubi/_generated/policyai/models/organization_settings_response_model.py +151 -0
  229. musubi/_generated/policyai/models/organization_settings_response_model_messages_item_type_1.py +46 -0
  230. musubi/_generated/policyai/models/output_field_source_enum.py +10 -0
  231. musubi/_generated/policyai/models/partial_update_policy_request_model.py +113 -0
  232. musubi/_generated/policyai/models/partial_update_policy_version_request_model.py +265 -0
  233. musubi/_generated/policyai/models/partial_update_prompt_template_request_model.py +113 -0
  234. musubi/_generated/policyai/models/partial_update_scope_request_model.py +93 -0
  235. musubi/_generated/policyai/models/pdf_as_url_content_model.py +121 -0
  236. musubi/_generated/policyai/models/pdf_as_url_content_model_data_type_0.py +8 -0
  237. musubi/_generated/policyai/models/pdf_as_url_content_model_format.py +8 -0
  238. musubi/_generated/policyai/models/pdf_as_url_content_model_type.py +8 -0
  239. musubi/_generated/policyai/models/pdf_as_url_content_response_model.py +193 -0
  240. musubi/_generated/policyai/models/pdf_as_url_content_response_model_data_type_0.py +8 -0
  241. musubi/_generated/policyai/models/pdf_as_url_content_response_model_format.py +8 -0
  242. musubi/_generated/policyai/models/pdf_as_url_content_response_model_messages_item_type_1.py +46 -0
  243. musubi/_generated/policyai/models/pdf_as_url_content_response_model_type.py +8 -0
  244. musubi/_generated/policyai/models/policy_label_model.py +71 -0
  245. musubi/_generated/policyai/models/policy_llm_model.py +103 -0
  246. musubi/_generated/policyai/models/policy_llm_model_extraparamvalues.py +46 -0
  247. musubi/_generated/policyai/models/policy_llm_model_paramvalues.py +46 -0
  248. musubi/_generated/policyai/models/policy_prompt_template_response_model.py +171 -0
  249. musubi/_generated/policyai/models/policy_prompt_template_response_model_messages_item_type_1.py +46 -0
  250. musubi/_generated/policyai/models/policy_v2_data_response_model.py +191 -0
  251. musubi/_generated/policyai/models/policy_v2_draft_labeler_config_model.py +150 -0
  252. musubi/_generated/policyai/models/policy_v2_draft_labeler_config_model_extramodelparamvalues.py +46 -0
  253. musubi/_generated/policyai/models/policy_v2_draft_labeler_config_model_modelparamvalues.py +46 -0
  254. musubi/_generated/policyai/models/policy_v2_draft_labeler_config_model_type.py +8 -0
  255. musubi/_generated/policyai/models/policy_v2_envelope_response_model.py +118 -0
  256. musubi/_generated/policyai/models/policy_v2_envelope_response_model_messages_item_type_1.py +46 -0
  257. musubi/_generated/policyai/models/policy_v2_labeler_config_model.py +154 -0
  258. musubi/_generated/policyai/models/policy_v2_labeler_config_model_extramodelparamvalues.py +46 -0
  259. musubi/_generated/policyai/models/policy_v2_labeler_config_model_modelparamvalues.py +46 -0
  260. musubi/_generated/policyai/models/policy_v2_labeler_config_model_type.py +8 -0
  261. musubi/_generated/policyai/models/policy_v2_labeler_internal_metadata_model.py +87 -0
  262. musubi/_generated/policyai/models/policy_v2_labeler_internal_metadata_model_type.py +9 -0
  263. musubi/_generated/policyai/models/policy_v2_list_response_model.py +124 -0
  264. musubi/_generated/policyai/models/policy_v2_list_response_model_messages_item_type_1.py +46 -0
  265. musubi/_generated/policyai/models/policy_v2_response_model.py +173 -0
  266. musubi/_generated/policyai/models/policy_v2_response_model_extra.py +46 -0
  267. musubi/_generated/policyai/models/policy_v2_version_envelope_response_model.py +118 -0
  268. musubi/_generated/policyai/models/policy_v2_version_envelope_response_model_messages_item_type_1.py +46 -0
  269. musubi/_generated/policyai/models/policy_v2_version_metadata_model.py +107 -0
  270. musubi/_generated/policyai/models/policy_v2_version_response_model.py +189 -0
  271. musubi/_generated/policyai/models/policy_v2_version_response_model_extra.py +46 -0
  272. musubi/_generated/policyai/models/policy_v2_version_state_enum.py +9 -0
  273. musubi/_generated/policyai/models/policy_version_definition_category_model.py +72 -0
  274. musubi/_generated/policyai/models/policy_version_definition_category_request_model.py +72 -0
  275. musubi/_generated/policyai/models/policy_version_definition_model.py +86 -0
  276. musubi/_generated/policyai/models/policy_version_definition_request_model.py +88 -0
  277. musubi/_generated/policyai/models/policy_version_envelope_response_model.py +118 -0
  278. musubi/_generated/policyai/models/policy_version_envelope_response_model_messages_item_type_1.py +46 -0
  279. musubi/_generated/policyai/models/policy_version_examples_category_model_input.py +83 -0
  280. musubi/_generated/policyai/models/policy_version_examples_category_model_output.py +83 -0
  281. musubi/_generated/policyai/models/policy_version_examples_model.py +86 -0
  282. musubi/_generated/policyai/models/policy_version_examples_request_model.py +88 -0
  283. musubi/_generated/policyai/models/policy_version_metadata_model.py +70 -0
  284. musubi/_generated/policyai/models/policy_version_model.py +187 -0
  285. musubi/_generated/policyai/models/policy_version_response_model.py +234 -0
  286. musubi/_generated/policyai/models/policy_version_response_model_messages_item_type_1.py +46 -0
  287. musubi/_generated/policyai/models/policy_version_settings_model.py +112 -0
  288. musubi/_generated/policyai/models/policy_version_tag_envelope_response_model.py +118 -0
  289. musubi/_generated/policyai/models/policy_version_tag_envelope_response_model_messages_item_type_1.py +46 -0
  290. musubi/_generated/policyai/models/policy_version_tag_model.py +134 -0
  291. musubi/_generated/policyai/models/policy_version_tag_response_list_model.py +126 -0
  292. musubi/_generated/policyai/models/policy_version_tag_response_list_model_messages_item_type_1.py +46 -0
  293. musubi/_generated/policyai/models/policy_with_related_metadata_envelope_response_model.py +122 -0
  294. musubi/_generated/policyai/models/policy_with_related_metadata_envelope_response_model_messages_item_type_1.py +46 -0
  295. musubi/_generated/policyai/models/policy_with_related_metadata_response_list_model.py +130 -0
  296. musubi/_generated/policyai/models/policy_with_related_metadata_response_list_model_messages_item_type_1.py +46 -0
  297. musubi/_generated/policyai/models/policy_with_related_metadata_response_model.py +215 -0
  298. musubi/_generated/policyai/models/policy_with_related_metadata_response_model_messages_item_type_1.py +46 -0
  299. musubi/_generated/policyai/models/policy_with_version_content_model.py +158 -0
  300. musubi/_generated/policyai/models/policy_with_versions_content_envelope_response_model.py +122 -0
  301. musubi/_generated/policyai/models/policy_with_versions_content_envelope_response_model_messages_item_type_1.py +46 -0
  302. musubi/_generated/policyai/models/prompt_template_envelope_response_model.py +119 -0
  303. musubi/_generated/policyai/models/prompt_template_envelope_response_model_messages_item_type_1.py +46 -0
  304. musubi/_generated/policyai/models/prompt_template_list_envelope_response_model.py +129 -0
  305. musubi/_generated/policyai/models/prompt_template_list_envelope_response_model_messages_item_type_1.py +46 -0
  306. musubi/_generated/policyai/models/request_base_64_image_content.py +71 -0
  307. musubi/_generated/policyai/models/request_base_64_image_content_type.py +8 -0
  308. musubi/_generated/policyai/models/scope_attachment_response_list_model.py +126 -0
  309. musubi/_generated/policyai/models/scope_attachment_response_list_model_messages_item_type_1.py +46 -0
  310. musubi/_generated/policyai/models/scope_attachment_response_model.py +161 -0
  311. musubi/_generated/policyai/models/scope_attachment_response_model_messages_item_type_1.py +46 -0
  312. musubi/_generated/policyai/models/scope_model.py +124 -0
  313. musubi/_generated/policyai/models/scope_response_list_model.py +120 -0
  314. musubi/_generated/policyai/models/scope_response_list_model_messages_item_type_1.py +46 -0
  315. musubi/_generated/policyai/models/scope_response_model.py +171 -0
  316. musubi/_generated/policyai/models/scope_response_model_messages_item_type_1.py +46 -0
  317. musubi/_generated/policyai/models/severity_enum.py +11 -0
  318. musubi/_generated/policyai/models/text_content.py +71 -0
  319. musubi/_generated/policyai/models/text_content_model.py +105 -0
  320. musubi/_generated/policyai/models/text_content_model_format.py +8 -0
  321. musubi/_generated/policyai/models/text_content_model_type.py +8 -0
  322. musubi/_generated/policyai/models/text_content_response_model.py +175 -0
  323. musubi/_generated/policyai/models/text_content_response_model_format.py +8 -0
  324. musubi/_generated/policyai/models/text_content_response_model_messages_item_type_1.py +46 -0
  325. musubi/_generated/policyai/models/text_content_response_model_type.py +8 -0
  326. musubi/_generated/policyai/models/text_content_type.py +8 -0
  327. musubi/_generated/policyai/models/text_example_model.py +80 -0
  328. musubi/_generated/policyai/models/text_example_model_type.py +8 -0
  329. musubi/_generated/policyai/models/time_bin_enum.py +10 -0
  330. musubi/_generated/policyai/models/update_dataset_item_request_model.py +135 -0
  331. musubi/_generated/policyai/models/update_dataset_item_request_model_metadata_type_0.py +46 -0
  332. musubi/_generated/policyai/models/update_draft_v2_policy_version_api_v2_policies_by_key_organization_id_policy_key_versions_draft_patch_update_policy_v2_version_request_model.py +114 -0
  333. musubi/_generated/policyai/models/update_labeling_endpoint_request_model.py +138 -0
  334. musubi/_generated/policyai/models/update_organization_settings_request_model.py +133 -0
  335. musubi/_generated/policyai/models/update_policy_v2_request_model.py +113 -0
  336. musubi/_generated/policyai/models/update_policy_v2_version_request_model.py +111 -0
  337. musubi/_generated/policyai/models/update_policy_version_tag_request_model.py +172 -0
  338. musubi/_generated/policyai/models/validation_error.py +90 -0
  339. musubi/_generated/policyai/models/version_response_model.py +110 -0
  340. musubi/_generated/policyai/models/version_response_model_messages_item_type_1.py +46 -0
  341. musubi/_generated/policyai/models/video_as_url_content_model.py +121 -0
  342. musubi/_generated/policyai/models/video_as_url_content_model_data_type_0.py +8 -0
  343. musubi/_generated/policyai/models/video_as_url_content_model_format.py +8 -0
  344. musubi/_generated/policyai/models/video_as_url_content_model_type.py +8 -0
  345. musubi/_generated/policyai/models/video_as_url_content_response_model.py +193 -0
  346. musubi/_generated/policyai/models/video_as_url_content_response_model_data_type_0.py +8 -0
  347. musubi/_generated/policyai/models/video_as_url_content_response_model_format.py +8 -0
  348. musubi/_generated/policyai/models/video_as_url_content_response_model_messages_item_type_1.py +46 -0
  349. musubi/_generated/policyai/models/video_as_url_content_response_model_type.py +8 -0
  350. musubi/_generated/policyai/py.typed +1 -0
  351. musubi/_generated/policyai/types.py +54 -0
  352. musubi/auth/__init__.py +0 -0
  353. musubi/auth/config.py +670 -0
  354. musubi/auth/device_flow.py +264 -0
  355. musubi/auth/iam.py +231 -0
  356. musubi/bulk.py +376 -0
  357. musubi/cli.py +920 -0
  358. musubi/client.py +216 -0
  359. musubi/commands/__init__.py +0 -0
  360. musubi/commands/compare.py +49 -0
  361. musubi/commands/dataset.py +224 -0
  362. musubi/commands/doctor.py +178 -0
  363. musubi/commands/install_skills.py +239 -0
  364. musubi/commands/label_dataset.py +208 -0
  365. musubi/commands/login.py +431 -0
  366. musubi/commands/logout.py +63 -0
  367. musubi/commands/mcp_install.py +184 -0
  368. musubi/commands/profiles.py +111 -0
  369. musubi/commands/project_init.py +106 -0
  370. musubi/commands/switch.py +57 -0
  371. musubi/commands/uninstall.py +177 -0
  372. musubi/commands/upgrade.py +95 -0
  373. musubi/data/hosts.json +82 -0
  374. musubi/datasets_workflow.py +1037 -0
  375. musubi/exceptions.py +64 -0
  376. musubi/labeling.py +330 -0
  377. musubi/mcp_hosts.py +474 -0
  378. musubi/mcp_server.py +1195 -0
  379. musubi/policy_diff.py +366 -0
  380. musubi/policy_helpers.py +106 -0
  381. musubi/prompts.py +113 -0
  382. musubi/resources/__init__.py +0 -0
  383. musubi/resources/datasets/__init__.py +5 -0
  384. musubi/resources/datasets/dataset.py +552 -0
  385. musubi/resources/iam/__init__.py +10 -0
  386. musubi/resources/iam/iam.py +126 -0
  387. musubi/resources/policyai/__init__.py +0 -0
  388. musubi/resources/policyai/endpoints.py +84 -0
  389. musubi/resources/policyai/labels.py +92 -0
  390. musubi/resources/policyai/models.py +22 -0
  391. musubi/resources/policyai/policies.py +116 -0
  392. musubi_client-0.2.0.dist-info/METADATA +17 -0
  393. musubi_client-0.2.0.dist-info/RECORD +395 -0
  394. musubi_client-0.2.0.dist-info/WHEEL +4 -0
  395. musubi_client-0.2.0.dist-info/entry_points.txt +3 -0
musubi/__init__.py ADDED
@@ -0,0 +1,43 @@
1
+ """Musubi Python SDK — client for the Musubi PolicyAI API.
2
+
3
+ This SDK exposes v2 API surfaces plus v1 resources that have no v2 equivalent
4
+ yet (datasets, evaluations). Superseded v1 endpoints are intentionally excluded.
5
+ See client.py module docstring for the full supersession map.
6
+ """
7
+
8
+ from musubi.client import AsyncMusubiClient, MusubiClient
9
+ from musubi.exceptions import (
10
+ MusubiAPIError,
11
+ MusubiAuthError,
12
+ MusubiError,
13
+ MusubiNotFoundError,
14
+ MusubiRateLimitError,
15
+ MusubiValidationError,
16
+ )
17
+ from musubi.labeling import (
18
+ audio_url_content,
19
+ image_base64_content,
20
+ image_url_content,
21
+ pdf_url_content,
22
+ policy_labeler,
23
+ text_content,
24
+ video_url_content,
25
+ )
26
+
27
+ __all__ = [
28
+ "AsyncMusubiClient",
29
+ "MusubiAPIError",
30
+ "MusubiAuthError",
31
+ "MusubiClient",
32
+ "MusubiError",
33
+ "MusubiNotFoundError",
34
+ "MusubiRateLimitError",
35
+ "MusubiValidationError",
36
+ "audio_url_content",
37
+ "image_base64_content",
38
+ "image_url_content",
39
+ "pdf_url_content",
40
+ "policy_labeler",
41
+ "text_content",
42
+ "video_url_content",
43
+ ]
musubi/_base.py ADDED
@@ -0,0 +1,65 @@
1
+ """Base resource class for SDK resource groups."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING, Any
6
+
7
+ from musubi.exceptions import raise_for_status
8
+
9
+ if TYPE_CHECKING:
10
+ from musubi._generated.policyai.client import AuthenticatedClient
11
+
12
+
13
+ class SyncResource:
14
+ """Base class for sync resource groups."""
15
+
16
+ def __init__(self, client: AuthenticatedClient, org_id: str) -> None:
17
+ self._client = client
18
+ self._org_id = org_id
19
+
20
+ def _request(self, method: str, path: str, *, json: Any = None, params: dict[str, Any] | None = None) -> Any:
21
+ """Make an authenticated request and return the parsed JSON body."""
22
+ http_client = self._client.get_httpx_client()
23
+ response = http_client.request(method, path, json=json, params=_clean_params(params))
24
+ raise_for_status(response.status_code, response.content)
25
+ if response.status_code == 204:
26
+ return None
27
+ return response.json()
28
+
29
+ def _request_data(self, method: str, path: str, *, json: Any = None, params: dict[str, Any] | None = None) -> Any:
30
+ """Make a request and unwrap the envelope, returning the `data` field."""
31
+ body = self._request(method, path, json=json, params=params)
32
+ if isinstance(body, dict) and "data" in body:
33
+ return body["data"]
34
+ return body
35
+
36
+
37
+ class AsyncResource:
38
+ """Base class for async resource groups."""
39
+
40
+ def __init__(self, client: AuthenticatedClient, org_id: str) -> None:
41
+ self._client = client
42
+ self._org_id = org_id
43
+
44
+ async def _request(self, method: str, path: str, *, json: Any = None, params: dict[str, Any] | None = None) -> Any:
45
+ http_client = self._client.get_async_httpx_client()
46
+ response = await http_client.request(method, path, json=json, params=_clean_params(params))
47
+ raise_for_status(response.status_code, response.content)
48
+ if response.status_code == 204:
49
+ return None
50
+ return response.json()
51
+
52
+ async def _request_data(
53
+ self, method: str, path: str, *, json: Any = None, params: dict[str, Any] | None = None
54
+ ) -> Any:
55
+ body = await self._request(method, path, json=json, params=params)
56
+ if isinstance(body, dict) and "data" in body:
57
+ return body["data"]
58
+ return body
59
+
60
+
61
+ def _clean_params(params: dict[str, Any] | None) -> dict[str, Any] | None:
62
+ """Remove None values from query params."""
63
+ if params is None:
64
+ return None
65
+ return {k: v for k, v in params.items() if v is not None}
musubi/_cli_shared.py ADDED
@@ -0,0 +1,39 @@
1
+ """Tiny CLI helpers shared by `cli.py` and the `commands/` modules.
2
+
3
+ A leaf module (imports nothing from the package) so both the CLI root and
4
+ the command modules can import from it without the import cycle that forces
5
+ `commands/*` to shim `_out`/`_client_from_ctx` off `cli`.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import click
11
+
12
+ _ID_SHORT_WIDTH = 8
13
+
14
+
15
+ def parse_kv_pairs(values: tuple[str, ...], *, what: str = "csv_column=value") -> dict[str, str]:
16
+ """Parse repeatable `key=value` CLI options into a dict.
17
+
18
+ Used for `--content-column csv_col=content_key` and
19
+ `--content-format csv_col=type`. `what` names the expected shape in the
20
+ error message.
21
+ """
22
+ result: dict[str, str] = {}
23
+ for v in values:
24
+ if "=" not in v:
25
+ raise click.BadParameter(f"Expected {what}, got: {v}")
26
+ left, right = v.split("=", 1)
27
+ result[left] = right
28
+ return result
29
+
30
+
31
+ def short_id(org_id: str | None, *, width: int = _ID_SHORT_WIDTH) -> str:
32
+ """Truncate an org/id for display (`019e48d3…`), or `?` when absent.
33
+
34
+ One width everywhere so the same org renders identically across the
35
+ header, `profiles list`, and `doctor`.
36
+ """
37
+ if not org_id:
38
+ return "?"
39
+ return org_id[:width] + "…" if len(org_id) > width else org_id
File without changes
@@ -0,0 +1,8 @@
1
+ """A client library for accessing Policy AI"""
2
+
3
+ from .client import AuthenticatedClient, Client
4
+
5
+ __all__ = (
6
+ "AuthenticatedClient",
7
+ "Client",
8
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,125 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.version_response_model import VersionResponseModel
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+ _kwargs: dict[str, Any] = {
14
+ "method": "get",
15
+ "url": "/version",
16
+ }
17
+
18
+ return _kwargs
19
+
20
+
21
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> VersionResponseModel | None:
22
+ if response.status_code == 200:
23
+ response_200 = VersionResponseModel.from_dict(response.json())
24
+
25
+ return response_200
26
+
27
+ if client.raise_on_unexpected_status:
28
+ raise errors.UnexpectedStatus(response.status_code, response.content)
29
+ else:
30
+ return None
31
+
32
+
33
+ def _build_response(
34
+ *, client: AuthenticatedClient | Client, response: httpx.Response
35
+ ) -> Response[VersionResponseModel]:
36
+ return Response(
37
+ status_code=HTTPStatus(response.status_code),
38
+ content=response.content,
39
+ headers=response.headers,
40
+ parsed=_parse_response(client=client, response=response),
41
+ )
42
+
43
+
44
+ def sync_detailed(
45
+ *,
46
+ client: AuthenticatedClient,
47
+ ) -> Response[VersionResponseModel]:
48
+ """Get version information for the application
49
+
50
+ Raises:
51
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
52
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
53
+
54
+ Returns:
55
+ Response[VersionResponseModel]
56
+ """
57
+
58
+ kwargs = _get_kwargs()
59
+
60
+ response = client.get_httpx_client().request(
61
+ **kwargs,
62
+ )
63
+
64
+ return _build_response(client=client, response=response)
65
+
66
+
67
+ def sync(
68
+ *,
69
+ client: AuthenticatedClient,
70
+ ) -> VersionResponseModel | None:
71
+ """Get version information for the application
72
+
73
+ Raises:
74
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
76
+
77
+ Returns:
78
+ VersionResponseModel
79
+ """
80
+
81
+ return sync_detailed(
82
+ client=client,
83
+ ).parsed
84
+
85
+
86
+ async def asyncio_detailed(
87
+ *,
88
+ client: AuthenticatedClient,
89
+ ) -> Response[VersionResponseModel]:
90
+ """Get version information for the application
91
+
92
+ Raises:
93
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
94
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
95
+
96
+ Returns:
97
+ Response[VersionResponseModel]
98
+ """
99
+
100
+ kwargs = _get_kwargs()
101
+
102
+ response = await client.get_async_httpx_client().request(**kwargs)
103
+
104
+ return _build_response(client=client, response=response)
105
+
106
+
107
+ async def asyncio(
108
+ *,
109
+ client: AuthenticatedClient,
110
+ ) -> VersionResponseModel | None:
111
+ """Get version information for the application
112
+
113
+ Raises:
114
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
116
+
117
+ Returns:
118
+ VersionResponseModel
119
+ """
120
+
121
+ return (
122
+ await asyncio_detailed(
123
+ client=client,
124
+ )
125
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,197 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+ from uuid import UUID
5
+
6
+ import httpx
7
+
8
+ from ... import errors
9
+ from ...client import AuthenticatedClient, Client
10
+ from ...models.evaluate_content_request_model import EvaluateContentRequestModel
11
+ from ...models.http_validation_error import HTTPValidationError
12
+ from ...models.moderation_results_envelope_response_model import ModerationResultsEnvelopeResponseModel
13
+ from ...types import Response
14
+
15
+
16
+ def _get_kwargs(
17
+ policy_id: UUID,
18
+ policy_version_id: UUID,
19
+ *,
20
+ body: EvaluateContentRequestModel,
21
+ ) -> dict[str, Any]:
22
+ headers: dict[str, Any] = {}
23
+
24
+ _kwargs: dict[str, Any] = {
25
+ "method": "post",
26
+ "url": "/v1/decisions/policies/{policy_id}/versions/{policy_version_id}".format(
27
+ policy_id=quote(str(policy_id), safe=""),
28
+ policy_version_id=quote(str(policy_version_id), safe=""),
29
+ ),
30
+ }
31
+
32
+ _kwargs["json"] = body.to_dict()
33
+
34
+ headers["Content-Type"] = "application/json"
35
+
36
+ _kwargs["headers"] = headers
37
+ return _kwargs
38
+
39
+
40
+ def _parse_response(
41
+ *, client: AuthenticatedClient | Client, response: httpx.Response
42
+ ) -> HTTPValidationError | ModerationResultsEnvelopeResponseModel | None:
43
+ if response.status_code == 200:
44
+ response_200 = ModerationResultsEnvelopeResponseModel.from_dict(response.json())
45
+
46
+ return response_200
47
+
48
+ if response.status_code == 422:
49
+ response_422 = HTTPValidationError.from_dict(response.json())
50
+
51
+ return response_422
52
+
53
+ if client.raise_on_unexpected_status:
54
+ raise errors.UnexpectedStatus(response.status_code, response.content)
55
+ else:
56
+ return None
57
+
58
+
59
+ def _build_response(
60
+ *, client: AuthenticatedClient | Client, response: httpx.Response
61
+ ) -> Response[HTTPValidationError | ModerationResultsEnvelopeResponseModel]:
62
+ return Response(
63
+ status_code=HTTPStatus(response.status_code),
64
+ content=response.content,
65
+ headers=response.headers,
66
+ parsed=_parse_response(client=client, response=response),
67
+ )
68
+
69
+
70
+ def sync_detailed(
71
+ policy_id: UUID,
72
+ policy_version_id: UUID,
73
+ *,
74
+ client: AuthenticatedClient,
75
+ body: EvaluateContentRequestModel,
76
+ ) -> Response[HTTPValidationError | ModerationResultsEnvelopeResponseModel]:
77
+ """Evaluate content against a policy version.
78
+
79
+ Args:
80
+ policy_id (UUID):
81
+ policy_version_id (UUID):
82
+ body (EvaluateContentRequestModel):
83
+
84
+ Raises:
85
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
86
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
87
+
88
+ Returns:
89
+ Response[HTTPValidationError | ModerationResultsEnvelopeResponseModel]
90
+ """
91
+
92
+ kwargs = _get_kwargs(
93
+ policy_id=policy_id,
94
+ policy_version_id=policy_version_id,
95
+ body=body,
96
+ )
97
+
98
+ response = client.get_httpx_client().request(
99
+ **kwargs,
100
+ )
101
+
102
+ return _build_response(client=client, response=response)
103
+
104
+
105
+ def sync(
106
+ policy_id: UUID,
107
+ policy_version_id: UUID,
108
+ *,
109
+ client: AuthenticatedClient,
110
+ body: EvaluateContentRequestModel,
111
+ ) -> HTTPValidationError | ModerationResultsEnvelopeResponseModel | None:
112
+ """Evaluate content against a policy version.
113
+
114
+ Args:
115
+ policy_id (UUID):
116
+ policy_version_id (UUID):
117
+ body (EvaluateContentRequestModel):
118
+
119
+ Raises:
120
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
121
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
122
+
123
+ Returns:
124
+ HTTPValidationError | ModerationResultsEnvelopeResponseModel
125
+ """
126
+
127
+ return sync_detailed(
128
+ policy_id=policy_id,
129
+ policy_version_id=policy_version_id,
130
+ client=client,
131
+ body=body,
132
+ ).parsed
133
+
134
+
135
+ async def asyncio_detailed(
136
+ policy_id: UUID,
137
+ policy_version_id: UUID,
138
+ *,
139
+ client: AuthenticatedClient,
140
+ body: EvaluateContentRequestModel,
141
+ ) -> Response[HTTPValidationError | ModerationResultsEnvelopeResponseModel]:
142
+ """Evaluate content against a policy version.
143
+
144
+ Args:
145
+ policy_id (UUID):
146
+ policy_version_id (UUID):
147
+ body (EvaluateContentRequestModel):
148
+
149
+ Raises:
150
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
151
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
152
+
153
+ Returns:
154
+ Response[HTTPValidationError | ModerationResultsEnvelopeResponseModel]
155
+ """
156
+
157
+ kwargs = _get_kwargs(
158
+ policy_id=policy_id,
159
+ policy_version_id=policy_version_id,
160
+ body=body,
161
+ )
162
+
163
+ response = await client.get_async_httpx_client().request(**kwargs)
164
+
165
+ return _build_response(client=client, response=response)
166
+
167
+
168
+ async def asyncio(
169
+ policy_id: UUID,
170
+ policy_version_id: UUID,
171
+ *,
172
+ client: AuthenticatedClient,
173
+ body: EvaluateContentRequestModel,
174
+ ) -> HTTPValidationError | ModerationResultsEnvelopeResponseModel | None:
175
+ """Evaluate content against a policy version.
176
+
177
+ Args:
178
+ policy_id (UUID):
179
+ policy_version_id (UUID):
180
+ body (EvaluateContentRequestModel):
181
+
182
+ Raises:
183
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
184
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
185
+
186
+ Returns:
187
+ HTTPValidationError | ModerationResultsEnvelopeResponseModel
188
+ """
189
+
190
+ return (
191
+ await asyncio_detailed(
192
+ policy_id=policy_id,
193
+ policy_version_id=policy_version_id,
194
+ client=client,
195
+ body=body,
196
+ )
197
+ ).parsed
@@ -0,0 +1,182 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.evaluate_content_request_model import EvaluateContentRequestModel
10
+ from ...models.http_validation_error import HTTPValidationError
11
+ from ...models.multiple_decision_results_response_model import MultipleDecisionResultsResponseModel
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ tag_name: str,
17
+ *,
18
+ body: EvaluateContentRequestModel,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "post",
24
+ "url": "/v1/decisions/evaluate/{tag_name}".format(
25
+ tag_name=quote(str(tag_name), safe=""),
26
+ ),
27
+ }
28
+
29
+ _kwargs["json"] = body.to_dict()
30
+
31
+ headers["Content-Type"] = "application/json"
32
+
33
+ _kwargs["headers"] = headers
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(
38
+ *, client: AuthenticatedClient | Client, response: httpx.Response
39
+ ) -> HTTPValidationError | MultipleDecisionResultsResponseModel | None:
40
+ if response.status_code == 200:
41
+ response_200 = MultipleDecisionResultsResponseModel.from_dict(response.json())
42
+
43
+ return response_200
44
+
45
+ if response.status_code == 422:
46
+ response_422 = HTTPValidationError.from_dict(response.json())
47
+
48
+ return response_422
49
+
50
+ if client.raise_on_unexpected_status:
51
+ raise errors.UnexpectedStatus(response.status_code, response.content)
52
+ else:
53
+ return None
54
+
55
+
56
+ def _build_response(
57
+ *, client: AuthenticatedClient | Client, response: httpx.Response
58
+ ) -> Response[HTTPValidationError | MultipleDecisionResultsResponseModel]:
59
+ return Response(
60
+ status_code=HTTPStatus(response.status_code),
61
+ content=response.content,
62
+ headers=response.headers,
63
+ parsed=_parse_response(client=client, response=response),
64
+ )
65
+
66
+
67
+ def sync_detailed(
68
+ tag_name: str,
69
+ *,
70
+ client: AuthenticatedClient,
71
+ body: EvaluateContentRequestModel,
72
+ ) -> Response[HTTPValidationError | MultipleDecisionResultsResponseModel]:
73
+ """Evaluate content against all policy versions in a tag.
74
+
75
+ Args:
76
+ tag_name (str):
77
+ body (EvaluateContentRequestModel):
78
+
79
+ Raises:
80
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
81
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
82
+
83
+ Returns:
84
+ Response[HTTPValidationError | MultipleDecisionResultsResponseModel]
85
+ """
86
+
87
+ kwargs = _get_kwargs(
88
+ tag_name=tag_name,
89
+ body=body,
90
+ )
91
+
92
+ response = client.get_httpx_client().request(
93
+ **kwargs,
94
+ )
95
+
96
+ return _build_response(client=client, response=response)
97
+
98
+
99
+ def sync(
100
+ tag_name: str,
101
+ *,
102
+ client: AuthenticatedClient,
103
+ body: EvaluateContentRequestModel,
104
+ ) -> HTTPValidationError | MultipleDecisionResultsResponseModel | None:
105
+ """Evaluate content against all policy versions in a tag.
106
+
107
+ Args:
108
+ tag_name (str):
109
+ body (EvaluateContentRequestModel):
110
+
111
+ Raises:
112
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
114
+
115
+ Returns:
116
+ HTTPValidationError | MultipleDecisionResultsResponseModel
117
+ """
118
+
119
+ return sync_detailed(
120
+ tag_name=tag_name,
121
+ client=client,
122
+ body=body,
123
+ ).parsed
124
+
125
+
126
+ async def asyncio_detailed(
127
+ tag_name: str,
128
+ *,
129
+ client: AuthenticatedClient,
130
+ body: EvaluateContentRequestModel,
131
+ ) -> Response[HTTPValidationError | MultipleDecisionResultsResponseModel]:
132
+ """Evaluate content against all policy versions in a tag.
133
+
134
+ Args:
135
+ tag_name (str):
136
+ body (EvaluateContentRequestModel):
137
+
138
+ Raises:
139
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
140
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
141
+
142
+ Returns:
143
+ Response[HTTPValidationError | MultipleDecisionResultsResponseModel]
144
+ """
145
+
146
+ kwargs = _get_kwargs(
147
+ tag_name=tag_name,
148
+ body=body,
149
+ )
150
+
151
+ response = await client.get_async_httpx_client().request(**kwargs)
152
+
153
+ return _build_response(client=client, response=response)
154
+
155
+
156
+ async def asyncio(
157
+ tag_name: str,
158
+ *,
159
+ client: AuthenticatedClient,
160
+ body: EvaluateContentRequestModel,
161
+ ) -> HTTPValidationError | MultipleDecisionResultsResponseModel | None:
162
+ """Evaluate content against all policy versions in a tag.
163
+
164
+ Args:
165
+ tag_name (str):
166
+ body (EvaluateContentRequestModel):
167
+
168
+ Raises:
169
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
170
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
171
+
172
+ Returns:
173
+ HTTPValidationError | MultipleDecisionResultsResponseModel
174
+ """
175
+
176
+ return (
177
+ await asyncio_detailed(
178
+ tag_name=tag_name,
179
+ client=client,
180
+ body=body,
181
+ )
182
+ ).parsed