shaped 2.0.2__py3-none-any.whl → 2.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shaped/__init__.py +47 -42
- shaped/autogen/__init__.py +37 -51
- shaped/autogen/api/engine_api.py +1 -1
- shaped/autogen/api/query_api.py +8 -68
- shaped/autogen/api/table_api.py +1 -1
- shaped/autogen/api/view_api.py +1 -1
- shaped/autogen/api_client.py +4 -4
- shaped/autogen/configuration.py +5 -3
- shaped/autogen/exceptions.py +7 -4
- shaped/autogen/models/__init__.py +19 -26
- shaped/autogen/models/ai_enrichment_view_config.py +1 -1
- shaped/autogen/models/algorithm.py +1 -1
- shaped/autogen/models/amplitude_table_config.py +1 -1
- shaped/autogen/models/ascending.py +29 -17
- shaped/autogen/models/attn_dropout_prob.py +1 -1
- shaped/autogen/models/attribute_journey.py +1 -1
- shaped/autogen/models/attribute_value.py +1 -1
- shaped/autogen/models/autoscaling_config.py +1 -1
- shaped/autogen/models/aws_pinpoint_table_config.py +1 -1
- shaped/autogen/models/batch_size.py +1 -1
- shaped/autogen/models/batch_size1.py +1 -1
- shaped/autogen/models/batch_size2.py +1 -1
- shaped/autogen/models/big_query_table_config.py +1 -1
- shaped/autogen/models/bm25.py +1 -1
- shaped/autogen/models/boosted_reorder_step.py +1 -1
- shaped/autogen/models/canary_rollout.py +1 -1
- shaped/autogen/models/candidate_attributes_retrieve_step.py +1 -14
- shaped/autogen/models/candidate_ids_retrieve_step.py +1 -1
- shaped/autogen/models/candidate_retrieval_strategy.py +1 -1
- shaped/autogen/models/clickhouse_table_config.py +1 -1
- shaped/autogen/models/column_order_retrieve_step.py +1 -1
- shaped/autogen/models/column_ordering.py +1 -1
- shaped/autogen/models/create_table_response.py +1 -1
- shaped/autogen/models/create_view_response.py +1 -1
- shaped/autogen/models/custom_table_config.py +1 -1
- shaped/autogen/models/data_compute_config.py +1 -1
- shaped/autogen/models/data_config.py +1 -1
- shaped/autogen/models/data_config_interaction_table.py +1 -1
- shaped/autogen/models/data_split_config.py +1 -1
- shaped/autogen/models/data_split_strategy.py +1 -1
- shaped/autogen/models/data_tier.py +1 -1
- shaped/autogen/models/default.py +1 -1
- shaped/autogen/models/delete_engine_response.py +1 -1
- shaped/autogen/models/delete_table_response.py +1 -1
- shaped/autogen/models/delete_view_response.py +1 -1
- shaped/autogen/models/deployment_config.py +2 -8
- shaped/autogen/models/distance_function.py +5 -5
- shaped/autogen/models/diversity_reorder_step.py +1 -1
- shaped/autogen/models/dropout_rate.py +1 -1
- shaped/autogen/models/dynamo_db_table_config.py +1 -1
- shaped/autogen/models/dynamo_db_table_config_scan_kwargs_value.py +1 -1
- shaped/autogen/models/embedder_batch_size.py +1 -1
- shaped/autogen/models/embedding_config.py +1 -1
- shaped/autogen/models/embedding_dim.py +1 -1
- shaped/autogen/models/embedding_dims.py +1 -1
- shaped/autogen/models/embedding_size.py +1 -1
- shaped/autogen/models/encoder.py +1 -1
- shaped/autogen/models/encoding_pooling_strategy.py +5 -5
- shaped/autogen/models/engine.py +1 -1
- shaped/autogen/models/engine_config_v2.py +1 -1
- shaped/autogen/models/engine_details_response.py +1 -1
- shaped/autogen/models/engine_schema.py +8 -8
- shaped/autogen/models/engine_schema_user_inner.py +30 -18
- shaped/autogen/models/entity_config.py +1 -1
- shaped/autogen/models/entity_journey.py +28 -19
- shaped/autogen/models/entity_type.py +1 -1
- shaped/autogen/models/evaluation_config.py +1 -1
- shaped/autogen/models/exploration_reorder_step.py +1 -1
- shaped/autogen/models/expression_filter_step.py +1 -1
- shaped/autogen/models/factors.py +1 -1
- shaped/autogen/models/factors1.py +1 -1
- shaped/autogen/models/feature.py +1 -1
- shaped/autogen/models/feature_type.py +1 -1
- shaped/autogen/models/file_table_config.py +1 -1
- shaped/autogen/models/filter_config.py +14 -14
- shaped/autogen/models/filter_dataset.py +47 -23
- shaped/autogen/models/filter_index_type.py +1 -1
- shaped/autogen/models/filter_retrieve_step.py +1 -1
- 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 +1 -1
- shaped/autogen/models/hidden_dropout_prob.py +1 -1
- shaped/autogen/models/hidden_size.py +1 -1
- shaped/autogen/models/hidden_size1.py +1 -1
- shaped/autogen/models/http_problem_response.py +1 -1
- shaped/autogen/models/http_validation_error.py +1 -1
- shaped/autogen/models/hugging_face_encoder.py +6 -4
- shaped/autogen/models/iceberg_table_config.py +1 -1
- shaped/autogen/models/index_config.py +1 -1
- shaped/autogen/models/inner_entity_id.py +144 -0
- shaped/autogen/models/inner_size.py +1 -1
- shaped/autogen/models/inner_size1.py +1 -1
- shaped/autogen/models/inner_uid.py +144 -0
- shaped/autogen/models/interaction_config.py +1 -1
- shaped/autogen/models/interaction_pooling_encoder.py +1 -1
- shaped/autogen/models/interaction_round_robin_encoder.py +1 -1
- shaped/autogen/models/item_attribute_pooling_encoder.py +1 -14
- shaped/autogen/models/journey.py +1 -1
- shaped/autogen/models/kafka_table_config.py +1 -1
- shaped/autogen/models/kinesis_table_config.py +1 -1
- shaped/autogen/models/kinesis_table_config_column_schema_value.py +1 -1
- shaped/autogen/models/label.py +1 -1
- shaped/autogen/models/label_type.py +1 -2
- shaped/autogen/models/laplace_smoothing.py +1 -1
- shaped/autogen/models/latency_scaling_policy.py +1 -1
- shaped/autogen/models/learning_rate.py +1 -1
- shaped/autogen/models/learning_rate1.py +1 -1
- shaped/autogen/models/learning_rate2.py +1 -1
- shaped/autogen/models/learning_rate3.py +1 -1
- shaped/autogen/models/lexical_search_mode.py +3 -3
- shaped/autogen/models/list_engines_response.py +1 -1
- shaped/autogen/models/list_tables_response.py +1 -1
- shaped/autogen/models/list_views_response.py +1 -1
- shaped/autogen/models/location_inner.py +138 -0
- shaped/autogen/models/loss_types.py +1 -1
- shaped/autogen/models/lr.py +1 -1
- shaped/autogen/models/lr1.py +1 -1
- shaped/autogen/models/lr2.py +1 -1
- shaped/autogen/models/max_depth.py +1 -1
- shaped/autogen/models/max_leaves.py +1 -1
- shaped/autogen/models/max_seq_length.py +1 -1
- shaped/autogen/models/max_seq_length1.py +1 -1
- shaped/autogen/models/max_seq_length2.py +1 -1
- shaped/autogen/models/mode.py +1 -1
- shaped/autogen/models/mode1.py +20 -18
- shaped/autogen/models/mode2.py +32 -18
- shaped/autogen/models/models_inner.py +308 -0
- shaped/autogen/models/mongo_db_table_config.py +1 -1
- shaped/autogen/models/mssql_table_config.py +1 -1
- shaped/autogen/models/my_sql_table_config.py +1 -1
- shaped/autogen/models/n_epochs.py +1 -1
- shaped/autogen/models/n_epochs1.py +1 -1
- shaped/autogen/models/n_epochs2.py +1 -1
- shaped/autogen/models/n_estimators.py +1 -1
- shaped/autogen/models/n_heads.py +1 -1
- shaped/autogen/models/n_layers.py +1 -1
- shaped/autogen/models/neg_per_positive.py +1 -1
- shaped/autogen/models/negative_samples_count.py +1 -1
- shaped/autogen/models/ngram_tokenizer.py +1 -1
- shaped/autogen/models/no_op_config.py +1 -1
- shaped/autogen/models/num_blocks.py +1 -1
- shaped/autogen/models/num_heads.py +1 -1
- shaped/autogen/models/num_leaves.py +1 -1
- shaped/autogen/models/objective.py +1 -1
- shaped/autogen/models/objective1.py +1 -1
- shaped/autogen/models/online_store_config.py +1 -1
- shaped/autogen/models/pagination_config.py +1 -1
- shaped/autogen/models/parameter_definition.py +1 -1
- shaped/autogen/models/parameters_value.py +1 -1
- shaped/autogen/models/passthrough_score.py +1 -1
- shaped/autogen/models/personal_filter.py +1 -1
- shaped/autogen/models/pipeline_stage_explanation.py +4 -4
- shaped/autogen/models/policy.py +1 -1
- shaped/autogen/models/pool_fn.py +39 -21
- shaped/autogen/models/pooling_function.py +1 -1
- shaped/autogen/models/postgres_table_config.py +1 -1
- shaped/autogen/models/posthog_table_config.py +1 -1
- shaped/autogen/models/prebuilt_filter_step.py +1 -1
- shaped/autogen/models/precomputed_item_embedding.py +1 -1
- shaped/autogen/models/precomputed_user_embedding.py +1 -1
- shaped/autogen/models/query.py +15 -15
- shaped/autogen/models/query1.py +15 -15
- shaped/autogen/models/query_any_of.py +58 -26
- shaped/autogen/models/query_config.py +140 -0
- shaped/autogen/models/query_definition.py +1 -1
- shaped/autogen/models/query_encoder.py +1 -1
- shaped/autogen/models/query_explanation.py +7 -3
- shaped/autogen/models/query_request.py +1 -1
- shaped/autogen/models/query_result.py +1 -1
- shaped/autogen/models/query_table_config.py +1 -1
- shaped/autogen/models/rank_item_attribute_values_query_config.py +1 -1
- shaped/autogen/models/rank_query_config.py +7 -7
- shaped/autogen/models/rank_query_config_filter_inner.py +1 -1
- shaped/autogen/models/rank_query_config_reorder_inner.py +62 -25
- shaped/autogen/models/rank_query_config_retrieve_inner.py +100 -31
- shaped/autogen/models/recreate_rollout.py +1 -1
- shaped/autogen/models/redshift_table_config.py +1 -1
- shaped/autogen/models/reference_table_config.py +1 -1
- shaped/autogen/models/regularization.py +1 -1
- shaped/autogen/models/reorder_inner.py +149 -0
- shaped/autogen/models/reorder_step_explanation.py +207 -0
- shaped/autogen/models/request.py +1 -1
- shaped/autogen/models/request1.py +1 -1
- shaped/autogen/models/requests_per_second_scaling_policy.py +1 -1
- shaped/autogen/models/resource_config.py +100 -0
- shaped/autogen/models/response_get_view_details_views_view_name_get.py +1 -1
- shaped/autogen/models/result.py +1 -14
- shaped/autogen/models/result_embeddings_value.py +1 -1
- 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 +1 -1
- shaped/autogen/models/retriever1.py +1 -1
- shaped/autogen/models/rollout_config.py +1 -1
- shaped/autogen/models/rudderstack_table_config.py +1 -1
- shaped/autogen/models/sampling_strategy.py +1 -1
- shaped/autogen/models/saved_query_info_response.py +18 -4
- shaped/autogen/models/saved_query_list_response.py +1 -1
- shaped/autogen/models/saved_query_request.py +1 -1
- shaped/autogen/models/schema_config.py +1 -1
- shaped/autogen/models/score.py +1 -1
- shaped/autogen/models/score_ensemble.py +1 -14
- shaped/autogen/models/score_ensemble_policy_config.py +49 -25
- shaped/autogen/models/score_ensemble_policy_config_policies_inner.py +456 -123
- shaped/autogen/models/score_step_explanation.py +224 -0
- shaped/autogen/models/search_config.py +1 -1
- shaped/autogen/models/segment_table_config.py +1 -1
- shaped/autogen/models/sequence_length.py +1 -1
- shaped/autogen/models/server_config.py +14 -1
- shaped/autogen/models/setup_engine_response.py +1 -1
- shaped/autogen/models/shaped_internal_recsys_policies_als_model_policy_als_model_policy_config.py +9 -3
- shaped/autogen/models/shaped_internal_recsys_policies_beeformer_model_policy_beeformer_model_policy_beeformer_model_policy_config.py +9 -3
- shaped/autogen/models/shaped_internal_recsys_policies_bert_model_policy_bert_model_policy_bert_model_policy_config.py +10 -4
- shaped/autogen/models/shaped_internal_recsys_policies_chronological_model_policy_chronological_model_policy_config.py +46 -27
- shaped/autogen/models/shaped_internal_recsys_policies_elsa_model_policy_elsa_model_policy_elsa_model_policy_config.py +6 -4
- shaped/autogen/models/shaped_internal_recsys_policies_gsasrec_model_policy_gsasrec_model_policy_gsas_rec_model_policy_config.py +9 -3
- shaped/autogen/models/shaped_internal_recsys_policies_item2vec_model_policy_item2_vec_model_policy_config.py +1 -1
- shaped/autogen/models/shaped_internal_recsys_policies_item_content_similarity_model_policy_item_content_similarity_model_policy_config.py +77 -34
- shaped/autogen/models/shaped_internal_recsys_policies_lightgbm_model_policy_lightgbm_model_policy_light_gbm_model_policy_config.py +9 -3
- shaped/autogen/models/shaped_internal_recsys_policies_ngram_model_policy_ngram_model_policy_config.py +1 -1
- shaped/autogen/models/shaped_internal_recsys_policies_popular_model_policy_popular_model_policy_config.py +52 -28
- shaped/autogen/models/shaped_internal_recsys_policies_random_model_policy_random_model_policy_config.py +21 -17
- shaped/autogen/models/shaped_internal_recsys_policies_recently_popular_policy_recently_popular_policy_config.py +36 -23
- shaped/autogen/models/shaped_internal_recsys_policies_rising_popular_policy_rising_popular_policy_config.py +1 -1
- shaped/autogen/models/shaped_internal_recsys_policies_sasrec_model_policy_sasrec_model_policy_sas_rec_model_policy_config.py +9 -3
- shaped/autogen/models/shaped_internal_recsys_policies_svd_model_policy_svd_model_policy_config.py +1 -1
- shaped/autogen/models/shaped_internal_recsys_policies_two_tower_model_policy_two_tower_model_policy_two_tower_model_policy_config.py +9 -3
- shaped/autogen/models/shaped_internal_recsys_policies_user_item_content_similarity_model_policy_user_item_content_similarity_model_policy_config.py +53 -31
- shaped/autogen/models/shaped_internal_recsys_policies_widedeep_model_policy_wide_deep_model_policy_config.py +10 -4
- shaped/autogen/models/shaped_internal_recsys_policies_xgboost_model_policy_xg_boost_model_policy_config.py +12 -6
- shaped/autogen/models/shopify_table_config.py +1 -1
- shaped/autogen/models/similarity_retrieve_step.py +6 -4
- shaped/autogen/models/snowflake_table_config.py +1 -1
- shaped/autogen/models/sql_transform_type.py +1 -1
- shaped/autogen/models/sql_view_config.py +1 -1
- shaped/autogen/models/stemmer_tokenizer.py +1 -1
- shaped/autogen/models/step_explanation.py +1 -1
- shaped/autogen/models/steps_inner.py +179 -0
- shaped/autogen/models/strategy.py +1 -1
- shaped/autogen/models/table.py +1 -1
- shaped/autogen/models/table_deployment_type.py +1 -1
- shaped/autogen/models/table_insert_arguments.py +3 -3
- shaped/autogen/models/table_insert_response.py +1 -1
- shaped/autogen/models/text_encoding.py +29 -17
- shaped/autogen/models/text_search_retrieve_step.py +1 -1
- shaped/autogen/models/time_frequency.py +1 -1
- shaped/autogen/models/time_window.py +1 -1
- shaped/autogen/models/time_window_in_days.py +29 -17
- shaped/autogen/models/tokenizer.py +1 -1
- shaped/autogen/models/trained_model_encoder.py +1 -1
- shaped/autogen/models/training_compute_config.py +4 -4
- shaped/autogen/models/training_config.py +4 -4
- shaped/autogen/models/training_config_models_inner.py +325 -93
- shaped/autogen/models/training_strategy.py +1 -1
- shaped/autogen/models/transform_status.py +41 -0
- shaped/autogen/models/trending_mode.py +4 -4
- shaped/autogen/models/truncate_filter_step.py +1 -1
- shaped/autogen/models/tunable_bool.py +1 -1
- shaped/autogen/models/tunable_float.py +1 -1
- shaped/autogen/models/tunable_int.py +1 -1
- shaped/autogen/models/tunable_int_categorical.py +1 -1
- shaped/autogen/models/tunable_string.py +1 -1
- shaped/autogen/models/tuning_config.py +1 -1
- shaped/autogen/models/type.py +36 -20
- shaped/autogen/models/update_table_response.py +1 -1
- shaped/autogen/models/update_view_response.py +1 -1
- shaped/autogen/models/user_attribute_pooling_encoder.py +1 -1
- shaped/autogen/models/user_inner.py +134 -0
- shaped/autogen/models/val_split.py +1 -1
- shaped/autogen/models/validation_error.py +4 -4
- shaped/autogen/models/validation_error_loc_inner.py +28 -16
- shaped/autogen/models/value_type.py +1 -1
- shaped/autogen/models/vector_search_mode.py +6 -4
- shaped/autogen/models/view.py +4 -4
- shaped/autogen/models/view_details_ai.py +6 -6
- shaped/autogen/models/view_details_ai_schema_value.py +1 -1
- shaped/autogen/models/view_details_sql.py +6 -6
- shaped/autogen/models/view_status.py +8 -8
- shaped/autogen/models/weight_decay.py +1 -1
- shaped/autogen/models/whitespace_tokenizer.py +1 -1
- shaped/autogen/models/window_size.py +1 -1
- shaped/autogen/rest.py +9 -9
- shaped/cli/shaped_cli.py +152 -29
- shaped/client.py +50 -43
- shaped/config_builders.py +110 -100
- shaped/query_builder.py +56 -49
- {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/METADATA +2 -2
- shaped-2.0.4.dist-info/RECORD +296 -0
- {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/WHEEL +1 -1
- shaped-2.0.2.dist-info/RECORD +0 -278
- {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/entry_points.txt +0 -0
- {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/top_level.txt +0 -0
- {shaped-2.0.2.dist-info → shaped-2.0.4.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ReorderStepExplanation(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Explanation for a reorder step.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
step_name: Optional[StrictStr] = None
|
|
30
|
+
step_type: Optional[StrictStr] = Field(default='', description="Type of step. Examples: 'column_order', 'similarity', 'text_search', 'prebuilt', 'expression', 'score_ensemble', 'diversity', etc.")
|
|
31
|
+
input_count: Optional[StrictInt] = None
|
|
32
|
+
output_count: Optional[StrictInt] = None
|
|
33
|
+
filtered_count: Optional[StrictInt] = None
|
|
34
|
+
execution_time_ms: Optional[Union[StrictFloat, StrictInt]] = None
|
|
35
|
+
metadata: Optional[Dict[str, Any]] = Field(default=None, description="Additional step-specific metadata. Contains implementation details specific to the step type.")
|
|
36
|
+
reorder_type: Optional[StrictStr] = None
|
|
37
|
+
strength: Optional[Union[StrictFloat, StrictInt]] = None
|
|
38
|
+
items_reordered: Optional[StrictInt] = None
|
|
39
|
+
diversity_retriever_item_count: Optional[StrictInt] = None
|
|
40
|
+
diversity_attributes: Optional[List[StrictStr]] = None
|
|
41
|
+
lookback_window: Optional[StrictInt] = None
|
|
42
|
+
lookforward_window: Optional[StrictInt] = None
|
|
43
|
+
boost_retriever_item_count: Optional[StrictInt] = None
|
|
44
|
+
boost_filter: Optional[StrictStr] = None
|
|
45
|
+
items_boosted: Optional[StrictInt] = None
|
|
46
|
+
additional_properties: Dict[str, Any] = {}
|
|
47
|
+
__properties: ClassVar[List[str]] = ["step_name", "step_type", "input_count", "output_count", "filtered_count", "execution_time_ms", "metadata", "reorder_type", "strength", "items_reordered", "diversity_retriever_item_count", "diversity_attributes", "lookback_window", "lookforward_window", "boost_retriever_item_count", "boost_filter", "items_boosted"]
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
populate_by_name=True,
|
|
51
|
+
validate_assignment=True,
|
|
52
|
+
protected_namespaces=(),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def to_str(self) -> str:
|
|
57
|
+
"""Returns the string representation of the model using alias"""
|
|
58
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
59
|
+
|
|
60
|
+
def to_json(self) -> str:
|
|
61
|
+
"""Returns the JSON representation of the model using alias"""
|
|
62
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
63
|
+
return json.dumps(self.to_dict())
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
67
|
+
"""Create an instance of ReorderStepExplanation from a JSON string"""
|
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
|
69
|
+
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
71
|
+
"""Return the dictionary representation of the model using alias.
|
|
72
|
+
|
|
73
|
+
This has the following differences from calling pydantic's
|
|
74
|
+
`self.model_dump(by_alias=True)`:
|
|
75
|
+
|
|
76
|
+
* `None` is only added to the output dict for nullable fields that
|
|
77
|
+
were set at model initialization. Other fields with value `None`
|
|
78
|
+
are ignored.
|
|
79
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
80
|
+
"""
|
|
81
|
+
excluded_fields: Set[str] = set([
|
|
82
|
+
"additional_properties",
|
|
83
|
+
])
|
|
84
|
+
|
|
85
|
+
_dict = self.model_dump(
|
|
86
|
+
by_alias=True,
|
|
87
|
+
exclude=excluded_fields,
|
|
88
|
+
exclude_none=True,
|
|
89
|
+
)
|
|
90
|
+
# puts key-value pairs in additional_properties in the top level
|
|
91
|
+
if self.additional_properties is not None:
|
|
92
|
+
for _key, _value in self.additional_properties.items():
|
|
93
|
+
_dict[_key] = _value
|
|
94
|
+
|
|
95
|
+
# set to None if step_name (nullable) is None
|
|
96
|
+
# and model_fields_set contains the field
|
|
97
|
+
if self.step_name is None and "step_name" in self.model_fields_set:
|
|
98
|
+
_dict['step_name'] = None
|
|
99
|
+
|
|
100
|
+
# set to None if input_count (nullable) is None
|
|
101
|
+
# and model_fields_set contains the field
|
|
102
|
+
if self.input_count is None and "input_count" in self.model_fields_set:
|
|
103
|
+
_dict['input_count'] = None
|
|
104
|
+
|
|
105
|
+
# set to None if output_count (nullable) is None
|
|
106
|
+
# and model_fields_set contains the field
|
|
107
|
+
if self.output_count is None and "output_count" in self.model_fields_set:
|
|
108
|
+
_dict['output_count'] = None
|
|
109
|
+
|
|
110
|
+
# set to None if filtered_count (nullable) is None
|
|
111
|
+
# and model_fields_set contains the field
|
|
112
|
+
if self.filtered_count is None and "filtered_count" in self.model_fields_set:
|
|
113
|
+
_dict['filtered_count'] = None
|
|
114
|
+
|
|
115
|
+
# set to None if execution_time_ms (nullable) is None
|
|
116
|
+
# and model_fields_set contains the field
|
|
117
|
+
if self.execution_time_ms is None and "execution_time_ms" in self.model_fields_set:
|
|
118
|
+
_dict['execution_time_ms'] = None
|
|
119
|
+
|
|
120
|
+
# set to None if reorder_type (nullable) is None
|
|
121
|
+
# and model_fields_set contains the field
|
|
122
|
+
if self.reorder_type is None and "reorder_type" in self.model_fields_set:
|
|
123
|
+
_dict['reorder_type'] = None
|
|
124
|
+
|
|
125
|
+
# set to None if strength (nullable) is None
|
|
126
|
+
# and model_fields_set contains the field
|
|
127
|
+
if self.strength is None and "strength" in self.model_fields_set:
|
|
128
|
+
_dict['strength'] = None
|
|
129
|
+
|
|
130
|
+
# set to None if items_reordered (nullable) is None
|
|
131
|
+
# and model_fields_set contains the field
|
|
132
|
+
if self.items_reordered is None and "items_reordered" in self.model_fields_set:
|
|
133
|
+
_dict['items_reordered'] = None
|
|
134
|
+
|
|
135
|
+
# set to None if diversity_retriever_item_count (nullable) is None
|
|
136
|
+
# and model_fields_set contains the field
|
|
137
|
+
if self.diversity_retriever_item_count is None and "diversity_retriever_item_count" in self.model_fields_set:
|
|
138
|
+
_dict['diversity_retriever_item_count'] = None
|
|
139
|
+
|
|
140
|
+
# set to None if diversity_attributes (nullable) is None
|
|
141
|
+
# and model_fields_set contains the field
|
|
142
|
+
if self.diversity_attributes is None and "diversity_attributes" in self.model_fields_set:
|
|
143
|
+
_dict['diversity_attributes'] = None
|
|
144
|
+
|
|
145
|
+
# set to None if lookback_window (nullable) is None
|
|
146
|
+
# and model_fields_set contains the field
|
|
147
|
+
if self.lookback_window is None and "lookback_window" in self.model_fields_set:
|
|
148
|
+
_dict['lookback_window'] = None
|
|
149
|
+
|
|
150
|
+
# set to None if lookforward_window (nullable) is None
|
|
151
|
+
# and model_fields_set contains the field
|
|
152
|
+
if self.lookforward_window is None and "lookforward_window" in self.model_fields_set:
|
|
153
|
+
_dict['lookforward_window'] = None
|
|
154
|
+
|
|
155
|
+
# set to None if boost_retriever_item_count (nullable) is None
|
|
156
|
+
# and model_fields_set contains the field
|
|
157
|
+
if self.boost_retriever_item_count is None and "boost_retriever_item_count" in self.model_fields_set:
|
|
158
|
+
_dict['boost_retriever_item_count'] = None
|
|
159
|
+
|
|
160
|
+
# set to None if boost_filter (nullable) is None
|
|
161
|
+
# and model_fields_set contains the field
|
|
162
|
+
if self.boost_filter is None and "boost_filter" in self.model_fields_set:
|
|
163
|
+
_dict['boost_filter'] = None
|
|
164
|
+
|
|
165
|
+
# set to None if items_boosted (nullable) is None
|
|
166
|
+
# and model_fields_set contains the field
|
|
167
|
+
if self.items_boosted is None and "items_boosted" in self.model_fields_set:
|
|
168
|
+
_dict['items_boosted'] = None
|
|
169
|
+
|
|
170
|
+
return _dict
|
|
171
|
+
|
|
172
|
+
@classmethod
|
|
173
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
174
|
+
"""Create an instance of ReorderStepExplanation from a dict"""
|
|
175
|
+
if obj is None:
|
|
176
|
+
return None
|
|
177
|
+
|
|
178
|
+
if not isinstance(obj, dict):
|
|
179
|
+
return cls.model_validate(obj)
|
|
180
|
+
|
|
181
|
+
_obj = cls.model_validate({
|
|
182
|
+
"step_name": obj.get("step_name"),
|
|
183
|
+
"step_type": obj.get("step_type") if obj.get("step_type") is not None else '',
|
|
184
|
+
"input_count": obj.get("input_count"),
|
|
185
|
+
"output_count": obj.get("output_count"),
|
|
186
|
+
"filtered_count": obj.get("filtered_count"),
|
|
187
|
+
"execution_time_ms": obj.get("execution_time_ms"),
|
|
188
|
+
"metadata": obj.get("metadata"),
|
|
189
|
+
"reorder_type": obj.get("reorder_type"),
|
|
190
|
+
"strength": obj.get("strength"),
|
|
191
|
+
"items_reordered": obj.get("items_reordered"),
|
|
192
|
+
"diversity_retriever_item_count": obj.get("diversity_retriever_item_count"),
|
|
193
|
+
"diversity_attributes": obj.get("diversity_attributes"),
|
|
194
|
+
"lookback_window": obj.get("lookback_window"),
|
|
195
|
+
"lookforward_window": obj.get("lookforward_window"),
|
|
196
|
+
"boost_retriever_item_count": obj.get("boost_retriever_item_count"),
|
|
197
|
+
"boost_filter": obj.get("boost_filter"),
|
|
198
|
+
"items_boosted": obj.get("items_boosted")
|
|
199
|
+
})
|
|
200
|
+
# store additional fields in additional_properties
|
|
201
|
+
for _key in obj.keys():
|
|
202
|
+
if _key not in cls.__properties:
|
|
203
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
204
|
+
|
|
205
|
+
return _obj
|
|
206
|
+
|
|
207
|
+
|
shaped/autogen/models/request.py
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document: 2.0.
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
10
|
|
|
11
11
|
Do not edit the class manually.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document: 2.0.
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
10
|
|
|
11
11
|
Do not edit the class manually.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document: 2.0.
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
10
|
|
|
11
11
|
Do not edit the class manually.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ResourceConfig(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Configuration for the hardware resources for the query server deployment.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
min_cpu: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.001, description="Minimum CPU request for the inference deployment in CPU cores. This specifies the minimum number of CPU cores allocated to the query server deployment, but may be autoscaled up to adjust for traffic.")
|
|
30
|
+
additional_properties: Dict[str, Any] = {}
|
|
31
|
+
__properties: ClassVar[List[str]] = ["min_cpu"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of ResourceConfig from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
"additional_properties",
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# puts key-value pairs in additional_properties in the top level
|
|
75
|
+
if self.additional_properties is not None:
|
|
76
|
+
for _key, _value in self.additional_properties.items():
|
|
77
|
+
_dict[_key] = _value
|
|
78
|
+
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of ResourceConfig from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"min_cpu": obj.get("min_cpu") if obj.get("min_cpu") is not None else 0.001
|
|
92
|
+
})
|
|
93
|
+
# store additional fields in additional_properties
|
|
94
|
+
for _key in obj.keys():
|
|
95
|
+
if _key not in cls.__properties:
|
|
96
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
97
|
+
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document: 2.0.
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
10
|
|
|
11
11
|
Do not edit the class manually.
|
shaped/autogen/models/result.py
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document: 2.0.
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
10
|
|
|
11
11
|
Do not edit the class manually.
|
|
@@ -33,7 +33,6 @@ class Result(BaseModel):
|
|
|
33
33
|
metadata: Optional[Dict[str, Any]] = None
|
|
34
34
|
embeddings: Optional[Dict[str, Optional[ResultEmbeddingsValue]]] = None
|
|
35
35
|
journey: Optional[Journey] = None
|
|
36
|
-
additional_properties: Dict[str, Any] = {}
|
|
37
36
|
__properties: ClassVar[List[str]] = ["id", "score", "metadata", "embeddings", "journey"]
|
|
38
37
|
|
|
39
38
|
model_config = ConfigDict(
|
|
@@ -66,10 +65,8 @@ class Result(BaseModel):
|
|
|
66
65
|
* `None` is only added to the output dict for nullable fields that
|
|
67
66
|
were set at model initialization. Other fields with value `None`
|
|
68
67
|
are ignored.
|
|
69
|
-
* Fields in `self.additional_properties` are added to the output dict.
|
|
70
68
|
"""
|
|
71
69
|
excluded_fields: Set[str] = set([
|
|
72
|
-
"additional_properties",
|
|
73
70
|
])
|
|
74
71
|
|
|
75
72
|
_dict = self.model_dump(
|
|
@@ -87,11 +84,6 @@ class Result(BaseModel):
|
|
|
87
84
|
# override the default output from pydantic by calling `to_dict()` of journey
|
|
88
85
|
if self.journey:
|
|
89
86
|
_dict['journey'] = self.journey.to_dict()
|
|
90
|
-
# puts key-value pairs in additional_properties in the top level
|
|
91
|
-
if self.additional_properties is not None:
|
|
92
|
-
for _key, _value in self.additional_properties.items():
|
|
93
|
-
_dict[_key] = _value
|
|
94
|
-
|
|
95
87
|
# set to None if score (nullable) is None
|
|
96
88
|
# and model_fields_set contains the field
|
|
97
89
|
if self.score is None and "score" in self.model_fields_set:
|
|
@@ -135,11 +127,6 @@ class Result(BaseModel):
|
|
|
135
127
|
else None,
|
|
136
128
|
"journey": Journey.from_dict(obj["journey"]) if obj.get("journey") is not None else None
|
|
137
129
|
})
|
|
138
|
-
# store additional fields in additional_properties
|
|
139
|
-
for _key in obj.keys():
|
|
140
|
-
if _key not in cls.__properties:
|
|
141
|
-
_obj.additional_properties[_key] = obj.get(_key)
|
|
142
|
-
|
|
143
130
|
return _obj
|
|
144
131
|
|
|
145
132
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document: 2.0.
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
10
|
|
|
11
11
|
Do not edit the class manually.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Shaped API
|
|
5
|
+
|
|
6
|
+
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
from inspect import getfullargspec
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
|
|
21
|
+
from typing import Optional, Union
|
|
22
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
23
|
+
from typing_extensions import Literal, Self
|
|
24
|
+
from pydantic import Field
|
|
25
|
+
|
|
26
|
+
RETRIEVALSCORESVALUE_ANY_OF_SCHEMAS = ["float"]
|
|
27
|
+
|
|
28
|
+
class RetrievalScoresValue(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
RetrievalScoresValue
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
# data type: float
|
|
34
|
+
anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
|
|
35
|
+
if TYPE_CHECKING:
|
|
36
|
+
actual_instance: Optional[Union[float]] = None
|
|
37
|
+
else:
|
|
38
|
+
actual_instance: Any = None
|
|
39
|
+
any_of_schemas: Set[str] = { "float" }
|
|
40
|
+
|
|
41
|
+
model_config = {
|
|
42
|
+
"validate_assignment": True,
|
|
43
|
+
"protected_namespaces": (),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
47
|
+
if args:
|
|
48
|
+
if len(args) > 1:
|
|
49
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
50
|
+
if kwargs:
|
|
51
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
52
|
+
super().__init__(actual_instance=args[0])
|
|
53
|
+
else:
|
|
54
|
+
super().__init__(**kwargs)
|
|
55
|
+
|
|
56
|
+
@field_validator('actual_instance')
|
|
57
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
58
|
+
if v is None:
|
|
59
|
+
return v
|
|
60
|
+
|
|
61
|
+
instance = RetrievalScoresValue.model_construct()
|
|
62
|
+
error_messages = []
|
|
63
|
+
# validate data type: float
|
|
64
|
+
try:
|
|
65
|
+
instance.anyof_schema_1_validator = v
|
|
66
|
+
return v
|
|
67
|
+
except (ValidationError, ValueError) as e:
|
|
68
|
+
error_messages.append(str(e))
|
|
69
|
+
if error_messages:
|
|
70
|
+
# no match
|
|
71
|
+
raise ValueError("No match found when setting the actual_instance in RetrievalScoresValue with anyOf schemas: float. Details: " + ", ".join(error_messages))
|
|
72
|
+
else:
|
|
73
|
+
return v
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
77
|
+
return cls.from_json(json.dumps(obj))
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_json(cls, json_str: str) -> Self:
|
|
81
|
+
"""Returns the object represented by the json string"""
|
|
82
|
+
instance = cls.model_construct()
|
|
83
|
+
if json_str is None:
|
|
84
|
+
return instance
|
|
85
|
+
|
|
86
|
+
error_messages = []
|
|
87
|
+
# deserialize data into float
|
|
88
|
+
try:
|
|
89
|
+
# validation
|
|
90
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
91
|
+
# assign value to actual_instance
|
|
92
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
|
93
|
+
return instance
|
|
94
|
+
except (ValidationError, ValueError) as e:
|
|
95
|
+
error_messages.append(str(e))
|
|
96
|
+
|
|
97
|
+
if error_messages:
|
|
98
|
+
# no match
|
|
99
|
+
raise ValueError("No match found when deserializing the JSON string into RetrievalScoresValue with anyOf schemas: float. Details: " + ", ".join(error_messages))
|
|
100
|
+
else:
|
|
101
|
+
return instance
|
|
102
|
+
|
|
103
|
+
def to_json(self) -> str:
|
|
104
|
+
"""Returns the JSON representation of the actual instance"""
|
|
105
|
+
if self.actual_instance is None:
|
|
106
|
+
return "null"
|
|
107
|
+
|
|
108
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
109
|
+
return self.actual_instance.to_json()
|
|
110
|
+
else:
|
|
111
|
+
return json.dumps(self.actual_instance)
|
|
112
|
+
|
|
113
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], float]]:
|
|
114
|
+
"""Returns the dict representation of the actual instance"""
|
|
115
|
+
if self.actual_instance is None:
|
|
116
|
+
return None
|
|
117
|
+
|
|
118
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
119
|
+
return self.actual_instance.to_dict()
|
|
120
|
+
else:
|
|
121
|
+
return self.actual_instance
|
|
122
|
+
|
|
123
|
+
def to_str(self) -> str:
|
|
124
|
+
"""Returns the string representation of the actual instance"""
|
|
125
|
+
return pprint.pformat(self.model_dump())
|
|
126
|
+
|
|
127
|
+
|