shaped 2.0.2__py3-none-any.whl → 2.0.4__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 (294) hide show
  1. shaped/__init__.py +47 -42
  2. shaped/autogen/__init__.py +37 -51
  3. shaped/autogen/api/engine_api.py +1 -1
  4. shaped/autogen/api/query_api.py +8 -68
  5. shaped/autogen/api/table_api.py +1 -1
  6. shaped/autogen/api/view_api.py +1 -1
  7. shaped/autogen/api_client.py +4 -4
  8. shaped/autogen/configuration.py +5 -3
  9. shaped/autogen/exceptions.py +7 -4
  10. shaped/autogen/models/__init__.py +19 -26
  11. shaped/autogen/models/ai_enrichment_view_config.py +1 -1
  12. shaped/autogen/models/algorithm.py +1 -1
  13. shaped/autogen/models/amplitude_table_config.py +1 -1
  14. shaped/autogen/models/ascending.py +29 -17
  15. shaped/autogen/models/attn_dropout_prob.py +1 -1
  16. shaped/autogen/models/attribute_journey.py +1 -1
  17. shaped/autogen/models/attribute_value.py +1 -1
  18. shaped/autogen/models/autoscaling_config.py +1 -1
  19. shaped/autogen/models/aws_pinpoint_table_config.py +1 -1
  20. shaped/autogen/models/batch_size.py +1 -1
  21. shaped/autogen/models/batch_size1.py +1 -1
  22. shaped/autogen/models/batch_size2.py +1 -1
  23. shaped/autogen/models/big_query_table_config.py +1 -1
  24. shaped/autogen/models/bm25.py +1 -1
  25. shaped/autogen/models/boosted_reorder_step.py +1 -1
  26. shaped/autogen/models/canary_rollout.py +1 -1
  27. shaped/autogen/models/candidate_attributes_retrieve_step.py +1 -14
  28. shaped/autogen/models/candidate_ids_retrieve_step.py +1 -1
  29. shaped/autogen/models/candidate_retrieval_strategy.py +1 -1
  30. shaped/autogen/models/clickhouse_table_config.py +1 -1
  31. shaped/autogen/models/column_order_retrieve_step.py +1 -1
  32. shaped/autogen/models/column_ordering.py +1 -1
  33. shaped/autogen/models/create_table_response.py +1 -1
  34. shaped/autogen/models/create_view_response.py +1 -1
  35. shaped/autogen/models/custom_table_config.py +1 -1
  36. shaped/autogen/models/data_compute_config.py +1 -1
  37. shaped/autogen/models/data_config.py +1 -1
  38. shaped/autogen/models/data_config_interaction_table.py +1 -1
  39. shaped/autogen/models/data_split_config.py +1 -1
  40. shaped/autogen/models/data_split_strategy.py +1 -1
  41. shaped/autogen/models/data_tier.py +1 -1
  42. shaped/autogen/models/default.py +1 -1
  43. shaped/autogen/models/delete_engine_response.py +1 -1
  44. shaped/autogen/models/delete_table_response.py +1 -1
  45. shaped/autogen/models/delete_view_response.py +1 -1
  46. shaped/autogen/models/deployment_config.py +2 -8
  47. shaped/autogen/models/distance_function.py +5 -5
  48. shaped/autogen/models/diversity_reorder_step.py +1 -1
  49. shaped/autogen/models/dropout_rate.py +1 -1
  50. shaped/autogen/models/dynamo_db_table_config.py +1 -1
  51. shaped/autogen/models/dynamo_db_table_config_scan_kwargs_value.py +1 -1
  52. shaped/autogen/models/embedder_batch_size.py +1 -1
  53. shaped/autogen/models/embedding_config.py +1 -1
  54. shaped/autogen/models/embedding_dim.py +1 -1
  55. shaped/autogen/models/embedding_dims.py +1 -1
  56. shaped/autogen/models/embedding_size.py +1 -1
  57. shaped/autogen/models/encoder.py +1 -1
  58. shaped/autogen/models/encoding_pooling_strategy.py +5 -5
  59. shaped/autogen/models/engine.py +1 -1
  60. shaped/autogen/models/engine_config_v2.py +1 -1
  61. shaped/autogen/models/engine_details_response.py +1 -1
  62. shaped/autogen/models/engine_schema.py +8 -8
  63. shaped/autogen/models/engine_schema_user_inner.py +30 -18
  64. shaped/autogen/models/entity_config.py +1 -1
  65. shaped/autogen/models/entity_journey.py +28 -19
  66. shaped/autogen/models/entity_type.py +1 -1
  67. shaped/autogen/models/evaluation_config.py +1 -1
  68. shaped/autogen/models/exploration_reorder_step.py +1 -1
  69. shaped/autogen/models/expression_filter_step.py +1 -1
  70. shaped/autogen/models/factors.py +1 -1
  71. shaped/autogen/models/factors1.py +1 -1
  72. shaped/autogen/models/feature.py +1 -1
  73. shaped/autogen/models/feature_type.py +1 -1
  74. shaped/autogen/models/file_table_config.py +1 -1
  75. shaped/autogen/models/filter_config.py +14 -14
  76. shaped/autogen/models/filter_dataset.py +47 -23
  77. shaped/autogen/models/filter_index_type.py +1 -1
  78. shaped/autogen/models/filter_retrieve_step.py +1 -1
  79. shaped/autogen/models/filter_step_explanation.py +165 -0
  80. shaped/autogen/models/filter_table.py +140 -0
  81. shaped/autogen/models/filter_type.py +134 -0
  82. shaped/autogen/models/global_filter.py +1 -1
  83. shaped/autogen/models/hidden_dropout_prob.py +1 -1
  84. shaped/autogen/models/hidden_size.py +1 -1
  85. shaped/autogen/models/hidden_size1.py +1 -1
  86. shaped/autogen/models/http_problem_response.py +1 -1
  87. shaped/autogen/models/http_validation_error.py +1 -1
  88. shaped/autogen/models/hugging_face_encoder.py +6 -4
  89. shaped/autogen/models/iceberg_table_config.py +1 -1
  90. shaped/autogen/models/index_config.py +1 -1
  91. shaped/autogen/models/inner_entity_id.py +144 -0
  92. shaped/autogen/models/inner_size.py +1 -1
  93. shaped/autogen/models/inner_size1.py +1 -1
  94. shaped/autogen/models/inner_uid.py +144 -0
  95. shaped/autogen/models/interaction_config.py +1 -1
  96. shaped/autogen/models/interaction_pooling_encoder.py +1 -1
  97. shaped/autogen/models/interaction_round_robin_encoder.py +1 -1
  98. shaped/autogen/models/item_attribute_pooling_encoder.py +1 -14
  99. shaped/autogen/models/journey.py +1 -1
  100. shaped/autogen/models/kafka_table_config.py +1 -1
  101. shaped/autogen/models/kinesis_table_config.py +1 -1
  102. shaped/autogen/models/kinesis_table_config_column_schema_value.py +1 -1
  103. shaped/autogen/models/label.py +1 -1
  104. shaped/autogen/models/label_type.py +1 -2
  105. shaped/autogen/models/laplace_smoothing.py +1 -1
  106. shaped/autogen/models/latency_scaling_policy.py +1 -1
  107. shaped/autogen/models/learning_rate.py +1 -1
  108. shaped/autogen/models/learning_rate1.py +1 -1
  109. shaped/autogen/models/learning_rate2.py +1 -1
  110. shaped/autogen/models/learning_rate3.py +1 -1
  111. shaped/autogen/models/lexical_search_mode.py +3 -3
  112. shaped/autogen/models/list_engines_response.py +1 -1
  113. shaped/autogen/models/list_tables_response.py +1 -1
  114. shaped/autogen/models/list_views_response.py +1 -1
  115. shaped/autogen/models/location_inner.py +138 -0
  116. shaped/autogen/models/loss_types.py +1 -1
  117. shaped/autogen/models/lr.py +1 -1
  118. shaped/autogen/models/lr1.py +1 -1
  119. shaped/autogen/models/lr2.py +1 -1
  120. shaped/autogen/models/max_depth.py +1 -1
  121. shaped/autogen/models/max_leaves.py +1 -1
  122. shaped/autogen/models/max_seq_length.py +1 -1
  123. shaped/autogen/models/max_seq_length1.py +1 -1
  124. shaped/autogen/models/max_seq_length2.py +1 -1
  125. shaped/autogen/models/mode.py +1 -1
  126. shaped/autogen/models/mode1.py +20 -18
  127. shaped/autogen/models/mode2.py +32 -18
  128. shaped/autogen/models/models_inner.py +308 -0
  129. shaped/autogen/models/mongo_db_table_config.py +1 -1
  130. shaped/autogen/models/mssql_table_config.py +1 -1
  131. shaped/autogen/models/my_sql_table_config.py +1 -1
  132. shaped/autogen/models/n_epochs.py +1 -1
  133. shaped/autogen/models/n_epochs1.py +1 -1
  134. shaped/autogen/models/n_epochs2.py +1 -1
  135. shaped/autogen/models/n_estimators.py +1 -1
  136. shaped/autogen/models/n_heads.py +1 -1
  137. shaped/autogen/models/n_layers.py +1 -1
  138. shaped/autogen/models/neg_per_positive.py +1 -1
  139. shaped/autogen/models/negative_samples_count.py +1 -1
  140. shaped/autogen/models/ngram_tokenizer.py +1 -1
  141. shaped/autogen/models/no_op_config.py +1 -1
  142. shaped/autogen/models/num_blocks.py +1 -1
  143. shaped/autogen/models/num_heads.py +1 -1
  144. shaped/autogen/models/num_leaves.py +1 -1
  145. shaped/autogen/models/objective.py +1 -1
  146. shaped/autogen/models/objective1.py +1 -1
  147. shaped/autogen/models/online_store_config.py +1 -1
  148. shaped/autogen/models/pagination_config.py +1 -1
  149. shaped/autogen/models/parameter_definition.py +1 -1
  150. shaped/autogen/models/parameters_value.py +1 -1
  151. shaped/autogen/models/passthrough_score.py +1 -1
  152. shaped/autogen/models/personal_filter.py +1 -1
  153. shaped/autogen/models/pipeline_stage_explanation.py +4 -4
  154. shaped/autogen/models/policy.py +1 -1
  155. shaped/autogen/models/pool_fn.py +39 -21
  156. shaped/autogen/models/pooling_function.py +1 -1
  157. shaped/autogen/models/postgres_table_config.py +1 -1
  158. shaped/autogen/models/posthog_table_config.py +1 -1
  159. shaped/autogen/models/prebuilt_filter_step.py +1 -1
  160. shaped/autogen/models/precomputed_item_embedding.py +1 -1
  161. shaped/autogen/models/precomputed_user_embedding.py +1 -1
  162. shaped/autogen/models/query.py +15 -15
  163. shaped/autogen/models/query1.py +15 -15
  164. shaped/autogen/models/query_any_of.py +58 -26
  165. shaped/autogen/models/query_config.py +140 -0
  166. shaped/autogen/models/query_definition.py +1 -1
  167. shaped/autogen/models/query_encoder.py +1 -1
  168. shaped/autogen/models/query_explanation.py +7 -3
  169. shaped/autogen/models/query_request.py +1 -1
  170. shaped/autogen/models/query_result.py +1 -1
  171. shaped/autogen/models/query_table_config.py +1 -1
  172. shaped/autogen/models/rank_item_attribute_values_query_config.py +1 -1
  173. shaped/autogen/models/rank_query_config.py +7 -7
  174. shaped/autogen/models/rank_query_config_filter_inner.py +1 -1
  175. shaped/autogen/models/rank_query_config_reorder_inner.py +62 -25
  176. shaped/autogen/models/rank_query_config_retrieve_inner.py +100 -31
  177. shaped/autogen/models/recreate_rollout.py +1 -1
  178. shaped/autogen/models/redshift_table_config.py +1 -1
  179. shaped/autogen/models/reference_table_config.py +1 -1
  180. shaped/autogen/models/regularization.py +1 -1
  181. shaped/autogen/models/reorder_inner.py +149 -0
  182. shaped/autogen/models/reorder_step_explanation.py +207 -0
  183. shaped/autogen/models/request.py +1 -1
  184. shaped/autogen/models/request1.py +1 -1
  185. shaped/autogen/models/requests_per_second_scaling_policy.py +1 -1
  186. shaped/autogen/models/resource_config.py +100 -0
  187. shaped/autogen/models/response_get_view_details_views_view_name_get.py +1 -1
  188. shaped/autogen/models/result.py +1 -14
  189. shaped/autogen/models/result_embeddings_value.py +1 -1
  190. shaped/autogen/models/retrieval_scores_value.py +127 -0
  191. shaped/autogen/models/retrieve_inner.py +196 -0
  192. shaped/autogen/models/retrieve_step_explanation.py +172 -0
  193. shaped/autogen/models/retriever.py +1 -1
  194. shaped/autogen/models/retriever1.py +1 -1
  195. shaped/autogen/models/rollout_config.py +1 -1
  196. shaped/autogen/models/rudderstack_table_config.py +1 -1
  197. shaped/autogen/models/sampling_strategy.py +1 -1
  198. shaped/autogen/models/saved_query_info_response.py +18 -4
  199. shaped/autogen/models/saved_query_list_response.py +1 -1
  200. shaped/autogen/models/saved_query_request.py +1 -1
  201. shaped/autogen/models/schema_config.py +1 -1
  202. shaped/autogen/models/score.py +1 -1
  203. shaped/autogen/models/score_ensemble.py +1 -14
  204. shaped/autogen/models/score_ensemble_policy_config.py +49 -25
  205. shaped/autogen/models/score_ensemble_policy_config_policies_inner.py +456 -123
  206. shaped/autogen/models/score_step_explanation.py +224 -0
  207. shaped/autogen/models/search_config.py +1 -1
  208. shaped/autogen/models/segment_table_config.py +1 -1
  209. shaped/autogen/models/sequence_length.py +1 -1
  210. shaped/autogen/models/server_config.py +14 -1
  211. shaped/autogen/models/setup_engine_response.py +1 -1
  212. shaped/autogen/models/shaped_internal_recsys_policies_als_model_policy_als_model_policy_config.py +9 -3
  213. shaped/autogen/models/shaped_internal_recsys_policies_beeformer_model_policy_beeformer_model_policy_beeformer_model_policy_config.py +9 -3
  214. shaped/autogen/models/shaped_internal_recsys_policies_bert_model_policy_bert_model_policy_bert_model_policy_config.py +10 -4
  215. shaped/autogen/models/shaped_internal_recsys_policies_chronological_model_policy_chronological_model_policy_config.py +46 -27
  216. shaped/autogen/models/shaped_internal_recsys_policies_elsa_model_policy_elsa_model_policy_elsa_model_policy_config.py +6 -4
  217. shaped/autogen/models/shaped_internal_recsys_policies_gsasrec_model_policy_gsasrec_model_policy_gsas_rec_model_policy_config.py +9 -3
  218. shaped/autogen/models/shaped_internal_recsys_policies_item2vec_model_policy_item2_vec_model_policy_config.py +1 -1
  219. shaped/autogen/models/shaped_internal_recsys_policies_item_content_similarity_model_policy_item_content_similarity_model_policy_config.py +77 -34
  220. shaped/autogen/models/shaped_internal_recsys_policies_lightgbm_model_policy_lightgbm_model_policy_light_gbm_model_policy_config.py +9 -3
  221. shaped/autogen/models/shaped_internal_recsys_policies_ngram_model_policy_ngram_model_policy_config.py +1 -1
  222. shaped/autogen/models/shaped_internal_recsys_policies_popular_model_policy_popular_model_policy_config.py +52 -28
  223. shaped/autogen/models/shaped_internal_recsys_policies_random_model_policy_random_model_policy_config.py +21 -17
  224. shaped/autogen/models/shaped_internal_recsys_policies_recently_popular_policy_recently_popular_policy_config.py +36 -23
  225. shaped/autogen/models/shaped_internal_recsys_policies_rising_popular_policy_rising_popular_policy_config.py +1 -1
  226. shaped/autogen/models/shaped_internal_recsys_policies_sasrec_model_policy_sasrec_model_policy_sas_rec_model_policy_config.py +9 -3
  227. shaped/autogen/models/shaped_internal_recsys_policies_svd_model_policy_svd_model_policy_config.py +1 -1
  228. shaped/autogen/models/shaped_internal_recsys_policies_two_tower_model_policy_two_tower_model_policy_two_tower_model_policy_config.py +9 -3
  229. shaped/autogen/models/shaped_internal_recsys_policies_user_item_content_similarity_model_policy_user_item_content_similarity_model_policy_config.py +53 -31
  230. shaped/autogen/models/shaped_internal_recsys_policies_widedeep_model_policy_wide_deep_model_policy_config.py +10 -4
  231. shaped/autogen/models/shaped_internal_recsys_policies_xgboost_model_policy_xg_boost_model_policy_config.py +12 -6
  232. shaped/autogen/models/shopify_table_config.py +1 -1
  233. shaped/autogen/models/similarity_retrieve_step.py +6 -4
  234. shaped/autogen/models/snowflake_table_config.py +1 -1
  235. shaped/autogen/models/sql_transform_type.py +1 -1
  236. shaped/autogen/models/sql_view_config.py +1 -1
  237. shaped/autogen/models/stemmer_tokenizer.py +1 -1
  238. shaped/autogen/models/step_explanation.py +1 -1
  239. shaped/autogen/models/steps_inner.py +179 -0
  240. shaped/autogen/models/strategy.py +1 -1
  241. shaped/autogen/models/table.py +1 -1
  242. shaped/autogen/models/table_deployment_type.py +1 -1
  243. shaped/autogen/models/table_insert_arguments.py +3 -3
  244. shaped/autogen/models/table_insert_response.py +1 -1
  245. shaped/autogen/models/text_encoding.py +29 -17
  246. shaped/autogen/models/text_search_retrieve_step.py +1 -1
  247. shaped/autogen/models/time_frequency.py +1 -1
  248. shaped/autogen/models/time_window.py +1 -1
  249. shaped/autogen/models/time_window_in_days.py +29 -17
  250. shaped/autogen/models/tokenizer.py +1 -1
  251. shaped/autogen/models/trained_model_encoder.py +1 -1
  252. shaped/autogen/models/training_compute_config.py +4 -4
  253. shaped/autogen/models/training_config.py +4 -4
  254. shaped/autogen/models/training_config_models_inner.py +325 -93
  255. shaped/autogen/models/training_strategy.py +1 -1
  256. shaped/autogen/models/transform_status.py +41 -0
  257. shaped/autogen/models/trending_mode.py +4 -4
  258. shaped/autogen/models/truncate_filter_step.py +1 -1
  259. shaped/autogen/models/tunable_bool.py +1 -1
  260. shaped/autogen/models/tunable_float.py +1 -1
  261. shaped/autogen/models/tunable_int.py +1 -1
  262. shaped/autogen/models/tunable_int_categorical.py +1 -1
  263. shaped/autogen/models/tunable_string.py +1 -1
  264. shaped/autogen/models/tuning_config.py +1 -1
  265. shaped/autogen/models/type.py +36 -20
  266. shaped/autogen/models/update_table_response.py +1 -1
  267. shaped/autogen/models/update_view_response.py +1 -1
  268. shaped/autogen/models/user_attribute_pooling_encoder.py +1 -1
  269. shaped/autogen/models/user_inner.py +134 -0
  270. shaped/autogen/models/val_split.py +1 -1
  271. shaped/autogen/models/validation_error.py +4 -4
  272. shaped/autogen/models/validation_error_loc_inner.py +28 -16
  273. shaped/autogen/models/value_type.py +1 -1
  274. shaped/autogen/models/vector_search_mode.py +6 -4
  275. shaped/autogen/models/view.py +4 -4
  276. shaped/autogen/models/view_details_ai.py +6 -6
  277. shaped/autogen/models/view_details_ai_schema_value.py +1 -1
  278. shaped/autogen/models/view_details_sql.py +6 -6
  279. shaped/autogen/models/view_status.py +8 -8
  280. shaped/autogen/models/weight_decay.py +1 -1
  281. shaped/autogen/models/whitespace_tokenizer.py +1 -1
  282. shaped/autogen/models/window_size.py +1 -1
  283. shaped/autogen/rest.py +9 -9
  284. shaped/cli/shaped_cli.py +152 -29
  285. shaped/client.py +50 -43
  286. shaped/config_builders.py +110 -100
  287. shaped/query_builder.py +56 -49
  288. {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/METADATA +2 -2
  289. shaped-2.0.4.dist-info/RECORD +296 -0
  290. {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/WHEEL +1 -1
  291. shaped-2.0.2.dist-info/RECORD +0 -278
  292. {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/entry_points.txt +0 -0
  293. {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/top_level.txt +0 -0
  294. {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/zip-safe +0 -0
@@ -0,0 +1,224 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Shaped API
5
+
6
+ Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
+
8
+ The version of the OpenAPI document: 2.0.4
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, StrictFloat, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from shaped.autogen.models.retrieval_scores_value import RetrievalScoresValue
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ScoreStepExplanation(BaseModel):
27
+ """
28
+ Explanation for a scoring step.
29
+ """ # noqa: E501
30
+ step_name: Optional[StrictStr] = None
31
+ step_type: Optional[StrictStr] = Field(default='', description="Type of step. Examples: 'column_order', 'similarity', 'text_search', 'prebuilt', 'expression', 'score_ensemble', 'diversity', etc.")
32
+ input_count: Optional[StrictInt] = None
33
+ output_count: Optional[StrictInt] = None
34
+ filtered_count: Optional[StrictInt] = None
35
+ execution_time_ms: Optional[Union[StrictFloat, StrictInt]] = None
36
+ metadata: Optional[Dict[str, Any]] = Field(default=None, description="Additional step-specific metadata. Contains implementation details specific to the step type.")
37
+ score_type: Optional[StrictStr] = None
38
+ value_model: Optional[StrictStr] = None
39
+ score_distribution: Optional[Dict[str, Union[StrictFloat, StrictInt]]] = None
40
+ items_scored: Optional[StrictInt] = None
41
+ scoring_policy_scores: Optional[Dict[str, List[Optional[RetrievalScoresValue]]]] = None
42
+ is_user_found_in_feature_store: Optional[StrictBool] = None
43
+ user_interaction_count: Optional[StrictInt] = None
44
+ user_feature_column_count: Optional[StrictInt] = None
45
+ item_feature_column_count: Optional[StrictInt] = None
46
+ candidate_item_features_count: Optional[StrictInt] = None
47
+ additional_properties: Dict[str, Any] = {}
48
+ __properties: ClassVar[List[str]] = ["step_name", "step_type", "input_count", "output_count", "filtered_count", "execution_time_ms", "metadata", "score_type", "value_model", "score_distribution", "items_scored", "scoring_policy_scores", "is_user_found_in_feature_store", "user_interaction_count", "user_feature_column_count", "item_feature_column_count", "candidate_item_features_count"]
49
+
50
+ model_config = ConfigDict(
51
+ populate_by_name=True,
52
+ validate_assignment=True,
53
+ protected_namespaces=(),
54
+ )
55
+
56
+
57
+ def to_str(self) -> str:
58
+ """Returns the string representation of the model using alias"""
59
+ return pprint.pformat(self.model_dump(by_alias=True))
60
+
61
+ def to_json(self) -> str:
62
+ """Returns the JSON representation of the model using alias"""
63
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
+ return json.dumps(self.to_dict())
65
+
66
+ @classmethod
67
+ def from_json(cls, json_str: str) -> Optional[Self]:
68
+ """Create an instance of ScoreStepExplanation from a JSON string"""
69
+ return cls.from_dict(json.loads(json_str))
70
+
71
+ def to_dict(self) -> Dict[str, Any]:
72
+ """Return the dictionary representation of the model using alias.
73
+
74
+ This has the following differences from calling pydantic's
75
+ `self.model_dump(by_alias=True)`:
76
+
77
+ * `None` is only added to the output dict for nullable fields that
78
+ were set at model initialization. Other fields with value `None`
79
+ are ignored.
80
+ * Fields in `self.additional_properties` are added to the output dict.
81
+ """
82
+ excluded_fields: Set[str] = set([
83
+ "additional_properties",
84
+ ])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # override the default output from pydantic by calling `to_dict()` of each value in scoring_policy_scores (dict of array)
92
+ _field_dict_of_array = {}
93
+ if self.scoring_policy_scores:
94
+ for _key_scoring_policy_scores in self.scoring_policy_scores:
95
+ if self.scoring_policy_scores[_key_scoring_policy_scores] is not None:
96
+ _field_dict_of_array[_key_scoring_policy_scores] = [
97
+ _item.to_dict() for _item in self.scoring_policy_scores[_key_scoring_policy_scores]
98
+ ]
99
+ _dict['scoring_policy_scores'] = _field_dict_of_array
100
+ # puts key-value pairs in additional_properties in the top level
101
+ if self.additional_properties is not None:
102
+ for _key, _value in self.additional_properties.items():
103
+ _dict[_key] = _value
104
+
105
+ # set to None if step_name (nullable) is None
106
+ # and model_fields_set contains the field
107
+ if self.step_name is None and "step_name" in self.model_fields_set:
108
+ _dict['step_name'] = None
109
+
110
+ # set to None if input_count (nullable) is None
111
+ # and model_fields_set contains the field
112
+ if self.input_count is None and "input_count" in self.model_fields_set:
113
+ _dict['input_count'] = None
114
+
115
+ # set to None if output_count (nullable) is None
116
+ # and model_fields_set contains the field
117
+ if self.output_count is None and "output_count" in self.model_fields_set:
118
+ _dict['output_count'] = None
119
+
120
+ # set to None if filtered_count (nullable) is None
121
+ # and model_fields_set contains the field
122
+ if self.filtered_count is None and "filtered_count" in self.model_fields_set:
123
+ _dict['filtered_count'] = None
124
+
125
+ # set to None if execution_time_ms (nullable) is None
126
+ # and model_fields_set contains the field
127
+ if self.execution_time_ms is None and "execution_time_ms" in self.model_fields_set:
128
+ _dict['execution_time_ms'] = None
129
+
130
+ # set to None if score_type (nullable) is None
131
+ # and model_fields_set contains the field
132
+ if self.score_type is None and "score_type" in self.model_fields_set:
133
+ _dict['score_type'] = None
134
+
135
+ # set to None if value_model (nullable) is None
136
+ # and model_fields_set contains the field
137
+ if self.value_model is None and "value_model" in self.model_fields_set:
138
+ _dict['value_model'] = None
139
+
140
+ # set to None if score_distribution (nullable) is None
141
+ # and model_fields_set contains the field
142
+ if self.score_distribution is None and "score_distribution" in self.model_fields_set:
143
+ _dict['score_distribution'] = None
144
+
145
+ # set to None if items_scored (nullable) is None
146
+ # and model_fields_set contains the field
147
+ if self.items_scored is None and "items_scored" in self.model_fields_set:
148
+ _dict['items_scored'] = None
149
+
150
+ # set to None if scoring_policy_scores (nullable) is None
151
+ # and model_fields_set contains the field
152
+ if self.scoring_policy_scores is None and "scoring_policy_scores" in self.model_fields_set:
153
+ _dict['scoring_policy_scores'] = None
154
+
155
+ # set to None if is_user_found_in_feature_store (nullable) is None
156
+ # and model_fields_set contains the field
157
+ if self.is_user_found_in_feature_store is None and "is_user_found_in_feature_store" in self.model_fields_set:
158
+ _dict['is_user_found_in_feature_store'] = None
159
+
160
+ # set to None if user_interaction_count (nullable) is None
161
+ # and model_fields_set contains the field
162
+ if self.user_interaction_count is None and "user_interaction_count" in self.model_fields_set:
163
+ _dict['user_interaction_count'] = None
164
+
165
+ # set to None if user_feature_column_count (nullable) is None
166
+ # and model_fields_set contains the field
167
+ if self.user_feature_column_count is None and "user_feature_column_count" in self.model_fields_set:
168
+ _dict['user_feature_column_count'] = None
169
+
170
+ # set to None if item_feature_column_count (nullable) is None
171
+ # and model_fields_set contains the field
172
+ if self.item_feature_column_count is None and "item_feature_column_count" in self.model_fields_set:
173
+ _dict['item_feature_column_count'] = None
174
+
175
+ # set to None if candidate_item_features_count (nullable) is None
176
+ # and model_fields_set contains the field
177
+ if self.candidate_item_features_count is None and "candidate_item_features_count" in self.model_fields_set:
178
+ _dict['candidate_item_features_count'] = None
179
+
180
+ return _dict
181
+
182
+ @classmethod
183
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
184
+ """Create an instance of ScoreStepExplanation from a dict"""
185
+ if obj is None:
186
+ return None
187
+
188
+ if not isinstance(obj, dict):
189
+ return cls.model_validate(obj)
190
+
191
+ _obj = cls.model_validate({
192
+ "step_name": obj.get("step_name"),
193
+ "step_type": obj.get("step_type") if obj.get("step_type") is not None else '',
194
+ "input_count": obj.get("input_count"),
195
+ "output_count": obj.get("output_count"),
196
+ "filtered_count": obj.get("filtered_count"),
197
+ "execution_time_ms": obj.get("execution_time_ms"),
198
+ "metadata": obj.get("metadata"),
199
+ "score_type": obj.get("score_type"),
200
+ "value_model": obj.get("value_model"),
201
+ "score_distribution": obj.get("score_distribution"),
202
+ "items_scored": obj.get("items_scored"),
203
+ "scoring_policy_scores": dict(
204
+ (_k,
205
+ [RetrievalScoresValue.from_dict(_item) for _item in _v]
206
+ if _v is not None
207
+ else None
208
+ )
209
+ for _k, _v in obj.get("scoring_policy_scores", {}).items()
210
+ ),
211
+ "is_user_found_in_feature_store": obj.get("is_user_found_in_feature_store"),
212
+ "user_interaction_count": obj.get("user_interaction_count"),
213
+ "user_feature_column_count": obj.get("user_feature_column_count"),
214
+ "item_feature_column_count": obj.get("item_feature_column_count"),
215
+ "candidate_item_features_count": obj.get("candidate_item_features_count")
216
+ })
217
+ # store additional fields in additional_properties
218
+ for _key in obj.keys():
219
+ if _key not in cls.__properties:
220
+ _obj.additional_properties[_key] = obj.get(_key)
221
+
222
+ return _obj
223
+
224
+
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -27,6 +27,7 @@ class ServerConfig(BaseModel):
27
27
  Low-level configuration for the inference server process.
28
28
  """ # noqa: E501
29
29
  worker_count: Optional[StrictInt] = Field(default=1, description="Number of worker processes per inference pod.")
30
+ additional_properties: Dict[str, Any] = {}
30
31
  __properties: ClassVar[List[str]] = ["worker_count"]
31
32
 
32
33
  model_config = ConfigDict(
@@ -59,8 +60,10 @@ class ServerConfig(BaseModel):
59
60
  * `None` is only added to the output dict for nullable fields that
60
61
  were set at model initialization. Other fields with value `None`
61
62
  are ignored.
63
+ * Fields in `self.additional_properties` are added to the output dict.
62
64
  """
63
65
  excluded_fields: Set[str] = set([
66
+ "additional_properties",
64
67
  ])
65
68
 
66
69
  _dict = self.model_dump(
@@ -68,6 +71,11 @@ class ServerConfig(BaseModel):
68
71
  exclude=excluded_fields,
69
72
  exclude_none=True,
70
73
  )
74
+ # puts key-value pairs in additional_properties in the top level
75
+ if self.additional_properties is not None:
76
+ for _key, _value in self.additional_properties.items():
77
+ _dict[_key] = _value
78
+
71
79
  return _dict
72
80
 
73
81
  @classmethod
@@ -82,6 +90,11 @@ class ServerConfig(BaseModel):
82
90
  _obj = cls.model_validate({
83
91
  "worker_count": obj.get("worker_count") if obj.get("worker_count") is not None else 1
84
92
  })
93
+ # store additional fields in additional_properties
94
+ for _key in obj.keys():
95
+ if _key not in cls.__properties:
96
+ _obj.additional_properties[_key] = obj.get(_key)
97
+
85
98
  return _obj
86
99
 
87
100
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -38,8 +38,11 @@ class ShapedInternalRecsysPoliciesAlsModelPolicyALSModelPolicyConfig(BaseModel):
38
38
  bm25_k1: Optional[Union[StrictFloat, StrictInt]] = Field(default=1.2, description="BM25 coefficient for item frequency factor.")
39
39
  bm25_b: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.75, description="BM25 coefficient for document length factor.")
40
40
  use_features: Optional[StrictBool] = Field(default=False, description="Whether to use entity features in the model.")
41
+ normalize_numerical_features: Optional[StrictBool] = Field(default=False, description="Enable NormalizeNumerical transform for entity features.")
42
+ use_derived_timestamp_features: Optional[StrictBool] = Field(default=False, description="Enable TimestampSinCosEncoder and TimestampCountEncoder for entity features.")
43
+ balance_labels: Optional[StrictBool] = Field(default=False, description="Enable BalanceLabel transform for interactions.")
41
44
  additional_properties: Dict[str, Any] = {}
42
- __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "factors", "regularization", "bm25", "bm25_k1", "bm25_b", "use_features"]
45
+ __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "factors", "regularization", "bm25", "bm25_k1", "bm25_b", "use_features", "normalize_numerical_features", "use_derived_timestamp_features", "balance_labels"]
43
46
 
44
47
  @field_validator('policy_type')
45
48
  def policy_type_validate_enum(cls, value):
@@ -136,7 +139,10 @@ class ShapedInternalRecsysPoliciesAlsModelPolicyALSModelPolicyConfig(BaseModel):
136
139
  "bm25": Bm25.from_dict(obj["bm25"]) if obj.get("bm25") is not None else None,
137
140
  "bm25_k1": obj.get("bm25_k1") if obj.get("bm25_k1") is not None else 1.2,
138
141
  "bm25_b": obj.get("bm25_b") if obj.get("bm25_b") is not None else 0.75,
139
- "use_features": obj.get("use_features") if obj.get("use_features") is not None else False
142
+ "use_features": obj.get("use_features") if obj.get("use_features") is not None else False,
143
+ "normalize_numerical_features": obj.get("normalize_numerical_features") if obj.get("normalize_numerical_features") is not None else False,
144
+ "use_derived_timestamp_features": obj.get("use_derived_timestamp_features") if obj.get("use_derived_timestamp_features") is not None else False,
145
+ "balance_labels": obj.get("balance_labels") if obj.get("balance_labels") is not None else False
140
146
  })
