shaped 2.0.4__py3-none-any.whl → 2.0.5__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 +5 -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 +5 -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_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 +5 -6
- 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 +5 -6
- 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 +5 -6
- 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.5.dist-info}/METADATA +1 -1
- shaped-2.0.5.dist-info/RECORD +271 -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.5.dist-info}/WHEEL +0 -0
- {shaped-2.0.4.dist-info → shaped-2.0.5.dist-info}/entry_points.txt +0 -0
- {shaped-2.0.4.dist-info → shaped-2.0.5.dist-info}/top_level.txt +0 -0
- {shaped-2.0.4.dist-info → shaped-2.0.5.dist-info}/zip-safe +0 -0
|
@@ -1,146 +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, ValidationError, field_validator
|
|
23
|
-
from shaped.autogen.models.feature import Feature
|
|
24
|
-
from shaped.autogen.models.label import Label
|
|
25
|
-
from typing_extensions import Self
|
|
26
|
-
|
|
27
|
-
ENGINESCHEMAUSERINNER_ANY_OF_SCHEMAS = ["Feature", "Label"]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class EngineSchemaUserInner(BaseModel):
|
|
31
|
-
"""
|
|
32
|
-
EngineSchemaUserInner
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
# data type: Feature
|
|
36
|
-
anyof_schema_1_validator: Optional[Feature] = None
|
|
37
|
-
# data type: Label
|
|
38
|
-
anyof_schema_2_validator: Optional[Label] = None
|
|
39
|
-
if TYPE_CHECKING:
|
|
40
|
-
actual_instance: Optional[Union[Feature, Label]] = None
|
|
41
|
-
else:
|
|
42
|
-
actual_instance: Any = None
|
|
43
|
-
any_of_schemas: Set[str] = {"Feature", "Label"}
|
|
44
|
-
|
|
45
|
-
model_config = {
|
|
46
|
-
"validate_assignment": True,
|
|
47
|
-
"protected_namespaces": (),
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
51
|
-
if args:
|
|
52
|
-
if len(args) > 1:
|
|
53
|
-
raise ValueError(
|
|
54
|
-
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
55
|
-
)
|
|
56
|
-
if kwargs:
|
|
57
|
-
raise ValueError(
|
|
58
|
-
"If a position argument is used, keyword arguments cannot be used."
|
|
59
|
-
)
|
|
60
|
-
super().__init__(actual_instance=args[0])
|
|
61
|
-
else:
|
|
62
|
-
super().__init__(**kwargs)
|
|
63
|
-
|
|
64
|
-
@field_validator("actual_instance")
|
|
65
|
-
def actual_instance_must_validate_anyof(cls, v):
|
|
66
|
-
instance = EngineSchemaUserInner.model_construct()
|
|
67
|
-
error_messages = []
|
|
68
|
-
# validate data type: Feature
|
|
69
|
-
if not isinstance(v, Feature):
|
|
70
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `Feature`")
|
|
71
|
-
else:
|
|
72
|
-
return v
|
|
73
|
-
|
|
74
|
-
# validate data type: Label
|
|
75
|
-
if not isinstance(v, Label):
|
|
76
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `Label`")
|
|
77
|
-
else:
|
|
78
|
-
return v
|
|
79
|
-
|
|
80
|
-
if error_messages:
|
|
81
|
-
# no match
|
|
82
|
-
raise ValueError(
|
|
83
|
-
"No match found when setting the actual_instance in EngineSchemaUserInner with anyOf schemas: Feature, Label. Details: "
|
|
84
|
-
+ ", ".join(error_messages)
|
|
85
|
-
)
|
|
86
|
-
else:
|
|
87
|
-
return v
|
|
88
|
-
|
|
89
|
-
@classmethod
|
|
90
|
-
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
91
|
-
return cls.from_json(json.dumps(obj))
|
|
92
|
-
|
|
93
|
-
@classmethod
|
|
94
|
-
def from_json(cls, json_str: str) -> Self:
|
|
95
|
-
"""Returns the object represented by the json string"""
|
|
96
|
-
instance = cls.model_construct()
|
|
97
|
-
error_messages = []
|
|
98
|
-
# anyof_schema_1_validator: Optional[Feature] = None
|
|
99
|
-
try:
|
|
100
|
-
instance.actual_instance = Feature.from_json(json_str)
|
|
101
|
-
return instance
|
|
102
|
-
except (ValidationError, ValueError) as e:
|
|
103
|
-
error_messages.append(str(e))
|
|
104
|
-
# anyof_schema_2_validator: Optional[Label] = None
|
|
105
|
-
try:
|
|
106
|
-
instance.actual_instance = Label.from_json(json_str)
|
|
107
|
-
return instance
|
|
108
|
-
except (ValidationError, ValueError) as e:
|
|
109
|
-
error_messages.append(str(e))
|
|
110
|
-
|
|
111
|
-
if error_messages:
|
|
112
|
-
# no match
|
|
113
|
-
raise ValueError(
|
|
114
|
-
"No match found when deserializing the JSON string into EngineSchemaUserInner with anyOf schemas: Feature, Label. Details: "
|
|
115
|
-
+ ", ".join(error_messages)
|
|
116
|
-
)
|
|
117
|
-
else:
|
|
118
|
-
return instance
|
|
119
|
-
|
|
120
|
-
def to_json(self) -> str:
|
|
121
|
-
"""Returns the JSON representation of the actual instance"""
|
|
122
|
-
if self.actual_instance is None:
|
|
123
|
-
return "null"
|
|
124
|
-
|
|
125
|
-
if hasattr(self.actual_instance, "to_json") and callable(
|
|
126
|
-
self.actual_instance.to_json
|
|
127
|
-
):
|
|
128
|
-
return self.actual_instance.to_json()
|
|
129
|
-
else:
|
|
130
|
-
return json.dumps(self.actual_instance)
|
|
131
|
-
|
|
132
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], Feature, Label]]:
|
|
133
|
-
"""Returns the dict representation of the actual instance"""
|
|
134
|
-
if self.actual_instance is None:
|
|
135
|
-
return None
|
|
136
|
-
|
|
137
|
-
if hasattr(self.actual_instance, "to_dict") and callable(
|
|
138
|
-
self.actual_instance.to_dict
|
|
139
|
-
):
|
|
140
|
-
return self.actual_instance.to_dict()
|
|
141
|
-
else:
|
|
142
|
-
return self.actual_instance
|
|
143
|
-
|
|
144
|
-
def to_str(self) -> str:
|
|
145
|
-
"""Returns the string representation of the actual instance"""
|
|
146
|
-
return pprint.pformat(self.model_dump())
|
|
@@ -1,164 +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
|
-
from typing import Any, Dict, Optional, Set, Union
|
|
20
|
-
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, ValidationError, field_validator
|
|
22
|
-
from shaped.autogen.models.query_table_config import QueryTableConfig
|
|
23
|
-
from shaped.autogen.models.reference_table_config import ReferenceTableConfig
|
|
24
|
-
from typing_extensions import Self
|
|
25
|
-
|
|
26
|
-
FILTERDATASET_ONE_OF_SCHEMAS = ["QueryTableConfig", "ReferenceTableConfig"]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class FilterDataset(BaseModel):
|
|
30
|
-
"""
|
|
31
|
-
Dataset configuration for the filter source data.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
# data type: QueryTableConfig
|
|
35
|
-
oneof_schema_1_validator: Optional[QueryTableConfig] = None
|
|
36
|
-
# data type: ReferenceTableConfig
|
|
37
|
-
oneof_schema_2_validator: Optional[ReferenceTableConfig] = None
|
|
38
|
-
actual_instance: Optional[Union[QueryTableConfig, ReferenceTableConfig]] = None
|
|
39
|
-
one_of_schemas: Set[str] = {"QueryTableConfig", "ReferenceTableConfig"}
|
|
40
|
-
|
|
41
|
-
model_config = ConfigDict(
|
|
42
|
-
validate_assignment=True,
|
|
43
|
-
protected_namespaces=(),
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
discriminator_value_class_map: Dict[str, str] = {}
|
|
47
|
-
|
|
48
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
49
|
-
if args:
|
|
50
|
-
if len(args) > 1:
|
|
51
|
-
raise ValueError(
|
|
52
|
-
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
53
|
-
)
|
|
54
|
-
if kwargs:
|
|
55
|
-
raise ValueError(
|
|
56
|
-
"If a position argument is used, keyword arguments cannot be used."
|
|
57
|
-
)
|
|
58
|
-
super().__init__(actual_instance=args[0])
|
|
59
|
-
else:
|
|
60
|
-
super().__init__(**kwargs)
|
|
61
|
-
|
|
62
|
-
@field_validator("actual_instance")
|
|
63
|
-
def actual_instance_must_validate_oneof(cls, v):
|
|
64
|
-
instance = FilterDataset.model_construct()
|
|
65
|
-
error_messages = []
|
|
66
|
-
match = 0
|
|
67
|
-
# validate data type: QueryTableConfig
|
|
68
|
-
if not isinstance(v, QueryTableConfig):
|
|
69
|
-
error_messages.append(
|
|
70
|
-
f"Error! Input type `{type(v)}` is not `QueryTableConfig`"
|
|
71
|
-
)
|
|
72
|
-
else:
|
|
73
|
-
match += 1
|
|
74
|
-
# validate data type: ReferenceTableConfig
|
|
75
|
-
if not isinstance(v, ReferenceTableConfig):
|
|
76
|
-
error_messages.append(
|
|
77
|
-
f"Error! Input type `{type(v)}` is not `ReferenceTableConfig`"
|
|
78
|
-
)
|
|
79
|
-
else:
|
|
80
|
-
match += 1
|
|
81
|
-
if match > 1:
|
|
82
|
-
# more than 1 match
|
|
83
|
-
raise ValueError(
|
|
84
|
-
"Multiple matches found when setting `actual_instance` in FilterDataset with oneOf schemas: QueryTableConfig, ReferenceTableConfig. Details: "
|
|
85
|
-
+ ", ".join(error_messages)
|
|
86
|
-
)
|
|
87
|
-
elif match == 0:
|
|
88
|
-
# no match
|
|
89
|
-
raise ValueError(
|
|
90
|
-
"No match found when setting `actual_instance` in FilterDataset with oneOf schemas: QueryTableConfig, ReferenceTableConfig. Details: "
|
|
91
|
-
+ ", ".join(error_messages)
|
|
92
|
-
)
|
|
93
|
-
else:
|
|
94
|
-
return v
|
|
95
|
-
|
|
96
|
-
@classmethod
|
|
97
|
-
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
98
|
-
return cls.from_json(json.dumps(obj))
|
|
99
|
-
|
|
100
|
-
@classmethod
|
|
101
|
-
def from_json(cls, json_str: str) -> Self:
|
|
102
|
-
"""Returns the object represented by the json string"""
|
|
103
|
-
instance = cls.model_construct()
|
|
104
|
-
error_messages = []
|
|
105
|
-
match = 0
|
|
106
|
-
|
|
107
|
-
# deserialize data into QueryTableConfig
|
|
108
|
-
try:
|
|
109
|
-
instance.actual_instance = QueryTableConfig.from_json(json_str)
|
|
110
|
-
match += 1
|
|
111
|
-
except (ValidationError, ValueError) as e:
|
|
112
|
-
error_messages.append(str(e))
|
|
113
|
-
# deserialize data into ReferenceTableConfig
|
|
114
|
-
try:
|
|
115
|
-
instance.actual_instance = ReferenceTableConfig.from_json(json_str)
|
|
116
|
-
match += 1
|
|
117
|
-
except (ValidationError, ValueError) as e:
|
|
118
|
-
error_messages.append(str(e))
|
|
119
|
-
|
|
120
|
-
if match > 1:
|
|
121
|
-
# more than 1 match
|
|
122
|
-
raise ValueError(
|
|
123
|
-
"Multiple matches found when deserializing the JSON string into FilterDataset with oneOf schemas: QueryTableConfig, ReferenceTableConfig. Details: "
|
|
124
|
-
+ ", ".join(error_messages)
|
|
125
|
-
)
|
|
126
|
-
elif match == 0:
|
|
127
|
-
# no match
|
|
128
|
-
raise ValueError(
|
|
129
|
-
"No match found when deserializing the JSON string into FilterDataset with oneOf schemas: QueryTableConfig, ReferenceTableConfig. Details: "
|
|
130
|
-
+ ", ".join(error_messages)
|
|
131
|
-
)
|
|
132
|
-
else:
|
|
133
|
-
return instance
|
|
134
|
-
|
|
135
|
-
def to_json(self) -> str:
|
|
136
|
-
"""Returns the JSON representation of the actual instance"""
|
|
137
|
-
if self.actual_instance is None:
|
|
138
|
-
return "null"
|
|
139
|
-
|
|
140
|
-
if hasattr(self.actual_instance, "to_json") and callable(
|
|
141
|
-
self.actual_instance.to_json
|
|
142
|
-
):
|
|
143
|
-
return self.actual_instance.to_json()
|
|
144
|
-
else:
|
|
145
|
-
return json.dumps(self.actual_instance)
|
|
146
|
-
|
|
147
|
-
def to_dict(
|
|
148
|
-
self,
|
|
149
|
-
) -> Optional[Union[Dict[str, Any], QueryTableConfig, ReferenceTableConfig]]:
|
|
150
|
-
"""Returns the dict representation of the actual instance"""
|
|
151
|
-
if self.actual_instance is None:
|
|
152
|
-
return None
|
|
153
|
-
|
|
154
|
-
if hasattr(self.actual_instance, "to_dict") and callable(
|
|
155
|
-
self.actual_instance.to_dict
|
|
156
|
-
):
|
|
157
|
-
return self.actual_instance.to_dict()
|
|
158
|
-
else:
|
|
159
|
-
# primitive type
|
|
160
|
-
return self.actual_instance
|
|
161
|
-
|
|
162
|
-
def to_str(self) -> str:
|
|
163
|
-
"""Returns the string representation of the actual instance"""
|
|
164
|
-
return pprint.pformat(self.model_dump())
|
shaped/autogen/models/mode2.py
DELETED
|
@@ -1,150 +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, StrictStr, ValidationError, field_validator
|
|
23
|
-
from shaped.autogen.models.tunable_string import TunableString
|
|
24
|
-
from typing_extensions import Self
|
|
25
|
-
|
|
26
|
-
MODE2_ANY_OF_SCHEMAS = ["TunableString", "str"]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class Mode2(BaseModel):
|
|
30
|
-
"""
|
|
31
|
-
Mode2
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
# data type: str
|
|
35
|
-
anyof_schema_1_validator: Optional[StrictStr] = None
|
|
36
|
-
# data type: TunableString
|
|
37
|
-
anyof_schema_2_validator: Optional[TunableString] = None
|
|
38
|
-
if TYPE_CHECKING:
|
|
39
|
-
actual_instance: Optional[Union[TunableString, str]] = None
|
|
40
|
-
else:
|
|
41
|
-
actual_instance: Any = None
|
|
42
|
-
any_of_schemas: Set[str] = {"TunableString", "str"}
|
|
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 = Mode2.model_construct()
|
|
66
|
-
error_messages = []
|
|
67
|
-
# validate data type: str
|
|
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: TunableString
|
|
74
|
-
if not isinstance(v, TunableString):
|
|
75
|
-
error_messages.append(
|
|
76
|
-
f"Error! Input type `{type(v)}` is not `TunableString`"
|
|
77
|
-
)
|
|
78
|
-
else:
|
|
79
|
-
return v
|
|
80
|
-
|
|
81
|
-
if error_messages:
|
|
82
|
-
# no match
|
|
83
|
-
raise ValueError(
|
|
84
|
-
"No match found when setting the actual_instance in Mode2 with anyOf schemas: TunableString, str. Details: "
|
|
85
|
-
+ ", ".join(error_messages)
|
|
86
|
-
)
|
|
87
|
-
else:
|
|
88
|
-
return v
|
|
89
|
-
|
|
90
|
-
@classmethod
|
|
91
|
-
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
92
|
-
return cls.from_json(json.dumps(obj))
|
|
93
|
-
|
|
94
|
-
@classmethod
|
|
95
|
-
def from_json(cls, json_str: str) -> Self:
|
|
96
|
-
"""Returns the object represented by the json string"""
|
|
97
|
-
instance = cls.model_construct()
|
|
98
|
-
error_messages = []
|
|
99
|
-
# deserialize data into str
|
|
100
|
-
try:
|
|
101
|
-
# validation
|
|
102
|
-
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
103
|
-
# assign value to actual_instance
|
|
104
|
-
instance.actual_instance = instance.anyof_schema_1_validator
|
|
105
|
-
return instance
|
|
106
|
-
except (ValidationError, ValueError) as e:
|
|
107
|
-
error_messages.append(str(e))
|
|
108
|
-
# anyof_schema_2_validator: Optional[TunableString] = None
|
|
109
|
-
try:
|
|
110
|
-
instance.actual_instance = TunableString.from_json(json_str)
|
|
111
|
-
return instance
|
|
112
|
-
except (ValidationError, ValueError) as e:
|
|
113
|
-
error_messages.append(str(e))
|
|
114
|
-
|
|
115
|
-
if error_messages:
|
|
116
|
-
# no match
|
|
117
|
-
raise ValueError(
|
|
118
|
-
"No match found when deserializing the JSON string into Mode2 with anyOf schemas: TunableString, str. Details: "
|
|
119
|
-
+ ", ".join(error_messages)
|
|
120
|
-
)
|
|
121
|
-
else:
|
|
122
|
-
return instance
|
|
123
|
-
|
|
124
|
-
def to_json(self) -> str:
|
|
125
|
-
"""Returns the JSON representation of the actual instance"""
|
|
126
|
-
if self.actual_instance is None:
|
|
127
|
-
return "null"
|
|
128
|
-
|
|
129
|
-
if hasattr(self.actual_instance, "to_json") and callable(
|
|
130
|
-
self.actual_instance.to_json
|
|
131
|
-
):
|
|
132
|
-
return self.actual_instance.to_json()
|
|
133
|
-
else:
|
|
134
|
-
return json.dumps(self.actual_instance)
|
|
135
|
-
|
|
136
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], TunableString, str]]:
|
|
137
|
-
"""Returns the dict representation of the actual instance"""
|
|
138
|
-
if self.actual_instance is None:
|
|
139
|
-
return None
|
|
140
|
-
|
|
141
|
-
if hasattr(self.actual_instance, "to_dict") and callable(
|
|
142
|
-
self.actual_instance.to_dict
|
|
143
|
-
):
|
|
144
|
-
return self.actual_instance.to_dict()
|
|
145
|
-
else:
|
|
146
|
-
return self.actual_instance
|
|
147
|
-
|
|
148
|
-
def to_str(self) -> str:
|
|
149
|
-
"""Returns the string representation of the actual instance"""
|
|
150
|
-
return pprint.pformat(self.model_dump())
|
shaped/autogen/models/pool_fn.py
DELETED
|
@@ -1,152 +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, ValidationError, field_validator
|
|
23
|
-
from shaped.autogen.models.encoding_pooling_strategy import EncodingPoolingStrategy
|
|
24
|
-
from shaped.autogen.models.tunable_string import TunableString
|
|
25
|
-
from typing_extensions import Self
|
|
26
|
-
|
|
27
|
-
POOLFN_ANY_OF_SCHEMAS = ["EncodingPoolingStrategy", "TunableString"]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class PoolFn(BaseModel):
|
|
31
|
-
"""
|
|
32
|
-
PoolFn
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
# data type: EncodingPoolingStrategy
|
|
36
|
-
anyof_schema_1_validator: Optional[EncodingPoolingStrategy] = None
|
|
37
|
-
# data type: TunableString
|
|
38
|
-
anyof_schema_2_validator: Optional[TunableString] = None
|
|
39
|
-
if TYPE_CHECKING:
|
|
40
|
-
actual_instance: Optional[Union[EncodingPoolingStrategy, TunableString]] = None
|
|
41
|
-
else:
|
|
42
|
-
actual_instance: Any = None
|
|
43
|
-
any_of_schemas: Set[str] = {"EncodingPoolingStrategy", "TunableString"}
|
|
44
|
-
|
|
45
|
-
model_config = {
|
|
46
|
-
"validate_assignment": True,
|
|
47
|
-
"protected_namespaces": (),
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
51
|
-
if args:
|
|
52
|
-
if len(args) > 1:
|
|
53
|
-
raise ValueError(
|
|
54
|
-
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
55
|
-
)
|
|
56
|
-
if kwargs:
|
|
57
|
-
raise ValueError(
|
|
58
|
-
"If a position argument is used, keyword arguments cannot be used."
|
|
59
|
-
)
|
|
60
|
-
super().__init__(actual_instance=args[0])
|
|
61
|
-
else:
|
|
62
|
-
super().__init__(**kwargs)
|
|
63
|
-
|
|
64
|
-
@field_validator("actual_instance")
|
|
65
|
-
def actual_instance_must_validate_anyof(cls, v):
|
|
66
|
-
instance = PoolFn.model_construct()
|
|
67
|
-
error_messages = []
|
|
68
|
-
# validate data type: EncodingPoolingStrategy
|
|
69
|
-
if not isinstance(v, EncodingPoolingStrategy):
|
|
70
|
-
error_messages.append(
|
|
71
|
-
f"Error! Input type `{type(v)}` is not `EncodingPoolingStrategy`"
|
|
72
|
-
)
|
|
73
|
-
else:
|
|
74
|
-
return v
|
|
75
|
-
|
|
76
|
-
# validate data type: TunableString
|
|
77
|
-
if not isinstance(v, TunableString):
|
|
78
|
-
error_messages.append(
|
|
79
|
-
f"Error! Input type `{type(v)}` is not `TunableString`"
|
|
80
|
-
)
|
|
81
|
-
else:
|
|
82
|
-
return v
|
|
83
|
-
|
|
84
|
-
if error_messages:
|
|
85
|
-
# no match
|
|
86
|
-
raise ValueError(
|
|
87
|
-
"No match found when setting the actual_instance in PoolFn with anyOf schemas: EncodingPoolingStrategy, TunableString. Details: "
|
|
88
|
-
+ ", ".join(error_messages)
|
|
89
|
-
)
|
|
90
|
-
else:
|
|
91
|
-
return v
|
|
92
|
-
|
|
93
|
-
@classmethod
|
|
94
|
-
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
95
|
-
return cls.from_json(json.dumps(obj))
|
|
96
|
-
|
|
97
|
-
@classmethod
|
|
98
|
-
def from_json(cls, json_str: str) -> Self:
|
|
99
|
-
"""Returns the object represented by the json string"""
|
|
100
|
-
instance = cls.model_construct()
|
|
101
|
-
error_messages = []
|
|
102
|
-
# anyof_schema_1_validator: Optional[EncodingPoolingStrategy] = None
|
|
103
|
-
try:
|
|
104
|
-
instance.actual_instance = EncodingPoolingStrategy.from_json(json_str)
|
|
105
|
-
return instance
|
|
106
|
-
except (ValidationError, ValueError) as e:
|
|
107
|
-
error_messages.append(str(e))
|
|
108
|
-
# anyof_schema_2_validator: Optional[TunableString] = None
|
|
109
|
-
try:
|
|
110
|
-
instance.actual_instance = TunableString.from_json(json_str)
|
|
111
|
-
return instance
|
|
112
|
-
except (ValidationError, ValueError) as e:
|
|
113
|
-
error_messages.append(str(e))
|
|
114
|
-
|
|
115
|
-
if error_messages:
|
|
116
|
-
# no match
|
|
117
|
-
raise ValueError(
|
|
118
|
-
"No match found when deserializing the JSON string into PoolFn with anyOf schemas: EncodingPoolingStrategy, TunableString. Details: "
|
|
119
|
-
+ ", ".join(error_messages)
|
|
120
|
-
)
|
|
121
|
-
else:
|
|
122
|
-
return instance
|
|
123
|
-
|
|
124
|
-
def to_json(self) -> str:
|
|
125
|
-
"""Returns the JSON representation of the actual instance"""
|
|
126
|
-
if self.actual_instance is None:
|
|
127
|
-
return "null"
|
|
128
|
-
|
|
129
|
-
if hasattr(self.actual_instance, "to_json") and callable(
|
|
130
|
-
self.actual_instance.to_json
|
|
131
|
-
):
|
|
132
|
-
return self.actual_instance.to_json()
|
|
133
|
-
else:
|
|
134
|
-
return json.dumps(self.actual_instance)
|
|
135
|
-
|
|
136
|
-
def to_dict(
|
|
137
|
-
self,
|
|
138
|
-
) -> Optional[Union[Dict[str, Any], EncodingPoolingStrategy, TunableString]]:
|
|
139
|
-
"""Returns the dict representation of the actual instance"""
|
|
140
|
-
if self.actual_instance is None:
|
|
141
|
-
return None
|
|
142
|
-
|
|
143
|
-
if hasattr(self.actual_instance, "to_dict") and callable(
|
|
144
|
-
self.actual_instance.to_dict
|
|
145
|
-
):
|
|
146
|
-
return self.actual_instance.to_dict()
|
|
147
|
-
else:
|
|
148
|
-
return self.actual_instance
|
|
149
|
-
|
|
150
|
-
def to_str(self) -> str:
|
|
151
|
-
"""Returns the string representation of the actual instance"""
|
|
152
|
-
return pprint.pformat(self.model_dump())
|