shaped 2.0.4__py3-none-any.whl → 2.0.8__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/autogen/__init__.py +9 -6
- shaped/autogen/api/engine_api.py +5 -6
- shaped/autogen/api/query_api.py +5 -6
- shaped/autogen/api/table_api.py +5 -6
- shaped/autogen/api/view_api.py +5 -6
- shaped/autogen/api_client.py +5 -6
- shaped/autogen/configuration.py +6 -7
- shaped/autogen/exceptions.py +5 -6
- shaped/autogen/models/__init__.py +7 -6
- shaped/autogen/models/ai_enrichment_view_config.py +5 -6
- shaped/autogen/models/algorithm.py +5 -6
- shaped/autogen/models/amplitude_table_config.py +5 -6
- shaped/autogen/models/attn_dropout_prob.py +5 -6
- shaped/autogen/models/attribute_journey.py +5 -6
- shaped/autogen/models/attribute_value.py +5 -6
- shaped/autogen/models/autoscaling_config.py +5 -6
- shaped/autogen/models/aws_pinpoint_table_config.py +5 -6
- shaped/autogen/models/batch_size.py +5 -6
- shaped/autogen/models/batch_size1.py +5 -6
- shaped/autogen/models/batch_size2.py +5 -6
- shaped/autogen/models/big_query_table_config.py +5 -6
- shaped/autogen/models/bm25.py +5 -6
- shaped/autogen/models/boosted_reorder_step.py +5 -6
- shaped/autogen/models/canary_rollout.py +5 -6
- shaped/autogen/models/candidate_attributes_retrieve_step.py +5 -6
- shaped/autogen/models/candidate_ids_retrieve_step.py +5 -6
- shaped/autogen/models/candidate_retrieval_strategy.py +5 -6
- shaped/autogen/models/clickhouse_table_config.py +5 -6
- shaped/autogen/models/column_index_config.py +89 -0
- shaped/autogen/models/column_order_retrieve_step.py +5 -6
- shaped/autogen/models/column_ordering.py +5 -6
- shaped/autogen/models/create_table_response.py +5 -6
- shaped/autogen/models/create_view_response.py +5 -6
- shaped/autogen/models/custom_table_config.py +5 -6
- shaped/autogen/models/data_compute_config.py +5 -6
- shaped/autogen/models/data_config.py +5 -6
- shaped/autogen/models/data_config_interaction_table.py +5 -6
- shaped/autogen/models/data_split_config.py +5 -6
- shaped/autogen/models/data_split_strategy.py +5 -6
- shaped/autogen/models/data_tier.py +5 -6
- shaped/autogen/models/default.py +5 -6
- shaped/autogen/models/delete_engine_response.py +5 -6
- shaped/autogen/models/delete_table_response.py +5 -6
- shaped/autogen/models/delete_view_response.py +5 -6
- shaped/autogen/models/deployment_config.py +5 -6
- shaped/autogen/models/diversity_reorder_step.py +5 -6
- shaped/autogen/models/dropout_rate.py +5 -6
- shaped/autogen/models/dynamo_db_table_config.py +5 -6
- shaped/autogen/models/dynamo_db_table_config_scan_kwargs_value.py +5 -6
- shaped/autogen/models/embedder_batch_size.py +5 -6
- shaped/autogen/models/embedding_config.py +5 -6
- shaped/autogen/models/embedding_dim.py +5 -6
- shaped/autogen/models/embedding_dims.py +5 -6
- shaped/autogen/models/embedding_size.py +5 -6
- shaped/autogen/models/encoder.py +5 -6
- shaped/autogen/models/engine.py +5 -6
- shaped/autogen/models/engine_config_v2.py +5 -6
- shaped/autogen/models/engine_details_response.py +5 -6
- shaped/autogen/models/engine_schema.py +5 -6
- shaped/autogen/models/entity_config.py +5 -6
- shaped/autogen/models/entity_journey.py +5 -6
- shaped/autogen/models/entity_type.py +5 -6
- shaped/autogen/models/evaluation_config.py +8 -7
- shaped/autogen/models/exploration_reorder_step.py +5 -6
- shaped/autogen/models/expression_filter_step.py +5 -6
- shaped/autogen/models/factors.py +5 -6
- shaped/autogen/models/factors1.py +5 -6
- shaped/autogen/models/feature.py +5 -6
- shaped/autogen/models/feature_type.py +5 -6
- shaped/autogen/models/file_table_config.py +5 -6
- shaped/autogen/models/filter_config.py +5 -6
- shaped/autogen/models/filter_index_type.py +5 -6
- shaped/autogen/models/filter_retrieve_step.py +5 -6
- shaped/autogen/models/filter_step_explanation.py +5 -6
- shaped/autogen/models/filter_table.py +5 -6
- shaped/autogen/models/filter_type.py +5 -6
- shaped/autogen/models/global_filter.py +5 -6
- shaped/autogen/models/hidden_dropout_prob.py +5 -6
- shaped/autogen/models/hidden_size.py +5 -6
- shaped/autogen/models/hidden_size1.py +5 -6
- shaped/autogen/models/http_problem_response.py +5 -6
- shaped/autogen/models/http_validation_error.py +5 -6
- shaped/autogen/models/hugging_face_encoder.py +5 -6
- shaped/autogen/models/iceberg_table_config.py +5 -6
- shaped/autogen/models/index_config.py +36 -8
- shaped/autogen/models/index_type.py +38 -0
- shaped/autogen/models/inner_entity_id.py +5 -6
- shaped/autogen/models/inner_size.py +5 -6
- shaped/autogen/models/inner_size1.py +5 -6
- shaped/autogen/models/inner_uid.py +5 -6
- shaped/autogen/models/interaction_config.py +5 -6
- shaped/autogen/models/interaction_pooling_encoder.py +5 -6
- shaped/autogen/models/interaction_round_robin_encoder.py +5 -6
- shaped/autogen/models/item_attribute_pooling_encoder.py +5 -6
- shaped/autogen/models/journey.py +5 -6
- shaped/autogen/models/kafka_table_config.py +5 -6
- shaped/autogen/models/kinesis_table_config.py +5 -6
- shaped/autogen/models/kinesis_table_config_column_schema_value.py +5 -6
- shaped/autogen/models/label.py +5 -6
- shaped/autogen/models/label_type.py +5 -6
- shaped/autogen/models/laplace_smoothing.py +5 -6
- shaped/autogen/models/latency_scaling_policy.py +5 -6
- shaped/autogen/models/learning_rate.py +5 -6
- shaped/autogen/models/learning_rate1.py +5 -6
- shaped/autogen/models/learning_rate2.py +5 -6
- shaped/autogen/models/learning_rate3.py +5 -6
- shaped/autogen/models/lexical_search_mode.py +5 -6
- shaped/autogen/models/list_engines_response.py +5 -6
- shaped/autogen/models/list_tables_response.py +5 -6
- shaped/autogen/models/list_views_response.py +5 -6
- shaped/autogen/models/location_inner.py +5 -6
- shaped/autogen/models/loss_types.py +5 -6
- shaped/autogen/models/lr.py +5 -6
- shaped/autogen/models/lr1.py +5 -6
- shaped/autogen/models/lr2.py +5 -6
- shaped/autogen/models/max_depth.py +5 -6
- shaped/autogen/models/max_leaves.py +5 -6
- shaped/autogen/models/max_seq_length.py +5 -6
- shaped/autogen/models/max_seq_length1.py +5 -6
- shaped/autogen/models/max_seq_length2.py +5 -6
- shaped/autogen/models/mode.py +5 -6
- shaped/autogen/models/mode1.py +5 -6
- shaped/autogen/models/models_inner.py +5 -6
- shaped/autogen/models/mongo_db_table_config.py +5 -6
- shaped/autogen/models/mssql_table_config.py +5 -6
- shaped/autogen/models/my_sql_table_config.py +5 -6
- shaped/autogen/models/n_epochs.py +5 -6
- shaped/autogen/models/n_epochs1.py +5 -6
- shaped/autogen/models/n_epochs2.py +5 -6
- shaped/autogen/models/n_estimators.py +5 -6
- shaped/autogen/models/n_heads.py +5 -6
- shaped/autogen/models/n_layers.py +5 -6
- shaped/autogen/models/neg_per_positive.py +5 -6
- shaped/autogen/models/negative_samples_count.py +5 -6
- shaped/autogen/models/ngram_tokenizer.py +5 -6
- shaped/autogen/models/no_op_config.py +5 -6
- shaped/autogen/models/num_blocks.py +5 -6
- shaped/autogen/models/num_heads.py +5 -6
- shaped/autogen/models/num_leaves.py +5 -6
- shaped/autogen/models/objective.py +5 -6
- shaped/autogen/models/objective1.py +5 -6
- shaped/autogen/models/online_store_config.py +5 -6
- shaped/autogen/models/pagination_config.py +5 -6
- shaped/autogen/models/parameter_definition.py +5 -6
- shaped/autogen/models/parameters_value.py +5 -6
- shaped/autogen/models/passthrough_score.py +5 -6
- shaped/autogen/models/personal_filter.py +5 -6
- shaped/autogen/models/pipeline_stage_explanation.py +5 -6
- shaped/autogen/models/policy.py +5 -6
- shaped/autogen/models/pooling_function.py +5 -6
- shaped/autogen/models/postgres_table_config.py +5 -6
- shaped/autogen/models/posthog_table_config.py +5 -6
- shaped/autogen/models/prebuilt_filter_step.py +5 -6
- shaped/autogen/models/precomputed_item_embedding.py +5 -6
- shaped/autogen/models/precomputed_user_embedding.py +5 -6
- shaped/autogen/models/query.py +5 -6
- shaped/autogen/models/query1.py +5 -6
- shaped/autogen/models/query_config.py +5 -6
- shaped/autogen/models/query_definition.py +5 -6
- shaped/autogen/models/query_encoder.py +5 -6
- shaped/autogen/models/query_explanation.py +5 -6
- shaped/autogen/models/query_request.py +5 -6
- shaped/autogen/models/query_result.py +5 -6
- shaped/autogen/models/query_table_config.py +5 -6
- shaped/autogen/models/rank_item_attribute_values_query_config.py +5 -6
- shaped/autogen/models/rank_query_config.py +5 -6
- shaped/autogen/models/rank_query_config_filter_inner.py +5 -6
- shaped/autogen/models/recreate_rollout.py +5 -6
- shaped/autogen/models/redshift_table_config.py +5 -6
- shaped/autogen/models/reference_table_config.py +5 -6
- shaped/autogen/models/regularization.py +5 -6
- shaped/autogen/models/reorder_inner.py +5 -6
- shaped/autogen/models/reorder_step_explanation.py +5 -6
- shaped/autogen/models/request.py +5 -6
- shaped/autogen/models/request1.py +5 -6
- shaped/autogen/models/requests_per_second_scaling_policy.py +5 -6
- shaped/autogen/models/resource_config.py +5 -6
- shaped/autogen/models/response_get_view_details_views_view_name_get.py +5 -6
- shaped/autogen/models/result.py +5 -6
- shaped/autogen/models/result_embeddings_value.py +5 -6
- shaped/autogen/models/retrieval_scores_value.py +5 -6
- shaped/autogen/models/retrieve_inner.py +5 -6
- shaped/autogen/models/retrieve_step_explanation.py +5 -6
- shaped/autogen/models/retriever.py +5 -6
- shaped/autogen/models/retriever1.py +5 -6
- shaped/autogen/models/rollout_config.py +5 -6
- shaped/autogen/models/rudderstack_table_config.py +5 -6
- shaped/autogen/models/sampling_strategy.py +5 -6
- shaped/autogen/models/saved_query_info_response.py +5 -6
- shaped/autogen/models/saved_query_list_response.py +5 -6
- shaped/autogen/models/saved_query_request.py +5 -6
- shaped/autogen/models/schema_config.py +5 -6
- shaped/autogen/models/score.py +5 -6
- shaped/autogen/models/score_ensemble.py +5 -6
- shaped/autogen/models/score_step_explanation.py +5 -6
- shaped/autogen/models/search_config.py +5 -6
- shaped/autogen/models/segment_table_config.py +5 -6
- shaped/autogen/models/sequence_length.py +5 -6
- shaped/autogen/models/server_config.py +5 -6
- shaped/autogen/models/setup_engine_response.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_als_model_policy_als_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_beeformer_model_policy_beeformer_model_policy_beeformer_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_bert_model_policy_bert_model_policy_bert_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_elsa_model_policy_elsa_model_policy_elsa_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_gsasrec_model_policy_gsasrec_model_policy_gsas_rec_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_item2vec_model_policy_item2_vec_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_lightgbm_model_policy_lightgbm_model_policy_light_gbm_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_ngram_model_policy_ngram_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_rising_popular_policy_rising_popular_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_sasrec_model_policy_sasrec_model_policy_sas_rec_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_svd_model_policy_svd_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_two_tower_model_policy_two_tower_model_policy_two_tower_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_widedeep_model_policy_wide_deep_model_policy_config.py +5 -6
- shaped/autogen/models/shaped_internal_recsys_policies_xgboost_model_policy_xg_boost_model_policy_config.py +5 -6
- shaped/autogen/models/shopify_table_config.py +5 -6
- shaped/autogen/models/similarity_retrieve_step.py +5 -6
- shaped/autogen/models/snowflake_table_config.py +5 -6
- shaped/autogen/models/sql_transform_type.py +5 -6
- shaped/autogen/models/sql_view_config.py +5 -6
- shaped/autogen/models/stemmer_tokenizer.py +5 -6
- shaped/autogen/models/step_explanation.py +5 -6
- shaped/autogen/models/steps_inner.py +5 -6
- shaped/autogen/models/strategy.py +5 -6
- shaped/autogen/models/table.py +5 -6
- shaped/autogen/models/table_deployment_type.py +5 -6
- shaped/autogen/models/table_insert_arguments.py +5 -6
- shaped/autogen/models/table_insert_response.py +5 -6
- shaped/autogen/models/text_search_retrieve_step.py +5 -6
- shaped/autogen/models/time_frequency.py +5 -6
- shaped/autogen/models/time_window.py +5 -6
- shaped/autogen/models/tokenizer.py +5 -6
- shaped/autogen/models/trained_model_encoder.py +5 -6
- shaped/autogen/models/training_compute_config.py +7 -10
- shaped/autogen/models/training_config.py +5 -6
- shaped/autogen/models/training_strategy.py +5 -6
- shaped/autogen/models/transform_status.py +5 -6
- shaped/autogen/models/truncate_filter_step.py +5 -6
- shaped/autogen/models/tunable_bool.py +5 -6
- shaped/autogen/models/tunable_float.py +5 -6
- shaped/autogen/models/tunable_int.py +5 -6
- shaped/autogen/models/tunable_int_categorical.py +5 -6
- shaped/autogen/models/tunable_string.py +5 -6
- shaped/autogen/models/tuning_config.py +5 -6
- shaped/autogen/models/update_table_response.py +5 -6
- shaped/autogen/models/update_view_response.py +5 -6
- shaped/autogen/models/user_attribute_pooling_encoder.py +5 -6
- shaped/autogen/models/user_inner.py +5 -6
- shaped/autogen/models/val_split.py +5 -6
- shaped/autogen/models/validation_error.py +5 -6
- shaped/autogen/models/value_type.py +5 -6
- shaped/autogen/models/vector_search_mode.py +5 -6
- shaped/autogen/models/view.py +5 -6
- shaped/autogen/models/view_details_ai.py +5 -6
- shaped/autogen/models/view_details_ai_schema_value.py +5 -6
- shaped/autogen/models/view_details_sql.py +5 -6
- shaped/autogen/models/weight_decay.py +5 -6
- shaped/autogen/models/whitespace_tokenizer.py +5 -6
- shaped/autogen/models/window_size.py +5 -6
- shaped/autogen/rest.py +5 -6
- {shaped-2.0.4.dist-info → shaped-2.0.8.dist-info}/METADATA +1 -1
- shaped-2.0.8.dist-info/RECORD +273 -0
- shaped/autogen/models/ascending.py +0 -148
- shaped/autogen/models/distance_function.py +0 -38
- shaped/autogen/models/encoding_pooling_strategy.py +0 -38
- shaped/autogen/models/engine_schema_user_inner.py +0 -146
- shaped/autogen/models/filter_dataset.py +0 -164
- shaped/autogen/models/mode2.py +0 -150
- shaped/autogen/models/pool_fn.py +0 -152
- shaped/autogen/models/query_any_of.py +0 -172
- shaped/autogen/models/rank_query_config_reorder_inner.py +0 -186
- shaped/autogen/models/rank_query_config_retrieve_inner.py +0 -265
- shaped/autogen/models/score_ensemble_policy_config.py +0 -165
- shaped/autogen/models/score_ensemble_policy_config_policies_inner.py +0 -755
- shaped/autogen/models/shaped_internal_recsys_policies_chronological_model_policy_chronological_model_policy_config.py +0 -156
- shaped/autogen/models/shaped_internal_recsys_policies_item_content_similarity_model_policy_item_content_similarity_model_policy_config.py +0 -195
- shaped/autogen/models/shaped_internal_recsys_policies_popular_model_policy_popular_model_policy_config.py +0 -161
- shaped/autogen/models/shaped_internal_recsys_policies_random_model_policy_random_model_policy_config.py +0 -108
- shaped/autogen/models/shaped_internal_recsys_policies_recently_popular_policy_recently_popular_policy_config.py +0 -143
- shaped/autogen/models/shaped_internal_recsys_policies_user_item_content_similarity_model_policy_user_item_content_similarity_model_policy_config.py +0 -153
- shaped/autogen/models/text_encoding.py +0 -148
- shaped/autogen/models/time_window_in_days.py +0 -154
- shaped/autogen/models/training_config_models_inner.py +0 -540
- shaped/autogen/models/trending_mode.py +0 -37
- shaped/autogen/models/type.py +0 -150
- shaped/autogen/models/validation_error_loc_inner.py +0 -150
- shaped/autogen/models/view_status.py +0 -41
- shaped-2.0.4.dist-info/RECORD +0 -296
- {shaped-2.0.4.dist-info → shaped-2.0.8.dist-info}/WHEEL +0 -0
- {shaped-2.0.4.dist-info → shaped-2.0.8.dist-info}/entry_points.txt +0 -0
- {shaped-2.0.4.dist-info → shaped-2.0.8.dist-info}/top_level.txt +0 -0
- {shaped-2.0.4.dist-info → shaped-2.0.8.dist-info}/zip-safe +0 -0
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Shaped API
|
|
5
|
-
|
|
6
|
-
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 2.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
23
|
-
from shaped.autogen.models.mode1 import Mode1
|
|
24
|
-
from typing_extensions import Self
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class ShapedInternalRecsysPoliciesRecentlyPopularPolicyRecentlyPopularPolicyConfig(
|
|
28
|
-
BaseModel
|
|
29
|
-
):
|
|
30
|
-
"""
|
|
31
|
-
ShapedInternalRecsysPoliciesRecentlyPopularPolicyRecentlyPopularPolicyConfig
|
|
32
|
-
""" # noqa: E501
|
|
33
|
-
|
|
34
|
-
policy_type: Optional[StrictStr] = "recently-popular"
|
|
35
|
-
name: Optional[StrictStr] = None
|
|
36
|
-
event_values: Optional[List[StrictStr]] = None
|
|
37
|
-
mode: Optional[Mode1] = None
|
|
38
|
-
additional_properties: Dict[str, Any] = {}
|
|
39
|
-
__properties: ClassVar[List[str]] = ["policy_type", "name", "event_values", "mode"]
|
|
40
|
-
|
|
41
|
-
@field_validator("policy_type")
|
|
42
|
-
def policy_type_validate_enum(cls, value):
|
|
43
|
-
"""Validates the enum"""
|
|
44
|
-
if value is None:
|
|
45
|
-
return value
|
|
46
|
-
|
|
47
|
-
if value not in set(["recently-popular"]):
|
|
48
|
-
raise ValueError("must be one of enum values ('recently-popular')")
|
|
49
|
-
return value
|
|
50
|
-
|
|
51
|
-
model_config = ConfigDict(
|
|
52
|
-
populate_by_name=True,
|
|
53
|
-
validate_assignment=True,
|
|
54
|
-
protected_namespaces=(),
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
def to_str(self) -> str:
|
|
58
|
-
"""Returns the string representation of the model using alias"""
|
|
59
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
60
|
-
|
|
61
|
-
def to_json(self) -> str:
|
|
62
|
-
"""Returns the JSON representation of the model using alias"""
|
|
63
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
64
|
-
return json.dumps(self.to_dict())
|
|
65
|
-
|
|
66
|
-
@classmethod
|
|
67
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
68
|
-
"""Create an instance of ShapedInternalRecsysPoliciesRecentlyPopularPolicyRecentlyPopularPolicyConfig from a JSON string"""
|
|
69
|
-
return cls.from_dict(json.loads(json_str))
|
|
70
|
-
|
|
71
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
72
|
-
"""Return the dictionary representation of the model using alias.
|
|
73
|
-
|
|
74
|
-
This has the following differences from calling pydantic's
|
|
75
|
-
`self.model_dump(by_alias=True)`:
|
|
76
|
-
|
|
77
|
-
* `None` is only added to the output dict for nullable fields that
|
|
78
|
-
were set at model initialization. Other fields with value `None`
|
|
79
|
-
are ignored.
|
|
80
|
-
* Fields in `self.additional_properties` are added to the output dict.
|
|
81
|
-
"""
|
|
82
|
-
excluded_fields: Set[str] = set(
|
|
83
|
-
[
|
|
84
|
-
"additional_properties",
|
|
85
|
-
]
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
_dict = self.model_dump(
|
|
89
|
-
by_alias=True,
|
|
90
|
-
exclude=excluded_fields,
|
|
91
|
-
exclude_none=True,
|
|
92
|
-
)
|
|
93
|
-
# override the default output from pydantic by calling `to_dict()` of mode
|
|
94
|
-
if self.mode:
|
|
95
|
-
_dict["mode"] = self.mode.to_dict()
|
|
96
|
-
# puts key-value pairs in additional_properties in the top level
|
|
97
|
-
if self.additional_properties is not None:
|
|
98
|
-
for _key, _value in self.additional_properties.items():
|
|
99
|
-
_dict[_key] = _value
|
|
100
|
-
|
|
101
|
-
# set to None if name (nullable) is None
|
|
102
|
-
# and model_fields_set contains the field
|
|
103
|
-
if self.name is None and "name" in self.model_fields_set:
|
|
104
|
-
_dict["name"] = None
|
|
105
|
-
|
|
106
|
-
# set to None if event_values (nullable) is None
|
|
107
|
-
# and model_fields_set contains the field
|
|
108
|
-
if self.event_values is None and "event_values" in self.model_fields_set:
|
|
109
|
-
_dict["event_values"] = None
|
|
110
|
-
|
|
111
|
-
return _dict
|
|
112
|
-
|
|
113
|
-
@classmethod
|
|
114
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
115
|
-
"""Create an instance of ShapedInternalRecsysPoliciesRecentlyPopularPolicyRecentlyPopularPolicyConfig from a dict"""
|
|
116
|
-
if obj is None:
|
|
117
|
-
return None
|
|
118
|
-
|
|
119
|
-
if not isinstance(obj, dict):
|
|
120
|
-
return cls.model_validate(obj)
|
|
121
|
-
|
|
122
|
-
_obj = cls.model_validate(
|
|
123
|
-
{
|
|
124
|
-
"policy_type": (
|
|
125
|
-
obj.get("policy_type")
|
|
126
|
-
if obj.get("policy_type") is not None
|
|
127
|
-
else "recently-popular"
|
|
128
|
-
),
|
|
129
|
-
"name": obj.get("name"),
|
|
130
|
-
"event_values": obj.get("event_values"),
|
|
131
|
-
"mode": (
|
|
132
|
-
Mode1.from_dict(obj["mode"])
|
|
133
|
-
if obj.get("mode") is not None
|
|
134
|
-
else None
|
|
135
|
-
),
|
|
136
|
-
}
|
|
137
|
-
)
|
|
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
|
-
return _obj
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Shaped API
|
|
5
|
-
|
|
6
|
-
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 2.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
23
|
-
from shaped.autogen.models.distance_function import DistanceFunction
|
|
24
|
-
from shaped.autogen.models.encoding_pooling_strategy import EncodingPoolingStrategy
|
|
25
|
-
from typing_extensions import Self
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class ShapedInternalRecsysPoliciesUserItemContentSimilarityModelPolicyUserItemContentSimilarityModelPolicyConfig(
|
|
29
|
-
BaseModel
|
|
30
|
-
):
|
|
31
|
-
"""
|
|
32
|
-
ShapedInternalRecsysPoliciesUserItemContentSimilarityModelPolicyUserItemContentSimilarityModelPolicyConfig
|
|
33
|
-
""" # noqa: E501
|
|
34
|
-
|
|
35
|
-
policy_type: Optional[StrictStr] = "user-item-content-similarity"
|
|
36
|
-
name: Optional[StrictStr] = None
|
|
37
|
-
event_values: Optional[List[StrictStr]] = None
|
|
38
|
-
pool_fn: Optional[EncodingPoolingStrategy] = None
|
|
39
|
-
distance_fn: Optional[DistanceFunction] = None
|
|
40
|
-
item_feature_names: Optional[List[StrictStr]] = None
|
|
41
|
-
user_feature_names: Optional[List[StrictStr]] = None
|
|
42
|
-
__properties: ClassVar[List[str]] = [
|
|
43
|
-
"policy_type",
|
|
44
|
-
"name",
|
|
45
|
-
"event_values",
|
|
46
|
-
"pool_fn",
|
|
47
|
-
"distance_fn",
|
|
48
|
-
"item_feature_names",
|
|
49
|
-
"user_feature_names",
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
@field_validator("policy_type")
|
|
53
|
-
def policy_type_validate_enum(cls, value):
|
|
54
|
-
"""Validates the enum"""
|
|
55
|
-
if value is None:
|
|
56
|
-
return value
|
|
57
|
-
|
|
58
|
-
if value not in set(["user-item-content-similarity"]):
|
|
59
|
-
raise ValueError(
|
|
60
|
-
"must be one of enum values ('user-item-content-similarity')"
|
|
61
|
-
)
|
|
62
|
-
return value
|
|
63
|
-
|
|
64
|
-
model_config = ConfigDict(
|
|
65
|
-
populate_by_name=True,
|
|
66
|
-
validate_assignment=True,
|
|
67
|
-
protected_namespaces=(),
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
def to_str(self) -> str:
|
|
71
|
-
"""Returns the string representation of the model using alias"""
|
|
72
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
73
|
-
|
|
74
|
-
def to_json(self) -> str:
|
|
75
|
-
"""Returns the JSON representation of the model using alias"""
|
|
76
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
77
|
-
return json.dumps(self.to_dict())
|
|
78
|
-
|
|
79
|
-
@classmethod
|
|
80
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
81
|
-
"""Create an instance of ShapedInternalRecsysPoliciesUserItemContentSimilarityModelPolicyUserItemContentSimilarityModelPolicyConfig from a JSON string"""
|
|
82
|
-
return cls.from_dict(json.loads(json_str))
|
|
83
|
-
|
|
84
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
85
|
-
"""Return the dictionary representation of the model using alias.
|
|
86
|
-
|
|
87
|
-
This has the following differences from calling pydantic's
|
|
88
|
-
`self.model_dump(by_alias=True)`:
|
|
89
|
-
|
|
90
|
-
* `None` is only added to the output dict for nullable fields that
|
|
91
|
-
were set at model initialization. Other fields with value `None`
|
|
92
|
-
are ignored.
|
|
93
|
-
"""
|
|
94
|
-
excluded_fields: Set[str] = set([])
|
|
95
|
-
|
|
96
|
-
_dict = self.model_dump(
|
|
97
|
-
by_alias=True,
|
|
98
|
-
exclude=excluded_fields,
|
|
99
|
-
exclude_none=True,
|
|
100
|
-
)
|
|
101
|
-
# set to None if name (nullable) is None
|
|
102
|
-
# and model_fields_set contains the field
|
|
103
|
-
if self.name is None and "name" in self.model_fields_set:
|
|
104
|
-
_dict["name"] = None
|
|
105
|
-
|
|
106
|
-
# set to None if event_values (nullable) is None
|
|
107
|
-
# and model_fields_set contains the field
|
|
108
|
-
if self.event_values is None and "event_values" in self.model_fields_set:
|
|
109
|
-
_dict["event_values"] = None
|
|
110
|
-
|
|
111
|
-
# set to None if item_feature_names (nullable) is None
|
|
112
|
-
# and model_fields_set contains the field
|
|
113
|
-
if (
|
|
114
|
-
self.item_feature_names is None
|
|
115
|
-
and "item_feature_names" in self.model_fields_set
|
|
116
|
-
):
|
|
117
|
-
_dict["item_feature_names"] = None
|
|
118
|
-
|
|
119
|
-
# set to None if user_feature_names (nullable) is None
|
|
120
|
-
# and model_fields_set contains the field
|
|
121
|
-
if (
|
|
122
|
-
self.user_feature_names is None
|
|
123
|
-
and "user_feature_names" in self.model_fields_set
|
|
124
|
-
):
|
|
125
|
-
_dict["user_feature_names"] = None
|
|
126
|
-
|
|
127
|
-
return _dict
|
|
128
|
-
|
|
129
|
-
@classmethod
|
|
130
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
131
|
-
"""Create an instance of ShapedInternalRecsysPoliciesUserItemContentSimilarityModelPolicyUserItemContentSimilarityModelPolicyConfig from a dict"""
|
|
132
|
-
if obj is None:
|
|
133
|
-
return None
|
|
134
|
-
|
|
135
|
-
if not isinstance(obj, dict):
|
|
136
|
-
return cls.model_validate(obj)
|
|
137
|
-
|
|
138
|
-
_obj = cls.model_validate(
|
|
139
|
-
{
|
|
140
|
-
"policy_type": (
|
|
141
|
-
obj.get("policy_type")
|
|
142
|
-
if obj.get("policy_type") is not None
|
|
143
|
-
else "user-item-content-similarity"
|
|
144
|
-
),
|
|
145
|
-
"name": obj.get("name"),
|
|
146
|
-
"event_values": obj.get("event_values"),
|
|
147
|
-
"pool_fn": obj.get("pool_fn"),
|
|
148
|
-
"distance_fn": obj.get("distance_fn"),
|
|
149
|
-
"item_feature_names": obj.get("item_feature_names"),
|
|
150
|
-
"user_feature_names": obj.get("user_feature_names"),
|
|
151
|
-
}
|
|
152
|
-
)
|
|
153
|
-
return _obj
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Shaped API
|
|
5
|
-
|
|
6
|
-
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 2.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import TYPE_CHECKING, Any, Dict, Optional, Set, Union
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, StrictBool, ValidationError, field_validator
|
|
23
|
-
from shaped.autogen.models.tunable_bool import TunableBool
|
|
24
|
-
from typing_extensions import Self
|
|
25
|
-
|
|
26
|
-
TEXTENCODING_ANY_OF_SCHEMAS = ["TunableBool", "bool"]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class TextEncoding(BaseModel):
|
|
30
|
-
"""
|
|
31
|
-
TextEncoding
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
# data type: bool
|
|
35
|
-
anyof_schema_1_validator: Optional[StrictBool] = None
|
|
36
|
-
# data type: TunableBool
|
|
37
|
-
anyof_schema_2_validator: Optional[TunableBool] = None
|
|
38
|
-
if TYPE_CHECKING:
|
|
39
|
-
actual_instance: Optional[Union[TunableBool, bool]] = None
|
|
40
|
-
else:
|
|
41
|
-
actual_instance: Any = None
|
|
42
|
-
any_of_schemas: Set[str] = {"TunableBool", "bool"}
|
|
43
|
-
|
|
44
|
-
model_config = {
|
|
45
|
-
"validate_assignment": True,
|
|
46
|
-
"protected_namespaces": (),
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
50
|
-
if args:
|
|
51
|
-
if len(args) > 1:
|
|
52
|
-
raise ValueError(
|
|
53
|
-
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
54
|
-
)
|
|
55
|
-
if kwargs:
|
|
56
|
-
raise ValueError(
|
|
57
|
-
"If a position argument is used, keyword arguments cannot be used."
|
|
58
|
-
)
|
|
59
|
-
super().__init__(actual_instance=args[0])
|
|
60
|
-
else:
|
|
61
|
-
super().__init__(**kwargs)
|
|
62
|
-
|
|
63
|
-
@field_validator("actual_instance")
|
|
64
|
-
def actual_instance_must_validate_anyof(cls, v):
|
|
65
|
-
instance = TextEncoding.model_construct()
|
|
66
|
-
error_messages = []
|
|
67
|
-
# validate data type: bool
|
|
68
|
-
try:
|
|
69
|
-
instance.anyof_schema_1_validator = v
|
|
70
|
-
return v
|
|
71
|
-
except (ValidationError, ValueError) as e:
|
|
72
|
-
error_messages.append(str(e))
|
|
73
|
-
# validate data type: TunableBool
|
|
74
|
-
if not isinstance(v, TunableBool):
|
|
75
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `TunableBool`")
|
|
76
|
-
else:
|
|
77
|
-
return v
|
|
78
|
-
|
|
79
|
-
if error_messages:
|
|
80
|
-
# no match
|
|
81
|
-
raise ValueError(
|
|
82
|
-
"No match found when setting the actual_instance in TextEncoding with anyOf schemas: TunableBool, bool. Details: "
|
|
83
|
-
+ ", ".join(error_messages)
|
|
84
|
-
)
|
|
85
|
-
else:
|
|
86
|
-
return v
|
|
87
|
-
|
|
88
|
-
@classmethod
|
|
89
|
-
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
90
|
-
return cls.from_json(json.dumps(obj))
|
|
91
|
-
|
|
92
|
-
@classmethod
|
|
93
|
-
def from_json(cls, json_str: str) -> Self:
|
|
94
|
-
"""Returns the object represented by the json string"""
|
|
95
|
-
instance = cls.model_construct()
|
|
96
|
-
error_messages = []
|
|
97
|
-
# deserialize data into bool
|
|
98
|
-
try:
|
|
99
|
-
# validation
|
|
100
|
-
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
101
|
-
# assign value to actual_instance
|
|
102
|
-
instance.actual_instance = instance.anyof_schema_1_validator
|
|
103
|
-
return instance
|
|
104
|
-
except (ValidationError, ValueError) as e:
|
|
105
|
-
error_messages.append(str(e))
|
|
106
|
-
# anyof_schema_2_validator: Optional[TunableBool] = None
|
|
107
|
-
try:
|
|
108
|
-
instance.actual_instance = TunableBool.from_json(json_str)
|
|
109
|
-
return instance
|
|
110
|
-
except (ValidationError, ValueError) as e:
|
|
111
|
-
error_messages.append(str(e))
|
|
112
|
-
|
|
113
|
-
if error_messages:
|
|
114
|
-
# no match
|
|
115
|
-
raise ValueError(
|
|
116
|
-
"No match found when deserializing the JSON string into TextEncoding with anyOf schemas: TunableBool, bool. Details: "
|
|
117
|
-
+ ", ".join(error_messages)
|
|
118
|
-
)
|
|
119
|
-
else:
|
|
120
|
-
return instance
|
|
121
|
-
|
|
122
|
-
def to_json(self) -> str:
|
|
123
|
-
"""Returns the JSON representation of the actual instance"""
|
|
124
|
-
if self.actual_instance is None:
|
|
125
|
-
return "null"
|
|
126
|
-
|
|
127
|
-
if hasattr(self.actual_instance, "to_json") and callable(
|
|
128
|
-
self.actual_instance.to_json
|
|
129
|
-
):
|
|
130
|
-
return self.actual_instance.to_json()
|
|
131
|
-
else:
|
|
132
|
-
return json.dumps(self.actual_instance)
|
|
133
|
-
|
|
134
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], TunableBool, bool]]:
|
|
135
|
-
"""Returns the dict representation of the actual instance"""
|
|
136
|
-
if self.actual_instance is None:
|
|
137
|
-
return None
|
|
138
|
-
|
|
139
|
-
if hasattr(self.actual_instance, "to_dict") and callable(
|
|
140
|
-
self.actual_instance.to_dict
|
|
141
|
-
):
|
|
142
|
-
return self.actual_instance.to_dict()
|
|
143
|
-
else:
|
|
144
|
-
return self.actual_instance
|
|
145
|
-
|
|
146
|
-
def to_str(self) -> str:
|
|
147
|
-
"""Returns the string representation of the actual instance"""
|
|
148
|
-
return pprint.pformat(self.model_dump())
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Shaped API
|
|
5
|
-
|
|
6
|
-
Welcome to Shaped's API reference docs. These provide a detailed view of the endpoints and CLI commands that Shaped provides and brief explanations of how they should be used. The Shaped API has four main endpoints: **Tables** - Provision and manage batch and real-time data connectors. **Views** - Configure SQL transformations and AI enrichment on your input data. Use SQL to combine multiple data sources or use an LLM to add new categories, extract specific attributes from descriptions, etc. **Engines** - Deploy and manage your relevance engines. The Engine API exposes configuration for indexing logic, input datasets, externam embeddings, and more. **Query** - Execute queries against your engines, to return data based on an input query or rerank an existing list. The Query API exposes the retrieve, filter, score, and ranking steps of the 4-stage ranking architecture. The base URL for each endpoint is: `https://api.shaped.ai/v2`
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 2.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import TYPE_CHECKING, Any, Dict, Optional, Set, Union
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, StrictInt, ValidationError, field_validator
|
|
23
|
-
from shaped.autogen.models.tunable_int import TunableInt
|
|
24
|
-
from typing_extensions import Self
|
|
25
|
-
|
|
26
|
-
TIMEWINDOWINDAYS_ANY_OF_SCHEMAS = ["TunableInt", "int"]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class TimeWindowInDays(BaseModel):
|
|
30
|
-
"""
|
|
31
|
-
TimeWindowInDays
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
# data type: int
|
|
35
|
-
anyof_schema_1_validator: Optional[StrictInt] = None
|
|
36
|
-
# data type: TunableInt
|
|
37
|
-
anyof_schema_2_validator: Optional[TunableInt] = None
|
|
38
|
-
if TYPE_CHECKING:
|
|
39
|
-
actual_instance: Optional[Union[TunableInt, int]] = None
|
|
40
|
-
else:
|
|
41
|
-
actual_instance: Any = None
|
|
42
|
-
any_of_schemas: Set[str] = {"TunableInt", "int"}
|
|
43
|
-
|
|
44
|
-
model_config = {
|
|
45
|
-
"validate_assignment": True,
|
|
46
|
-
"protected_namespaces": (),
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
50
|
-
if args:
|
|
51
|
-
if len(args) > 1:
|
|
52
|
-
raise ValueError(
|
|
53
|
-
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
54
|
-
)
|
|
55
|
-
if kwargs:
|
|
56
|
-
raise ValueError(
|
|
57
|
-
"If a position argument is used, keyword arguments cannot be used."
|
|
58
|
-
)
|
|
59
|
-
super().__init__(actual_instance=args[0])
|
|
60
|
-
else:
|
|
61
|
-
super().__init__(**kwargs)
|
|
62
|
-
|
|
63
|
-
@field_validator("actual_instance")
|
|
64
|
-
def actual_instance_must_validate_anyof(cls, v):
|
|
65
|
-
if v is None:
|
|
66
|
-
return v
|
|
67
|
-
|
|
68
|
-
instance = TimeWindowInDays.model_construct()
|
|
69
|
-
error_messages = []
|
|
70
|
-
# validate data type: int
|
|
71
|
-
try:
|
|
72
|
-
instance.anyof_schema_1_validator = v
|
|
73
|
-
return v
|
|
74
|
-
except (ValidationError, ValueError) as e:
|
|
75
|
-
error_messages.append(str(e))
|
|
76
|
-
# validate data type: TunableInt
|
|
77
|
-
if not isinstance(v, TunableInt):
|
|
78
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `TunableInt`")
|
|
79
|
-
else:
|
|
80
|
-
return v
|
|
81
|
-
|
|
82
|
-
if error_messages:
|
|
83
|
-
# no match
|
|
84
|
-
raise ValueError(
|
|
85
|
-
"No match found when setting the actual_instance in TimeWindowInDays with anyOf schemas: TunableInt, int. Details: "
|
|
86
|
-
+ ", ".join(error_messages)
|
|
87
|
-
)
|
|
88
|
-
else:
|
|
89
|
-
return v
|
|
90
|
-
|
|
91
|
-
@classmethod
|
|
92
|
-
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
93
|
-
return cls.from_json(json.dumps(obj))
|
|
94
|
-
|
|
95
|
-
@classmethod
|
|
96
|
-
def from_json(cls, json_str: str) -> Self:
|
|
97
|
-
"""Returns the object represented by the json string"""
|
|
98
|
-
instance = cls.model_construct()
|
|
99
|
-
if json_str is None:
|
|
100
|
-
return instance
|
|
101
|
-
|
|
102
|
-
error_messages = []
|
|
103
|
-
# deserialize data into int
|
|
104
|
-
try:
|
|
105
|
-
# validation
|
|
106
|
-
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
107
|
-
# assign value to actual_instance
|
|
108
|
-
instance.actual_instance = instance.anyof_schema_1_validator
|
|
109
|
-
return instance
|
|
110
|
-
except (ValidationError, ValueError) as e:
|
|
111
|
-
error_messages.append(str(e))
|
|
112
|
-
# anyof_schema_2_validator: Optional[TunableInt] = None
|
|
113
|
-
try:
|
|
114
|
-
instance.actual_instance = TunableInt.from_json(json_str)
|
|
115
|
-
return instance
|
|
116
|
-
except (ValidationError, ValueError) as e:
|
|
117
|
-
error_messages.append(str(e))
|
|
118
|
-
|
|
119
|
-
if error_messages:
|
|
120
|
-
# no match
|
|
121
|
-
raise ValueError(
|
|
122
|
-
"No match found when deserializing the JSON string into TimeWindowInDays with anyOf schemas: TunableInt, int. Details: "
|
|
123
|
-
+ ", ".join(error_messages)
|
|
124
|
-
)
|
|
125
|
-
else:
|
|
126
|
-
return instance
|
|
127
|
-
|
|
128
|
-
def to_json(self) -> str:
|
|
129
|
-
"""Returns the JSON representation of the actual instance"""
|
|
130
|
-
if self.actual_instance is None:
|
|
131
|
-
return "null"
|
|
132
|
-
|
|
133
|
-
if hasattr(self.actual_instance, "to_json") and callable(
|
|
134
|
-
self.actual_instance.to_json
|
|
135
|
-
):
|
|
136
|
-
return self.actual_instance.to_json()
|
|
137
|
-
else:
|
|
138
|
-
return json.dumps(self.actual_instance)
|
|
139
|
-
|
|
140
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], TunableInt, int]]:
|
|
141
|
-
"""Returns the dict representation of the actual instance"""
|
|
142
|
-
if self.actual_instance is None:
|
|
143
|
-
return None
|
|
144
|
-
|
|
145
|
-
if hasattr(self.actual_instance, "to_dict") and callable(
|
|
146
|
-
self.actual_instance.to_dict
|
|
147
|
-
):
|
|
148
|
-
return self.actual_instance.to_dict()
|
|
149
|
-
else:
|
|
150
|
-
return self.actual_instance
|
|
151
|
-
|
|
152
|
-
def to_str(self) -> str:
|
|
153
|
-
"""Returns the string representation of the actual instance"""
|
|
154
|
-
return pprint.pformat(self.model_dump())
|