141
147
  # store additional fields in additional_properties
142
148
  for _key in obj.keys():
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -45,7 +45,10 @@ class ShapedInternalRecsysPoliciesBeeformerModelPolicyBeeformerModelPolicyBeefor
45
45
  max_seq_length: Optional[MaxSeqLength] = None
46
46
  embedder_batch_size: Optional[EmbedderBatchSize] = None
47
47
  train_distributed: Optional[StrictBool] = Field(default=False, description="Train on multiple devices.")
48
- __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "device", "seed", "lr", "use_scheduler", "epochs", "max_output", "batch_size", "top_k", "embedder", "use_images", "max_seq_length", "embedder_batch_size", "train_distributed"]
48
+ normalize_numerical_features: Optional[StrictBool] = Field(default=False, description="Enable NormalizeNumerical transform for entity features.")
49
+ use_derived_timestamp_features: Optional[StrictBool] = Field(default=False, description="Enable TimestampSinCosEncoder and TimestampCountEncoder for entity features.")
50
+ balance_labels: Optional[StrictBool] = Field(default=False, description="Enable BalanceLabel transform for interactions.")
51
+ __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "device", "seed", "lr", "use_scheduler", "epochs", "max_output", "batch_size", "top_k", "embedder", "use_images", "max_seq_length", "embedder_batch_size", "train_distributed", "normalize_numerical_features", "use_derived_timestamp_features", "balance_labels"]
49
52
 
