shaped 2.0.1__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.
- shaped/__init__.py +59 -4
- shaped/autogen/__init__.py +527 -66
- shaped/autogen/api/__init__.py +4 -3
- shaped/autogen/api/engine_api.py +1467 -0
- shaped/autogen/api/{dataset_api.py → query_api.py} +159 -194
- shaped/autogen/api/table_api.py +1494 -0
- shaped/autogen/api/{model_management_api.py → view_api.py} +179 -181
- shaped/autogen/api_client.py +18 -11
- shaped/autogen/configuration.py +22 -9
- shaped/autogen/exceptions.py +25 -5
- shaped/autogen/models/__init__.py +247 -52
- shaped/autogen/models/ai_enrichment_view_config.py +123 -0
- shaped/autogen/models/{path.py → algorithm.py} +19 -19
- shaped/autogen/models/amplitude_table_config.py +106 -0
- shaped/autogen/models/ascending.py +148 -0
- shaped/autogen/models/attn_dropout_prob.py +136 -0
- shaped/autogen/models/attribute_journey.py +124 -0
- shaped/autogen/models/attribute_value.py +178 -0
- shaped/autogen/models/autoscaling_config.py +95 -0
- shaped/autogen/models/aws_pinpoint_table_config.py +108 -0
- shaped/autogen/models/batch_size.py +136 -0
- shaped/autogen/models/batch_size1.py +136 -0
- shaped/autogen/models/batch_size2.py +136 -0
- shaped/autogen/models/big_query_table_config.py +147 -0
- shaped/autogen/models/bm25.py +136 -0
- shaped/autogen/models/boosted_reorder_step.py +125 -0
- shaped/autogen/models/canary_rollout.py +99 -0
- shaped/autogen/models/candidate_attributes_retrieve_step.py +113 -0
- shaped/autogen/models/candidate_ids_retrieve_step.py +113 -0
- shaped/autogen/models/candidate_retrieval_strategy.py +41 -0
- shaped/autogen/models/clickhouse_table_config.py +146 -0
- shaped/autogen/models/column_order_retrieve_step.py +123 -0
- shaped/autogen/models/column_ordering.py +91 -0
- shaped/autogen/models/create_table_response.py +87 -0
- shaped/autogen/models/create_view_response.py +87 -0
- shaped/autogen/models/custom_table_config.py +135 -0
- shaped/autogen/models/data_compute_config.py +89 -0
- shaped/autogen/models/data_config.py +145 -0
- shaped/autogen/models/data_config_interaction_table.py +146 -0
- shaped/autogen/models/data_split_config.py +88 -0
- shaped/autogen/models/data_split_strategy.py +37 -0
- shaped/autogen/models/data_tier.py +37 -0
- shaped/autogen/models/default.py +246 -0
- shaped/autogen/models/delete_engine_response.py +87 -0
- shaped/autogen/models/delete_table_response.py +87 -0
- shaped/autogen/models/delete_view_response.py +87 -0
- shaped/autogen/models/deployment_config.py +117 -0
- shaped/autogen/models/distance_function.py +38 -0
- shaped/autogen/models/diversity_reorder_step.py +137 -0
- shaped/autogen/models/dropout_rate.py +136 -0
- shaped/autogen/models/dynamo_db_table_config.py +160 -0
- shaped/autogen/models/dynamo_db_table_config_scan_kwargs_value.py +138 -0
- shaped/autogen/models/embedder_batch_size.py +136 -0
- shaped/autogen/models/embedding_config.py +93 -0
- shaped/autogen/models/embedding_dim.py +136 -0
- shaped/autogen/models/embedding_dims.py +136 -0
- shaped/autogen/models/embedding_size.py +136 -0
- shaped/autogen/models/encoder.py +140 -0
- shaped/autogen/models/encoding_pooling_strategy.py +38 -0
- shaped/autogen/models/engine.py +109 -0
- shaped/autogen/models/engine_config_v2.py +152 -0
- shaped/autogen/models/engine_details_response.py +120 -0
- shaped/autogen/models/engine_schema.py +113 -0
- shaped/autogen/models/engine_schema_user_inner.py +146 -0
- shaped/autogen/models/entity_config.py +109 -0
- shaped/autogen/models/entity_journey.py +161 -0
- shaped/autogen/models/entity_type.py +38 -0
- shaped/autogen/models/evaluation_config.py +92 -0
- shaped/autogen/models/exploration_reorder_step.py +125 -0
- shaped/autogen/models/expression_filter_step.py +106 -0
- shaped/autogen/models/factors.py +136 -0
- shaped/autogen/models/factors1.py +136 -0
- shaped/autogen/models/feature.py +90 -0
- shaped/autogen/models/feature_type.py +60 -0
- shaped/autogen/models/file_table_config.py +112 -0
- shaped/autogen/models/filter_config.py +99 -0
- shaped/autogen/models/filter_dataset.py +164 -0
- shaped/autogen/models/filter_index_type.py +36 -0
- shaped/autogen/models/filter_retrieve_step.py +113 -0
- shaped/autogen/models/filter_step_explanation.py +165 -0
- shaped/autogen/models/filter_table.py +140 -0
- shaped/autogen/models/filter_type.py +134 -0
- shaped/autogen/models/global_filter.py +102 -0
- shaped/autogen/models/hidden_dropout_prob.py +136 -0
- shaped/autogen/models/hidden_size.py +136 -0
- shaped/autogen/models/hidden_size1.py +136 -0
- shaped/autogen/models/http_problem_response.py +115 -0
- shaped/autogen/models/http_validation_error.py +2 -2
- shaped/autogen/models/hugging_face_encoder.py +115 -0
- shaped/autogen/models/iceberg_table_config.py +154 -0
- shaped/autogen/models/index_config.py +101 -0
- shaped/autogen/models/inner_entity_id.py +144 -0
- shaped/autogen/models/inner_size.py +136 -0
- shaped/autogen/models/inner_size1.py +136 -0
- shaped/autogen/models/inner_uid.py +144 -0
- shaped/autogen/models/interaction_config.py +122 -0
- shaped/autogen/models/interaction_pooling_encoder.py +104 -0
- shaped/autogen/models/interaction_round_robin_encoder.py +104 -0
- shaped/autogen/models/item_attribute_pooling_encoder.py +111 -0
- shaped/autogen/models/journey.py +140 -0
- shaped/autogen/models/kafka_table_config.py +129 -0
- shaped/autogen/models/kinesis_table_config.py +140 -0
- shaped/autogen/models/kinesis_table_config_column_schema_value.py +136 -0
- shaped/autogen/models/label.py +90 -0
- shaped/autogen/models/label_type.py +36 -0
- shaped/autogen/models/laplace_smoothing.py +136 -0
- shaped/autogen/models/latency_scaling_policy.py +112 -0
- shaped/autogen/models/learning_rate.py +136 -0
- shaped/autogen/models/learning_rate1.py +136 -0
- shaped/autogen/models/learning_rate2.py +136 -0
- shaped/autogen/models/learning_rate3.py +136 -0
- shaped/autogen/models/lexical_search_mode.py +99 -0
- shaped/autogen/models/list_engines_response.py +95 -0
- shaped/autogen/models/list_tables_response.py +95 -0
- shaped/autogen/models/list_views_response.py +95 -0
- shaped/autogen/models/location_inner.py +138 -0
- shaped/autogen/models/loss_types.py +37 -0
- shaped/autogen/models/lr.py +136 -0
- shaped/autogen/models/lr1.py +136 -0
- shaped/autogen/models/lr2.py +136 -0
- shaped/autogen/models/max_depth.py +136 -0
- shaped/autogen/models/max_leaves.py +136 -0
- shaped/autogen/models/max_seq_length.py +136 -0
- shaped/autogen/models/max_seq_length1.py +136 -0
- shaped/autogen/models/max_seq_length2.py +136 -0
- shaped/autogen/models/mode.py +134 -0
- shaped/autogen/models/mode1.py +136 -0
- shaped/autogen/models/mode2.py +150 -0
- shaped/autogen/models/models_inner.py +308 -0
- shaped/autogen/models/mongo_db_table_config.py +147 -0
- shaped/autogen/models/mssql_table_config.py +155 -0
- shaped/autogen/models/{my_sql_dataset_config.py → my_sql_table_config.py} +45 -28
- shaped/autogen/models/n_epochs.py +136 -0
- shaped/autogen/models/n_epochs1.py +136 -0
- shaped/autogen/models/n_epochs2.py +136 -0
- shaped/autogen/models/n_estimators.py +136 -0
- shaped/autogen/models/n_heads.py +136 -0
- shaped/autogen/models/n_layers.py +136 -0
- shaped/autogen/models/neg_per_positive.py +136 -0
- shaped/autogen/models/negative_samples_count.py +136 -0
- shaped/autogen/models/ngram_tokenizer.py +103 -0
- shaped/autogen/models/no_op_config.py +117 -0
- shaped/autogen/models/num_blocks.py +136 -0
- shaped/autogen/models/num_heads.py +136 -0
- shaped/autogen/models/num_leaves.py +136 -0
- shaped/autogen/models/objective.py +40 -0
- shaped/autogen/models/objective1.py +134 -0
- shaped/autogen/models/online_store_config.py +89 -0
- shaped/autogen/models/pagination_config.py +87 -0
- shaped/autogen/models/parameter_definition.py +96 -0
- shaped/autogen/models/parameters_value.py +240 -0
- shaped/autogen/models/passthrough_score.py +104 -0
- shaped/autogen/models/personal_filter.py +104 -0
- shaped/autogen/models/pipeline_stage_explanation.py +118 -0
- shaped/autogen/models/policy.py +134 -0
- shaped/autogen/models/pool_fn.py +152 -0
- shaped/autogen/models/pooling_function.py +37 -0
- shaped/autogen/models/{postgres_dataset_config.py → postgres_table_config.py} +66 -28
- shaped/autogen/models/posthog_table_config.py +133 -0
- shaped/autogen/models/prebuilt_filter_step.py +113 -0
- shaped/autogen/models/precomputed_item_embedding.py +99 -0
- shaped/autogen/models/precomputed_user_embedding.py +99 -0
- shaped/autogen/models/query.py +136 -0
- shaped/autogen/models/query1.py +136 -0
- shaped/autogen/models/query_any_of.py +172 -0
- shaped/autogen/models/query_config.py +140 -0
- shaped/autogen/models/query_definition.py +106 -0
- shaped/autogen/models/query_encoder.py +194 -0
- shaped/autogen/models/query_explanation.py +201 -0
- shaped/autogen/models/query_request.py +121 -0
- shaped/autogen/models/query_result.py +113 -0
- shaped/autogen/models/query_table_config.py +99 -0
- shaped/autogen/models/rank_item_attribute_values_query_config.py +122 -0
- shaped/autogen/models/rank_query_config.py +167 -0
- shaped/autogen/models/rank_query_config_filter_inner.py +149 -0
- shaped/autogen/models/rank_query_config_reorder_inner.py +186 -0
- shaped/autogen/models/rank_query_config_retrieve_inner.py +265 -0
- shaped/autogen/models/recreate_rollout.py +97 -0
- shaped/autogen/models/{redshift_dataset_config.py → redshift_table_config.py} +48 -25
- shaped/autogen/models/reference_table_config.py +113 -0
- shaped/autogen/models/regularization.py +136 -0
- shaped/autogen/models/reorder_inner.py +149 -0
- shaped/autogen/models/reorder_step_explanation.py +207 -0
- shaped/autogen/models/request.py +378 -0
- shaped/autogen/models/request1.py +140 -0
- shaped/autogen/models/requests_per_second_scaling_policy.py +112 -0
- shaped/autogen/models/resource_config.py +100 -0
- shaped/autogen/models/response_get_view_details_views_view_name_get.py +134 -0
- shaped/autogen/models/result.py +132 -0
- shaped/autogen/models/result_embeddings_value.py +127 -0
- shaped/autogen/models/retrieval_scores_value.py +127 -0
- shaped/autogen/models/retrieve_inner.py +196 -0
- shaped/autogen/models/retrieve_step_explanation.py +172 -0
- shaped/autogen/models/retriever.py +196 -0
- shaped/autogen/models/retriever1.py +196 -0
- shaped/autogen/models/rollout_config.py +91 -0
- shaped/autogen/models/rudderstack_table_config.py +106 -0
- shaped/autogen/models/sampling_strategy.py +36 -0
- shaped/autogen/models/saved_query_info_response.py +103 -0
- shaped/autogen/models/saved_query_list_response.py +87 -0
- shaped/autogen/models/saved_query_request.py +115 -0
- shaped/autogen/models/schema_config.py +117 -0
- shaped/autogen/models/score.py +134 -0
- shaped/autogen/models/score_ensemble.py +127 -0
- shaped/autogen/models/score_ensemble_policy_config.py +165 -0
- shaped/autogen/models/score_ensemble_policy_config_policies_inner.py +755 -0
- shaped/autogen/models/score_step_explanation.py +224 -0
- shaped/autogen/models/search_config.py +105 -0
- shaped/autogen/models/segment_table_config.py +106 -0
- shaped/autogen/models/sequence_length.py +136 -0
- shaped/autogen/models/server_config.py +100 -0
- shaped/autogen/models/setup_engine_response.py +87 -0
- shaped/autogen/models/shaped_internal_recsys_policies_als_model_policy_als_model_policy_config.py +154 -0
- shaped/autogen/models/shaped_internal_recsys_policies_beeformer_model_policy_beeformer_model_policy_beeformer_model_policy_config.py +160 -0
- shaped/autogen/models/shaped_internal_recsys_policies_bert_model_policy_bert_model_policy_bert_model_policy_config.py +215 -0
- shaped/autogen/models/shaped_internal_recsys_policies_chronological_model_policy_chronological_model_policy_config.py +156 -0
- shaped/autogen/models/shaped_internal_recsys_policies_elsa_model_policy_elsa_model_policy_elsa_model_policy_config.py +141 -0
- shaped/autogen/models/shaped_internal_recsys_policies_gsasrec_model_policy_gsasrec_model_policy_gsas_rec_model_policy_config.py +211 -0
- shaped/autogen/models/shaped_internal_recsys_policies_item2vec_model_policy_item2_vec_model_policy_config.py +140 -0
- shaped/autogen/models/shaped_internal_recsys_policies_item_content_similarity_model_policy_item_content_similarity_model_policy_config.py +195 -0
- shaped/autogen/models/shaped_internal_recsys_policies_lightgbm_model_policy_lightgbm_model_policy_light_gbm_model_policy_config.py +245 -0
- shaped/autogen/models/shaped_internal_recsys_policies_ngram_model_policy_ngram_model_policy_config.py +119 -0
- shaped/autogen/models/shaped_internal_recsys_policies_popular_model_policy_popular_model_policy_config.py +161 -0
- shaped/autogen/models/shaped_internal_recsys_policies_random_model_policy_random_model_policy_config.py +108 -0
- shaped/autogen/models/shaped_internal_recsys_policies_recently_popular_policy_recently_popular_policy_config.py +143 -0
- shaped/autogen/models/shaped_internal_recsys_policies_rising_popular_policy_rising_popular_policy_config.py +123 -0
- shaped/autogen/models/shaped_internal_recsys_policies_sasrec_model_policy_sasrec_model_policy_sas_rec_model_policy_config.py +230 -0
- shaped/autogen/models/shaped_internal_recsys_policies_svd_model_policy_svd_model_policy_config.py +119 -0
- shaped/autogen/models/shaped_internal_recsys_policies_two_tower_model_policy_two_tower_model_policy_two_tower_model_policy_config.py +165 -0
- shaped/autogen/models/shaped_internal_recsys_policies_user_item_content_similarity_model_policy_user_item_content_similarity_model_policy_config.py +153 -0
- shaped/autogen/models/shaped_internal_recsys_policies_widedeep_model_policy_wide_deep_model_policy_config.py +137 -0
- shaped/autogen/models/shaped_internal_recsys_policies_xgboost_model_policy_xg_boost_model_policy_config.py +155 -0
- shaped/autogen/models/shopify_table_config.py +156 -0
- shaped/autogen/models/similarity_retrieve_step.py +123 -0
- shaped/autogen/models/{snowflake_dataset_config.py → snowflake_table_config.py} +47 -18
- shaped/autogen/models/sql_transform_type.py +37 -0
- shaped/autogen/models/sql_view_config.py +111 -0
- shaped/autogen/models/stemmer_tokenizer.py +105 -0
- shaped/autogen/models/step_explanation.py +137 -0
- shaped/autogen/models/steps_inner.py +179 -0
- shaped/autogen/models/strategy.py +134 -0
- shaped/autogen/models/table.py +102 -0
- shaped/autogen/models/table_deployment_type.py +38 -0
- shaped/autogen/models/table_insert_arguments.py +87 -0
- shaped/autogen/models/table_insert_response.py +87 -0
- shaped/autogen/models/text_encoding.py +148 -0
- shaped/autogen/models/text_search_retrieve_step.py +121 -0
- shaped/autogen/models/time_frequency.py +136 -0
- shaped/autogen/models/time_window.py +136 -0
- shaped/autogen/models/time_window_in_days.py +154 -0
- shaped/autogen/models/tokenizer.py +149 -0
- shaped/autogen/models/trained_model_encoder.py +99 -0
- shaped/autogen/models/training_compute_config.py +99 -0
- shaped/autogen/models/training_config.py +121 -0
- shaped/autogen/models/training_config_models_inner.py +540 -0
- shaped/autogen/models/training_strategy.py +37 -0
- shaped/autogen/models/transform_status.py +41 -0
- shaped/autogen/models/trending_mode.py +37 -0
- shaped/autogen/models/truncate_filter_step.py +106 -0
- shaped/autogen/models/tunable_bool.py +97 -0
- shaped/autogen/models/tunable_float.py +118 -0
- shaped/autogen/models/tunable_int.py +118 -0
- shaped/autogen/models/tunable_int_categorical.py +99 -0
- shaped/autogen/models/tunable_string.py +99 -0
- shaped/autogen/models/tuning_config.py +89 -0
- shaped/autogen/models/type.py +150 -0
- shaped/autogen/models/update_table_response.py +87 -0
- shaped/autogen/models/update_view_response.py +87 -0
- shaped/autogen/models/user_attribute_pooling_encoder.py +124 -0
- shaped/autogen/models/user_inner.py +134 -0
- shaped/autogen/models/val_split.py +136 -0
- shaped/autogen/models/validation_error.py +13 -3
- shaped/autogen/models/validation_error_loc_inner.py +150 -0
- shaped/autogen/models/value_type.py +7 -5
- shaped/autogen/models/vector_search_mode.py +101 -0
- shaped/autogen/models/view.py +104 -0
- shaped/autogen/models/view_details_ai.py +140 -0
- shaped/autogen/models/view_details_ai_schema_value.py +153 -0
- shaped/autogen/models/view_details_sql.py +140 -0
- shaped/autogen/models/view_status.py +41 -0
- shaped/autogen/models/weight_decay.py +136 -0
- shaped/autogen/models/whitespace_tokenizer.py +97 -0
- shaped/autogen/models/window_size.py +136 -0
- shaped/autogen/rest.py +10 -4
- shaped/cli/shaped_cli.py +163 -35
- shaped/client.py +591 -171
- shaped/config_builders.py +705 -0
- shaped/query_builder.py +781 -0
- {shaped-2.0.1.dist-info → shaped-2.0.4.dist-info}/METADATA +141 -6
- shaped-2.0.4.dist-info/RECORD +296 -0
- {shaped-2.0.1.dist-info → shaped-2.0.4.dist-info}/WHEEL +1 -1
- shaped-2.0.4.dist-info/entry_points.txt +2 -0
- shaped/autogen/api/model_inference_api.py +0 -2825
- shaped/autogen/models/amplitude_dataset_config.py +0 -96
- shaped/autogen/models/aws_pinpoint_dataset_config.py +0 -96
- shaped/autogen/models/big_query_dataset_config.py +0 -114
- shaped/autogen/models/complement_items_request.py +0 -99
- shaped/autogen/models/complement_items_response.py +0 -89
- shaped/autogen/models/connectors_inner.py +0 -134
- shaped/autogen/models/create_dataset_arguments.py +0 -263
- shaped/autogen/models/create_embedding_response.py +0 -87
- shaped/autogen/models/create_item_embedding_request.py +0 -89
- shaped/autogen/models/create_model_arguments.py +0 -107
- shaped/autogen/models/create_model_response.py +0 -87
- shaped/autogen/models/create_user_embedding_request.py +0 -89
- shaped/autogen/models/custom_dataset_config.py +0 -115
- shaped/autogen/models/dataset_config.py +0 -101
- shaped/autogen/models/dataset_schema_type.py +0 -47
- shaped/autogen/models/datasets_inner.py +0 -91
- shaped/autogen/models/delete_model_response.py +0 -87
- shaped/autogen/models/fetch_config.py +0 -95
- shaped/autogen/models/file_config.py +0 -105
- shaped/autogen/models/file_source_config.py +0 -89
- shaped/autogen/models/inference_config.py +0 -101
- shaped/autogen/models/insert_model_response.py +0 -87
- shaped/autogen/models/interaction.py +0 -87
- shaped/autogen/models/list_datasets_response.py +0 -95
- shaped/autogen/models/list_models_response.py +0 -95
- shaped/autogen/models/model_config.py +0 -99
- shaped/autogen/models/model_response.py +0 -95
- shaped/autogen/models/mongo_db_dataset_config.py +0 -119
- shaped/autogen/models/post_rank_request.py +0 -117
- shaped/autogen/models/rank_attribute_response.py +0 -89
- shaped/autogen/models/rank_grid_attribute_request.py +0 -91
- shaped/autogen/models/rank_grid_attribute_request1.py +0 -93
- shaped/autogen/models/rank_grid_attribute_response.py +0 -91
- shaped/autogen/models/rank_response.py +0 -91
- shaped/autogen/models/retrieve_request.py +0 -101
- shaped/autogen/models/retrieve_response.py +0 -91
- shaped/autogen/models/retriever_top_k_override.py +0 -97
- shaped/autogen/models/rudder_stack_dataset_config.py +0 -96
- shaped/autogen/models/segment_dataset_config.py +0 -96
- shaped/autogen/models/similar_item_request.py +0 -101
- shaped/autogen/models/similar_response.py +0 -89
- shaped/autogen/models/similar_users_request.py +0 -99
- shaped/autogen/models/successful_response.py +0 -87
- shaped/autogen/models/view_model_response.py +0 -99
- shaped-2.0.1.dist-info/RECORD +0 -73
- shaped-2.0.1.dist-info/entry_points.txt +0 -2
- {shaped-2.0.1.dist-info → shaped-2.0.4.dist-info}/top_level.txt +0 -0
- {shaped-2.0.1.dist-info → shaped-2.0.4.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
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.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
+
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
23
|
+
from shaped.autogen.models.ascending import Ascending
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPolicyConfig(
|
|
28
|
+
BaseModel
|
|
29
|
+
):
|
|
30
|
+
"""
|
|
31
|
+
ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPolicyConfig
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
|
|
34
|
+
policy_type: Optional[StrictStr] = "chronological"
|
|
35
|
+
name: Optional[StrictStr] = None
|
|
36
|
+
event_values: Optional[List[StrictStr]] = None
|
|
37
|
+
time_col: Optional[StrictStr] = None
|
|
38
|
+
ascending: Optional[Ascending] = None
|
|
39
|
+
additional_properties: Dict[str, Any] = {}
|
|
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")
|
|
49
|
+
def policy_type_validate_enum(cls, value):
|
|
50
|
+
"""Validates the enum"""
|
|
51
|
+
if value is None:
|
|
52
|
+
return value
|
|
53
|
+
|
|
54
|
+
if value not in set(["chronological"]):
|
|
55
|
+
raise ValueError("must be one of enum values ('chronological')")
|
|
56
|
+
return value
|
|
57
|
+
|
|
58
|
+
model_config = ConfigDict(
|
|
59
|
+
populate_by_name=True,
|
|
60
|
+
validate_assignment=True,
|
|
61
|
+
protected_namespaces=(),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
def to_str(self) -> str:
|
|
65
|
+
"""Returns the string representation of the model using alias"""
|
|
66
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
67
|
+
|
|
68
|
+
def to_json(self) -> str:
|
|
69
|
+
"""Returns the JSON representation of the model using alias"""
|
|
70
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
71
|
+
return json.dumps(self.to_dict())
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPolicyConfig from a JSON string"""
|
|
76
|
+
return cls.from_dict(json.loads(json_str))
|
|
77
|
+
|
|
78
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
79
|
+
"""Return the dictionary representation of the model using alias.
|
|
80
|
+
|
|
81
|
+
This has the following differences from calling pydantic's
|
|
82
|
+
`self.model_dump(by_alias=True)`:
|
|
83
|
+
|
|
84
|
+
* `None` is only added to the output dict for nullable fields that
|
|
85
|
+
were set at model initialization. Other fields with value `None`
|
|
86
|
+
are ignored.
|
|
87
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
88
|
+
"""
|
|
89
|
+
excluded_fields: Set[str] = set(
|
|
90
|
+
[
|
|
91
|
+
"additional_properties",
|
|
92
|
+
]
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
_dict = self.model_dump(
|
|
96
|
+
by_alias=True,
|
|
97
|
+
exclude=excluded_fields,
|
|
98
|
+
exclude_none=True,
|
|
99
|
+
)
|
|
100
|
+
# override the default output from pydantic by calling `to_dict()` of ascending
|
|
101
|
+
if self.ascending:
|
|
102
|
+
_dict["ascending"] = self.ascending.to_dict()
|
|
103
|
+
# puts key-value pairs in additional_properties in the top level
|
|
104
|
+
if self.additional_properties is not None:
|
|
105
|
+
for _key, _value in self.additional_properties.items():
|
|
106
|
+
_dict[_key] = _value
|
|
107
|
+
|
|
108
|
+
# set to None if name (nullable) is None
|
|
109
|
+
# and model_fields_set contains the field
|
|
110
|
+
if self.name is None and "name" in self.model_fields_set:
|
|
111
|
+
_dict["name"] = None
|
|
112
|
+
|
|
113
|
+
# set to None if event_values (nullable) is None
|
|
114
|
+
# and model_fields_set contains the field
|
|
115
|
+
if self.event_values is None and "event_values" in self.model_fields_set:
|
|
116
|
+
_dict["event_values"] = None
|
|
117
|
+
|
|
118
|
+
# set to None if time_col (nullable) is None
|
|
119
|
+
# and model_fields_set contains the field
|
|
120
|
+
if self.time_col is None and "time_col" in self.model_fields_set:
|
|
121
|
+
_dict["time_col"] = None
|
|
122
|
+
|
|
123
|
+
return _dict
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
127
|
+
"""Create an instance of ShapedInternalRecsysPoliciesChronologicalModelPolicyChronologicalModelPolicyConfig from a dict"""
|
|
128
|
+
if obj is None:
|
|
129
|
+
return None
|
|
130
|
+
|
|
131
|
+
if not isinstance(obj, dict):
|
|
132
|
+
return cls.model_validate(obj)
|
|
133
|
+
|
|
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
|
+
)
|
|
151
|
+
# store additional fields in additional_properties
|
|
152
|
+
for _key in obj.keys():
|
|
153
|
+
if _key not in cls.__properties:
|
|
154
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
155
|
+
|
|
156
|
+
return _obj
|
|
@@ -0,0 +1,141 @@
|
|
|
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, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from shaped.autogen.models.factors import Factors
|
|
23
|
+
from shaped.autogen.models.lr1 import Lr1
|
|
24
|
+
from shaped.autogen.models.training_strategy import TrainingStrategy
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class ShapedInternalRecsysPoliciesElsaModelPolicyElsaModelPolicyELSAModelPolicyConfig(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ShapedInternalRecsysPoliciesElsaModelPolicyElsaModelPolicyELSAModelPolicyConfig
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
policy_type: Optional[StrictStr] = 'elsa'
|
|
33
|
+
name: Optional[StrictStr] = None
|
|
34
|
+
event_values: Optional[List[StrictStr]] = None
|
|
35
|
+
batch_size: Optional[StrictInt] = Field(default=512, description="Number of samples processed before updating model weights.")
|
|
36
|
+
n_epochs: Optional[StrictInt] = Field(default=1, description="Number of complete passes through the training dataset.")
|
|
37
|
+
factors: Optional[Factors] = None
|
|
38
|
+
lr: Optional[Lr1] = None
|
|
39
|
+
device: Optional[StrictStr] = None
|
|
40
|
+
strategy: Optional[TrainingStrategy] = None
|
|
41
|
+
patience: Optional[StrictInt] = Field(default=3, description="Number of epochs to wait without improvement before early stopping.")
|
|
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"]
|
|
44
|
+
|
|
45
|
+
@field_validator('policy_type')
|
|
46
|
+
def policy_type_validate_enum(cls, value):
|
|
47
|
+
"""Validates the enum"""
|
|
48
|
+
if value is None:
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
if value not in set(['elsa']):
|
|
52
|
+
raise ValueError("must be one of enum values ('elsa')")
|
|
53
|
+
return value
|
|
54
|
+
|
|
55
|
+
model_config = ConfigDict(
|
|
56
|
+
populate_by_name=True,
|
|
57
|
+
validate_assignment=True,
|
|
58
|
+
protected_namespaces=(),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def to_str(self) -> str:
|
|
63
|
+
"""Returns the string representation of the model using alias"""
|
|
64
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
65
|
+
|
|
66
|
+
def to_json(self) -> str:
|
|
67
|
+
"""Returns the JSON representation of the model using alias"""
|
|
68
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
69
|
+
return json.dumps(self.to_dict())
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
73
|
+
"""Create an instance of ShapedInternalRecsysPoliciesElsaModelPolicyElsaModelPolicyELSAModelPolicyConfig from a JSON string"""
|
|
74
|
+
return cls.from_dict(json.loads(json_str))
|
|
75
|
+
|
|
76
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
77
|
+
"""Return the dictionary representation of the model using alias.
|
|
78
|
+
|
|
79
|
+
This has the following differences from calling pydantic's
|
|
80
|
+
`self.model_dump(by_alias=True)`:
|
|
81
|
+
|
|
82
|
+
* `None` is only added to the output dict for nullable fields that
|
|
83
|
+
were set at model initialization. Other fields with value `None`
|
|
84
|
+
are ignored.
|
|
85
|
+
"""
|
|
86
|
+
excluded_fields: Set[str] = set([
|
|
87
|
+
])
|
|
88
|
+
|
|
89
|
+
_dict = self.model_dump(
|
|
90
|
+
by_alias=True,
|
|
91
|
+
exclude=excluded_fields,
|
|
92
|
+
exclude_none=True,
|
|
93
|
+
)
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of factors
|
|
95
|
+
if self.factors:
|
|
96
|
+
_dict['factors'] = self.factors.to_dict()
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of lr
|
|
98
|
+
if self.lr:
|
|
99
|
+
_dict['lr'] = self.lr.to_dict()
|
|
100
|
+
# set to None if name (nullable) is None
|
|
101
|
+
# and model_fields_set contains the field
|
|
102
|
+
if self.name is None and "name" in self.model_fields_set:
|
|
103
|
+
_dict['name'] = None
|
|
104
|
+
|
|
105
|
+
# set to None if event_values (nullable) is None
|
|
106
|
+
# and model_fields_set contains the field
|
|
107
|
+
if self.event_values is None and "event_values" in self.model_fields_set:
|
|
108
|
+
_dict['event_values'] = None
|
|
109
|
+
|
|
110
|
+
# set to None if device (nullable) is None
|
|
111
|
+
# and model_fields_set contains the field
|
|
112
|
+
if self.device is None and "device" in self.model_fields_set:
|
|
113
|
+
_dict['device'] = None
|
|
114
|
+
|
|
115
|
+
return _dict
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
119
|
+
"""Create an instance of ShapedInternalRecsysPoliciesElsaModelPolicyElsaModelPolicyELSAModelPolicyConfig from a dict"""
|
|
120
|
+
if obj is None:
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
if not isinstance(obj, dict):
|
|
124
|
+
return cls.model_validate(obj)
|
|
125
|
+
|
|
126
|
+
_obj = cls.model_validate({
|
|
127
|
+
"policy_type": obj.get("policy_type") if obj.get("policy_type") is not None else 'elsa',
|
|
128
|
+
"name": obj.get("name"),
|
|
129
|
+
"event_values": obj.get("event_values"),
|
|
130
|
+
"batch_size": obj.get("batch_size") if obj.get("batch_size") is not None else 512,
|
|
131
|
+
"n_epochs": obj.get("n_epochs") if obj.get("n_epochs") is not None else 1,
|
|
132
|
+
"factors": Factors.from_dict(obj["factors"]) if obj.get("factors") is not None else None,
|
|
133
|
+
"lr": Lr1.from_dict(obj["lr"]) if obj.get("lr") is not None else None,
|
|
134
|
+
"device": obj.get("device"),
|
|
135
|
+
"strategy": obj.get("strategy"),
|
|
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
|
|
138
|
+
})
|
|
139
|
+
return _obj
|
|
140
|
+
|
|
141
|
+
|
|
@@ -0,0 +1,211 @@
|
|
|
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, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from shaped.autogen.models.batch_size1 import BatchSize1
|
|
23
|
+
from shaped.autogen.models.dropout_rate import DropoutRate
|
|
24
|
+
from shaped.autogen.models.embedding_dim import EmbeddingDim
|
|
25
|
+
from shaped.autogen.models.learning_rate import LearningRate
|
|
26
|
+
from shaped.autogen.models.n_epochs1 import NEpochs1
|
|
27
|
+
from shaped.autogen.models.neg_per_positive import NegPerPositive
|
|
28
|
+
from shaped.autogen.models.num_blocks import NumBlocks
|
|
29
|
+
from shaped.autogen.models.num_heads import NumHeads
|
|
30
|
+
from shaped.autogen.models.sequence_length import SequenceLength
|
|
31
|
+
from typing import Optional, Set
|
|
32
|
+
from typing_extensions import Self
|
|
33
|
+
|
|
34
|
+
class ShapedInternalRecsysPoliciesGsasrecModelPolicyGsasrecModelPolicyGSASRecModelPolicyConfig(BaseModel):
|
|
35
|
+
"""
|
|
36
|
+
ShapedInternalRecsysPoliciesGsasrecModelPolicyGsasrecModelPolicyGSASRecModelPolicyConfig
|
|
37
|
+
""" # noqa: E501
|
|
38
|
+
policy_type: Optional[StrictStr] = 'gsasrec'
|
|
39
|
+
name: Optional[StrictStr] = None
|
|
40
|
+
event_values: Optional[List[StrictStr]] = None
|
|
41
|
+
batch_size: Optional[BatchSize1] = None
|
|
42
|
+
eval_batch_size: Optional[StrictInt] = Field(default=32, description="Batch size used during model evaluation.")
|
|
43
|
+
n_epochs: Optional[NEpochs1] = None
|
|
44
|
+
device: Optional[StrictStr] = None
|
|
45
|
+
learning_rate: Optional[LearningRate] = None
|
|
46
|
+
weight_decay: Optional[Union[StrictFloat, StrictInt]] = Field(default=5.0E-4, description="L2 regularization term to prevent overfitting.")
|
|
47
|
+
patience: Optional[StrictInt] = Field(default=3, description="Number of epochs to wait without improvement before early stopping.")
|
|
48
|
+
sequence_length: Optional[SequenceLength] = None
|
|
49
|
+
embedding_dim: Optional[EmbeddingDim] = None
|
|
50
|
+
num_heads: Optional[NumHeads] = None
|
|
51
|
+
num_blocks: Optional[NumBlocks] = None
|
|
52
|
+
dropout_rate: Optional[DropoutRate] = None
|
|
53
|
+
reuse_item_embeddings: Optional[StrictBool] = False
|
|
54
|
+
max_batches_per_epoch: Optional[StrictInt] = 100
|
|
55
|
+
gbce_t: Optional[Union[StrictFloat, StrictInt]] = 0.75
|
|
56
|
+
filter_rated: Optional[StrictBool] = False
|
|
57
|
+
neg_per_positive: Optional[NegPerPositive] = None
|
|
58
|
+
eval_after_epochs: Optional[StrictInt] = 1
|
|
59
|
+
split_ratio: Optional[Union[StrictFloat, StrictInt]] = 0.9
|
|
60
|
+
eps: Optional[Union[StrictFloat, StrictInt]] = 1.0E-10
|
|
61
|
+
normalize_numerical_features: Optional[StrictBool] = Field(default=True, description="Enable NormalizeNumerical transform for entity features.")
|
|
62
|
+
use_derived_timestamp_features: Optional[StrictBool] = Field(default=True, description="Enable TimestampSinCosEncoder and TimestampCountEncoder for entity features.")
|
|
63
|
+
balance_labels: Optional[StrictBool] = Field(default=True, description="Enable BalanceLabel transform for interactions.")
|
|
64
|
+
additional_properties: Dict[str, Any] = {}
|
|
65
|
+
__properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "batch_size", "eval_batch_size", "n_epochs", "device", "learning_rate", "weight_decay", "patience", "sequence_length", "embedding_dim", "num_heads", "num_blocks", "dropout_rate", "reuse_item_embeddings", "max_batches_per_epoch", "gbce_t", "filter_rated", "neg_per_positive", "eval_after_epochs", "split_ratio", "eps", "normalize_numerical_features", "use_derived_timestamp_features", "balance_labels"]
|
|
66
|
+
|
|
67
|
+
@field_validator('policy_type')
|
|
68
|
+
def policy_type_validate_enum(cls, value):
|
|
69
|
+
"""Validates the enum"""
|
|
70
|
+
if value is None:
|
|
71
|
+
return value
|
|
72
|
+
|
|
73
|
+
if value not in set(['gsasrec']):
|
|
74
|
+
raise ValueError("must be one of enum values ('gsasrec')")
|
|
75
|
+
return value
|
|
76
|
+
|
|
77
|
+
model_config = ConfigDict(
|
|
78
|
+
populate_by_name=True,
|
|
79
|
+
validate_assignment=True,
|
|
80
|
+
protected_namespaces=(),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def to_str(self) -> str:
|
|
85
|
+
"""Returns the string representation of the model using alias"""
|
|
86
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
87
|
+
|
|
88
|
+
def to_json(self) -> str:
|
|
89
|
+
"""Returns the JSON representation of the model using alias"""
|
|
90
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
91
|
+
return json.dumps(self.to_dict())
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
95
|
+
"""Create an instance of ShapedInternalRecsysPoliciesGsasrecModelPolicyGsasrecModelPolicyGSASRecModelPolicyConfig from a JSON string"""
|
|
96
|
+
return cls.from_dict(json.loads(json_str))
|
|
97
|
+
|
|
98
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
99
|
+
"""Return the dictionary representation of the model using alias.
|
|
100
|
+
|
|
101
|
+
This has the following differences from calling pydantic's
|
|
102
|
+
`self.model_dump(by_alias=True)`:
|
|
103
|
+
|
|
104
|
+
* `None` is only added to the output dict for nullable fields that
|
|
105
|
+
were set at model initialization. Other fields with value `None`
|
|
106
|
+
are ignored.
|
|
107
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
108
|
+
"""
|
|
109
|
+
excluded_fields: Set[str] = set([
|
|
110
|
+
"additional_properties",
|
|
111
|
+
])
|
|
112
|
+
|
|
113
|
+
_dict = self.model_dump(
|
|
114
|
+
by_alias=True,
|
|
115
|
+
exclude=excluded_fields,
|
|
116
|
+
exclude_none=True,
|
|
117
|
+
)
|
|
118
|
+
# override the default output from pydantic by calling `to_dict()` of batch_size
|
|
119
|
+
if self.batch_size:
|
|
120
|
+
_dict['batch_size'] = self.batch_size.to_dict()
|
|
121
|
+
# override the default output from pydantic by calling `to_dict()` of n_epochs
|
|
122
|
+
if self.n_epochs:
|
|
123
|
+
_dict['n_epochs'] = self.n_epochs.to_dict()
|
|
124
|
+
# override the default output from pydantic by calling `to_dict()` of learning_rate
|
|
125
|
+
if self.learning_rate:
|
|
126
|
+
_dict['learning_rate'] = self.learning_rate.to_dict()
|
|
127
|
+
# override the default output from pydantic by calling `to_dict()` of sequence_length
|
|
128
|
+
if self.sequence_length:
|
|
129
|
+
_dict['sequence_length'] = self.sequence_length.to_dict()
|
|
130
|
+
# override the default output from pydantic by calling `to_dict()` of embedding_dim
|
|
131
|
+
if self.embedding_dim:
|
|
132
|
+
_dict['embedding_dim'] = self.embedding_dim.to_dict()
|
|
133
|
+
# override the default output from pydantic by calling `to_dict()` of num_heads
|
|
134
|
+
if self.num_heads:
|
|
135
|
+
_dict['num_heads'] = self.num_heads.to_dict()
|
|
136
|
+
# override the default output from pydantic by calling `to_dict()` of num_blocks
|
|
137
|
+
if self.num_blocks:
|
|
138
|
+
_dict['num_blocks'] = self.num_blocks.to_dict()
|
|
139
|
+
# override the default output from pydantic by calling `to_dict()` of dropout_rate
|
|
140
|
+
if self.dropout_rate:
|
|
141
|
+
_dict['dropout_rate'] = self.dropout_rate.to_dict()
|
|
142
|
+
# override the default output from pydantic by calling `to_dict()` of neg_per_positive
|
|
143
|
+
if self.neg_per_positive:
|
|
144
|
+
_dict['neg_per_positive'] = self.neg_per_positive.to_dict()
|
|
145
|
+
# puts key-value pairs in additional_properties in the top level
|
|
146
|
+
if self.additional_properties is not None:
|
|
147
|
+
for _key, _value in self.additional_properties.items():
|
|
148
|
+
_dict[_key] = _value
|
|
149
|
+
|
|
150
|
+
# set to None if name (nullable) is None
|
|
151
|
+
# and model_fields_set contains the field
|
|
152
|
+
if self.name is None and "name" in self.model_fields_set:
|
|
153
|
+
_dict['name'] = None
|
|
154
|
+
|
|
155
|
+
# set to None if event_values (nullable) is None
|
|
156
|
+
# and model_fields_set contains the field
|
|
157
|
+
if self.event_values is None and "event_values" in self.model_fields_set:
|
|
158
|
+
_dict['event_values'] = None
|
|
159
|
+
|
|
160
|
+
# set to None if device (nullable) is None
|
|
161
|
+
# and model_fields_set contains the field
|
|
162
|
+
if self.device is None and "device" in self.model_fields_set:
|
|
163
|
+
_dict['device'] = None
|
|
164
|
+
|
|
165
|
+
return _dict
|
|
166
|
+
|
|
167
|
+
@classmethod
|
|
168
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
169
|
+
"""Create an instance of ShapedInternalRecsysPoliciesGsasrecModelPolicyGsasrecModelPolicyGSASRecModelPolicyConfig from a dict"""
|
|
170
|
+
if obj is None:
|
|
171
|
+
return None
|
|
172
|
+
|
|
173
|
+
if not isinstance(obj, dict):
|
|
174
|
+
return cls.model_validate(obj)
|
|
175
|
+
|
|
176
|
+
_obj = cls.model_validate({
|
|
177
|
+
"policy_type": obj.get("policy_type") if obj.get("policy_type") is not None else 'gsasrec',
|
|
178
|
+
"name": obj.get("name"),
|
|
179
|
+
"event_values": obj.get("event_values"),
|
|
180
|
+
"batch_size": BatchSize1.from_dict(obj["batch_size"]) if obj.get("batch_size") is not None else None,
|
|
181
|
+
"eval_batch_size": obj.get("eval_batch_size") if obj.get("eval_batch_size") is not None else 32,
|
|
182
|
+
"n_epochs": NEpochs1.from_dict(obj["n_epochs"]) if obj.get("n_epochs") is not None else None,
|
|
183
|
+
"device": obj.get("device"),
|
|
184
|
+
"learning_rate": LearningRate.from_dict(obj["learning_rate"]) if obj.get("learning_rate") is not None else None,
|
|
185
|
+
"weight_decay": obj.get("weight_decay") if obj.get("weight_decay") is not None else 5.0E-4,
|
|
186
|
+
"patience": obj.get("patience") if obj.get("patience") is not None else 3,
|
|
187
|
+
"sequence_length": SequenceLength.from_dict(obj["sequence_length"]) if obj.get("sequence_length") is not None else None,
|
|
188
|
+
"embedding_dim": EmbeddingDim.from_dict(obj["embedding_dim"]) if obj.get("embedding_dim") is not None else None,
|
|
189
|
+
"num_heads": NumHeads.from_dict(obj["num_heads"]) if obj.get("num_heads") is not None else None,
|
|
190
|
+
"num_blocks": NumBlocks.from_dict(obj["num_blocks"]) if obj.get("num_blocks") is not None else None,
|
|
191
|
+
"dropout_rate": DropoutRate.from_dict(obj["dropout_rate"]) if obj.get("dropout_rate") is not None else None,
|
|
192
|
+
"reuse_item_embeddings": obj.get("reuse_item_embeddings") if obj.get("reuse_item_embeddings") is not None else False,
|
|
193
|
+
"max_batches_per_epoch": obj.get("max_batches_per_epoch") if obj.get("max_batches_per_epoch") is not None else 100,
|
|
194
|
+
"gbce_t": obj.get("gbce_t") if obj.get("gbce_t") is not None else 0.75,
|
|
195
|
+
"filter_rated": obj.get("filter_rated") if obj.get("filter_rated") is not None else False,
|
|
196
|
+
"neg_per_positive": NegPerPositive.from_dict(obj["neg_per_positive"]) if obj.get("neg_per_positive") is not None else None,
|
|
197
|
+
"eval_after_epochs": obj.get("eval_after_epochs") if obj.get("eval_after_epochs") is not None else 1,
|
|
198
|
+
"split_ratio": obj.get("split_ratio") if obj.get("split_ratio") is not None else 0.9,
|
|
199
|
+
"eps": obj.get("eps") if obj.get("eps") is not None else 1.0E-10,
|
|
200
|
+
"normalize_numerical_features": obj.get("normalize_numerical_features") if obj.get("normalize_numerical_features") is not None else True,
|
|
201
|
+
"use_derived_timestamp_features": obj.get("use_derived_timestamp_features") if obj.get("use_derived_timestamp_features") is not None else True,
|
|
202
|
+
"balance_labels": obj.get("balance_labels") if obj.get("balance_labels") is not None else True
|
|
203
|
+
})
|
|
204
|
+
# store additional fields in additional_properties
|
|
205
|
+
for _key in obj.keys():
|
|
206
|
+
if _key not in cls.__properties:
|
|
207
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
208
|
+
|
|
209
|
+
return _obj
|
|
210
|
+
|
|
211
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
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, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from shaped.autogen.models.algorithm import Algorithm
|
|
23
|
+
from shaped.autogen.models.embedding_size import EmbeddingSize
|
|
24
|
+
from shaped.autogen.models.window_size import WindowSize
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class ShapedInternalRecsysPoliciesItem2vecModelPolicyItem2VecModelPolicyConfig(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ShapedInternalRecsysPoliciesItem2vecModelPolicyItem2VecModelPolicyConfig
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
policy_type: Optional[StrictStr] = 'item2vec'
|
|
33
|
+
name: Optional[StrictStr] = None
|
|
34
|
+
event_values: Optional[List[StrictStr]] = None
|
|
35
|
+
embedding_size: Optional[EmbeddingSize] = None
|
|
36
|
+
window_size: Optional[WindowSize] = None
|
|
37
|
+
min_count: Optional[StrictInt] = Field(default=1, description="Minimum number of times an item must appear to be included in the vocabulary.")
|
|
38
|
+
algorithm: Optional[Algorithm] = None
|
|
39
|
+
max_window_size: Optional[StrictInt] = Field(default=50, description="Maximum window size for context.")
|
|
40
|
+
workers: Optional[StrictInt] = None
|
|
41
|
+
__properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "embedding_size", "window_size", "min_count", "algorithm", "max_window_size", "workers"]
|
|
42
|
+
|
|
43
|
+
@field_validator('policy_type')
|
|
44
|
+
def policy_type_validate_enum(cls, value):
|
|
45
|
+
"""Validates the enum"""
|
|
46
|
+
if value is None:
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
if value not in set(['item2vec']):
|
|
50
|
+
raise ValueError("must be one of enum values ('item2vec')")
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
populate_by_name=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def to_str(self) -> str:
|
|
61
|
+
"""Returns the string representation of the model using alias"""
|
|
62
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
63
|
+
|
|
64
|
+
def to_json(self) -> str:
|
|
65
|
+
"""Returns the JSON representation of the model using alias"""
|
|
66
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
67
|
+
return json.dumps(self.to_dict())
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
71
|
+
"""Create an instance of ShapedInternalRecsysPoliciesItem2vecModelPolicyItem2VecModelPolicyConfig from a JSON string"""
|
|
72
|
+
return cls.from_dict(json.loads(json_str))
|
|
73
|
+
|
|
74
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
75
|
+
"""Return the dictionary representation of the model using alias.
|
|
76
|
+
|
|
77
|
+
This has the following differences from calling pydantic's
|
|
78
|
+
`self.model_dump(by_alias=True)`:
|
|
79
|
+
|
|
80
|
+
* `None` is only added to the output dict for nullable fields that
|
|
81
|
+
were set at model initialization. Other fields with value `None`
|
|
82
|
+
are ignored.
|
|
83
|
+
"""
|
|
84
|
+
excluded_fields: Set[str] = set([
|
|
85
|
+
])
|
|
86
|
+
|
|
87
|
+
_dict = self.model_dump(
|
|
88
|
+
by_alias=True,
|
|
89
|
+
exclude=excluded_fields,
|
|
90
|
+
exclude_none=True,
|
|
91
|
+
)
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of embedding_size
|
|
93
|
+
if self.embedding_size:
|
|
94
|
+
_dict['embedding_size'] = self.embedding_size.to_dict()
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of window_size
|
|
96
|
+
if self.window_size:
|
|
97
|
+
_dict['window_size'] = self.window_size.to_dict()
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of algorithm
|
|
99
|
+
if self.algorithm:
|
|
100
|
+
_dict['algorithm'] = self.algorithm.to_dict()
|
|
101
|
+
# set to None if name (nullable) is None
|
|
102
|
+
# and model_fields_set contains the field
|
|
103
|
+
if self.name is None and "name" in self.model_fields_set:
|
|
104
|
+
_dict['name'] = None
|
|
105
|
+
|
|
106
|
+
# set to None if event_values (nullable) is None
|
|
107
|
+
# and model_fields_set contains the field
|
|
108
|
+
if self.event_values is None and "event_values" in self.model_fields_set:
|
|
109
|
+
_dict['event_values'] = None
|
|
110
|
+
|
|
111
|
+
# set to None if workers (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.workers is None and "workers" in self.model_fields_set:
|
|
114
|
+
_dict['workers'] = None
|
|
115
|
+
|
|
116
|
+
return _dict
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
120
|
+
"""Create an instance of ShapedInternalRecsysPoliciesItem2vecModelPolicyItem2VecModelPolicyConfig from a dict"""
|
|
121
|
+
if obj is None:
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
if not isinstance(obj, dict):
|
|
125
|
+
return cls.model_validate(obj)
|
|
126
|
+
|
|
127
|
+
_obj = cls.model_validate({
|
|
128
|
+
"policy_type": obj.get("policy_type") if obj.get("policy_type") is not None else 'item2vec',
|
|
129
|
+
"name": obj.get("name"),
|
|
130
|
+
"event_values": obj.get("event_values"),
|
|
131
|
+
"embedding_size": EmbeddingSize.from_dict(obj["embedding_size"]) if obj.get("embedding_size") is not None else None,
|
|
132
|
+
"window_size": WindowSize.from_dict(obj["window_size"]) if obj.get("window_size") is not None else None,
|
|
133
|
+
"min_count": obj.get("min_count") if obj.get("min_count") is not None else 1,
|
|
134
|
+
"algorithm": Algorithm.from_dict(obj["algorithm"]) if obj.get("algorithm") is not None else None,
|
|
135
|
+
"max_window_size": obj.get("max_window_size") if obj.get("max_window_size") is not None else 50,
|
|
136
|
+
"workers": obj.get("workers")
|
|
137
|
+
})
|
|
138
|
+
return _obj
|
|
139
|
+
|
|
140
|
+
|