shaped 2.0.0__py3-none-any.whl → 2.0.2__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 +54 -4
- shaped/autogen/__init__.py +541 -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} +219 -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 +15 -8
- shaped/autogen/configuration.py +20 -9
- shaped/autogen/exceptions.py +19 -2
- shaped/autogen/models/__init__.py +254 -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 +136 -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 +126 -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 +123 -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 +134 -0
- shaped/autogen/models/entity_config.py +109 -0
- shaped/autogen/models/entity_journey.py +152 -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 +140 -0
- shaped/autogen/models/filter_index_type.py +36 -0
- shaped/autogen/models/filter_retrieve_step.py +113 -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 +113 -0
- shaped/autogen/models/iceberg_table_config.py +154 -0
- shaped/autogen/models/index_config.py +101 -0
- shaped/autogen/models/inner_size.py +136 -0
- shaped/autogen/models/inner_size1.py +136 -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 +124 -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 +37 -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/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 +134 -0
- shaped/autogen/models/mode2.py +136 -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 +134 -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 +140 -0
- shaped/autogen/models/query_definition.py +106 -0
- shaped/autogen/models/query_encoder.py +194 -0
- shaped/autogen/models/query_explanation.py +197 -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 +149 -0
- shaped/autogen/models/rank_query_config_retrieve_inner.py +196 -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/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/response_get_view_details_views_view_name_get.py +134 -0
- shaped/autogen/models/result.py +145 -0
- shaped/autogen/models/result_embeddings_value.py +127 -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 +89 -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 +140 -0
- shaped/autogen/models/score_ensemble_policy_config.py +141 -0
- shaped/autogen/models/score_ensemble_policy_config_policies_inner.py +422 -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 +87 -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 +148 -0
- shaped/autogen/models/shaped_internal_recsys_policies_beeformer_model_policy_beeformer_model_policy_beeformer_model_policy_config.py +154 -0
- shaped/autogen/models/shaped_internal_recsys_policies_bert_model_policy_bert_model_policy_bert_model_policy_config.py +209 -0
- shaped/autogen/models/shaped_internal_recsys_policies_chronological_model_policy_chronological_model_policy_config.py +137 -0
- shaped/autogen/models/shaped_internal_recsys_policies_elsa_model_policy_elsa_model_policy_elsa_model_policy_config.py +139 -0
- shaped/autogen/models/shaped_internal_recsys_policies_gsasrec_model_policy_gsasrec_model_policy_gsas_rec_model_policy_config.py +205 -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 +152 -0
- shaped/autogen/models/shaped_internal_recsys_policies_lightgbm_model_policy_lightgbm_model_policy_light_gbm_model_policy_config.py +239 -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 +137 -0
- shaped/autogen/models/shaped_internal_recsys_policies_random_model_policy_random_model_policy_config.py +104 -0
- shaped/autogen/models/shaped_internal_recsys_policies_recently_popular_policy_recently_popular_policy_config.py +130 -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 +224 -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 +159 -0
- shaped/autogen/models/shaped_internal_recsys_policies_user_item_content_similarity_model_policy_user_item_content_similarity_model_policy_config.py +131 -0
- shaped/autogen/models/shaped_internal_recsys_policies_widedeep_model_policy_wide_deep_model_policy_config.py +131 -0
- shaped/autogen/models/shaped_internal_recsys_policies_xgboost_model_policy_xg_boost_model_policy_config.py +149 -0
- shaped/autogen/models/shopify_table_config.py +156 -0
- shaped/autogen/models/similarity_retrieve_step.py +121 -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/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 +136 -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 +142 -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 +308 -0
- shaped/autogen/models/training_strategy.py +37 -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 +134 -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/val_split.py +136 -0
- shaped/autogen/models/validation_error.py +13 -3
- shaped/autogen/models/validation_error_loc_inner.py +138 -0
- shaped/autogen/models/value_type.py +7 -5
- shaped/autogen/models/vector_search_mode.py +99 -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 +8 -2
- shaped/cli/shaped_cli.py +12 -7
- shaped/client.py +587 -174
- shaped/config_builders.py +695 -0
- shaped/query_builder.py +774 -0
- {shaped-2.0.0.dist-info → shaped-2.0.2.dist-info}/METADATA +119 -56
- shaped-2.0.2.dist-info/RECORD +278 -0
- shaped-2.0.2.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.0.dist-info/RECORD +0 -73
- shaped-2.0.0.dist-info/entry_points.txt +0 -2
- {shaped-2.0.0.dist-info → shaped-2.0.2.dist-info}/WHEEL +0 -0
- {shaped-2.0.0.dist-info → shaped-2.0.2.dist-info}/top_level.txt +0 -0
- {shaped-2.0.0.dist-info → shaped-2.0.2.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from shaped.autogen.models.pipeline_stage_explanation import PipelineStageExplanation
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class QueryExplanation(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Detailed explanation of the query execution pipeline. This follows the declarative query structure, providing explanations for each stage and step in the pipeline. Per-entity journey tracking is attached to individual Result objects in QueryResult.results.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
query_name: Optional[StrictStr] = None
|
|
31
|
+
query_type: Optional[StrictStr] = None
|
|
32
|
+
parameters: Optional[Dict[str, Any]] = Field(default=None, description="Parameters that were passed to the query. Shows the resolved values for any $parameter references used in the query configuration.")
|
|
33
|
+
pagination_id: Optional[StrictStr] = None
|
|
34
|
+
retrieve_stage: Optional[PipelineStageExplanation] = None
|
|
35
|
+
filter_stage: Optional[PipelineStageExplanation] = None
|
|
36
|
+
score_stage: Optional[PipelineStageExplanation] = None
|
|
37
|
+
reorder_stage: Optional[PipelineStageExplanation] = None
|
|
38
|
+
total_execution_time_ms: Optional[Union[StrictFloat, StrictInt]] = None
|
|
39
|
+
final_result_count: Optional[StrictInt] = None
|
|
40
|
+
limit_applied: Optional[StrictInt] = None
|
|
41
|
+
inner_uid: Optional[StrictInt] = None
|
|
42
|
+
outer_uid: Optional[StrictStr] = None
|
|
43
|
+
additional_properties: Dict[str, Any] = {}
|
|
44
|
+
__properties: ClassVar[List[str]] = ["query_name", "query_type", "parameters", "pagination_id", "retrieve_stage", "filter_stage", "score_stage", "reorder_stage", "total_execution_time_ms", "final_result_count", "limit_applied", "inner_uid", "outer_uid"]
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
populate_by_name=True,
|
|
48
|
+
validate_assignment=True,
|
|
49
|
+
protected_namespaces=(),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def to_str(self) -> str:
|
|
54
|
+
"""Returns the string representation of the model using alias"""
|
|
55
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
56
|
+
|
|
57
|
+
def to_json(self) -> str:
|
|
58
|
+
"""Returns the JSON representation of the model using alias"""
|
|
59
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
60
|
+
return json.dumps(self.to_dict())
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
64
|
+
"""Create an instance of QueryExplanation from a JSON string"""
|
|
65
|
+
return cls.from_dict(json.loads(json_str))
|
|
66
|
+
|
|
67
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
68
|
+
"""Return the dictionary representation of the model using alias.
|
|
69
|
+
|
|
70
|
+
This has the following differences from calling pydantic's
|
|
71
|
+
`self.model_dump(by_alias=True)`:
|
|
72
|
+
|
|
73
|
+
* `None` is only added to the output dict for nullable fields that
|
|
74
|
+
were set at model initialization. Other fields with value `None`
|
|
75
|
+
are ignored.
|
|
76
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
"additional_properties",
|
|
80
|
+
])
|
|
81
|
+
|
|
82
|
+
_dict = self.model_dump(
|
|
83
|
+
by_alias=True,
|
|
84
|
+
exclude=excluded_fields,
|
|
85
|
+
exclude_none=True,
|
|
86
|
+
)
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of retrieve_stage
|
|
88
|
+
if self.retrieve_stage:
|
|
89
|
+
_dict['retrieve_stage'] = self.retrieve_stage.to_dict()
|
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of filter_stage
|
|
91
|
+
if self.filter_stage:
|
|
92
|
+
_dict['filter_stage'] = self.filter_stage.to_dict()
|
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of score_stage
|
|
94
|
+
if self.score_stage:
|
|
95
|
+
_dict['score_stage'] = self.score_stage.to_dict()
|
|
96
|
+
# override the default output from pydantic by calling `to_dict()` of reorder_stage
|
|
97
|
+
if self.reorder_stage:
|
|
98
|
+
_dict['reorder_stage'] = self.reorder_stage.to_dict()
|
|
99
|
+
# puts key-value pairs in additional_properties in the top level
|
|
100
|
+
if self.additional_properties is not None:
|
|
101
|
+
for _key, _value in self.additional_properties.items():
|
|
102
|
+
_dict[_key] = _value
|
|
103
|
+
|
|
104
|
+
# set to None if query_name (nullable) is None
|
|
105
|
+
# and model_fields_set contains the field
|
|
106
|
+
if self.query_name is None and "query_name" in self.model_fields_set:
|
|
107
|
+
_dict['query_name'] = None
|
|
108
|
+
|
|
109
|
+
# set to None if query_type (nullable) is None
|
|
110
|
+
# and model_fields_set contains the field
|
|
111
|
+
if self.query_type is None and "query_type" in self.model_fields_set:
|
|
112
|
+
_dict['query_type'] = None
|
|
113
|
+
|
|
114
|
+
# set to None if pagination_id (nullable) is None
|
|
115
|
+
# and model_fields_set contains the field
|
|
116
|
+
if self.pagination_id is None and "pagination_id" in self.model_fields_set:
|
|
117
|
+
_dict['pagination_id'] = None
|
|
118
|
+
|
|
119
|
+
# set to None if retrieve_stage (nullable) is None
|
|
120
|
+
# and model_fields_set contains the field
|
|
121
|
+
if self.retrieve_stage is None and "retrieve_stage" in self.model_fields_set:
|
|
122
|
+
_dict['retrieve_stage'] = None
|
|
123
|
+
|
|
124
|
+
# set to None if filter_stage (nullable) is None
|
|
125
|
+
# and model_fields_set contains the field
|
|
126
|
+
if self.filter_stage is None and "filter_stage" in self.model_fields_set:
|
|
127
|
+
_dict['filter_stage'] = None
|
|
128
|
+
|
|
129
|
+
# set to None if score_stage (nullable) is None
|
|
130
|
+
# and model_fields_set contains the field
|
|
131
|
+
if self.score_stage is None and "score_stage" in self.model_fields_set:
|
|
132
|
+
_dict['score_stage'] = None
|
|
133
|
+
|
|
134
|
+
# set to None if reorder_stage (nullable) is None
|
|
135
|
+
# and model_fields_set contains the field
|
|
136
|
+
if self.reorder_stage is None and "reorder_stage" in self.model_fields_set:
|
|
137
|
+
_dict['reorder_stage'] = None
|
|
138
|
+
|
|
139
|
+
# set to None if total_execution_time_ms (nullable) is None
|
|
140
|
+
# and model_fields_set contains the field
|
|
141
|
+
if self.total_execution_time_ms is None and "total_execution_time_ms" in self.model_fields_set:
|
|
142
|
+
_dict['total_execution_time_ms'] = None
|
|
143
|
+
|
|
144
|
+
# set to None if final_result_count (nullable) is None
|
|
145
|
+
# and model_fields_set contains the field
|
|
146
|
+
if self.final_result_count is None and "final_result_count" in self.model_fields_set:
|
|
147
|
+
_dict['final_result_count'] = None
|
|
148
|
+
|
|
149
|
+
# set to None if limit_applied (nullable) is None
|
|
150
|
+
# and model_fields_set contains the field
|
|
151
|
+
if self.limit_applied is None and "limit_applied" in self.model_fields_set:
|
|
152
|
+
_dict['limit_applied'] = None
|
|
153
|
+
|
|
154
|
+
# set to None if inner_uid (nullable) is None
|
|
155
|
+
# and model_fields_set contains the field
|
|
156
|
+
if self.inner_uid is None and "inner_uid" in self.model_fields_set:
|
|
157
|
+
_dict['inner_uid'] = None
|
|
158
|
+
|
|
159
|
+
# set to None if outer_uid (nullable) is None
|
|
160
|
+
# and model_fields_set contains the field
|
|
161
|
+
if self.outer_uid is None and "outer_uid" in self.model_fields_set:
|
|
162
|
+
_dict['outer_uid'] = None
|
|
163
|
+
|
|
164
|
+
return _dict
|
|
165
|
+
|
|
166
|
+
@classmethod
|
|
167
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
168
|
+
"""Create an instance of QueryExplanation from a dict"""
|
|
169
|
+
if obj is None:
|
|
170
|
+
return None
|
|
171
|
+
|
|
172
|
+
if not isinstance(obj, dict):
|
|
173
|
+
return cls.model_validate(obj)
|
|
174
|
+
|
|
175
|
+
_obj = cls.model_validate({
|
|
176
|
+
"query_name": obj.get("query_name"),
|
|
177
|
+
"query_type": obj.get("query_type"),
|
|
178
|
+
"parameters": obj.get("parameters"),
|
|
179
|
+
"pagination_id": obj.get("pagination_id"),
|
|
180
|
+
"retrieve_stage": PipelineStageExplanation.from_dict(obj["retrieve_stage"]) if obj.get("retrieve_stage") is not None else None,
|
|
181
|
+
"filter_stage": PipelineStageExplanation.from_dict(obj["filter_stage"]) if obj.get("filter_stage") is not None else None,
|
|
182
|
+
"score_stage": PipelineStageExplanation.from_dict(obj["score_stage"]) if obj.get("score_stage") is not None else None,
|
|
183
|
+
"reorder_stage": PipelineStageExplanation.from_dict(obj["reorder_stage"]) if obj.get("reorder_stage") is not None else None,
|
|
184
|
+
"total_execution_time_ms": obj.get("total_execution_time_ms"),
|
|
185
|
+
"final_result_count": obj.get("final_result_count"),
|
|
186
|
+
"limit_applied": obj.get("limit_applied"),
|
|
187
|
+
"inner_uid": obj.get("inner_uid"),
|
|
188
|
+
"outer_uid": obj.get("outer_uid")
|
|
189
|
+
})
|
|
190
|
+
# store additional fields in additional_properties
|
|
191
|
+
for _key in obj.keys():
|
|
192
|
+
if _key not in cls.__properties:
|
|
193
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
194
|
+
|
|
195
|
+
return _obj
|
|
196
|
+
|
|
197
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from shaped.autogen.models.parameters_value import ParametersValue
|
|
23
|
+
from shaped.autogen.models.query1 import Query1
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class QueryRequest(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Request model for ad-hoc queries.
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
parameters: Optional[Dict[str, ParametersValue]] = Field(default=None, description="Query parameters that can be referenced in the query configuration using $parameter.name syntax. Supports int, float, str, bool, and lists of these types.")
|
|
32
|
+
query: Query1
|
|
33
|
+
return_metadata: Optional[StrictBool] = Field(default=True, description="Whether to include entity metadata (attributes) in the response. When true, each result includes an 'attributes' field with entity metadata.")
|
|
34
|
+
return_explanation: Optional[StrictBool] = Field(default=False, description="Whether to include a detailed explanation of query execution. When true, the response includes an 'explanation' field with information about retrieval, filtering, scoring, and reordering stages.")
|
|
35
|
+
return_journey_explanations: Optional[StrictBool] = Field(default=False, description="Whether to include per-entity journey tracking in results. When true, each result includes a 'journey' field showing how that entity moved through the query pipeline.")
|
|
36
|
+
pagination_key: Optional[StrictStr] = None
|
|
37
|
+
ignore_pagination: Optional[StrictBool] = Field(default=False, description="Whether to ignore pagination and return results from the beginning. When true, pagination_key is ignored and results start from the first page.")
|
|
38
|
+
__properties: ClassVar[List[str]] = ["parameters", "query", "return_metadata", "return_explanation", "return_journey_explanations", "pagination_key", "ignore_pagination"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of QueryRequest from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of each value in parameters (dict)
|
|
80
|
+
_field_dict = {}
|
|
81
|
+
if self.parameters:
|
|
82
|
+
for _key_parameters in self.parameters:
|
|
83
|
+
if self.parameters[_key_parameters]:
|
|
84
|
+
_field_dict[_key_parameters] = self.parameters[_key_parameters].to_dict()
|
|
85
|
+
_dict['parameters'] = _field_dict
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of query
|
|
87
|
+
if self.query:
|
|
88
|
+
_dict['query'] = self.query.to_dict()
|
|
89
|
+
# set to None if pagination_key (nullable) is None
|
|
90
|
+
# and model_fields_set contains the field
|
|
91
|
+
if self.pagination_key is None and "pagination_key" in self.model_fields_set:
|
|
92
|
+
_dict['pagination_key'] = None
|
|
93
|
+
|
|
94
|
+
return _dict
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
98
|
+
"""Create an instance of QueryRequest from a dict"""
|
|
99
|
+
if obj is None:
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
if not isinstance(obj, dict):
|
|
103
|
+
return cls.model_validate(obj)
|
|
104
|
+
|
|
105
|
+
_obj = cls.model_validate({
|
|
106
|
+
"parameters": dict(
|
|
107
|
+
(_k, ParametersValue.from_dict(_v))
|
|
108
|
+
for _k, _v in obj["parameters"].items()
|
|
109
|
+
)
|
|
110
|
+
if obj.get("parameters") is not None
|
|
111
|
+
else None,
|
|
112
|
+
"query": Query1.from_dict(obj["query"]) if obj.get("query") is not None else None,
|
|
113
|
+
"return_metadata": obj.get("return_metadata") if obj.get("return_metadata") is not None else True,
|
|
114
|
+
"return_explanation": obj.get("return_explanation") if obj.get("return_explanation") is not None else False,
|
|
115
|
+
"return_journey_explanations": obj.get("return_journey_explanations") if obj.get("return_journey_explanations") is not None else False,
|
|
116
|
+
"pagination_key": obj.get("pagination_key"),
|
|
117
|
+
"ignore_pagination": obj.get("ignore_pagination") if obj.get("ignore_pagination") is not None else False
|
|
118
|
+
})
|
|
119
|
+
return _obj
|
|
120
|
+
|
|
121
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from shaped.autogen.models.query_explanation import QueryExplanation
|
|
23
|
+
from shaped.autogen.models.result import Result
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class QueryResult(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Result of a query execution. Contains a list of ranked entities (items, users, or attributes) with their scores and optional attributes. Attributes: results: List of result entities with scores and attributes. entity_type: Type of entities returned (\"item\", \"user\", \"attribute\"). explanation: Optional detailed execution explanation.
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
results: List[Result] = Field(description="List of ranked result entities. Each result contains an id, score, and optionally attributes, embeddings, and journey tracking. Results are ordered by score (descending) after all pipeline stages.")
|
|
32
|
+
entity_type: Optional[StrictStr] = None
|
|
33
|
+
explanation: Optional[QueryExplanation] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["results", "entity_type", "explanation"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of QueryResult from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.results:
|
|
78
|
+
for _item_results in self.results:
|
|
79
|
+
if _item_results:
|
|
80
|
+
_items.append(_item_results.to_dict())
|
|
81
|
+
_dict['results'] = _items
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of explanation
|
|
83
|
+
if self.explanation:
|
|
84
|
+
_dict['explanation'] = self.explanation.to_dict()
|
|
85
|
+
# set to None if entity_type (nullable) is None
|
|
86
|
+
# and model_fields_set contains the field
|
|
87
|
+
if self.entity_type is None and "entity_type" in self.model_fields_set:
|
|
88
|
+
_dict['entity_type'] = None
|
|
89
|
+
|
|
90
|
+
# set to None if explanation (nullable) is None
|
|
91
|
+
# and model_fields_set contains the field
|
|
92
|
+
if self.explanation is None and "explanation" in self.model_fields_set:
|
|
93
|
+
_dict['explanation'] = None
|
|
94
|
+
|
|
95
|
+
return _dict
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
99
|
+
"""Create an instance of QueryResult from a dict"""
|
|
100
|
+
if obj is None:
|
|
101
|
+
return None
|
|
102
|
+
|
|
103
|
+
if not isinstance(obj, dict):
|
|
104
|
+
return cls.model_validate(obj)
|
|
105
|
+
|
|
106
|
+
_obj = cls.model_validate({
|
|
107
|
+
"results": [Result.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
|
108
|
+
"entity_type": obj.get("entity_type"),
|
|
109
|
+
"explanation": QueryExplanation.from_dict(obj["explanation"]) if obj.get("explanation") is not None else None
|
|
110
|
+
})
|
|
111
|
+
return _obj
|
|
112
|
+
|
|
113
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class QueryTableConfig(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Table config that uses a SQL query to fetch data. Supports joins and complex SQL operations.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
type: Optional[StrictStr] = Field(default='query', description="Type discriminator for query-based config.")
|
|
30
|
+
query: StrictStr = Field(description="SQL query to run against the data in your account. Your query can reference tables or transforms. Uses Clickhouse SQL dialect.")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["type", "query"]
|
|
32
|
+
|
|
33
|
+
@field_validator('type')
|
|
34
|
+
def type_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value is None:
|
|
37
|
+
return value
|
|
38
|
+
|
|
39
|
+
if value not in set(['query']):
|
|
40
|
+
raise ValueError("must be one of enum values ('query')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of QueryTableConfig from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of QueryTableConfig from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"type": obj.get("type") if obj.get("type") is not None else 'query',
|
|
95
|
+
"query": obj.get("query")
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class RankItemAttributeValuesQueryConfig(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Config for a query pipeline that ranks the possible values of a given item attribute. If a user_id is provided, the ranking will be personalized.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
input_attribute: StrictStr = Field(description="Item attribute name to rank values for.")
|
|
30
|
+
columns: Optional[List[StrictStr]] = None
|
|
31
|
+
embeddings: Optional[List[StrictStr]] = None
|
|
32
|
+
limit: Optional[StrictInt] = Field(default=15, description="Maximum number of attribute values to return.")
|
|
33
|
+
input_user_id: Optional[StrictStr] = None
|
|
34
|
+
type: Optional[StrictStr] = Field(default='rank_attributes', description="Query config type discriminator.")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["input_attribute", "columns", "embeddings", "limit", "input_user_id", "type"]
|
|
36
|
+
|
|
37
|
+
@field_validator('type')
|
|
38
|
+
def type_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value is None:
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
if value not in set(['rank_attributes']):
|
|
44
|
+
raise ValueError("must be one of enum values ('rank_attributes')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
populate_by_name=True,
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_str(self) -> str:
|
|
55
|
+
"""Returns the string representation of the model using alias"""
|
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
57
|
+
|
|
58
|
+
def to_json(self) -> str:
|
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
61
|
+
return json.dumps(self.to_dict())
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of RankItemAttributeValuesQueryConfig from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# set to None if columns (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.columns is None and "columns" in self.model_fields_set:
|
|
89
|
+
_dict['columns'] = None
|
|
90
|
+
|
|
91
|
+
# set to None if embeddings (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.embeddings is None and "embeddings" in self.model_fields_set:
|
|
94
|
+
_dict['embeddings'] = None
|
|
95
|
+
|
|
96
|
+
# set to None if input_user_id (nullable) is None
|
|
97
|
+
# and model_fields_set contains the field
|
|
98
|
+
if self.input_user_id is None and "input_user_id" in self.model_fields_set:
|
|
99
|
+
_dict['input_user_id'] = None
|
|
100
|
+
|
|
101
|
+
return _dict
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
105
|
+
"""Create an instance of RankItemAttributeValuesQueryConfig from a dict"""
|
|
106
|
+
if obj is None:
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
if not isinstance(obj, dict):
|
|
110
|
+
return cls.model_validate(obj)
|
|
111
|
+
|
|
112
|
+
_obj = cls.model_validate({
|
|
113
|
+
"input_attribute": obj.get("input_attribute"),
|
|
114
|
+
"columns": obj.get("columns"),
|
|
115
|
+
"embeddings": obj.get("embeddings"),
|
|
116
|
+
"limit": obj.get("limit") if obj.get("limit") is not None else 15,
|
|
117
|
+
"input_user_id": obj.get("input_user_id"),
|
|
118
|
+
"type": obj.get("type") if obj.get("type") is not None else 'rank_attributes'
|
|
119
|
+
})
|
|
120
|
+
return _obj
|
|
121
|
+
|
|
122
|
+
|