50
53
  @field_validator('policy_type')
51
54
  def policy_type_validate_enum(cls, value):
@@ -147,7 +150,10 @@ class ShapedInternalRecsysPoliciesBeeformerModelPolicyBeeformerModelPolicyBeefor
147
150
  "use_images": obj.get("use_images") if obj.get("use_images") is not None else False,
148
151
  "max_seq_length": MaxSeqLength.from_dict(obj["max_seq_length"]) if obj.get("max_seq_length") is not None else None,
149
152
  "embedder_batch_size": EmbedderBatchSize.from_dict(obj["embedder_batch_size"]) if obj.get("embedder_batch_size") is not None else None,
150
- "train_distributed": obj.get("train_distributed") if obj.get("train_distributed") is not None else False
153
+ "train_distributed": obj.get("train_distributed") if obj.get("train_distributed") is not None else False,
154
+ "normalize_numerical_features": obj.get("normalize_numerical_features") if obj.get("normalize_numerical_features") is not None else False,
155
+ "use_derived_timestamp_features": obj.get("use_derived_timestamp_features") if obj.get("use_derived_timestamp_features") is not None else False,
156
+ "balance_labels": obj.get("balance_labels") if obj.get("balance_labels") is not None else False
151
157
  })
152
158
  return _obj
153
159
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -17,7 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional, Union
22
22
  from shaped.autogen.models.attn_dropout_prob import AttnDropoutProb
