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
|
@@ -1,2825 +0,0 @@
|
|
|
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. Shaped's API is composed of 3 components: 1. **Dataset** - used to provision and manage 'Shaped Datasets', which are persisted data views of external data. Shaped Datasets can be created from any of our 'Shaped connectors' (e.g. S3, Segment, Snowflake, etc.) and support both batch ingestion (up to a 15min delay) and stream ingestion (up to a 30 second delay) depending on the specific connector used. Shaped datasets can also be created from local files, which is particularly useful for getting started with a snapshot of data. 2. **Model Management** - used to provision and manage 'Shaped Models', which represent a system of data pipelines, training and serving infrastructure for your ranking use-case. 3. **Model Inference** - a high performance API that's used to make user-understanding requests or ranking inferences to your 'Shaped Models'. For example, the 'rank' endpoint can be used to determine for a given user id query, what is the content that is most engaging to that user. The recommended workflow to interact with the Shaped API is as follows: 1. First create 'Shaped Datasets' to sync over data that your Shaped understanding models will need. The models at the minimum need interaction data to understand behavior of your users, so start with that and add your item and user catalog data later. 2. Then create 'Shaped Models' that use your created 'Shaped Datasets' as input. Your Shaped Model will will start streaming, processing and training from your connected data immediately. After a few hours your model will have tuned all parameters based on your data and will deploy an active model. 3. You can now use the 'Model Inference' endpoints to make real-time inferences to your model based on your use-case.
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 1.0.1
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
import warnings
|
|
15
|
-
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
16
|
-
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
17
|
-
from typing_extensions import Annotated
|
|
18
|
-
|
|
19
|
-
from pydantic import Field, StrictStr
|
|
20
|
-
from typing import Optional
|
|
21
|
-
from typing_extensions import Annotated
|
|
22
|
-
from shaped.autogen.models.complement_items_request import ComplementItemsRequest
|
|
23
|
-
from shaped.autogen.models.complement_items_response import ComplementItemsResponse
|
|
24
|
-
from shaped.autogen.models.create_embedding_response import CreateEmbeddingResponse
|
|
25
|
-
from shaped.autogen.models.create_item_embedding_request import CreateItemEmbeddingRequest
|
|
26
|
-
from shaped.autogen.models.create_user_embedding_request import CreateUserEmbeddingRequest
|
|
27
|
-
from shaped.autogen.models.post_rank_request import PostRankRequest
|
|
28
|
-
from shaped.autogen.models.rank_attribute_response import RankAttributeResponse
|
|
29
|
-
from shaped.autogen.models.rank_grid_attribute_request import RankGridAttributeRequest
|
|
30
|
-
from shaped.autogen.models.rank_grid_attribute_request1 import RankGridAttributeRequest1
|
|
31
|
-
from shaped.autogen.models.rank_grid_attribute_response import RankGridAttributeResponse
|
|
32
|
-
from shaped.autogen.models.rank_response import RankResponse
|
|
33
|
-
from shaped.autogen.models.retrieve_request import RetrieveRequest
|
|
34
|
-
from shaped.autogen.models.retrieve_response import RetrieveResponse
|
|
35
|
-
from shaped.autogen.models.similar_item_request import SimilarItemRequest
|
|
36
|
-
from shaped.autogen.models.similar_response import SimilarResponse
|
|
37
|
-
from shaped.autogen.models.similar_users_request import SimilarUsersRequest
|
|
38
|
-
|
|
39
|
-
from shaped.autogen.api_client import ApiClient, RequestSerialized
|
|
40
|
-
from shaped.autogen.api_response import ApiResponse
|
|
41
|
-
from shaped.autogen.rest import RESTResponseType
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class ModelInferenceApi:
|
|
45
|
-
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
46
|
-
Ref: https://openapi-generator.tech
|
|
47
|
-
|
|
48
|
-
Do not edit the class manually.
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
def __init__(self, api_client=None) -> None:
|
|
52
|
-
if api_client is None:
|
|
53
|
-
api_client = ApiClient.get_default()
|
|
54
|
-
self.api_client = api_client
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@validate_call
|
|
58
|
-
def post_complement_items_models_model_name_complement_items_post(
|
|
59
|
-
self,
|
|
60
|
-
model_name: StrictStr,
|
|
61
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
62
|
-
complement_items_request: Optional[ComplementItemsRequest] = None,
|
|
63
|
-
_request_timeout: Union[
|
|
64
|
-
None,
|
|
65
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
66
|
-
Tuple[
|
|
67
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
68
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
69
|
-
]
|
|
70
|
-
] = None,
|
|
71
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
72
|
-
_content_type: Optional[StrictStr] = None,
|
|
73
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
74
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
75
|
-
) -> ComplementItemsResponse:
|
|
76
|
-
"""Complement Items
|
|
77
|
-
|
|
78
|
-
Complement Items returns a list of items that complement the given input items. For example, if you have a list of items in a user's cart, you can use this endpoint to return items that complement the cart (i.e. \"Complete-the-bag\" use-cases).
|
|
79
|
-
|
|
80
|
-
:param model_name: (required)
|
|
81
|
-
:type model_name: str
|
|
82
|
-
:param x_api_key: (required)
|
|
83
|
-
:type x_api_key: str
|
|
84
|
-
:param complement_items_request:
|
|
85
|
-
:type complement_items_request: ComplementItemsRequest
|
|
86
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
87
|
-
number provided, it will be total request
|
|
88
|
-
timeout. It can also be a pair (tuple) of
|
|
89
|
-
(connection, read) timeouts.
|
|
90
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
91
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
92
|
-
request; this effectively ignores the
|
|
93
|
-
authentication in the spec for a single request.
|
|
94
|
-
:type _request_auth: dict, optional
|
|
95
|
-
:param _content_type: force content-type for the request.
|
|
96
|
-
:type _content_type: str, Optional
|
|
97
|
-
:param _headers: set to override the headers for a single
|
|
98
|
-
request; this effectively ignores the headers
|
|
99
|
-
in the spec for a single request.
|
|
100
|
-
:type _headers: dict, optional
|
|
101
|
-
:param _host_index: set to override the host_index for a single
|
|
102
|
-
request; this effectively ignores the host_index
|
|
103
|
-
in the spec for a single request.
|
|
104
|
-
:type _host_index: int, optional
|
|
105
|
-
:return: Returns the result object.
|
|
106
|
-
""" # noqa: E501
|
|
107
|
-
|
|
108
|
-
_param = self._post_complement_items_models_model_name_complement_items_post_serialize(
|
|
109
|
-
model_name=model_name,
|
|
110
|
-
x_api_key=x_api_key,
|
|
111
|
-
complement_items_request=complement_items_request,
|
|
112
|
-
_request_auth=_request_auth,
|
|
113
|
-
_content_type=_content_type,
|
|
114
|
-
_headers=_headers,
|
|
115
|
-
_host_index=_host_index
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
119
|
-
'200': "ComplementItemsResponse",
|
|
120
|
-
'422': "HTTPValidationError",
|
|
121
|
-
}
|
|
122
|
-
response_data = self.api_client.call_api(
|
|
123
|
-
*_param,
|
|
124
|
-
_request_timeout=_request_timeout
|
|
125
|
-
)
|
|
126
|
-
response_data.read()
|
|
127
|
-
return self.api_client.response_deserialize(
|
|
128
|
-
response_data=response_data,
|
|
129
|
-
response_types_map=_response_types_map,
|
|
130
|
-
).data
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
@validate_call
|
|
134
|
-
def post_complement_items_models_model_name_complement_items_post_with_http_info(
|
|
135
|
-
self,
|
|
136
|
-
model_name: StrictStr,
|
|
137
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
138
|
-
complement_items_request: Optional[ComplementItemsRequest] = None,
|
|
139
|
-
_request_timeout: Union[
|
|
140
|
-
None,
|
|
141
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
142
|
-
Tuple[
|
|
143
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
144
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
145
|
-
]
|
|
146
|
-
] = None,
|
|
147
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
148
|
-
_content_type: Optional[StrictStr] = None,
|
|
149
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
150
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
151
|
-
) -> ApiResponse[ComplementItemsResponse]:
|
|
152
|
-
"""Complement Items
|
|
153
|
-
|
|
154
|
-
Complement Items returns a list of items that complement the given input items. For example, if you have a list of items in a user's cart, you can use this endpoint to return items that complement the cart (i.e. \"Complete-the-bag\" use-cases).
|
|
155
|
-
|
|
156
|
-
:param model_name: (required)
|
|
157
|
-
:type model_name: str
|
|
158
|
-
:param x_api_key: (required)
|
|
159
|
-
:type x_api_key: str
|
|
160
|
-
:param complement_items_request:
|
|
161
|
-
:type complement_items_request: ComplementItemsRequest
|
|
162
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
163
|
-
number provided, it will be total request
|
|
164
|
-
timeout. It can also be a pair (tuple) of
|
|
165
|
-
(connection, read) timeouts.
|
|
166
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
167
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
168
|
-
request; this effectively ignores the
|
|
169
|
-
authentication in the spec for a single request.
|
|
170
|
-
:type _request_auth: dict, optional
|
|
171
|
-
:param _content_type: force content-type for the request.
|
|
172
|
-
:type _content_type: str, Optional
|
|
173
|
-
:param _headers: set to override the headers for a single
|
|
174
|
-
request; this effectively ignores the headers
|
|
175
|
-
in the spec for a single request.
|
|
176
|
-
:type _headers: dict, optional
|
|
177
|
-
:param _host_index: set to override the host_index for a single
|
|
178
|
-
request; this effectively ignores the host_index
|
|
179
|
-
in the spec for a single request.
|
|
180
|
-
:type _host_index: int, optional
|
|
181
|
-
:return: Returns the result object.
|
|
182
|
-
""" # noqa: E501
|
|
183
|
-
|
|
184
|
-
_param = self._post_complement_items_models_model_name_complement_items_post_serialize(
|
|
185
|
-
model_name=model_name,
|
|
186
|
-
x_api_key=x_api_key,
|
|
187
|
-
complement_items_request=complement_items_request,
|
|
188
|
-
_request_auth=_request_auth,
|
|
189
|
-
_content_type=_content_type,
|
|
190
|
-
_headers=_headers,
|
|
191
|
-
_host_index=_host_index
|
|
192
|
-
)
|
|
193
|
-
|
|
194
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
195
|
-
'200': "ComplementItemsResponse",
|
|
196
|
-
'422': "HTTPValidationError",
|
|
197
|
-
}
|
|
198
|
-
response_data = self.api_client.call_api(
|
|
199
|
-
*_param,
|
|
200
|
-
_request_timeout=_request_timeout
|
|
201
|
-
)
|
|
202
|
-
response_data.read()
|
|
203
|
-
return self.api_client.response_deserialize(
|
|
204
|
-
response_data=response_data,
|
|
205
|
-
response_types_map=_response_types_map,
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
@validate_call
|
|
210
|
-
def post_complement_items_models_model_name_complement_items_post_without_preload_content(
|
|
211
|
-
self,
|
|
212
|
-
model_name: StrictStr,
|
|
213
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
214
|
-
complement_items_request: Optional[ComplementItemsRequest] = None,
|
|
215
|
-
_request_timeout: Union[
|
|
216
|
-
None,
|
|
217
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
218
|
-
Tuple[
|
|
219
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
220
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
221
|
-
]
|
|
222
|
-
] = None,
|
|
223
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
224
|
-
_content_type: Optional[StrictStr] = None,
|
|
225
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
226
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
227
|
-
) -> RESTResponseType:
|
|
228
|
-
"""Complement Items
|
|
229
|
-
|
|
230
|
-
Complement Items returns a list of items that complement the given input items. For example, if you have a list of items in a user's cart, you can use this endpoint to return items that complement the cart (i.e. \"Complete-the-bag\" use-cases).
|
|
231
|
-
|
|
232
|
-
:param model_name: (required)
|
|
233
|
-
:type model_name: str
|
|
234
|
-
:param x_api_key: (required)
|
|
235
|
-
:type x_api_key: str
|
|
236
|
-
:param complement_items_request:
|
|
237
|
-
:type complement_items_request: ComplementItemsRequest
|
|
238
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
239
|
-
number provided, it will be total request
|
|
240
|
-
timeout. It can also be a pair (tuple) of
|
|
241
|
-
(connection, read) timeouts.
|
|
242
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
243
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
244
|
-
request; this effectively ignores the
|
|
245
|
-
authentication in the spec for a single request.
|
|
246
|
-
:type _request_auth: dict, optional
|
|
247
|
-
:param _content_type: force content-type for the request.
|
|
248
|
-
:type _content_type: str, Optional
|
|
249
|
-
:param _headers: set to override the headers for a single
|
|
250
|
-
request; this effectively ignores the headers
|
|
251
|
-
in the spec for a single request.
|
|
252
|
-
:type _headers: dict, optional
|
|
253
|
-
:param _host_index: set to override the host_index for a single
|
|
254
|
-
request; this effectively ignores the host_index
|
|
255
|
-
in the spec for a single request.
|
|
256
|
-
:type _host_index: int, optional
|
|
257
|
-
:return: Returns the result object.
|
|
258
|
-
""" # noqa: E501
|
|
259
|
-
|
|
260
|
-
_param = self._post_complement_items_models_model_name_complement_items_post_serialize(
|
|
261
|
-
model_name=model_name,
|
|
262
|
-
x_api_key=x_api_key,
|
|
263
|
-
complement_items_request=complement_items_request,
|
|
264
|
-
_request_auth=_request_auth,
|
|
265
|
-
_content_type=_content_type,
|
|
266
|
-
_headers=_headers,
|
|
267
|
-
_host_index=_host_index
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
271
|
-
'200': "ComplementItemsResponse",
|
|
272
|
-
'422': "HTTPValidationError",
|
|
273
|
-
}
|
|
274
|
-
response_data = self.api_client.call_api(
|
|
275
|
-
*_param,
|
|
276
|
-
_request_timeout=_request_timeout
|
|
277
|
-
)
|
|
278
|
-
return response_data.response
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
def _post_complement_items_models_model_name_complement_items_post_serialize(
|
|
282
|
-
self,
|
|
283
|
-
model_name,
|
|
284
|
-
x_api_key,
|
|
285
|
-
complement_items_request,
|
|
286
|
-
_request_auth,
|
|
287
|
-
_content_type,
|
|
288
|
-
_headers,
|
|
289
|
-
_host_index,
|
|
290
|
-
) -> RequestSerialized:
|
|
291
|
-
|
|
292
|
-
_host = None
|
|
293
|
-
|
|
294
|
-
_collection_formats: Dict[str, str] = {
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
_path_params: Dict[str, str] = {}
|
|
298
|
-
_query_params: List[Tuple[str, str]] = []
|
|
299
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
300
|
-
_form_params: List[Tuple[str, str]] = []
|
|
301
|
-
_files: Dict[
|
|
302
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
303
|
-
] = {}
|
|
304
|
-
_body_params: Optional[bytes] = None
|
|
305
|
-
|
|
306
|
-
# process the path parameters
|
|
307
|
-
if model_name is not None:
|
|
308
|
-
_path_params['model_name'] = model_name
|
|
309
|
-
# process the query parameters
|
|
310
|
-
# process the header parameters
|
|
311
|
-
if x_api_key is not None:
|
|
312
|
-
_header_params['x-api-key'] = x_api_key
|
|
313
|
-
# process the form parameters
|
|
314
|
-
# process the body parameter
|
|
315
|
-
if complement_items_request is not None:
|
|
316
|
-
_body_params = complement_items_request
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
# set the HTTP header `Accept`
|
|
320
|
-
if 'Accept' not in _header_params:
|
|
321
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
322
|
-
[
|
|
323
|
-
'application/json'
|
|
324
|
-
]
|
|
325
|
-
)
|
|
326
|
-
|
|
327
|
-
# set the HTTP header `Content-Type`
|
|
328
|
-
if _content_type:
|
|
329
|
-
_header_params['Content-Type'] = _content_type
|
|
330
|
-
else:
|
|
331
|
-
_default_content_type = (
|
|
332
|
-
self.api_client.select_header_content_type(
|
|
333
|
-
[
|
|
334
|
-
'application/json'
|
|
335
|
-
]
|
|
336
|
-
)
|
|
337
|
-
)
|
|
338
|
-
if _default_content_type is not None:
|
|
339
|
-
_header_params['Content-Type'] = _default_content_type
|
|
340
|
-
|
|
341
|
-
# authentication setting
|
|
342
|
-
_auth_settings: List[str] = [
|
|
343
|
-
]
|
|
344
|
-
|
|
345
|
-
return self.api_client.param_serialize(
|
|
346
|
-
method='POST',
|
|
347
|
-
resource_path='/models/{model_name}/complement_items',
|
|
348
|
-
path_params=_path_params,
|
|
349
|
-
query_params=_query_params,
|
|
350
|
-
header_params=_header_params,
|
|
351
|
-
body=_body_params,
|
|
352
|
-
post_params=_form_params,
|
|
353
|
-
files=_files,
|
|
354
|
-
auth_settings=_auth_settings,
|
|
355
|
-
collection_formats=_collection_formats,
|
|
356
|
-
_host=_host,
|
|
357
|
-
_request_auth=_request_auth
|
|
358
|
-
)
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
@validate_call
|
|
364
|
-
def post_create_item_embedding_models_model_name_create_item_embedding_post(
|
|
365
|
-
self,
|
|
366
|
-
model_name: StrictStr,
|
|
367
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
368
|
-
create_item_embedding_request: Optional[CreateItemEmbeddingRequest] = None,
|
|
369
|
-
_request_timeout: Union[
|
|
370
|
-
None,
|
|
371
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
372
|
-
Tuple[
|
|
373
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
374
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
375
|
-
]
|
|
376
|
-
] = None,
|
|
377
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
378
|
-
_content_type: Optional[StrictStr] = None,
|
|
379
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
380
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
381
|
-
) -> CreateEmbeddingResponse:
|
|
382
|
-
"""Create Item Embeddings
|
|
383
|
-
|
|
384
|
-
Create Item Embeddings generates a real-time item embedding for the given item. These embeddings are used to power a variety of content/product understanding use-cases at a lower level than our other inference endpoints. For example, in a zero-shot setting you can analyze these embeddings to understand the clusters of items in your catalog, which can be helpful for platform analytics and topic modeling use-cases. In a fine-tune setting, you can use these item embeddings as input into a downstream machine-learning task such as content moderation classification or your own recommendation model. If the dimension parameter is given, we project the embeddings to the given dimension. Note that if projecting the embedding then the embeddings won't be aligned across calls or with the user embeddings.
|
|
385
|
-
|
|
386
|
-
:param model_name: (required)
|
|
387
|
-
:type model_name: str
|
|
388
|
-
:param x_api_key: (required)
|
|
389
|
-
:type x_api_key: str
|
|
390
|
-
:param create_item_embedding_request:
|
|
391
|
-
:type create_item_embedding_request: CreateItemEmbeddingRequest
|
|
392
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
393
|
-
number provided, it will be total request
|
|
394
|
-
timeout. It can also be a pair (tuple) of
|
|
395
|
-
(connection, read) timeouts.
|
|
396
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
397
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
398
|
-
request; this effectively ignores the
|
|
399
|
-
authentication in the spec for a single request.
|
|
400
|
-
:type _request_auth: dict, optional
|
|
401
|
-
:param _content_type: force content-type for the request.
|
|
402
|
-
:type _content_type: str, Optional
|
|
403
|
-
:param _headers: set to override the headers for a single
|
|
404
|
-
request; this effectively ignores the headers
|
|
405
|
-
in the spec for a single request.
|
|
406
|
-
:type _headers: dict, optional
|
|
407
|
-
:param _host_index: set to override the host_index for a single
|
|
408
|
-
request; this effectively ignores the host_index
|
|
409
|
-
in the spec for a single request.
|
|
410
|
-
:type _host_index: int, optional
|
|
411
|
-
:return: Returns the result object.
|
|
412
|
-
""" # noqa: E501
|
|
413
|
-
|
|
414
|
-
_param = self._post_create_item_embedding_models_model_name_create_item_embedding_post_serialize(
|
|
415
|
-
model_name=model_name,
|
|
416
|
-
x_api_key=x_api_key,
|
|
417
|
-
create_item_embedding_request=create_item_embedding_request,
|
|
418
|
-
_request_auth=_request_auth,
|
|
419
|
-
_content_type=_content_type,
|
|
420
|
-
_headers=_headers,
|
|
421
|
-
_host_index=_host_index
|
|
422
|
-
)
|
|
423
|
-
|
|
424
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
425
|
-
'200': "CreateEmbeddingResponse",
|
|
426
|
-
'422': "HTTPValidationError",
|
|
427
|
-
}
|
|
428
|
-
response_data = self.api_client.call_api(
|
|
429
|
-
*_param,
|
|
430
|
-
_request_timeout=_request_timeout
|
|
431
|
-
)
|
|
432
|
-
response_data.read()
|
|
433
|
-
return self.api_client.response_deserialize(
|
|
434
|
-
response_data=response_data,
|
|
435
|
-
response_types_map=_response_types_map,
|
|
436
|
-
).data
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
@validate_call
|
|
440
|
-
def post_create_item_embedding_models_model_name_create_item_embedding_post_with_http_info(
|
|
441
|
-
self,
|
|
442
|
-
model_name: StrictStr,
|
|
443
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
444
|
-
create_item_embedding_request: Optional[CreateItemEmbeddingRequest] = None,
|
|
445
|
-
_request_timeout: Union[
|
|
446
|
-
None,
|
|
447
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
448
|
-
Tuple[
|
|
449
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
450
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
451
|
-
]
|
|
452
|
-
] = None,
|
|
453
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
454
|
-
_content_type: Optional[StrictStr] = None,
|
|
455
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
456
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
457
|
-
) -> ApiResponse[CreateEmbeddingResponse]:
|
|
458
|
-
"""Create Item Embeddings
|
|
459
|
-
|
|
460
|
-
Create Item Embeddings generates a real-time item embedding for the given item. These embeddings are used to power a variety of content/product understanding use-cases at a lower level than our other inference endpoints. For example, in a zero-shot setting you can analyze these embeddings to understand the clusters of items in your catalog, which can be helpful for platform analytics and topic modeling use-cases. In a fine-tune setting, you can use these item embeddings as input into a downstream machine-learning task such as content moderation classification or your own recommendation model. If the dimension parameter is given, we project the embeddings to the given dimension. Note that if projecting the embedding then the embeddings won't be aligned across calls or with the user embeddings.
|
|
461
|
-
|
|
462
|
-
:param model_name: (required)
|
|
463
|
-
:type model_name: str
|
|
464
|
-
:param x_api_key: (required)
|
|
465
|
-
:type x_api_key: str
|
|
466
|
-
:param create_item_embedding_request:
|
|
467
|
-
:type create_item_embedding_request: CreateItemEmbeddingRequest
|
|
468
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
469
|
-
number provided, it will be total request
|
|
470
|
-
timeout. It can also be a pair (tuple) of
|
|
471
|
-
(connection, read) timeouts.
|
|
472
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
473
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
474
|
-
request; this effectively ignores the
|
|
475
|
-
authentication in the spec for a single request.
|
|
476
|
-
:type _request_auth: dict, optional
|
|
477
|
-
:param _content_type: force content-type for the request.
|
|
478
|
-
:type _content_type: str, Optional
|
|
479
|
-
:param _headers: set to override the headers for a single
|
|
480
|
-
request; this effectively ignores the headers
|
|
481
|
-
in the spec for a single request.
|
|
482
|
-
:type _headers: dict, optional
|
|
483
|
-
:param _host_index: set to override the host_index for a single
|
|
484
|
-
request; this effectively ignores the host_index
|
|
485
|
-
in the spec for a single request.
|
|
486
|
-
:type _host_index: int, optional
|
|
487
|
-
:return: Returns the result object.
|
|
488
|
-
""" # noqa: E501
|
|
489
|
-
|
|
490
|
-
_param = self._post_create_item_embedding_models_model_name_create_item_embedding_post_serialize(
|
|
491
|
-
model_name=model_name,
|
|
492
|
-
x_api_key=x_api_key,
|
|
493
|
-
create_item_embedding_request=create_item_embedding_request,
|
|
494
|
-
_request_auth=_request_auth,
|
|
495
|
-
_content_type=_content_type,
|
|
496
|
-
_headers=_headers,
|
|
497
|
-
_host_index=_host_index
|
|
498
|
-
)
|
|
499
|
-
|
|
500
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
501
|
-
'200': "CreateEmbeddingResponse",
|
|
502
|
-
'422': "HTTPValidationError",
|
|
503
|
-
}
|
|
504
|
-
response_data = self.api_client.call_api(
|
|
505
|
-
*_param,
|
|
506
|
-
_request_timeout=_request_timeout
|
|
507
|
-
)
|
|
508
|
-
response_data.read()
|
|
509
|
-
return self.api_client.response_deserialize(
|
|
510
|
-
response_data=response_data,
|
|
511
|
-
response_types_map=_response_types_map,
|
|
512
|
-
)
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
@validate_call
|
|
516
|
-
def post_create_item_embedding_models_model_name_create_item_embedding_post_without_preload_content(
|
|
517
|
-
self,
|
|
518
|
-
model_name: StrictStr,
|
|
519
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
520
|
-
create_item_embedding_request: Optional[CreateItemEmbeddingRequest] = None,
|
|
521
|
-
_request_timeout: Union[
|
|
522
|
-
None,
|
|
523
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
524
|
-
Tuple[
|
|
525
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
526
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
527
|
-
]
|
|
528
|
-
] = None,
|
|
529
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
530
|
-
_content_type: Optional[StrictStr] = None,
|
|
531
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
532
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
533
|
-
) -> RESTResponseType:
|
|
534
|
-
"""Create Item Embeddings
|
|
535
|
-
|
|
536
|
-
Create Item Embeddings generates a real-time item embedding for the given item. These embeddings are used to power a variety of content/product understanding use-cases at a lower level than our other inference endpoints. For example, in a zero-shot setting you can analyze these embeddings to understand the clusters of items in your catalog, which can be helpful for platform analytics and topic modeling use-cases. In a fine-tune setting, you can use these item embeddings as input into a downstream machine-learning task such as content moderation classification or your own recommendation model. If the dimension parameter is given, we project the embeddings to the given dimension. Note that if projecting the embedding then the embeddings won't be aligned across calls or with the user embeddings.
|
|
537
|
-
|
|
538
|
-
:param model_name: (required)
|
|
539
|
-
:type model_name: str
|
|
540
|
-
:param x_api_key: (required)
|
|
541
|
-
:type x_api_key: str
|
|
542
|
-
:param create_item_embedding_request:
|
|
543
|
-
:type create_item_embedding_request: CreateItemEmbeddingRequest
|
|
544
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
545
|
-
number provided, it will be total request
|
|
546
|
-
timeout. It can also be a pair (tuple) of
|
|
547
|
-
(connection, read) timeouts.
|
|
548
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
549
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
550
|
-
request; this effectively ignores the
|
|
551
|
-
authentication in the spec for a single request.
|
|
552
|
-
:type _request_auth: dict, optional
|
|
553
|
-
:param _content_type: force content-type for the request.
|
|
554
|
-
:type _content_type: str, Optional
|
|
555
|
-
:param _headers: set to override the headers for a single
|
|
556
|
-
request; this effectively ignores the headers
|
|
557
|
-
in the spec for a single request.
|
|
558
|
-
:type _headers: dict, optional
|
|
559
|
-
:param _host_index: set to override the host_index for a single
|
|
560
|
-
request; this effectively ignores the host_index
|
|
561
|
-
in the spec for a single request.
|
|
562
|
-
:type _host_index: int, optional
|
|
563
|
-
:return: Returns the result object.
|
|
564
|
-
""" # noqa: E501
|
|
565
|
-
|
|
566
|
-
_param = self._post_create_item_embedding_models_model_name_create_item_embedding_post_serialize(
|
|
567
|
-
model_name=model_name,
|
|
568
|
-
x_api_key=x_api_key,
|
|
569
|
-
create_item_embedding_request=create_item_embedding_request,
|
|
570
|
-
_request_auth=_request_auth,
|
|
571
|
-
_content_type=_content_type,
|
|
572
|
-
_headers=_headers,
|
|
573
|
-
_host_index=_host_index
|
|
574
|
-
)
|
|
575
|
-
|
|
576
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
577
|
-
'200': "CreateEmbeddingResponse",
|
|
578
|
-
'422': "HTTPValidationError",
|
|
579
|
-
}
|
|
580
|
-
response_data = self.api_client.call_api(
|
|
581
|
-
*_param,
|
|
582
|
-
_request_timeout=_request_timeout
|
|
583
|
-
)
|
|
584
|
-
return response_data.response
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
def _post_create_item_embedding_models_model_name_create_item_embedding_post_serialize(
|
|
588
|
-
self,
|
|
589
|
-
model_name,
|
|
590
|
-
x_api_key,
|
|
591
|
-
create_item_embedding_request,
|
|
592
|
-
_request_auth,
|
|
593
|
-
_content_type,
|
|
594
|
-
_headers,
|
|
595
|
-
_host_index,
|
|
596
|
-
) -> RequestSerialized:
|
|
597
|
-
|
|
598
|
-
_host = None
|
|
599
|
-
|
|
600
|
-
_collection_formats: Dict[str, str] = {
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
_path_params: Dict[str, str] = {}
|
|
604
|
-
_query_params: List[Tuple[str, str]] = []
|
|
605
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
606
|
-
_form_params: List[Tuple[str, str]] = []
|
|
607
|
-
_files: Dict[
|
|
608
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
609
|
-
] = {}
|
|
610
|
-
_body_params: Optional[bytes] = None
|
|
611
|
-
|
|
612
|
-
# process the path parameters
|
|
613
|
-
if model_name is not None:
|
|
614
|
-
_path_params['model_name'] = model_name
|
|
615
|
-
# process the query parameters
|
|
616
|
-
# process the header parameters
|
|
617
|
-
if x_api_key is not None:
|
|
618
|
-
_header_params['x-api-key'] = x_api_key
|
|
619
|
-
# process the form parameters
|
|
620
|
-
# process the body parameter
|
|
621
|
-
if create_item_embedding_request is not None:
|
|
622
|
-
_body_params = create_item_embedding_request
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
# set the HTTP header `Accept`
|
|
626
|
-
if 'Accept' not in _header_params:
|
|
627
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
628
|
-
[
|
|
629
|
-
'application/json'
|
|
630
|
-
]
|
|
631
|
-
)
|
|
632
|
-
|
|
633
|
-
# set the HTTP header `Content-Type`
|
|
634
|
-
if _content_type:
|
|
635
|
-
_header_params['Content-Type'] = _content_type
|
|
636
|
-
else:
|
|
637
|
-
_default_content_type = (
|
|
638
|
-
self.api_client.select_header_content_type(
|
|
639
|
-
[
|
|
640
|
-
'application/json'
|
|
641
|
-
]
|
|
642
|
-
)
|
|
643
|
-
)
|
|
644
|
-
if _default_content_type is not None:
|
|
645
|
-
_header_params['Content-Type'] = _default_content_type
|
|
646
|
-
|
|
647
|
-
# authentication setting
|
|
648
|
-
_auth_settings: List[str] = [
|
|
649
|
-
]
|
|
650
|
-
|
|
651
|
-
return self.api_client.param_serialize(
|
|
652
|
-
method='POST',
|
|
653
|
-
resource_path='/models/{model_name}/item_embeddings',
|
|
654
|
-
path_params=_path_params,
|
|
655
|
-
query_params=_query_params,
|
|
656
|
-
header_params=_header_params,
|
|
657
|
-
body=_body_params,
|
|
658
|
-
post_params=_form_params,
|
|
659
|
-
files=_files,
|
|
660
|
-
auth_settings=_auth_settings,
|
|
661
|
-
collection_formats=_collection_formats,
|
|
662
|
-
_host=_host,
|
|
663
|
-
_request_auth=_request_auth
|
|
664
|
-
)
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
@validate_call
|
|
670
|
-
def post_create_user_embedding_models_model_name_create_user_embedding_post(
|
|
671
|
-
self,
|
|
672
|
-
model_name: StrictStr,
|
|
673
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
674
|
-
create_user_embedding_request: Optional[CreateUserEmbeddingRequest] = None,
|
|
675
|
-
_request_timeout: Union[
|
|
676
|
-
None,
|
|
677
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
678
|
-
Tuple[
|
|
679
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
680
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
681
|
-
]
|
|
682
|
-
] = None,
|
|
683
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
684
|
-
_content_type: Optional[StrictStr] = None,
|
|
685
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
686
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
687
|
-
) -> CreateEmbeddingResponse:
|
|
688
|
-
"""Create User Embeddings
|
|
689
|
-
|
|
690
|
-
Create User Embeddings generates a real-time user embedding for the given user. These embeddings are used to power a variety of content/product understanding use-cases at a lower level than our other inference endpoints. For example, in a zero-shot setting you can analyze these embeddings to understand the clusters of users, which can be helpful for platform analytics and user segmentation use-cases. In a fine-tune setting, you can use these user embeddings as input into a downstream machine-learning task such as churn prediction, fraud detection or your own recommendation model. If the dimension parameter is given, we project the embeddings to the given dimension. Note that if projecting the embedding then the embeddings won't be aligned across calls or with the item embeddings.
|
|
691
|
-
|
|
692
|
-
:param model_name: (required)
|
|
693
|
-
:type model_name: str
|
|
694
|
-
:param x_api_key: (required)
|
|
695
|
-
:type x_api_key: str
|
|
696
|
-
:param create_user_embedding_request:
|
|
697
|
-
:type create_user_embedding_request: CreateUserEmbeddingRequest
|
|
698
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
699
|
-
number provided, it will be total request
|
|
700
|
-
timeout. It can also be a pair (tuple) of
|
|
701
|
-
(connection, read) timeouts.
|
|
702
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
703
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
704
|
-
request; this effectively ignores the
|
|
705
|
-
authentication in the spec for a single request.
|
|
706
|
-
:type _request_auth: dict, optional
|
|
707
|
-
:param _content_type: force content-type for the request.
|
|
708
|
-
:type _content_type: str, Optional
|
|
709
|
-
:param _headers: set to override the headers for a single
|
|
710
|
-
request; this effectively ignores the headers
|
|
711
|
-
in the spec for a single request.
|
|
712
|
-
:type _headers: dict, optional
|
|
713
|
-
:param _host_index: set to override the host_index for a single
|
|
714
|
-
request; this effectively ignores the host_index
|
|
715
|
-
in the spec for a single request.
|
|
716
|
-
:type _host_index: int, optional
|
|
717
|
-
:return: Returns the result object.
|
|
718
|
-
""" # noqa: E501
|
|
719
|
-
|
|
720
|
-
_param = self._post_create_user_embedding_models_model_name_create_user_embedding_post_serialize(
|
|
721
|
-
model_name=model_name,
|
|
722
|
-
x_api_key=x_api_key,
|
|
723
|
-
create_user_embedding_request=create_user_embedding_request,
|
|
724
|
-
_request_auth=_request_auth,
|
|
725
|
-
_content_type=_content_type,
|
|
726
|
-
_headers=_headers,
|
|
727
|
-
_host_index=_host_index
|
|
728
|
-
)
|
|
729
|
-
|
|
730
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
731
|
-
'200': "CreateEmbeddingResponse",
|
|
732
|
-
'422': "HTTPValidationError",
|
|
733
|
-
}
|
|
734
|
-
response_data = self.api_client.call_api(
|
|
735
|
-
*_param,
|
|
736
|
-
_request_timeout=_request_timeout
|
|
737
|
-
)
|
|
738
|
-
response_data.read()
|
|
739
|
-
return self.api_client.response_deserialize(
|
|
740
|
-
response_data=response_data,
|
|
741
|
-
response_types_map=_response_types_map,
|
|
742
|
-
).data
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
@validate_call
|
|
746
|
-
def post_create_user_embedding_models_model_name_create_user_embedding_post_with_http_info(
|
|
747
|
-
self,
|
|
748
|
-
model_name: StrictStr,
|
|
749
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
750
|
-
create_user_embedding_request: Optional[CreateUserEmbeddingRequest] = None,
|
|
751
|
-
_request_timeout: Union[
|
|
752
|
-
None,
|
|
753
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
754
|
-
Tuple[
|
|
755
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
756
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
757
|
-
]
|
|
758
|
-
] = None,
|
|
759
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
760
|
-
_content_type: Optional[StrictStr] = None,
|
|
761
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
762
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
763
|
-
) -> ApiResponse[CreateEmbeddingResponse]:
|
|
764
|
-
"""Create User Embeddings
|
|
765
|
-
|
|
766
|
-
Create User Embeddings generates a real-time user embedding for the given user. These embeddings are used to power a variety of content/product understanding use-cases at a lower level than our other inference endpoints. For example, in a zero-shot setting you can analyze these embeddings to understand the clusters of users, which can be helpful for platform analytics and user segmentation use-cases. In a fine-tune setting, you can use these user embeddings as input into a downstream machine-learning task such as churn prediction, fraud detection or your own recommendation model. If the dimension parameter is given, we project the embeddings to the given dimension. Note that if projecting the embedding then the embeddings won't be aligned across calls or with the item embeddings.
|
|
767
|
-
|
|
768
|
-
:param model_name: (required)
|
|
769
|
-
:type model_name: str
|
|
770
|
-
:param x_api_key: (required)
|
|
771
|
-
:type x_api_key: str
|
|
772
|
-
:param create_user_embedding_request:
|
|
773
|
-
:type create_user_embedding_request: CreateUserEmbeddingRequest
|
|
774
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
775
|
-
number provided, it will be total request
|
|
776
|
-
timeout. It can also be a pair (tuple) of
|
|
777
|
-
(connection, read) timeouts.
|
|
778
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
779
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
780
|
-
request; this effectively ignores the
|
|
781
|
-
authentication in the spec for a single request.
|
|
782
|
-
:type _request_auth: dict, optional
|
|
783
|
-
:param _content_type: force content-type for the request.
|
|
784
|
-
:type _content_type: str, Optional
|
|
785
|
-
:param _headers: set to override the headers for a single
|
|
786
|
-
request; this effectively ignores the headers
|
|
787
|
-
in the spec for a single request.
|
|
788
|
-
:type _headers: dict, optional
|
|
789
|
-
:param _host_index: set to override the host_index for a single
|
|
790
|
-
request; this effectively ignores the host_index
|
|
791
|
-
in the spec for a single request.
|
|
792
|
-
:type _host_index: int, optional
|
|
793
|
-
:return: Returns the result object.
|
|
794
|
-
""" # noqa: E501
|
|
795
|
-
|
|
796
|
-
_param = self._post_create_user_embedding_models_model_name_create_user_embedding_post_serialize(
|
|
797
|
-
model_name=model_name,
|
|
798
|
-
x_api_key=x_api_key,
|
|
799
|
-
create_user_embedding_request=create_user_embedding_request,
|
|
800
|
-
_request_auth=_request_auth,
|
|
801
|
-
_content_type=_content_type,
|
|
802
|
-
_headers=_headers,
|
|
803
|
-
_host_index=_host_index
|
|
804
|
-
)
|
|
805
|
-
|
|
806
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
807
|
-
'200': "CreateEmbeddingResponse",
|
|
808
|
-
'422': "HTTPValidationError",
|
|
809
|
-
}
|
|
810
|
-
response_data = self.api_client.call_api(
|
|
811
|
-
*_param,
|
|
812
|
-
_request_timeout=_request_timeout
|
|
813
|
-
)
|
|
814
|
-
response_data.read()
|
|
815
|
-
return self.api_client.response_deserialize(
|
|
816
|
-
response_data=response_data,
|
|
817
|
-
response_types_map=_response_types_map,
|
|
818
|
-
)
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
@validate_call
|
|
822
|
-
def post_create_user_embedding_models_model_name_create_user_embedding_post_without_preload_content(
|
|
823
|
-
self,
|
|
824
|
-
model_name: StrictStr,
|
|
825
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
826
|
-
create_user_embedding_request: Optional[CreateUserEmbeddingRequest] = None,
|
|
827
|
-
_request_timeout: Union[
|
|
828
|
-
None,
|
|
829
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
830
|
-
Tuple[
|
|
831
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
832
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
833
|
-
]
|
|
834
|
-
] = None,
|
|
835
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
836
|
-
_content_type: Optional[StrictStr] = None,
|
|
837
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
838
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
839
|
-
) -> RESTResponseType:
|
|
840
|
-
"""Create User Embeddings
|
|
841
|
-
|
|
842
|
-
Create User Embeddings generates a real-time user embedding for the given user. These embeddings are used to power a variety of content/product understanding use-cases at a lower level than our other inference endpoints. For example, in a zero-shot setting you can analyze these embeddings to understand the clusters of users, which can be helpful for platform analytics and user segmentation use-cases. In a fine-tune setting, you can use these user embeddings as input into a downstream machine-learning task such as churn prediction, fraud detection or your own recommendation model. If the dimension parameter is given, we project the embeddings to the given dimension. Note that if projecting the embedding then the embeddings won't be aligned across calls or with the item embeddings.
|
|
843
|
-
|
|
844
|
-
:param model_name: (required)
|
|
845
|
-
:type model_name: str
|
|
846
|
-
:param x_api_key: (required)
|
|
847
|
-
:type x_api_key: str
|
|
848
|
-
:param create_user_embedding_request:
|
|
849
|
-
:type create_user_embedding_request: CreateUserEmbeddingRequest
|
|
850
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
851
|
-
number provided, it will be total request
|
|
852
|
-
timeout. It can also be a pair (tuple) of
|
|
853
|
-
(connection, read) timeouts.
|
|
854
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
855
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
856
|
-
request; this effectively ignores the
|
|
857
|
-
authentication in the spec for a single request.
|
|
858
|
-
:type _request_auth: dict, optional
|
|
859
|
-
:param _content_type: force content-type for the request.
|
|
860
|
-
:type _content_type: str, Optional
|
|
861
|
-
:param _headers: set to override the headers for a single
|
|
862
|
-
request; this effectively ignores the headers
|
|
863
|
-
in the spec for a single request.
|
|
864
|
-
:type _headers: dict, optional
|
|
865
|
-
:param _host_index: set to override the host_index for a single
|
|
866
|
-
request; this effectively ignores the host_index
|
|
867
|
-
in the spec for a single request.
|
|
868
|
-
:type _host_index: int, optional
|
|
869
|
-
:return: Returns the result object.
|
|
870
|
-
""" # noqa: E501
|
|
871
|
-
|
|
872
|
-
_param = self._post_create_user_embedding_models_model_name_create_user_embedding_post_serialize(
|
|
873
|
-
model_name=model_name,
|
|
874
|
-
x_api_key=x_api_key,
|
|
875
|
-
create_user_embedding_request=create_user_embedding_request,
|
|
876
|
-
_request_auth=_request_auth,
|
|
877
|
-
_content_type=_content_type,
|
|
878
|
-
_headers=_headers,
|
|
879
|
-
_host_index=_host_index
|
|
880
|
-
)
|
|
881
|
-
|
|
882
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
883
|
-
'200': "CreateEmbeddingResponse",
|
|
884
|
-
'422': "HTTPValidationError",
|
|
885
|
-
}
|
|
886
|
-
response_data = self.api_client.call_api(
|
|
887
|
-
*_param,
|
|
888
|
-
_request_timeout=_request_timeout
|
|
889
|
-
)
|
|
890
|
-
return response_data.response
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
def _post_create_user_embedding_models_model_name_create_user_embedding_post_serialize(
|
|
894
|
-
self,
|
|
895
|
-
model_name,
|
|
896
|
-
x_api_key,
|
|
897
|
-
create_user_embedding_request,
|
|
898
|
-
_request_auth,
|
|
899
|
-
_content_type,
|
|
900
|
-
_headers,
|
|
901
|
-
_host_index,
|
|
902
|
-
) -> RequestSerialized:
|
|
903
|
-
|
|
904
|
-
_host = None
|
|
905
|
-
|
|
906
|
-
_collection_formats: Dict[str, str] = {
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
_path_params: Dict[str, str] = {}
|
|
910
|
-
_query_params: List[Tuple[str, str]] = []
|
|
911
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
912
|
-
_form_params: List[Tuple[str, str]] = []
|
|
913
|
-
_files: Dict[
|
|
914
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
915
|
-
] = {}
|
|
916
|
-
_body_params: Optional[bytes] = None
|
|
917
|
-
|
|
918
|
-
# process the path parameters
|
|
919
|
-
if model_name is not None:
|
|
920
|
-
_path_params['model_name'] = model_name
|
|
921
|
-
# process the query parameters
|
|
922
|
-
# process the header parameters
|
|
923
|
-
if x_api_key is not None:
|
|
924
|
-
_header_params['x-api-key'] = x_api_key
|
|
925
|
-
# process the form parameters
|
|
926
|
-
# process the body parameter
|
|
927
|
-
if create_user_embedding_request is not None:
|
|
928
|
-
_body_params = create_user_embedding_request
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
# set the HTTP header `Accept`
|
|
932
|
-
if 'Accept' not in _header_params:
|
|
933
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
934
|
-
[
|
|
935
|
-
'application/json'
|
|
936
|
-
]
|
|
937
|
-
)
|
|
938
|
-
|
|
939
|
-
# set the HTTP header `Content-Type`
|
|
940
|
-
if _content_type:
|
|
941
|
-
_header_params['Content-Type'] = _content_type
|
|
942
|
-
else:
|
|
943
|
-
_default_content_type = (
|
|
944
|
-
self.api_client.select_header_content_type(
|
|
945
|
-
[
|
|
946
|
-
'application/json'
|
|
947
|
-
]
|
|
948
|
-
)
|
|
949
|
-
)
|
|
950
|
-
if _default_content_type is not None:
|
|
951
|
-
_header_params['Content-Type'] = _default_content_type
|
|
952
|
-
|
|
953
|
-
# authentication setting
|
|
954
|
-
_auth_settings: List[str] = [
|
|
955
|
-
]
|
|
956
|
-
|
|
957
|
-
return self.api_client.param_serialize(
|
|
958
|
-
method='POST',
|
|
959
|
-
resource_path='/models/{model_name}/user_embeddings',
|
|
960
|
-
path_params=_path_params,
|
|
961
|
-
query_params=_query_params,
|
|
962
|
-
header_params=_header_params,
|
|
963
|
-
body=_body_params,
|
|
964
|
-
post_params=_form_params,
|
|
965
|
-
files=_files,
|
|
966
|
-
auth_settings=_auth_settings,
|
|
967
|
-
collection_formats=_collection_formats,
|
|
968
|
-
_host=_host,
|
|
969
|
-
_request_auth=_request_auth
|
|
970
|
-
)
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
@validate_call
|
|
976
|
-
def post_rank_attribute_grid_models_model_name_rank_attribute_grid_post(
|
|
977
|
-
self,
|
|
978
|
-
model_name: StrictStr,
|
|
979
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
980
|
-
rank_grid_attribute_request1: Optional[RankGridAttributeRequest1] = None,
|
|
981
|
-
_request_timeout: Union[
|
|
982
|
-
None,
|
|
983
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
984
|
-
Tuple[
|
|
985
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
986
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
987
|
-
]
|
|
988
|
-
] = None,
|
|
989
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
990
|
-
_content_type: Optional[StrictStr] = None,
|
|
991
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
992
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
993
|
-
) -> RankGridAttributeResponse:
|
|
994
|
-
"""Rank Attribute Grid
|
|
995
|
-
|
|
996
|
-
Rank Attribute Grid is used to build a grid interface of items, much like what you'd see on streaming sites or e-commerce marketplaces. The rows define different attributes (the top-most being the most relevant to the query user) and the columns are different items (the left-most being the most relevant to the query user). If a container type is used as the given attribute then the rows will be ranked by the inner container element values.
|
|
997
|
-
|
|
998
|
-
:param model_name: (required)
|
|
999
|
-
:type model_name: str
|
|
1000
|
-
:param x_api_key: (required)
|
|
1001
|
-
:type x_api_key: str
|
|
1002
|
-
:param rank_grid_attribute_request1:
|
|
1003
|
-
:type rank_grid_attribute_request1: RankGridAttributeRequest1
|
|
1004
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1005
|
-
number provided, it will be total request
|
|
1006
|
-
timeout. It can also be a pair (tuple) of
|
|
1007
|
-
(connection, read) timeouts.
|
|
1008
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1009
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1010
|
-
request; this effectively ignores the
|
|
1011
|
-
authentication in the spec for a single request.
|
|
1012
|
-
:type _request_auth: dict, optional
|
|
1013
|
-
:param _content_type: force content-type for the request.
|
|
1014
|
-
:type _content_type: str, Optional
|
|
1015
|
-
:param _headers: set to override the headers for a single
|
|
1016
|
-
request; this effectively ignores the headers
|
|
1017
|
-
in the spec for a single request.
|
|
1018
|
-
:type _headers: dict, optional
|
|
1019
|
-
:param _host_index: set to override the host_index for a single
|
|
1020
|
-
request; this effectively ignores the host_index
|
|
1021
|
-
in the spec for a single request.
|
|
1022
|
-
:type _host_index: int, optional
|
|
1023
|
-
:return: Returns the result object.
|
|
1024
|
-
""" # noqa: E501
|
|
1025
|
-
|
|
1026
|
-
_param = self._post_rank_attribute_grid_models_model_name_rank_attribute_grid_post_serialize(
|
|
1027
|
-
model_name=model_name,
|
|
1028
|
-
x_api_key=x_api_key,
|
|
1029
|
-
rank_grid_attribute_request1=rank_grid_attribute_request1,
|
|
1030
|
-
_request_auth=_request_auth,
|
|
1031
|
-
_content_type=_content_type,
|
|
1032
|
-
_headers=_headers,
|
|
1033
|
-
_host_index=_host_index
|
|
1034
|
-
)
|
|
1035
|
-
|
|
1036
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1037
|
-
'200': "RankGridAttributeResponse",
|
|
1038
|
-
'422': "HTTPValidationError",
|
|
1039
|
-
}
|
|
1040
|
-
response_data = self.api_client.call_api(
|
|
1041
|
-
*_param,
|
|
1042
|
-
_request_timeout=_request_timeout
|
|
1043
|
-
)
|
|
1044
|
-
response_data.read()
|
|
1045
|
-
return self.api_client.response_deserialize(
|
|
1046
|
-
response_data=response_data,
|
|
1047
|
-
response_types_map=_response_types_map,
|
|
1048
|
-
).data
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
@validate_call
|
|
1052
|
-
def post_rank_attribute_grid_models_model_name_rank_attribute_grid_post_with_http_info(
|
|
1053
|
-
self,
|
|
1054
|
-
model_name: StrictStr,
|
|
1055
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1056
|
-
rank_grid_attribute_request1: Optional[RankGridAttributeRequest1] = None,
|
|
1057
|
-
_request_timeout: Union[
|
|
1058
|
-
None,
|
|
1059
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1060
|
-
Tuple[
|
|
1061
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1062
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1063
|
-
]
|
|
1064
|
-
] = None,
|
|
1065
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1066
|
-
_content_type: Optional[StrictStr] = None,
|
|
1067
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1068
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1069
|
-
) -> ApiResponse[RankGridAttributeResponse]:
|
|
1070
|
-
"""Rank Attribute Grid
|
|
1071
|
-
|
|
1072
|
-
Rank Attribute Grid is used to build a grid interface of items, much like what you'd see on streaming sites or e-commerce marketplaces. The rows define different attributes (the top-most being the most relevant to the query user) and the columns are different items (the left-most being the most relevant to the query user). If a container type is used as the given attribute then the rows will be ranked by the inner container element values.
|
|
1073
|
-
|
|
1074
|
-
:param model_name: (required)
|
|
1075
|
-
:type model_name: str
|
|
1076
|
-
:param x_api_key: (required)
|
|
1077
|
-
:type x_api_key: str
|
|
1078
|
-
:param rank_grid_attribute_request1:
|
|
1079
|
-
:type rank_grid_attribute_request1: RankGridAttributeRequest1
|
|
1080
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1081
|
-
number provided, it will be total request
|
|
1082
|
-
timeout. It can also be a pair (tuple) of
|
|
1083
|
-
(connection, read) timeouts.
|
|
1084
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1085
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1086
|
-
request; this effectively ignores the
|
|
1087
|
-
authentication in the spec for a single request.
|
|
1088
|
-
:type _request_auth: dict, optional
|
|
1089
|
-
:param _content_type: force content-type for the request.
|
|
1090
|
-
:type _content_type: str, Optional
|
|
1091
|
-
:param _headers: set to override the headers for a single
|
|
1092
|
-
request; this effectively ignores the headers
|
|
1093
|
-
in the spec for a single request.
|
|
1094
|
-
:type _headers: dict, optional
|
|
1095
|
-
:param _host_index: set to override the host_index for a single
|
|
1096
|
-
request; this effectively ignores the host_index
|
|
1097
|
-
in the spec for a single request.
|
|
1098
|
-
:type _host_index: int, optional
|
|
1099
|
-
:return: Returns the result object.
|
|
1100
|
-
""" # noqa: E501
|
|
1101
|
-
|
|
1102
|
-
_param = self._post_rank_attribute_grid_models_model_name_rank_attribute_grid_post_serialize(
|
|
1103
|
-
model_name=model_name,
|
|
1104
|
-
x_api_key=x_api_key,
|
|
1105
|
-
rank_grid_attribute_request1=rank_grid_attribute_request1,
|
|
1106
|
-
_request_auth=_request_auth,
|
|
1107
|
-
_content_type=_content_type,
|
|
1108
|
-
_headers=_headers,
|
|
1109
|
-
_host_index=_host_index
|
|
1110
|
-
)
|
|
1111
|
-
|
|
1112
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1113
|
-
'200': "RankGridAttributeResponse",
|
|
1114
|
-
'422': "HTTPValidationError",
|
|
1115
|
-
}
|
|
1116
|
-
response_data = self.api_client.call_api(
|
|
1117
|
-
*_param,
|
|
1118
|
-
_request_timeout=_request_timeout
|
|
1119
|
-
)
|
|
1120
|
-
response_data.read()
|
|
1121
|
-
return self.api_client.response_deserialize(
|
|
1122
|
-
response_data=response_data,
|
|
1123
|
-
response_types_map=_response_types_map,
|
|
1124
|
-
)
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
@validate_call
|
|
1128
|
-
def post_rank_attribute_grid_models_model_name_rank_attribute_grid_post_without_preload_content(
|
|
1129
|
-
self,
|
|
1130
|
-
model_name: StrictStr,
|
|
1131
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1132
|
-
rank_grid_attribute_request1: Optional[RankGridAttributeRequest1] = None,
|
|
1133
|
-
_request_timeout: Union[
|
|
1134
|
-
None,
|
|
1135
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1136
|
-
Tuple[
|
|
1137
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1138
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1139
|
-
]
|
|
1140
|
-
] = None,
|
|
1141
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1142
|
-
_content_type: Optional[StrictStr] = None,
|
|
1143
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1144
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1145
|
-
) -> RESTResponseType:
|
|
1146
|
-
"""Rank Attribute Grid
|
|
1147
|
-
|
|
1148
|
-
Rank Attribute Grid is used to build a grid interface of items, much like what you'd see on streaming sites or e-commerce marketplaces. The rows define different attributes (the top-most being the most relevant to the query user) and the columns are different items (the left-most being the most relevant to the query user). If a container type is used as the given attribute then the rows will be ranked by the inner container element values.
|
|
1149
|
-
|
|
1150
|
-
:param model_name: (required)
|
|
1151
|
-
:type model_name: str
|
|
1152
|
-
:param x_api_key: (required)
|
|
1153
|
-
:type x_api_key: str
|
|
1154
|
-
:param rank_grid_attribute_request1:
|
|
1155
|
-
:type rank_grid_attribute_request1: RankGridAttributeRequest1
|
|
1156
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1157
|
-
number provided, it will be total request
|
|
1158
|
-
timeout. It can also be a pair (tuple) of
|
|
1159
|
-
(connection, read) timeouts.
|
|
1160
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1161
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1162
|
-
request; this effectively ignores the
|
|
1163
|
-
authentication in the spec for a single request.
|
|
1164
|
-
:type _request_auth: dict, optional
|
|
1165
|
-
:param _content_type: force content-type for the request.
|
|
1166
|
-
:type _content_type: str, Optional
|
|
1167
|
-
:param _headers: set to override the headers for a single
|
|
1168
|
-
request; this effectively ignores the headers
|
|
1169
|
-
in the spec for a single request.
|
|
1170
|
-
:type _headers: dict, optional
|
|
1171
|
-
:param _host_index: set to override the host_index for a single
|
|
1172
|
-
request; this effectively ignores the host_index
|
|
1173
|
-
in the spec for a single request.
|
|
1174
|
-
:type _host_index: int, optional
|
|
1175
|
-
:return: Returns the result object.
|
|
1176
|
-
""" # noqa: E501
|
|
1177
|
-
|
|
1178
|
-
_param = self._post_rank_attribute_grid_models_model_name_rank_attribute_grid_post_serialize(
|
|
1179
|
-
model_name=model_name,
|
|
1180
|
-
x_api_key=x_api_key,
|
|
1181
|
-
rank_grid_attribute_request1=rank_grid_attribute_request1,
|
|
1182
|
-
_request_auth=_request_auth,
|
|
1183
|
-
_content_type=_content_type,
|
|
1184
|
-
_headers=_headers,
|
|
1185
|
-
_host_index=_host_index
|
|
1186
|
-
)
|
|
1187
|
-
|
|
1188
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1189
|
-
'200': "RankGridAttributeResponse",
|
|
1190
|
-
'422': "HTTPValidationError",
|
|
1191
|
-
}
|
|
1192
|
-
response_data = self.api_client.call_api(
|
|
1193
|
-
*_param,
|
|
1194
|
-
_request_timeout=_request_timeout
|
|
1195
|
-
)
|
|
1196
|
-
return response_data.response
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
def _post_rank_attribute_grid_models_model_name_rank_attribute_grid_post_serialize(
|
|
1200
|
-
self,
|
|
1201
|
-
model_name,
|
|
1202
|
-
x_api_key,
|
|
1203
|
-
rank_grid_attribute_request1,
|
|
1204
|
-
_request_auth,
|
|
1205
|
-
_content_type,
|
|
1206
|
-
_headers,
|
|
1207
|
-
_host_index,
|
|
1208
|
-
) -> RequestSerialized:
|
|
1209
|
-
|
|
1210
|
-
_host = None
|
|
1211
|
-
|
|
1212
|
-
_collection_formats: Dict[str, str] = {
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
_path_params: Dict[str, str] = {}
|
|
1216
|
-
_query_params: List[Tuple[str, str]] = []
|
|
1217
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
1218
|
-
_form_params: List[Tuple[str, str]] = []
|
|
1219
|
-
_files: Dict[
|
|
1220
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
1221
|
-
] = {}
|
|
1222
|
-
_body_params: Optional[bytes] = None
|
|
1223
|
-
|
|
1224
|
-
# process the path parameters
|
|
1225
|
-
if model_name is not None:
|
|
1226
|
-
_path_params['model_name'] = model_name
|
|
1227
|
-
# process the query parameters
|
|
1228
|
-
# process the header parameters
|
|
1229
|
-
if x_api_key is not None:
|
|
1230
|
-
_header_params['x-api-key'] = x_api_key
|
|
1231
|
-
# process the form parameters
|
|
1232
|
-
# process the body parameter
|
|
1233
|
-
if rank_grid_attribute_request1 is not None:
|
|
1234
|
-
_body_params = rank_grid_attribute_request1
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
# set the HTTP header `Accept`
|
|
1238
|
-
if 'Accept' not in _header_params:
|
|
1239
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
1240
|
-
[
|
|
1241
|
-
'application/json'
|
|
1242
|
-
]
|
|
1243
|
-
)
|
|
1244
|
-
|
|
1245
|
-
# set the HTTP header `Content-Type`
|
|
1246
|
-
if _content_type:
|
|
1247
|
-
_header_params['Content-Type'] = _content_type
|
|
1248
|
-
else:
|
|
1249
|
-
_default_content_type = (
|
|
1250
|
-
self.api_client.select_header_content_type(
|
|
1251
|
-
[
|
|
1252
|
-
'application/json'
|
|
1253
|
-
]
|
|
1254
|
-
)
|
|
1255
|
-
)
|
|
1256
|
-
if _default_content_type is not None:
|
|
1257
|
-
_header_params['Content-Type'] = _default_content_type
|
|
1258
|
-
|
|
1259
|
-
# authentication setting
|
|
1260
|
-
_auth_settings: List[str] = [
|
|
1261
|
-
]
|
|
1262
|
-
|
|
1263
|
-
return self.api_client.param_serialize(
|
|
1264
|
-
method='POST',
|
|
1265
|
-
resource_path='/models/{model_name}/rank_attribute_grid',
|
|
1266
|
-
path_params=_path_params,
|
|
1267
|
-
query_params=_query_params,
|
|
1268
|
-
header_params=_header_params,
|
|
1269
|
-
body=_body_params,
|
|
1270
|
-
post_params=_form_params,
|
|
1271
|
-
files=_files,
|
|
1272
|
-
auth_settings=_auth_settings,
|
|
1273
|
-
collection_formats=_collection_formats,
|
|
1274
|
-
_host=_host,
|
|
1275
|
-
_request_auth=_request_auth
|
|
1276
|
-
)
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
@validate_call
|
|
1282
|
-
def post_rank_attributes_models_model_name_rank_attributes_post(
|
|
1283
|
-
self,
|
|
1284
|
-
model_name: StrictStr,
|
|
1285
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1286
|
-
rank_grid_attribute_request: Optional[RankGridAttributeRequest] = None,
|
|
1287
|
-
_request_timeout: Union[
|
|
1288
|
-
None,
|
|
1289
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1290
|
-
Tuple[
|
|
1291
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1292
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1293
|
-
]
|
|
1294
|
-
] = None,
|
|
1295
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1296
|
-
_content_type: Optional[StrictStr] = None,
|
|
1297
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1298
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1299
|
-
) -> RankAttributeResponse:
|
|
1300
|
-
"""Rank Attributes
|
|
1301
|
-
|
|
1302
|
-
Rank Attributes returns the most relevant attribute values for the given input user and attribute name. The attribute_name must match the item attributes of the model. If no user_id is provided then the most popular attributes are returned.
|
|
1303
|
-
|
|
1304
|
-
:param model_name: (required)
|
|
1305
|
-
:type model_name: str
|
|
1306
|
-
:param x_api_key: (required)
|
|
1307
|
-
:type x_api_key: str
|
|
1308
|
-
:param rank_grid_attribute_request:
|
|
1309
|
-
:type rank_grid_attribute_request: RankGridAttributeRequest
|
|
1310
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1311
|
-
number provided, it will be total request
|
|
1312
|
-
timeout. It can also be a pair (tuple) of
|
|
1313
|
-
(connection, read) timeouts.
|
|
1314
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1315
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1316
|
-
request; this effectively ignores the
|
|
1317
|
-
authentication in the spec for a single request.
|
|
1318
|
-
:type _request_auth: dict, optional
|
|
1319
|
-
:param _content_type: force content-type for the request.
|
|
1320
|
-
:type _content_type: str, Optional
|
|
1321
|
-
:param _headers: set to override the headers for a single
|
|
1322
|
-
request; this effectively ignores the headers
|
|
1323
|
-
in the spec for a single request.
|
|
1324
|
-
:type _headers: dict, optional
|
|
1325
|
-
:param _host_index: set to override the host_index for a single
|
|
1326
|
-
request; this effectively ignores the host_index
|
|
1327
|
-
in the spec for a single request.
|
|
1328
|
-
:type _host_index: int, optional
|
|
1329
|
-
:return: Returns the result object.
|
|
1330
|
-
""" # noqa: E501
|
|
1331
|
-
|
|
1332
|
-
_param = self._post_rank_attributes_models_model_name_rank_attributes_post_serialize(
|
|
1333
|
-
model_name=model_name,
|
|
1334
|
-
x_api_key=x_api_key,
|
|
1335
|
-
rank_grid_attribute_request=rank_grid_attribute_request,
|
|
1336
|
-
_request_auth=_request_auth,
|
|
1337
|
-
_content_type=_content_type,
|
|
1338
|
-
_headers=_headers,
|
|
1339
|
-
_host_index=_host_index
|
|
1340
|
-
)
|
|
1341
|
-
|
|
1342
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1343
|
-
'200': "RankAttributeResponse",
|
|
1344
|
-
'422': "HTTPValidationError",
|
|
1345
|
-
}
|
|
1346
|
-
response_data = self.api_client.call_api(
|
|
1347
|
-
*_param,
|
|
1348
|
-
_request_timeout=_request_timeout
|
|
1349
|
-
)
|
|
1350
|
-
response_data.read()
|
|
1351
|
-
return self.api_client.response_deserialize(
|
|
1352
|
-
response_data=response_data,
|
|
1353
|
-
response_types_map=_response_types_map,
|
|
1354
|
-
).data
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
@validate_call
|
|
1358
|
-
def post_rank_attributes_models_model_name_rank_attributes_post_with_http_info(
|
|
1359
|
-
self,
|
|
1360
|
-
model_name: StrictStr,
|
|
1361
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1362
|
-
rank_grid_attribute_request: Optional[RankGridAttributeRequest] = None,
|
|
1363
|
-
_request_timeout: Union[
|
|
1364
|
-
None,
|
|
1365
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1366
|
-
Tuple[
|
|
1367
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1368
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1369
|
-
]
|
|
1370
|
-
] = None,
|
|
1371
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1372
|
-
_content_type: Optional[StrictStr] = None,
|
|
1373
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1374
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1375
|
-
) -> ApiResponse[RankAttributeResponse]:
|
|
1376
|
-
"""Rank Attributes
|
|
1377
|
-
|
|
1378
|
-
Rank Attributes returns the most relevant attribute values for the given input user and attribute name. The attribute_name must match the item attributes of the model. If no user_id is provided then the most popular attributes are returned.
|
|
1379
|
-
|
|
1380
|
-
:param model_name: (required)
|
|
1381
|
-
:type model_name: str
|
|
1382
|
-
:param x_api_key: (required)
|
|
1383
|
-
:type x_api_key: str
|
|
1384
|
-
:param rank_grid_attribute_request:
|
|
1385
|
-
:type rank_grid_attribute_request: RankGridAttributeRequest
|
|
1386
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1387
|
-
number provided, it will be total request
|
|
1388
|
-
timeout. It can also be a pair (tuple) of
|
|
1389
|
-
(connection, read) timeouts.
|
|
1390
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1391
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1392
|
-
request; this effectively ignores the
|
|
1393
|
-
authentication in the spec for a single request.
|
|
1394
|
-
:type _request_auth: dict, optional
|
|
1395
|
-
:param _content_type: force content-type for the request.
|
|
1396
|
-
:type _content_type: str, Optional
|
|
1397
|
-
:param _headers: set to override the headers for a single
|
|
1398
|
-
request; this effectively ignores the headers
|
|
1399
|
-
in the spec for a single request.
|
|
1400
|
-
:type _headers: dict, optional
|
|
1401
|
-
:param _host_index: set to override the host_index for a single
|
|
1402
|
-
request; this effectively ignores the host_index
|
|
1403
|
-
in the spec for a single request.
|
|
1404
|
-
:type _host_index: int, optional
|
|
1405
|
-
:return: Returns the result object.
|
|
1406
|
-
""" # noqa: E501
|
|
1407
|
-
|
|
1408
|
-
_param = self._post_rank_attributes_models_model_name_rank_attributes_post_serialize(
|
|
1409
|
-
model_name=model_name,
|
|
1410
|
-
x_api_key=x_api_key,
|
|
1411
|
-
rank_grid_attribute_request=rank_grid_attribute_request,
|
|
1412
|
-
_request_auth=_request_auth,
|
|
1413
|
-
_content_type=_content_type,
|
|
1414
|
-
_headers=_headers,
|
|
1415
|
-
_host_index=_host_index
|
|
1416
|
-
)
|
|
1417
|
-
|
|
1418
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1419
|
-
'200': "RankAttributeResponse",
|
|
1420
|
-
'422': "HTTPValidationError",
|
|
1421
|
-
}
|
|
1422
|
-
response_data = self.api_client.call_api(
|
|
1423
|
-
*_param,
|
|
1424
|
-
_request_timeout=_request_timeout
|
|
1425
|
-
)
|
|
1426
|
-
response_data.read()
|
|
1427
|
-
return self.api_client.response_deserialize(
|
|
1428
|
-
response_data=response_data,
|
|
1429
|
-
response_types_map=_response_types_map,
|
|
1430
|
-
)
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
@validate_call
|
|
1434
|
-
def post_rank_attributes_models_model_name_rank_attributes_post_without_preload_content(
|
|
1435
|
-
self,
|
|
1436
|
-
model_name: StrictStr,
|
|
1437
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1438
|
-
rank_grid_attribute_request: Optional[RankGridAttributeRequest] = None,
|
|
1439
|
-
_request_timeout: Union[
|
|
1440
|
-
None,
|
|
1441
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1442
|
-
Tuple[
|
|
1443
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1444
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1445
|
-
]
|
|
1446
|
-
] = None,
|
|
1447
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1448
|
-
_content_type: Optional[StrictStr] = None,
|
|
1449
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1450
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1451
|
-
) -> RESTResponseType:
|
|
1452
|
-
"""Rank Attributes
|
|
1453
|
-
|
|
1454
|
-
Rank Attributes returns the most relevant attribute values for the given input user and attribute name. The attribute_name must match the item attributes of the model. If no user_id is provided then the most popular attributes are returned.
|
|
1455
|
-
|
|
1456
|
-
:param model_name: (required)
|
|
1457
|
-
:type model_name: str
|
|
1458
|
-
:param x_api_key: (required)
|
|
1459
|
-
:type x_api_key: str
|
|
1460
|
-
:param rank_grid_attribute_request:
|
|
1461
|
-
:type rank_grid_attribute_request: RankGridAttributeRequest
|
|
1462
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1463
|
-
number provided, it will be total request
|
|
1464
|
-
timeout. It can also be a pair (tuple) of
|
|
1465
|
-
(connection, read) timeouts.
|
|
1466
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1467
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1468
|
-
request; this effectively ignores the
|
|
1469
|
-
authentication in the spec for a single request.
|
|
1470
|
-
:type _request_auth: dict, optional
|
|
1471
|
-
:param _content_type: force content-type for the request.
|
|
1472
|
-
:type _content_type: str, Optional
|
|
1473
|
-
:param _headers: set to override the headers for a single
|
|
1474
|
-
request; this effectively ignores the headers
|
|
1475
|
-
in the spec for a single request.
|
|
1476
|
-
:type _headers: dict, optional
|
|
1477
|
-
:param _host_index: set to override the host_index for a single
|
|
1478
|
-
request; this effectively ignores the host_index
|
|
1479
|
-
in the spec for a single request.
|
|
1480
|
-
:type _host_index: int, optional
|
|
1481
|
-
:return: Returns the result object.
|
|
1482
|
-
""" # noqa: E501
|
|
1483
|
-
|
|
1484
|
-
_param = self._post_rank_attributes_models_model_name_rank_attributes_post_serialize(
|
|
1485
|
-
model_name=model_name,
|
|
1486
|
-
x_api_key=x_api_key,
|
|
1487
|
-
rank_grid_attribute_request=rank_grid_attribute_request,
|
|
1488
|
-
_request_auth=_request_auth,
|
|
1489
|
-
_content_type=_content_type,
|
|
1490
|
-
_headers=_headers,
|
|
1491
|
-
_host_index=_host_index
|
|
1492
|
-
)
|
|
1493
|
-
|
|
1494
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1495
|
-
'200': "RankAttributeResponse",
|
|
1496
|
-
'422': "HTTPValidationError",
|
|
1497
|
-
}
|
|
1498
|
-
response_data = self.api_client.call_api(
|
|
1499
|
-
*_param,
|
|
1500
|
-
_request_timeout=_request_timeout
|
|
1501
|
-
)
|
|
1502
|
-
return response_data.response
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
def _post_rank_attributes_models_model_name_rank_attributes_post_serialize(
|
|
1506
|
-
self,
|
|
1507
|
-
model_name,
|
|
1508
|
-
x_api_key,
|
|
1509
|
-
rank_grid_attribute_request,
|
|
1510
|
-
_request_auth,
|
|
1511
|
-
_content_type,
|
|
1512
|
-
_headers,
|
|
1513
|
-
_host_index,
|
|
1514
|
-
) -> RequestSerialized:
|
|
1515
|
-
|
|
1516
|
-
_host = None
|
|
1517
|
-
|
|
1518
|
-
_collection_formats: Dict[str, str] = {
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
_path_params: Dict[str, str] = {}
|
|
1522
|
-
_query_params: List[Tuple[str, str]] = []
|
|
1523
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
1524
|
-
_form_params: List[Tuple[str, str]] = []
|
|
1525
|
-
_files: Dict[
|
|
1526
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
1527
|
-
] = {}
|
|
1528
|
-
_body_params: Optional[bytes] = None
|
|
1529
|
-
|
|
1530
|
-
# process the path parameters
|
|
1531
|
-
if model_name is not None:
|
|
1532
|
-
_path_params['model_name'] = model_name
|
|
1533
|
-
# process the query parameters
|
|
1534
|
-
# process the header parameters
|
|
1535
|
-
if x_api_key is not None:
|
|
1536
|
-
_header_params['x-api-key'] = x_api_key
|
|
1537
|
-
# process the form parameters
|
|
1538
|
-
# process the body parameter
|
|
1539
|
-
if rank_grid_attribute_request is not None:
|
|
1540
|
-
_body_params = rank_grid_attribute_request
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
# set the HTTP header `Accept`
|
|
1544
|
-
if 'Accept' not in _header_params:
|
|
1545
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
1546
|
-
[
|
|
1547
|
-
'application/json'
|
|
1548
|
-
]
|
|
1549
|
-
)
|
|
1550
|
-
|
|
1551
|
-
# set the HTTP header `Content-Type`
|
|
1552
|
-
if _content_type:
|
|
1553
|
-
_header_params['Content-Type'] = _content_type
|
|
1554
|
-
else:
|
|
1555
|
-
_default_content_type = (
|
|
1556
|
-
self.api_client.select_header_content_type(
|
|
1557
|
-
[
|
|
1558
|
-
'application/json'
|
|
1559
|
-
]
|
|
1560
|
-
)
|
|
1561
|
-
)
|
|
1562
|
-
if _default_content_type is not None:
|
|
1563
|
-
_header_params['Content-Type'] = _default_content_type
|
|
1564
|
-
|
|
1565
|
-
# authentication setting
|
|
1566
|
-
_auth_settings: List[str] = [
|
|
1567
|
-
]
|
|
1568
|
-
|
|
1569
|
-
return self.api_client.param_serialize(
|
|
1570
|
-
method='POST',
|
|
1571
|
-
resource_path='/models/{model_name}/rank_attributes',
|
|
1572
|
-
path_params=_path_params,
|
|
1573
|
-
query_params=_query_params,
|
|
1574
|
-
header_params=_header_params,
|
|
1575
|
-
body=_body_params,
|
|
1576
|
-
post_params=_form_params,
|
|
1577
|
-
files=_files,
|
|
1578
|
-
auth_settings=_auth_settings,
|
|
1579
|
-
collection_formats=_collection_formats,
|
|
1580
|
-
_host=_host,
|
|
1581
|
-
_request_auth=_request_auth
|
|
1582
|
-
)
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
@validate_call
|
|
1588
|
-
def post_rank_models_model_id_rank_post(
|
|
1589
|
-
self,
|
|
1590
|
-
model_name: StrictStr,
|
|
1591
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1592
|
-
post_rank_request: PostRankRequest,
|
|
1593
|
-
_request_timeout: Union[
|
|
1594
|
-
None,
|
|
1595
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1596
|
-
Tuple[
|
|
1597
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1598
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1599
|
-
]
|
|
1600
|
-
] = None,
|
|
1601
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1602
|
-
_content_type: Optional[StrictStr] = None,
|
|
1603
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1604
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1605
|
-
) -> RankResponse:
|
|
1606
|
-
"""Rank
|
|
1607
|
-
|
|
1608
|
-
Rank returns the list of relevant item ids (from most-relevant to least) for the given request context. This is useful for many real-time ranking use-cases such as: - Personalized recommendations e.g. used in 'For You' feeds, 'You May Also Like' carousels and 'Recommended for You' sections, etc.. - Personalized search e.g. used to power any search bars or category pages. - Trending items e.g. used to show recently popular items that are most relevant to the user query. There are several ways to use rank depending on the combination of request arguments given. Notably, 1. If no arguments are given, Rank will return a list of trending items. This is useful if you want to add a trending items feed or carousel or if you want to surface a generic ranking to a new non-persistent user. 2. If a user_id is given, Rank will return a list of relevant items personalized for that user. Under-the-hood Shaped's underlying model will estimate the most relevant items for this user and apply your personal filters to determine the ranking. 3. If item_ids are given, then we restrict the output to the provided item_ids. This is useful if you want to skip Shaped's 'Candidate Generation' step and score a subset of items directly. 4. If interactions are given, then we re-rank based on the item_id sequence provided. This is useful for real-time session based ranking when you haven't connected a real-time data source or would prefer to accumulate interaction windows yourself. 5. If filter_predicate is given, then we filter out the set of candidate ranking items based on the given retrieval query. This is useful for metadata search use-cases. 8. If flush_paginations is true, we clear the underlying pagination store cache. 9. If return_metadata is given, we will return raw metadata for the ranked items. This is useful if you want to display item images, descriptions, etc. in your application without having to hydrate the ids metadata yourself. **latency:** This endpoint maintains a p95 200ms latency and is suitable for real-time usage within your application. We also provide a convenience GET request for this endpoint, it uses the user_id, limit and return_metadata query arguments.
|
|
1609
|
-
|
|
1610
|
-
:param model_name: (required)
|
|
1611
|
-
:type model_name: str
|
|
1612
|
-
:param x_api_key: (required)
|
|
1613
|
-
:type x_api_key: str
|
|
1614
|
-
:param post_rank_request: (required)
|
|
1615
|
-
:type post_rank_request: PostRankRequest
|
|
1616
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1617
|
-
number provided, it will be total request
|
|
1618
|
-
timeout. It can also be a pair (tuple) of
|
|
1619
|
-
(connection, read) timeouts.
|
|
1620
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1621
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1622
|
-
request; this effectively ignores the
|
|
1623
|
-
authentication in the spec for a single request.
|
|
1624
|
-
:type _request_auth: dict, optional
|
|
1625
|
-
:param _content_type: force content-type for the request.
|
|
1626
|
-
:type _content_type: str, Optional
|
|
1627
|
-
:param _headers: set to override the headers for a single
|
|
1628
|
-
request; this effectively ignores the headers
|
|
1629
|
-
in the spec for a single request.
|
|
1630
|
-
:type _headers: dict, optional
|
|
1631
|
-
:param _host_index: set to override the host_index for a single
|
|
1632
|
-
request; this effectively ignores the host_index
|
|
1633
|
-
in the spec for a single request.
|
|
1634
|
-
:type _host_index: int, optional
|
|
1635
|
-
:return: Returns the result object.
|
|
1636
|
-
""" # noqa: E501
|
|
1637
|
-
|
|
1638
|
-
_param = self._post_rank_models_model_id_rank_post_serialize(
|
|
1639
|
-
model_name=model_name,
|
|
1640
|
-
x_api_key=x_api_key,
|
|
1641
|
-
post_rank_request=post_rank_request,
|
|
1642
|
-
_request_auth=_request_auth,
|
|
1643
|
-
_content_type=_content_type,
|
|
1644
|
-
_headers=_headers,
|
|
1645
|
-
_host_index=_host_index
|
|
1646
|
-
)
|
|
1647
|
-
|
|
1648
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1649
|
-
'200': "RankResponse",
|
|
1650
|
-
'422': "HTTPValidationError",
|
|
1651
|
-
}
|
|
1652
|
-
response_data = self.api_client.call_api(
|
|
1653
|
-
*_param,
|
|
1654
|
-
_request_timeout=_request_timeout
|
|
1655
|
-
)
|
|
1656
|
-
response_data.read()
|
|
1657
|
-
return self.api_client.response_deserialize(
|
|
1658
|
-
response_data=response_data,
|
|
1659
|
-
response_types_map=_response_types_map,
|
|
1660
|
-
).data
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
@validate_call
|
|
1664
|
-
def post_rank_models_model_id_rank_post_with_http_info(
|
|
1665
|
-
self,
|
|
1666
|
-
model_name: StrictStr,
|
|
1667
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1668
|
-
post_rank_request: PostRankRequest,
|
|
1669
|
-
_request_timeout: Union[
|
|
1670
|
-
None,
|
|
1671
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1672
|
-
Tuple[
|
|
1673
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1674
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1675
|
-
]
|
|
1676
|
-
] = None,
|
|
1677
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1678
|
-
_content_type: Optional[StrictStr] = None,
|
|
1679
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1680
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1681
|
-
) -> ApiResponse[RankResponse]:
|
|
1682
|
-
"""Rank
|
|
1683
|
-
|
|
1684
|
-
Rank returns the list of relevant item ids (from most-relevant to least) for the given request context. This is useful for many real-time ranking use-cases such as: - Personalized recommendations e.g. used in 'For You' feeds, 'You May Also Like' carousels and 'Recommended for You' sections, etc.. - Personalized search e.g. used to power any search bars or category pages. - Trending items e.g. used to show recently popular items that are most relevant to the user query. There are several ways to use rank depending on the combination of request arguments given. Notably, 1. If no arguments are given, Rank will return a list of trending items. This is useful if you want to add a trending items feed or carousel or if you want to surface a generic ranking to a new non-persistent user. 2. If a user_id is given, Rank will return a list of relevant items personalized for that user. Under-the-hood Shaped's underlying model will estimate the most relevant items for this user and apply your personal filters to determine the ranking. 3. If item_ids are given, then we restrict the output to the provided item_ids. This is useful if you want to skip Shaped's 'Candidate Generation' step and score a subset of items directly. 4. If interactions are given, then we re-rank based on the item_id sequence provided. This is useful for real-time session based ranking when you haven't connected a real-time data source or would prefer to accumulate interaction windows yourself. 5. If filter_predicate is given, then we filter out the set of candidate ranking items based on the given retrieval query. This is useful for metadata search use-cases. 8. If flush_paginations is true, we clear the underlying pagination store cache. 9. If return_metadata is given, we will return raw metadata for the ranked items. This is useful if you want to display item images, descriptions, etc. in your application without having to hydrate the ids metadata yourself. **latency:** This endpoint maintains a p95 200ms latency and is suitable for real-time usage within your application. We also provide a convenience GET request for this endpoint, it uses the user_id, limit and return_metadata query arguments.
|
|
1685
|
-
|
|
1686
|
-
:param model_name: (required)
|
|
1687
|
-
:type model_name: str
|
|
1688
|
-
:param x_api_key: (required)
|
|
1689
|
-
:type x_api_key: str
|
|
1690
|
-
:param post_rank_request: (required)
|
|
1691
|
-
:type post_rank_request: PostRankRequest
|
|
1692
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1693
|
-
number provided, it will be total request
|
|
1694
|
-
timeout. It can also be a pair (tuple) of
|
|
1695
|
-
(connection, read) timeouts.
|
|
1696
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1697
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1698
|
-
request; this effectively ignores the
|
|
1699
|
-
authentication in the spec for a single request.
|
|
1700
|
-
:type _request_auth: dict, optional
|
|
1701
|
-
:param _content_type: force content-type for the request.
|
|
1702
|
-
:type _content_type: str, Optional
|
|
1703
|
-
:param _headers: set to override the headers for a single
|
|
1704
|
-
request; this effectively ignores the headers
|
|
1705
|
-
in the spec for a single request.
|
|
1706
|
-
:type _headers: dict, optional
|
|
1707
|
-
:param _host_index: set to override the host_index for a single
|
|
1708
|
-
request; this effectively ignores the host_index
|
|
1709
|
-
in the spec for a single request.
|
|
1710
|
-
:type _host_index: int, optional
|
|
1711
|
-
:return: Returns the result object.
|
|
1712
|
-
""" # noqa: E501
|
|
1713
|
-
|
|
1714
|
-
_param = self._post_rank_models_model_id_rank_post_serialize(
|
|
1715
|
-
model_name=model_name,
|
|
1716
|
-
x_api_key=x_api_key,
|
|
1717
|
-
post_rank_request=post_rank_request,
|
|
1718
|
-
_request_auth=_request_auth,
|
|
1719
|
-
_content_type=_content_type,
|
|
1720
|
-
_headers=_headers,
|
|
1721
|
-
_host_index=_host_index
|
|
1722
|
-
)
|
|
1723
|
-
|
|
1724
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1725
|
-
'200': "RankResponse",
|
|
1726
|
-
'422': "HTTPValidationError",
|
|
1727
|
-
}
|
|
1728
|
-
response_data = self.api_client.call_api(
|
|
1729
|
-
*_param,
|
|
1730
|
-
_request_timeout=_request_timeout
|
|
1731
|
-
)
|
|
1732
|
-
response_data.read()
|
|
1733
|
-
return self.api_client.response_deserialize(
|
|
1734
|
-
response_data=response_data,
|
|
1735
|
-
response_types_map=_response_types_map,
|
|
1736
|
-
)
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
@validate_call
|
|
1740
|
-
def post_rank_models_model_id_rank_post_without_preload_content(
|
|
1741
|
-
self,
|
|
1742
|
-
model_name: StrictStr,
|
|
1743
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1744
|
-
post_rank_request: PostRankRequest,
|
|
1745
|
-
_request_timeout: Union[
|
|
1746
|
-
None,
|
|
1747
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1748
|
-
Tuple[
|
|
1749
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1750
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1751
|
-
]
|
|
1752
|
-
] = None,
|
|
1753
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1754
|
-
_content_type: Optional[StrictStr] = None,
|
|
1755
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1756
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1757
|
-
) -> RESTResponseType:
|
|
1758
|
-
"""Rank
|
|
1759
|
-
|
|
1760
|
-
Rank returns the list of relevant item ids (from most-relevant to least) for the given request context. This is useful for many real-time ranking use-cases such as: - Personalized recommendations e.g. used in 'For You' feeds, 'You May Also Like' carousels and 'Recommended for You' sections, etc.. - Personalized search e.g. used to power any search bars or category pages. - Trending items e.g. used to show recently popular items that are most relevant to the user query. There are several ways to use rank depending on the combination of request arguments given. Notably, 1. If no arguments are given, Rank will return a list of trending items. This is useful if you want to add a trending items feed or carousel or if you want to surface a generic ranking to a new non-persistent user. 2. If a user_id is given, Rank will return a list of relevant items personalized for that user. Under-the-hood Shaped's underlying model will estimate the most relevant items for this user and apply your personal filters to determine the ranking. 3. If item_ids are given, then we restrict the output to the provided item_ids. This is useful if you want to skip Shaped's 'Candidate Generation' step and score a subset of items directly. 4. If interactions are given, then we re-rank based on the item_id sequence provided. This is useful for real-time session based ranking when you haven't connected a real-time data source or would prefer to accumulate interaction windows yourself. 5. If filter_predicate is given, then we filter out the set of candidate ranking items based on the given retrieval query. This is useful for metadata search use-cases. 8. If flush_paginations is true, we clear the underlying pagination store cache. 9. If return_metadata is given, we will return raw metadata for the ranked items. This is useful if you want to display item images, descriptions, etc. in your application without having to hydrate the ids metadata yourself. **latency:** This endpoint maintains a p95 200ms latency and is suitable for real-time usage within your application. We also provide a convenience GET request for this endpoint, it uses the user_id, limit and return_metadata query arguments.
|
|
1761
|
-
|
|
1762
|
-
:param model_name: (required)
|
|
1763
|
-
:type model_name: str
|
|
1764
|
-
:param x_api_key: (required)
|
|
1765
|
-
:type x_api_key: str
|
|
1766
|
-
:param post_rank_request: (required)
|
|
1767
|
-
:type post_rank_request: PostRankRequest
|
|
1768
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1769
|
-
number provided, it will be total request
|
|
1770
|
-
timeout. It can also be a pair (tuple) of
|
|
1771
|
-
(connection, read) timeouts.
|
|
1772
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1773
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1774
|
-
request; this effectively ignores the
|
|
1775
|
-
authentication in the spec for a single request.
|
|
1776
|
-
:type _request_auth: dict, optional
|
|
1777
|
-
:param _content_type: force content-type for the request.
|
|
1778
|
-
:type _content_type: str, Optional
|
|
1779
|
-
:param _headers: set to override the headers for a single
|
|
1780
|
-
request; this effectively ignores the headers
|
|
1781
|
-
in the spec for a single request.
|
|
1782
|
-
:type _headers: dict, optional
|
|
1783
|
-
:param _host_index: set to override the host_index for a single
|
|
1784
|
-
request; this effectively ignores the host_index
|
|
1785
|
-
in the spec for a single request.
|
|
1786
|
-
:type _host_index: int, optional
|
|
1787
|
-
:return: Returns the result object.
|
|
1788
|
-
""" # noqa: E501
|
|
1789
|
-
|
|
1790
|
-
_param = self._post_rank_models_model_id_rank_post_serialize(
|
|
1791
|
-
model_name=model_name,
|
|
1792
|
-
x_api_key=x_api_key,
|
|
1793
|
-
post_rank_request=post_rank_request,
|
|
1794
|
-
_request_auth=_request_auth,
|
|
1795
|
-
_content_type=_content_type,
|
|
1796
|
-
_headers=_headers,
|
|
1797
|
-
_host_index=_host_index
|
|
1798
|
-
)
|
|
1799
|
-
|
|
1800
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1801
|
-
'200': "RankResponse",
|
|
1802
|
-
'422': "HTTPValidationError",
|
|
1803
|
-
}
|
|
1804
|
-
response_data = self.api_client.call_api(
|
|
1805
|
-
*_param,
|
|
1806
|
-
_request_timeout=_request_timeout
|
|
1807
|
-
)
|
|
1808
|
-
return response_data.response
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
def _post_rank_models_model_id_rank_post_serialize(
|
|
1812
|
-
self,
|
|
1813
|
-
model_name,
|
|
1814
|
-
x_api_key,
|
|
1815
|
-
post_rank_request,
|
|
1816
|
-
_request_auth,
|
|
1817
|
-
_content_type,
|
|
1818
|
-
_headers,
|
|
1819
|
-
_host_index,
|
|
1820
|
-
) -> RequestSerialized:
|
|
1821
|
-
|
|
1822
|
-
_host = None
|
|
1823
|
-
|
|
1824
|
-
_collection_formats: Dict[str, str] = {
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
_path_params: Dict[str, str] = {}
|
|
1828
|
-
_query_params: List[Tuple[str, str]] = []
|
|
1829
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
1830
|
-
_form_params: List[Tuple[str, str]] = []
|
|
1831
|
-
_files: Dict[
|
|
1832
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
1833
|
-
] = {}
|
|
1834
|
-
_body_params: Optional[bytes] = None
|
|
1835
|
-
|
|
1836
|
-
# process the path parameters
|
|
1837
|
-
if model_name is not None:
|
|
1838
|
-
_path_params['model_name'] = model_name
|
|
1839
|
-
# process the query parameters
|
|
1840
|
-
# process the header parameters
|
|
1841
|
-
if x_api_key is not None:
|
|
1842
|
-
_header_params['x-api-key'] = x_api_key
|
|
1843
|
-
# process the form parameters
|
|
1844
|
-
# process the body parameter
|
|
1845
|
-
if post_rank_request is not None:
|
|
1846
|
-
_body_params = post_rank_request
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
# set the HTTP header `Accept`
|
|
1850
|
-
if 'Accept' not in _header_params:
|
|
1851
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
1852
|
-
[
|
|
1853
|
-
'application/json'
|
|
1854
|
-
]
|
|
1855
|
-
)
|
|
1856
|
-
|
|
1857
|
-
# set the HTTP header `Content-Type`
|
|
1858
|
-
if _content_type:
|
|
1859
|
-
_header_params['Content-Type'] = _content_type
|
|
1860
|
-
else:
|
|
1861
|
-
_default_content_type = (
|
|
1862
|
-
self.api_client.select_header_content_type(
|
|
1863
|
-
[
|
|
1864
|
-
'application/json'
|
|
1865
|
-
]
|
|
1866
|
-
)
|
|
1867
|
-
)
|
|
1868
|
-
if _default_content_type is not None:
|
|
1869
|
-
_header_params['Content-Type'] = _default_content_type
|
|
1870
|
-
|
|
1871
|
-
# authentication setting
|
|
1872
|
-
_auth_settings: List[str] = [
|
|
1873
|
-
]
|
|
1874
|
-
|
|
1875
|
-
return self.api_client.param_serialize(
|
|
1876
|
-
method='POST',
|
|
1877
|
-
resource_path='/models/{model_name}/rank',
|
|
1878
|
-
path_params=_path_params,
|
|
1879
|
-
query_params=_query_params,
|
|
1880
|
-
header_params=_header_params,
|
|
1881
|
-
body=_body_params,
|
|
1882
|
-
post_params=_form_params,
|
|
1883
|
-
files=_files,
|
|
1884
|
-
auth_settings=_auth_settings,
|
|
1885
|
-
collection_formats=_collection_formats,
|
|
1886
|
-
_host=_host,
|
|
1887
|
-
_request_auth=_request_auth
|
|
1888
|
-
)
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
@validate_call
|
|
1894
|
-
def post_retrieve_models_model_id_retrieve_post(
|
|
1895
|
-
self,
|
|
1896
|
-
model_name: StrictStr,
|
|
1897
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1898
|
-
retrieve_request: RetrieveRequest,
|
|
1899
|
-
_request_timeout: Union[
|
|
1900
|
-
None,
|
|
1901
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1902
|
-
Tuple[
|
|
1903
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1904
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1905
|
-
]
|
|
1906
|
-
] = None,
|
|
1907
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1908
|
-
_content_type: Optional[StrictStr] = None,
|
|
1909
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1910
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1911
|
-
) -> RetrieveResponse:
|
|
1912
|
-
"""Retrieve
|
|
1913
|
-
|
|
1914
|
-
Retrieve returns relevant item_ids for the given input text or user query. It can be used instead of rank if the filtering, scoring and ordering stages aren't needed for the final ranking. Typically people use this endpoint over rank if they want to reduce latency and complexity of the ranking pipeline and only need a subset of the functionality, e.g. just search but without personalization.
|
|
1915
|
-
|
|
1916
|
-
:param model_name: (required)
|
|
1917
|
-
:type model_name: str
|
|
1918
|
-
:param x_api_key: (required)
|
|
1919
|
-
:type x_api_key: str
|
|
1920
|
-
:param retrieve_request: (required)
|
|
1921
|
-
:type retrieve_request: RetrieveRequest
|
|
1922
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1923
|
-
number provided, it will be total request
|
|
1924
|
-
timeout. It can also be a pair (tuple) of
|
|
1925
|
-
(connection, read) timeouts.
|
|
1926
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
1927
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
1928
|
-
request; this effectively ignores the
|
|
1929
|
-
authentication in the spec for a single request.
|
|
1930
|
-
:type _request_auth: dict, optional
|
|
1931
|
-
:param _content_type: force content-type for the request.
|
|
1932
|
-
:type _content_type: str, Optional
|
|
1933
|
-
:param _headers: set to override the headers for a single
|
|
1934
|
-
request; this effectively ignores the headers
|
|
1935
|
-
in the spec for a single request.
|
|
1936
|
-
:type _headers: dict, optional
|
|
1937
|
-
:param _host_index: set to override the host_index for a single
|
|
1938
|
-
request; this effectively ignores the host_index
|
|
1939
|
-
in the spec for a single request.
|
|
1940
|
-
:type _host_index: int, optional
|
|
1941
|
-
:return: Returns the result object.
|
|
1942
|
-
""" # noqa: E501
|
|
1943
|
-
|
|
1944
|
-
_param = self._post_retrieve_models_model_id_retrieve_post_serialize(
|
|
1945
|
-
model_name=model_name,
|
|
1946
|
-
x_api_key=x_api_key,
|
|
1947
|
-
retrieve_request=retrieve_request,
|
|
1948
|
-
_request_auth=_request_auth,
|
|
1949
|
-
_content_type=_content_type,
|
|
1950
|
-
_headers=_headers,
|
|
1951
|
-
_host_index=_host_index
|
|
1952
|
-
)
|
|
1953
|
-
|
|
1954
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
1955
|
-
'200': "RetrieveResponse",
|
|
1956
|
-
'422': "HTTPValidationError",
|
|
1957
|
-
}
|
|
1958
|
-
response_data = self.api_client.call_api(
|
|
1959
|
-
*_param,
|
|
1960
|
-
_request_timeout=_request_timeout
|
|
1961
|
-
)
|
|
1962
|
-
response_data.read()
|
|
1963
|
-
return self.api_client.response_deserialize(
|
|
1964
|
-
response_data=response_data,
|
|
1965
|
-
response_types_map=_response_types_map,
|
|
1966
|
-
).data
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
@validate_call
|
|
1970
|
-
def post_retrieve_models_model_id_retrieve_post_with_http_info(
|
|
1971
|
-
self,
|
|
1972
|
-
model_name: StrictStr,
|
|
1973
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
1974
|
-
retrieve_request: RetrieveRequest,
|
|
1975
|
-
_request_timeout: Union[
|
|
1976
|
-
None,
|
|
1977
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1978
|
-
Tuple[
|
|
1979
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
1980
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
1981
|
-
]
|
|
1982
|
-
] = None,
|
|
1983
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1984
|
-
_content_type: Optional[StrictStr] = None,
|
|
1985
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1986
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1987
|
-
) -> ApiResponse[RetrieveResponse]:
|
|
1988
|
-
"""Retrieve
|
|
1989
|
-
|
|
1990
|
-
Retrieve returns relevant item_ids for the given input text or user query. It can be used instead of rank if the filtering, scoring and ordering stages aren't needed for the final ranking. Typically people use this endpoint over rank if they want to reduce latency and complexity of the ranking pipeline and only need a subset of the functionality, e.g. just search but without personalization.
|
|
1991
|
-
|
|
1992
|
-
:param model_name: (required)
|
|
1993
|
-
:type model_name: str
|
|
1994
|
-
:param x_api_key: (required)
|
|
1995
|
-
:type x_api_key: str
|
|
1996
|
-
:param retrieve_request: (required)
|
|
1997
|
-
:type retrieve_request: RetrieveRequest
|
|
1998
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
1999
|
-
number provided, it will be total request
|
|
2000
|
-
timeout. It can also be a pair (tuple) of
|
|
2001
|
-
(connection, read) timeouts.
|
|
2002
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2003
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2004
|
-
request; this effectively ignores the
|
|
2005
|
-
authentication in the spec for a single request.
|
|
2006
|
-
:type _request_auth: dict, optional
|
|
2007
|
-
:param _content_type: force content-type for the request.
|
|
2008
|
-
:type _content_type: str, Optional
|
|
2009
|
-
:param _headers: set to override the headers for a single
|
|
2010
|
-
request; this effectively ignores the headers
|
|
2011
|
-
in the spec for a single request.
|
|
2012
|
-
:type _headers: dict, optional
|
|
2013
|
-
:param _host_index: set to override the host_index for a single
|
|
2014
|
-
request; this effectively ignores the host_index
|
|
2015
|
-
in the spec for a single request.
|
|
2016
|
-
:type _host_index: int, optional
|
|
2017
|
-
:return: Returns the result object.
|
|
2018
|
-
""" # noqa: E501
|
|
2019
|
-
|
|
2020
|
-
_param = self._post_retrieve_models_model_id_retrieve_post_serialize(
|
|
2021
|
-
model_name=model_name,
|
|
2022
|
-
x_api_key=x_api_key,
|
|
2023
|
-
retrieve_request=retrieve_request,
|
|
2024
|
-
_request_auth=_request_auth,
|
|
2025
|
-
_content_type=_content_type,
|
|
2026
|
-
_headers=_headers,
|
|
2027
|
-
_host_index=_host_index
|
|
2028
|
-
)
|
|
2029
|
-
|
|
2030
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2031
|
-
'200': "RetrieveResponse",
|
|
2032
|
-
'422': "HTTPValidationError",
|
|
2033
|
-
}
|
|
2034
|
-
response_data = self.api_client.call_api(
|
|
2035
|
-
*_param,
|
|
2036
|
-
_request_timeout=_request_timeout
|
|
2037
|
-
)
|
|
2038
|
-
response_data.read()
|
|
2039
|
-
return self.api_client.response_deserialize(
|
|
2040
|
-
response_data=response_data,
|
|
2041
|
-
response_types_map=_response_types_map,
|
|
2042
|
-
)
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
@validate_call
|
|
2046
|
-
def post_retrieve_models_model_id_retrieve_post_without_preload_content(
|
|
2047
|
-
self,
|
|
2048
|
-
model_name: StrictStr,
|
|
2049
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
2050
|
-
retrieve_request: RetrieveRequest,
|
|
2051
|
-
_request_timeout: Union[
|
|
2052
|
-
None,
|
|
2053
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2054
|
-
Tuple[
|
|
2055
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2056
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
2057
|
-
]
|
|
2058
|
-
] = None,
|
|
2059
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2060
|
-
_content_type: Optional[StrictStr] = None,
|
|
2061
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2062
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2063
|
-
) -> RESTResponseType:
|
|
2064
|
-
"""Retrieve
|
|
2065
|
-
|
|
2066
|
-
Retrieve returns relevant item_ids for the given input text or user query. It can be used instead of rank if the filtering, scoring and ordering stages aren't needed for the final ranking. Typically people use this endpoint over rank if they want to reduce latency and complexity of the ranking pipeline and only need a subset of the functionality, e.g. just search but without personalization.
|
|
2067
|
-
|
|
2068
|
-
:param model_name: (required)
|
|
2069
|
-
:type model_name: str
|
|
2070
|
-
:param x_api_key: (required)
|
|
2071
|
-
:type x_api_key: str
|
|
2072
|
-
:param retrieve_request: (required)
|
|
2073
|
-
:type retrieve_request: RetrieveRequest
|
|
2074
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
2075
|
-
number provided, it will be total request
|
|
2076
|
-
timeout. It can also be a pair (tuple) of
|
|
2077
|
-
(connection, read) timeouts.
|
|
2078
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2079
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2080
|
-
request; this effectively ignores the
|
|
2081
|
-
authentication in the spec for a single request.
|
|
2082
|
-
:type _request_auth: dict, optional
|
|
2083
|
-
:param _content_type: force content-type for the request.
|
|
2084
|
-
:type _content_type: str, Optional
|
|
2085
|
-
:param _headers: set to override the headers for a single
|
|
2086
|
-
request; this effectively ignores the headers
|
|
2087
|
-
in the spec for a single request.
|
|
2088
|
-
:type _headers: dict, optional
|
|
2089
|
-
:param _host_index: set to override the host_index for a single
|
|
2090
|
-
request; this effectively ignores the host_index
|
|
2091
|
-
in the spec for a single request.
|
|
2092
|
-
:type _host_index: int, optional
|
|
2093
|
-
:return: Returns the result object.
|
|
2094
|
-
""" # noqa: E501
|
|
2095
|
-
|
|
2096
|
-
_param = self._post_retrieve_models_model_id_retrieve_post_serialize(
|
|
2097
|
-
model_name=model_name,
|
|
2098
|
-
x_api_key=x_api_key,
|
|
2099
|
-
retrieve_request=retrieve_request,
|
|
2100
|
-
_request_auth=_request_auth,
|
|
2101
|
-
_content_type=_content_type,
|
|
2102
|
-
_headers=_headers,
|
|
2103
|
-
_host_index=_host_index
|
|
2104
|
-
)
|
|
2105
|
-
|
|
2106
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2107
|
-
'200': "RetrieveResponse",
|
|
2108
|
-
'422': "HTTPValidationError",
|
|
2109
|
-
}
|
|
2110
|
-
response_data = self.api_client.call_api(
|
|
2111
|
-
*_param,
|
|
2112
|
-
_request_timeout=_request_timeout
|
|
2113
|
-
)
|
|
2114
|
-
return response_data.response
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
def _post_retrieve_models_model_id_retrieve_post_serialize(
|
|
2118
|
-
self,
|
|
2119
|
-
model_name,
|
|
2120
|
-
x_api_key,
|
|
2121
|
-
retrieve_request,
|
|
2122
|
-
_request_auth,
|
|
2123
|
-
_content_type,
|
|
2124
|
-
_headers,
|
|
2125
|
-
_host_index,
|
|
2126
|
-
) -> RequestSerialized:
|
|
2127
|
-
|
|
2128
|
-
_host = None
|
|
2129
|
-
|
|
2130
|
-
_collection_formats: Dict[str, str] = {
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
_path_params: Dict[str, str] = {}
|
|
2134
|
-
_query_params: List[Tuple[str, str]] = []
|
|
2135
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
2136
|
-
_form_params: List[Tuple[str, str]] = []
|
|
2137
|
-
_files: Dict[
|
|
2138
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
2139
|
-
] = {}
|
|
2140
|
-
_body_params: Optional[bytes] = None
|
|
2141
|
-
|
|
2142
|
-
# process the path parameters
|
|
2143
|
-
if model_name is not None:
|
|
2144
|
-
_path_params['model_name'] = model_name
|
|
2145
|
-
# process the query parameters
|
|
2146
|
-
# process the header parameters
|
|
2147
|
-
if x_api_key is not None:
|
|
2148
|
-
_header_params['x-api-key'] = x_api_key
|
|
2149
|
-
# process the form parameters
|
|
2150
|
-
# process the body parameter
|
|
2151
|
-
if retrieve_request is not None:
|
|
2152
|
-
_body_params = retrieve_request
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
# set the HTTP header `Accept`
|
|
2156
|
-
if 'Accept' not in _header_params:
|
|
2157
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
2158
|
-
[
|
|
2159
|
-
'application/json'
|
|
2160
|
-
]
|
|
2161
|
-
)
|
|
2162
|
-
|
|
2163
|
-
# set the HTTP header `Content-Type`
|
|
2164
|
-
if _content_type:
|
|
2165
|
-
_header_params['Content-Type'] = _content_type
|
|
2166
|
-
else:
|
|
2167
|
-
_default_content_type = (
|
|
2168
|
-
self.api_client.select_header_content_type(
|
|
2169
|
-
[
|
|
2170
|
-
'application/json'
|
|
2171
|
-
]
|
|
2172
|
-
)
|
|
2173
|
-
)
|
|
2174
|
-
if _default_content_type is not None:
|
|
2175
|
-
_header_params['Content-Type'] = _default_content_type
|
|
2176
|
-
|
|
2177
|
-
# authentication setting
|
|
2178
|
-
_auth_settings: List[str] = [
|
|
2179
|
-
]
|
|
2180
|
-
|
|
2181
|
-
return self.api_client.param_serialize(
|
|
2182
|
-
method='POST',
|
|
2183
|
-
resource_path='/models/{model_name}/retrieve',
|
|
2184
|
-
path_params=_path_params,
|
|
2185
|
-
query_params=_query_params,
|
|
2186
|
-
header_params=_header_params,
|
|
2187
|
-
body=_body_params,
|
|
2188
|
-
post_params=_form_params,
|
|
2189
|
-
files=_files,
|
|
2190
|
-
auth_settings=_auth_settings,
|
|
2191
|
-
collection_formats=_collection_formats,
|
|
2192
|
-
_host=_host,
|
|
2193
|
-
_request_auth=_request_auth
|
|
2194
|
-
)
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
@validate_call
|
|
2200
|
-
def post_similar_items_models_model_name_similar_items_post(
|
|
2201
|
-
self,
|
|
2202
|
-
model_name: StrictStr,
|
|
2203
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
2204
|
-
similar_item_request: Optional[SimilarItemRequest] = None,
|
|
2205
|
-
_request_timeout: Union[
|
|
2206
|
-
None,
|
|
2207
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2208
|
-
Tuple[
|
|
2209
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2210
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
2211
|
-
]
|
|
2212
|
-
] = None,
|
|
2213
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2214
|
-
_content_type: Optional[StrictStr] = None,
|
|
2215
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2216
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2217
|
-
) -> SimilarResponse:
|
|
2218
|
-
"""Similar Items
|
|
2219
|
-
|
|
2220
|
-
Similar Items returns a list of similar items to the given input item query. If a user_id is given the response will return similar items personalized for that user. This endpoint can be used to power use-cases like: 1. \"You May Also Like\" surfaces. 2. \"What-to-watch next\" surfaces. 4. \"Similar to this item\" surfaces.
|
|
2221
|
-
|
|
2222
|
-
:param model_name: (required)
|
|
2223
|
-
:type model_name: str
|
|
2224
|
-
:param x_api_key: (required)
|
|
2225
|
-
:type x_api_key: str
|
|
2226
|
-
:param similar_item_request:
|
|
2227
|
-
:type similar_item_request: SimilarItemRequest
|
|
2228
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
2229
|
-
number provided, it will be total request
|
|
2230
|
-
timeout. It can also be a pair (tuple) of
|
|
2231
|
-
(connection, read) timeouts.
|
|
2232
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2233
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2234
|
-
request; this effectively ignores the
|
|
2235
|
-
authentication in the spec for a single request.
|
|
2236
|
-
:type _request_auth: dict, optional
|
|
2237
|
-
:param _content_type: force content-type for the request.
|
|
2238
|
-
:type _content_type: str, Optional
|
|
2239
|
-
:param _headers: set to override the headers for a single
|
|
2240
|
-
request; this effectively ignores the headers
|
|
2241
|
-
in the spec for a single request.
|
|
2242
|
-
:type _headers: dict, optional
|
|
2243
|
-
:param _host_index: set to override the host_index for a single
|
|
2244
|
-
request; this effectively ignores the host_index
|
|
2245
|
-
in the spec for a single request.
|
|
2246
|
-
:type _host_index: int, optional
|
|
2247
|
-
:return: Returns the result object.
|
|
2248
|
-
""" # noqa: E501
|
|
2249
|
-
|
|
2250
|
-
_param = self._post_similar_items_models_model_name_similar_items_post_serialize(
|
|
2251
|
-
model_name=model_name,
|
|
2252
|
-
x_api_key=x_api_key,
|
|
2253
|
-
similar_item_request=similar_item_request,
|
|
2254
|
-
_request_auth=_request_auth,
|
|
2255
|
-
_content_type=_content_type,
|
|
2256
|
-
_headers=_headers,
|
|
2257
|
-
_host_index=_host_index
|
|
2258
|
-
)
|
|
2259
|
-
|
|
2260
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2261
|
-
'200': "SimilarResponse",
|
|
2262
|
-
'422': "HTTPValidationError",
|
|
2263
|
-
}
|
|
2264
|
-
response_data = self.api_client.call_api(
|
|
2265
|
-
*_param,
|
|
2266
|
-
_request_timeout=_request_timeout
|
|
2267
|
-
)
|
|
2268
|
-
response_data.read()
|
|
2269
|
-
return self.api_client.response_deserialize(
|
|
2270
|
-
response_data=response_data,
|
|
2271
|
-
response_types_map=_response_types_map,
|
|
2272
|
-
).data
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
@validate_call
|
|
2276
|
-
def post_similar_items_models_model_name_similar_items_post_with_http_info(
|
|
2277
|
-
self,
|
|
2278
|
-
model_name: StrictStr,
|
|
2279
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
2280
|
-
similar_item_request: Optional[SimilarItemRequest] = None,
|
|
2281
|
-
_request_timeout: Union[
|
|
2282
|
-
None,
|
|
2283
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2284
|
-
Tuple[
|
|
2285
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2286
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
2287
|
-
]
|
|
2288
|
-
] = None,
|
|
2289
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2290
|
-
_content_type: Optional[StrictStr] = None,
|
|
2291
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2292
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2293
|
-
) -> ApiResponse[SimilarResponse]:
|
|
2294
|
-
"""Similar Items
|
|
2295
|
-
|
|
2296
|
-
Similar Items returns a list of similar items to the given input item query. If a user_id is given the response will return similar items personalized for that user. This endpoint can be used to power use-cases like: 1. \"You May Also Like\" surfaces. 2. \"What-to-watch next\" surfaces. 4. \"Similar to this item\" surfaces.
|
|
2297
|
-
|
|
2298
|
-
:param model_name: (required)
|
|
2299
|
-
:type model_name: str
|
|
2300
|
-
:param x_api_key: (required)
|
|
2301
|
-
:type x_api_key: str
|
|
2302
|
-
:param similar_item_request:
|
|
2303
|
-
:type similar_item_request: SimilarItemRequest
|
|
2304
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
2305
|
-
number provided, it will be total request
|
|
2306
|
-
timeout. It can also be a pair (tuple) of
|
|
2307
|
-
(connection, read) timeouts.
|
|
2308
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2309
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2310
|
-
request; this effectively ignores the
|
|
2311
|
-
authentication in the spec for a single request.
|
|
2312
|
-
:type _request_auth: dict, optional
|
|
2313
|
-
:param _content_type: force content-type for the request.
|
|
2314
|
-
:type _content_type: str, Optional
|
|
2315
|
-
:param _headers: set to override the headers for a single
|
|
2316
|
-
request; this effectively ignores the headers
|
|
2317
|
-
in the spec for a single request.
|
|
2318
|
-
:type _headers: dict, optional
|
|
2319
|
-
:param _host_index: set to override the host_index for a single
|
|
2320
|
-
request; this effectively ignores the host_index
|
|
2321
|
-
in the spec for a single request.
|
|
2322
|
-
:type _host_index: int, optional
|
|
2323
|
-
:return: Returns the result object.
|
|
2324
|
-
""" # noqa: E501
|
|
2325
|
-
|
|
2326
|
-
_param = self._post_similar_items_models_model_name_similar_items_post_serialize(
|
|
2327
|
-
model_name=model_name,
|
|
2328
|
-
x_api_key=x_api_key,
|
|
2329
|
-
similar_item_request=similar_item_request,
|
|
2330
|
-
_request_auth=_request_auth,
|
|
2331
|
-
_content_type=_content_type,
|
|
2332
|
-
_headers=_headers,
|
|
2333
|
-
_host_index=_host_index
|
|
2334
|
-
)
|
|
2335
|
-
|
|
2336
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2337
|
-
'200': "SimilarResponse",
|
|
2338
|
-
'422': "HTTPValidationError",
|
|
2339
|
-
}
|
|
2340
|
-
response_data = self.api_client.call_api(
|
|
2341
|
-
*_param,
|
|
2342
|
-
_request_timeout=_request_timeout
|
|
2343
|
-
)
|
|
2344
|
-
response_data.read()
|
|
2345
|
-
return self.api_client.response_deserialize(
|
|
2346
|
-
response_data=response_data,
|
|
2347
|
-
response_types_map=_response_types_map,
|
|
2348
|
-
)
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
@validate_call
|
|
2352
|
-
def post_similar_items_models_model_name_similar_items_post_without_preload_content(
|
|
2353
|
-
self,
|
|
2354
|
-
model_name: StrictStr,
|
|
2355
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
2356
|
-
similar_item_request: Optional[SimilarItemRequest] = None,
|
|
2357
|
-
_request_timeout: Union[
|
|
2358
|
-
None,
|
|
2359
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2360
|
-
Tuple[
|
|
2361
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2362
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
2363
|
-
]
|
|
2364
|
-
] = None,
|
|
2365
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2366
|
-
_content_type: Optional[StrictStr] = None,
|
|
2367
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2368
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2369
|
-
) -> RESTResponseType:
|
|
2370
|
-
"""Similar Items
|
|
2371
|
-
|
|
2372
|
-
Similar Items returns a list of similar items to the given input item query. If a user_id is given the response will return similar items personalized for that user. This endpoint can be used to power use-cases like: 1. \"You May Also Like\" surfaces. 2. \"What-to-watch next\" surfaces. 4. \"Similar to this item\" surfaces.
|
|
2373
|
-
|
|
2374
|
-
:param model_name: (required)
|
|
2375
|
-
:type model_name: str
|
|
2376
|
-
:param x_api_key: (required)
|
|
2377
|
-
:type x_api_key: str
|
|
2378
|
-
:param similar_item_request:
|
|
2379
|
-
:type similar_item_request: SimilarItemRequest
|
|
2380
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
2381
|
-
number provided, it will be total request
|
|
2382
|
-
timeout. It can also be a pair (tuple) of
|
|
2383
|
-
(connection, read) timeouts.
|
|
2384
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2385
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2386
|
-
request; this effectively ignores the
|
|
2387
|
-
authentication in the spec for a single request.
|
|
2388
|
-
:type _request_auth: dict, optional
|
|
2389
|
-
:param _content_type: force content-type for the request.
|
|
2390
|
-
:type _content_type: str, Optional
|
|
2391
|
-
:param _headers: set to override the headers for a single
|
|
2392
|
-
request; this effectively ignores the headers
|
|
2393
|
-
in the spec for a single request.
|
|
2394
|
-
:type _headers: dict, optional
|
|
2395
|
-
:param _host_index: set to override the host_index for a single
|
|
2396
|
-
request; this effectively ignores the host_index
|
|
2397
|
-
in the spec for a single request.
|
|
2398
|
-
:type _host_index: int, optional
|
|
2399
|
-
:return: Returns the result object.
|
|
2400
|
-
""" # noqa: E501
|
|
2401
|
-
|
|
2402
|
-
_param = self._post_similar_items_models_model_name_similar_items_post_serialize(
|
|
2403
|
-
model_name=model_name,
|
|
2404
|
-
x_api_key=x_api_key,
|
|
2405
|
-
similar_item_request=similar_item_request,
|
|
2406
|
-
_request_auth=_request_auth,
|
|
2407
|
-
_content_type=_content_type,
|
|
2408
|
-
_headers=_headers,
|
|
2409
|
-
_host_index=_host_index
|
|
2410
|
-
)
|
|
2411
|
-
|
|
2412
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2413
|
-
'200': "SimilarResponse",
|
|
2414
|
-
'422': "HTTPValidationError",
|
|
2415
|
-
}
|
|
2416
|
-
response_data = self.api_client.call_api(
|
|
2417
|
-
*_param,
|
|
2418
|
-
_request_timeout=_request_timeout
|
|
2419
|
-
)
|
|
2420
|
-
return response_data.response
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
def _post_similar_items_models_model_name_similar_items_post_serialize(
|
|
2424
|
-
self,
|
|
2425
|
-
model_name,
|
|
2426
|
-
x_api_key,
|
|
2427
|
-
similar_item_request,
|
|
2428
|
-
_request_auth,
|
|
2429
|
-
_content_type,
|
|
2430
|
-
_headers,
|
|
2431
|
-
_host_index,
|
|
2432
|
-
) -> RequestSerialized:
|
|
2433
|
-
|
|
2434
|
-
_host = None
|
|
2435
|
-
|
|
2436
|
-
_collection_formats: Dict[str, str] = {
|
|
2437
|
-
}
|
|
2438
|
-
|
|
2439
|
-
_path_params: Dict[str, str] = {}
|
|
2440
|
-
_query_params: List[Tuple[str, str]] = []
|
|
2441
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
2442
|
-
_form_params: List[Tuple[str, str]] = []
|
|
2443
|
-
_files: Dict[
|
|
2444
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
2445
|
-
] = {}
|
|
2446
|
-
_body_params: Optional[bytes] = None
|
|
2447
|
-
|
|
2448
|
-
# process the path parameters
|
|
2449
|
-
if model_name is not None:
|
|
2450
|
-
_path_params['model_name'] = model_name
|
|
2451
|
-
# process the query parameters
|
|
2452
|
-
# process the header parameters
|
|
2453
|
-
if x_api_key is not None:
|
|
2454
|
-
_header_params['x-api-key'] = x_api_key
|
|
2455
|
-
# process the form parameters
|
|
2456
|
-
# process the body parameter
|
|
2457
|
-
if similar_item_request is not None:
|
|
2458
|
-
_body_params = similar_item_request
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
# set the HTTP header `Accept`
|
|
2462
|
-
if 'Accept' not in _header_params:
|
|
2463
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
2464
|
-
[
|
|
2465
|
-
'application/json'
|
|
2466
|
-
]
|
|
2467
|
-
)
|
|
2468
|
-
|
|
2469
|
-
# set the HTTP header `Content-Type`
|
|
2470
|
-
if _content_type:
|
|
2471
|
-
_header_params['Content-Type'] = _content_type
|
|
2472
|
-
else:
|
|
2473
|
-
_default_content_type = (
|
|
2474
|
-
self.api_client.select_header_content_type(
|
|
2475
|
-
[
|
|
2476
|
-
'application/json'
|
|
2477
|
-
]
|
|
2478
|
-
)
|
|
2479
|
-
)
|
|
2480
|
-
if _default_content_type is not None:
|
|
2481
|
-
_header_params['Content-Type'] = _default_content_type
|
|
2482
|
-
|
|
2483
|
-
# authentication setting
|
|
2484
|
-
_auth_settings: List[str] = [
|
|
2485
|
-
]
|
|
2486
|
-
|
|
2487
|
-
return self.api_client.param_serialize(
|
|
2488
|
-
method='POST',
|
|
2489
|
-
resource_path='/models/{model_name}/similar_items',
|
|
2490
|
-
path_params=_path_params,
|
|
2491
|
-
query_params=_query_params,
|
|
2492
|
-
header_params=_header_params,
|
|
2493
|
-
body=_body_params,
|
|
2494
|
-
post_params=_form_params,
|
|
2495
|
-
files=_files,
|
|
2496
|
-
auth_settings=_auth_settings,
|
|
2497
|
-
collection_formats=_collection_formats,
|
|
2498
|
-
_host=_host,
|
|
2499
|
-
_request_auth=_request_auth
|
|
2500
|
-
)
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
@validate_call
|
|
2506
|
-
def post_similar_users_models_model_name_similar_users_post(
|
|
2507
|
-
self,
|
|
2508
|
-
model_name: StrictStr,
|
|
2509
|
-
user_id: StrictStr,
|
|
2510
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
2511
|
-
similar_users_request: Optional[SimilarUsersRequest] = None,
|
|
2512
|
-
_request_timeout: Union[
|
|
2513
|
-
None,
|
|
2514
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2515
|
-
Tuple[
|
|
2516
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2517
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
2518
|
-
]
|
|
2519
|
-
] = None,
|
|
2520
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2521
|
-
_content_type: Optional[StrictStr] = None,
|
|
2522
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2523
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2524
|
-
) -> SimilarResponse:
|
|
2525
|
-
"""Similar Users
|
|
2526
|
-
|
|
2527
|
-
Similar Users returns a list of similar user to the given input user query. This endpoint can be used to power use-cases like: 1. \"Who to follow\" surfaces. 2. \"People like you\" surfaces. 3. \"Connection recommendation\" surfaces.
|
|
2528
|
-
|
|
2529
|
-
:param model_name: (required)
|
|
2530
|
-
:type model_name: str
|
|
2531
|
-
:param user_id: (required)
|
|
2532
|
-
:type user_id: str
|
|
2533
|
-
:param x_api_key: (required)
|
|
2534
|
-
:type x_api_key: str
|
|
2535
|
-
:param similar_users_request:
|
|
2536
|
-
:type similar_users_request: SimilarUsersRequest
|
|
2537
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
2538
|
-
number provided, it will be total request
|
|
2539
|
-
timeout. It can also be a pair (tuple) of
|
|
2540
|
-
(connection, read) timeouts.
|
|
2541
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2542
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2543
|
-
request; this effectively ignores the
|
|
2544
|
-
authentication in the spec for a single request.
|
|
2545
|
-
:type _request_auth: dict, optional
|
|
2546
|
-
:param _content_type: force content-type for the request.
|
|
2547
|
-
:type _content_type: str, Optional
|
|
2548
|
-
:param _headers: set to override the headers for a single
|
|
2549
|
-
request; this effectively ignores the headers
|
|
2550
|
-
in the spec for a single request.
|
|
2551
|
-
:type _headers: dict, optional
|
|
2552
|
-
:param _host_index: set to override the host_index for a single
|
|
2553
|
-
request; this effectively ignores the host_index
|
|
2554
|
-
in the spec for a single request.
|
|
2555
|
-
:type _host_index: int, optional
|
|
2556
|
-
:return: Returns the result object.
|
|
2557
|
-
""" # noqa: E501
|
|
2558
|
-
|
|
2559
|
-
_param = self._post_similar_users_models_model_name_similar_users_post_serialize(
|
|
2560
|
-
model_name=model_name,
|
|
2561
|
-
user_id=user_id,
|
|
2562
|
-
x_api_key=x_api_key,
|
|
2563
|
-
similar_users_request=similar_users_request,
|
|
2564
|
-
_request_auth=_request_auth,
|
|
2565
|
-
_content_type=_content_type,
|
|
2566
|
-
_headers=_headers,
|
|
2567
|
-
_host_index=_host_index
|
|
2568
|
-
)
|
|
2569
|
-
|
|
2570
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2571
|
-
'200': "SimilarResponse",
|
|
2572
|
-
'422': "HTTPValidationError",
|
|
2573
|
-
}
|
|
2574
|
-
response_data = self.api_client.call_api(
|
|
2575
|
-
*_param,
|
|
2576
|
-
_request_timeout=_request_timeout
|
|
2577
|
-
)
|
|
2578
|
-
response_data.read()
|
|
2579
|
-
return self.api_client.response_deserialize(
|
|
2580
|
-
response_data=response_data,
|
|
2581
|
-
response_types_map=_response_types_map,
|
|
2582
|
-
).data
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
@validate_call
|
|
2586
|
-
def post_similar_users_models_model_name_similar_users_post_with_http_info(
|
|
2587
|
-
self,
|
|
2588
|
-
model_name: StrictStr,
|
|
2589
|
-
user_id: StrictStr,
|
|
2590
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
2591
|
-
similar_users_request: Optional[SimilarUsersRequest] = None,
|
|
2592
|
-
_request_timeout: Union[
|
|
2593
|
-
None,
|
|
2594
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2595
|
-
Tuple[
|
|
2596
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2597
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
2598
|
-
]
|
|
2599
|
-
] = None,
|
|
2600
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2601
|
-
_content_type: Optional[StrictStr] = None,
|
|
2602
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2603
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2604
|
-
) -> ApiResponse[SimilarResponse]:
|
|
2605
|
-
"""Similar Users
|
|
2606
|
-
|
|
2607
|
-
Similar Users returns a list of similar user to the given input user query. This endpoint can be used to power use-cases like: 1. \"Who to follow\" surfaces. 2. \"People like you\" surfaces. 3. \"Connection recommendation\" surfaces.
|
|
2608
|
-
|
|
2609
|
-
:param model_name: (required)
|
|
2610
|
-
:type model_name: str
|
|
2611
|
-
:param user_id: (required)
|
|
2612
|
-
:type user_id: str
|
|
2613
|
-
:param x_api_key: (required)
|
|
2614
|
-
:type x_api_key: str
|
|
2615
|
-
:param similar_users_request:
|
|
2616
|
-
:type similar_users_request: SimilarUsersRequest
|
|
2617
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
2618
|
-
number provided, it will be total request
|
|
2619
|
-
timeout. It can also be a pair (tuple) of
|
|
2620
|
-
(connection, read) timeouts.
|
|
2621
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2622
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2623
|
-
request; this effectively ignores the
|
|
2624
|
-
authentication in the spec for a single request.
|
|
2625
|
-
:type _request_auth: dict, optional
|
|
2626
|
-
:param _content_type: force content-type for the request.
|
|
2627
|
-
:type _content_type: str, Optional
|
|
2628
|
-
:param _headers: set to override the headers for a single
|
|
2629
|
-
request; this effectively ignores the headers
|
|
2630
|
-
in the spec for a single request.
|
|
2631
|
-
:type _headers: dict, optional
|
|
2632
|
-
:param _host_index: set to override the host_index for a single
|
|
2633
|
-
request; this effectively ignores the host_index
|
|
2634
|
-
in the spec for a single request.
|
|
2635
|
-
:type _host_index: int, optional
|
|
2636
|
-
:return: Returns the result object.
|
|
2637
|
-
""" # noqa: E501
|
|
2638
|
-
|
|
2639
|
-
_param = self._post_similar_users_models_model_name_similar_users_post_serialize(
|
|
2640
|
-
model_name=model_name,
|
|
2641
|
-
user_id=user_id,
|
|
2642
|
-
x_api_key=x_api_key,
|
|
2643
|
-
similar_users_request=similar_users_request,
|
|
2644
|
-
_request_auth=_request_auth,
|
|
2645
|
-
_content_type=_content_type,
|
|
2646
|
-
_headers=_headers,
|
|
2647
|
-
_host_index=_host_index
|
|
2648
|
-
)
|
|
2649
|
-
|
|
2650
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2651
|
-
'200': "SimilarResponse",
|
|
2652
|
-
'422': "HTTPValidationError",
|
|
2653
|
-
}
|
|
2654
|
-
response_data = self.api_client.call_api(
|
|
2655
|
-
*_param,
|
|
2656
|
-
_request_timeout=_request_timeout
|
|
2657
|
-
)
|
|
2658
|
-
response_data.read()
|
|
2659
|
-
return self.api_client.response_deserialize(
|
|
2660
|
-
response_data=response_data,
|
|
2661
|
-
response_types_map=_response_types_map,
|
|
2662
|
-
)
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
@validate_call
|
|
2666
|
-
def post_similar_users_models_model_name_similar_users_post_without_preload_content(
|
|
2667
|
-
self,
|
|
2668
|
-
model_name: StrictStr,
|
|
2669
|
-
user_id: StrictStr,
|
|
2670
|
-
x_api_key: Annotated[str, Field(min_length=40, strict=True, max_length=40)],
|
|
2671
|
-
similar_users_request: Optional[SimilarUsersRequest] = None,
|
|
2672
|
-
_request_timeout: Union[
|
|
2673
|
-
None,
|
|
2674
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2675
|
-
Tuple[
|
|
2676
|
-
Annotated[StrictFloat, Field(gt=0)],
|
|
2677
|
-
Annotated[StrictFloat, Field(gt=0)]
|
|
2678
|
-
]
|
|
2679
|
-
] = None,
|
|
2680
|
-
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2681
|
-
_content_type: Optional[StrictStr] = None,
|
|
2682
|
-
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2683
|
-
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2684
|
-
) -> RESTResponseType:
|
|
2685
|
-
"""Similar Users
|
|
2686
|
-
|
|
2687
|
-
Similar Users returns a list of similar user to the given input user query. This endpoint can be used to power use-cases like: 1. \"Who to follow\" surfaces. 2. \"People like you\" surfaces. 3. \"Connection recommendation\" surfaces.
|
|
2688
|
-
|
|
2689
|
-
:param model_name: (required)
|
|
2690
|
-
:type model_name: str
|
|
2691
|
-
:param user_id: (required)
|
|
2692
|
-
:type user_id: str
|
|
2693
|
-
:param x_api_key: (required)
|
|
2694
|
-
:type x_api_key: str
|
|
2695
|
-
:param similar_users_request:
|
|
2696
|
-
:type similar_users_request: SimilarUsersRequest
|
|
2697
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
2698
|
-
number provided, it will be total request
|
|
2699
|
-
timeout. It can also be a pair (tuple) of
|
|
2700
|
-
(connection, read) timeouts.
|
|
2701
|
-
:type _request_timeout: int, tuple(int, int), optional
|
|
2702
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
2703
|
-
request; this effectively ignores the
|
|
2704
|
-
authentication in the spec for a single request.
|
|
2705
|
-
:type _request_auth: dict, optional
|
|
2706
|
-
:param _content_type: force content-type for the request.
|
|
2707
|
-
:type _content_type: str, Optional
|
|
2708
|
-
:param _headers: set to override the headers for a single
|
|
2709
|
-
request; this effectively ignores the headers
|
|
2710
|
-
in the spec for a single request.
|
|
2711
|
-
:type _headers: dict, optional
|
|
2712
|
-
:param _host_index: set to override the host_index for a single
|
|
2713
|
-
request; this effectively ignores the host_index
|
|
2714
|
-
in the spec for a single request.
|
|
2715
|
-
:type _host_index: int, optional
|
|
2716
|
-
:return: Returns the result object.
|
|
2717
|
-
""" # noqa: E501
|
|
2718
|
-
|
|
2719
|
-
_param = self._post_similar_users_models_model_name_similar_users_post_serialize(
|
|
2720
|
-
model_name=model_name,
|
|
2721
|
-
user_id=user_id,
|
|
2722
|
-
x_api_key=x_api_key,
|
|
2723
|
-
similar_users_request=similar_users_request,
|
|
2724
|
-
_request_auth=_request_auth,
|
|
2725
|
-
_content_type=_content_type,
|
|
2726
|
-
_headers=_headers,
|
|
2727
|
-
_host_index=_host_index
|
|
2728
|
-
)
|
|
2729
|
-
|
|
2730
|
-
_response_types_map: Dict[str, Optional[str]] = {
|
|
2731
|
-
'200': "SimilarResponse",
|
|
2732
|
-
'422': "HTTPValidationError",
|
|
2733
|
-
}
|
|
2734
|
-
response_data = self.api_client.call_api(
|
|
2735
|
-
*_param,
|
|
2736
|
-
_request_timeout=_request_timeout
|
|
2737
|
-
)
|
|
2738
|
-
return response_data.response
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
def _post_similar_users_models_model_name_similar_users_post_serialize(
|
|
2742
|
-
self,
|
|
2743
|
-
model_name,
|
|
2744
|
-
user_id,
|
|
2745
|
-
x_api_key,
|
|
2746
|
-
similar_users_request,
|
|
2747
|
-
_request_auth,
|
|
2748
|
-
_content_type,
|
|
2749
|
-
_headers,
|
|
2750
|
-
_host_index,
|
|
2751
|
-
) -> RequestSerialized:
|
|
2752
|
-
|
|
2753
|
-
_host = None
|
|
2754
|
-
|
|
2755
|
-
_collection_formats: Dict[str, str] = {
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
_path_params: Dict[str, str] = {}
|
|
2759
|
-
_query_params: List[Tuple[str, str]] = []
|
|
2760
|
-
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
2761
|
-
_form_params: List[Tuple[str, str]] = []
|
|
2762
|
-
_files: Dict[
|
|
2763
|
-
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
2764
|
-
] = {}
|
|
2765
|
-
_body_params: Optional[bytes] = None
|
|
2766
|
-
|
|
2767
|
-
# process the path parameters
|
|
2768
|
-
if model_name is not None:
|
|
2769
|
-
_path_params['model_name'] = model_name
|
|
2770
|
-
# process the query parameters
|
|
2771
|
-
if user_id is not None:
|
|
2772
|
-
|
|
2773
|
-
_query_params.append(('user_id', user_id))
|
|
2774
|
-
|
|
2775
|
-
# process the header parameters
|
|
2776
|
-
if x_api_key is not None:
|
|
2777
|
-
_header_params['x-api-key'] = x_api_key
|
|
2778
|
-
# process the form parameters
|
|
2779
|
-
# process the body parameter
|
|
2780
|
-
if similar_users_request is not None:
|
|
2781
|
-
_body_params = similar_users_request
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
# set the HTTP header `Accept`
|
|
2785
|
-
if 'Accept' not in _header_params:
|
|
2786
|
-
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
2787
|
-
[
|
|
2788
|
-
'application/json'
|
|
2789
|
-
]
|
|
2790
|
-
)
|
|
2791
|
-
|
|
2792
|
-
# set the HTTP header `Content-Type`
|
|
2793
|
-
if _content_type:
|
|
2794
|
-
_header_params['Content-Type'] = _content_type
|
|
2795
|
-
else:
|
|
2796
|
-
_default_content_type = (
|
|
2797
|
-
self.api_client.select_header_content_type(
|
|
2798
|
-
[
|
|
2799
|
-
'application/json'
|
|
2800
|
-
]
|
|
2801
|
-
)
|
|
2802
|
-
)
|
|
2803
|
-
if _default_content_type is not None:
|
|
2804
|
-
_header_params['Content-Type'] = _default_content_type
|
|
2805
|
-
|
|
2806
|
-
# authentication setting
|
|
2807
|
-
_auth_settings: List[str] = [
|
|
2808
|
-
]
|
|
2809
|
-
|
|
2810
|
-
return self.api_client.param_serialize(
|
|
2811
|
-
method='POST',
|
|
2812
|
-
resource_path='/models/{model_name}/similar_users',
|
|
2813
|
-
path_params=_path_params,
|
|
2814
|
-
query_params=_query_params,
|
|
2815
|
-
header_params=_header_params,
|
|
2816
|
-
body=_body_params,
|
|
2817
|
-
post_params=_form_params,
|
|
2818
|
-
files=_files,
|
|
2819
|
-
auth_settings=_auth_settings,
|
|
2820
|
-
collection_formats=_collection_formats,
|
|
2821
|
-
_host=_host,
|
|
2822
|
-
_request_auth=_request_auth
|
|
2823
|
-
)
|
|
2824
|
-
|
|
2825
|
-
|