23
23
  from shaped.autogen.models.batch_size import BatchSize
@@ -64,7 +64,10 @@ class ShapedInternalRecsysPoliciesBertModelPolicyBertModelPolicyBERTModelPolicyC
64
64
  sample_ratio: Optional[Union[StrictFloat, StrictInt]] = 0.8
65
65
  eval_step: Optional[StrictInt] = 1
66
66
  early_stopping_step: Optional[StrictInt] = 5
67
- __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "batch_size", "eval_batch_size", "n_epochs", "negative_samples_count", "device", "hidden_size", "inner_size", "learning_rate", "attn_dropout_prob", "hidden_act", "hidden_dropout_prob", "n_heads", "n_layers", "layer_norm_eps", "initializer_range", "mask_rate", "loss_type", "max_seq_length", "sample_strategy", "sample_seed", "sample_ratio", "eval_step", "early_stopping_step"]
67
+ normalize_numerical_features: Optional[StrictBool] = Field(default=True, description="Enable NormalizeNumerical transform for entity features.")
68
+ use_derived_timestamp_features: Optional[StrictBool] = Field(default=True, description="Enable TimestampSinCosEncoder and TimestampCountEncoder for entity features.")
69
+ balance_labels: Optional[StrictBool] = Field(default=True, description="Enable BalanceLabel transform for interactions.")
70
+ __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "batch_size", "eval_batch_size", "n_epochs", "negative_samples_count", "device", "hidden_size", "inner_size", "learning_rate", "attn_dropout_prob", "hidden_act", "hidden_dropout_prob", "n_heads", "n_layers", "layer_norm_eps", "initializer_range", "mask_rate", "loss_type", "max_seq_length", "sample_strategy", "sample_seed", "sample_ratio", "eval_step", "early_stopping_step", "normalize_numerical_features", "use_derived_timestamp_features", "balance_labels"]
68
71
 
69
72
  @field_validator('policy_type')
70
73
  def policy_type_validate_enum(cls, value):
@@ -202,7 +205,10 @@ class ShapedInternalRecsysPoliciesBertModelPolicyBertModelPolicyBERTModelPolicyC
202
205
  "sample_seed": obj.get("sample_seed") if obj.get("sample_seed") is not None else 42,
203
206
  "sample_ratio": obj.get("sample_ratio") if obj.get("sample_ratio") is not None else 0.8,
204
207
  "eval_step": obj.get("eval_step") if obj.get("eval_step") is not None else 1,
205
- "early_stopping_step": obj.get("early_stopping_step") if obj.get("early_stopping_step") is not None else 5
208
+ "early_stopping_step": obj.get("early_stopping_step") if obj.get("early_stopping_step") is not None else 5,
209
+ "normalize_numerical_features": obj.get("normalize_numerical_features") if obj.get("normalize_numerical_features") is not None else True,
210
+ "use_derived_timestamp_features": obj.get("use_derived_timestamp_features") if obj.get("use_derived_timestamp_features") is not None else True,
211
+ "balance_labels": obj.get("balance_labels") if obj.get("balance_labels") is not None else True
206
212
  })
207
213
  return _obj
208
214
 
@@ -13,35 +13,45 @@
13
13
 
14
14
 
15
15
  from __future__ import annotations
16
+
17
+ import json
16
18
  import pprint
17
19
  import re # noqa: F401
18
- import json
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
21
 
20
22
  from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
23
  from shaped.autogen.models.ascending import Ascending
23
- from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
 
26
- class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPolicyConfig(BaseModel):
26
+
27
+ class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPolicyConfig(
28
+ BaseModel
29
+ ):
27
30
  """
28
31
  ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPolicyConfig
29
- """ # noqa: E501
30
- policy_type: Optional[StrictStr] = 'chronological'
32
+ """ # noqa: E501
33
+
34
+ policy_type: Optional[StrictStr] = "chronological"
31
35
  name: Optional[StrictStr] = None
32
36
  event_values: Optional[List[StrictStr]] = None
33
37
  time_col: Optional[StrictStr] = None
34
38
  ascending: Optional[Ascending] = None
35
39
  additional_properties: Dict[str, Any] = {}
36
- __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "time_col", "ascending"]
37
-
38
- @field_validator('policy_type')
40
+ __properties: ClassVar[List[str]] = [
41
+ "policy_type",
42
+ "name",
43
+ "event_values",
44
+ "time_col",
45
+ "ascending",
46
+ ]
47
+
48
+ @field_validator("policy_type")
39
49
  def policy_type_validate_enum(cls, value):
40
50
  """Validates the enum"""
41
51
  if value is None:
42
52
  return value
43
53
 
44
- if value not in set(['chronological']):
54
+ if value not in set(["chronological"]):
45
55
  raise ValueError("must be one of enum values ('chronological')")
46
56
  return value
47
57
 
@@ -51,7 +61,6 @@ class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPoli
51
61
  protected_namespaces=(),
52
62
  )
53
63
 
54
-
55
64
  def to_str(self) -> str:
56
65
  """Returns the string representation of the model using alias"""
57
66
  return pprint.pformat(self.model_dump(by_alias=True))
@@ -77,9 +86,11 @@ class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPoli
77
86
  are ignored.
78
87
  * Fields in `self.additional_properties` are added to the output dict.
79
88
  """
80
- excluded_fields: Set[str] = set([
81
- "additional_properties",
82
- ])
89
+ excluded_fields: Set[str] = set(
90
+ [
91
+ "additional_properties",
92
+ ]
93
+ )
83
94
 
84
95
  _dict = self.model_dump(
85
96
  by_alias=True,
@@ -88,7 +99,7 @@ class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPoli
88
99
  )
89
100
  # override the default output from pydantic by calling `to_dict()` of ascending
90
101
  if self.ascending:
91
- _dict['ascending'] = self.ascending.to_dict()
102
+ _dict["ascending"] = self.ascending.to_dict()
92
103
  # puts key-value pairs in additional_properties in the top level
93
104
  if self.additional_properties is not None:
94
105
  for _key, _value in self.additional_properties.items():
@@ -97,17 +108,17 @@ class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPoli
97
108
  # set to None if name (nullable) is None
98
109
  # and model_fields_set contains the field
99
110
  if self.name is None and "name" in self.model_fields_set:
100
- _dict['name'] = None
111
+ _dict["name"] = None
101
112
 
102
113
  # set to None if event_values (nullable) is None
103
114
  # and model_fields_set contains the field
104
115
  if self.event_values is None and "event_values" in self.model_fields_set:
105
- _dict['event_values'] = None
116
+ _dict["event_values"] = None
106
117
 
107
118
  # set to None if time_col (nullable) is None
108
119
  # and model_fields_set contains the field
109
120
  if self.time_col is None and "time_col" in self.model_fields_set:
110
- _dict['time_col'] = None
121
+ _dict["time_col"] = None
111
122
 
112
123
  return _dict
113
124
 
@@ -120,18 +131,26 @@ class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPoli
120
131
  if not isinstance(obj, dict):
121
132
  return cls.model_validate(obj)
122
133
 
123
- _obj = cls.model_validate({
124
- "policy_type": obj.get("policy_type") if obj.get("policy_type") is not None else 'chronological',
125
- "name": obj.get("name"),
126
- "event_values": obj.get("event_values"),
127
- "time_col": obj.get("time_col"),
128
- "ascending": Ascending.from_dict(obj["ascending"]) if obj.get("ascending") is not None else None
129
- })
134
+ _obj = cls.model_validate(
135
+ {
136
+ "policy_type": (
137
+ obj.get("policy_type")
138
+ if obj.get("policy_type") is not None
139
+ else "chronological"
140
+ ),
141
+ "name": obj.get("name"),
142
+ "event_values": obj.get("event_values"),
143
+ "time_col": obj.get("time_col"),
144
+ "ascending": (
145
+ Ascending.from_dict(obj["ascending"])
146
+ if obj.get("ascending") is not None
147
+ else None
148
+ ),
149
+ }
150
+ )
130
151
  # store additional fields in additional_properties
131
152
  for _key in obj.keys():
132
153
  if _key not in cls.__properties:
133
154
  _obj.additional_properties[_key] = obj.get(_key)
134
155
 
135
156
  return _obj
136
-
137
-
@@ -5,7 +5,7 @@
5
5
 
6
6
  Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 2.0.4
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -17,7 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from shaped.autogen.models.factors import Factors
23
23
  from shaped.autogen.models.lr1 import Lr1
@@ -39,7 +39,8 @@ class ShapedInternalRecsysPoliciesElsaModelPolicyElsaModelPolicyELSAModelPolicyC
39
39
  device: Optional[StrictStr] = None
40
40
  strategy: Optional[TrainingStrategy] = None
41
41
  patience: Optional[StrictInt] = Field(default=3, description="Number of epochs to wait without improvement before early stopping.")
42
- __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "batch_size", "n_epochs", "factors", "lr", "device", "strategy", "patience"]
42
+ balance_labels: Optional[StrictBool] = Field(default=True, description="Enable BalanceLabel transform for interactions.")
43
+ __properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "batch_size", "n_epochs", "factors", "lr", "device", "strategy", "patience", "balance_labels"]
43
44
 
44
45
  @field_validator('policy_type')
45
46
  def policy_type_validate_enum(cls, value):
@@ -132,7 +133,8 @@ class ShapedInternalRecsysPoliciesElsaModelPolicyElsaModelPolicyELSAModelPolicyC
132
133
  "lr": Lr1.from_dict(obj["lr"]) if obj.get("lr") is not None else None,
133
134
  "device": obj.get("device"),
134
135
  "strategy": obj.get("strategy"),
135
- "patience": obj.get("patience") if obj.get("patience") is not None else 3
136
+ "patience": obj.get("patience") if obj.get("patience") is not None else 3,
137
+ "balance_labels": obj.get("balance_labels") if obj.get("balance_labels") is not None else True
136
138
  })
137
139
  return _obj
138
140