vectorize_client.models.destination_connector_input_config
Vectorize API
API for Vectorize services (Beta)
The version of the OpenAPI document: 0.1.2 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4 Vectorize API 5 6 API for Vectorize services (Beta) 7 8 The version of the OpenAPI document: 0.1.2 9 Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11 Do not edit the class manually. 12""" # noqa: E501 13 14 15from __future__ import annotations 16import json 17import pprint 18from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator 19from typing import Any, List, Optional 20from vectorize_client.models.azureaisearch_config import AZUREAISEARCHConfig 21from vectorize_client.models.capella_config import CAPELLAConfig 22from vectorize_client.models.datastax_config import DATASTAXConfig 23from vectorize_client.models.elastic_config import ELASTICConfig 24from vectorize_client.models.milvus_config import MILVUSConfig 25from vectorize_client.models.pinecone_config import PINECONEConfig 26from vectorize_client.models.postgresql_config import POSTGRESQLConfig 27from vectorize_client.models.qdrant_config import QDRANTConfig 28from vectorize_client.models.singlestore_config import SINGLESTOREConfig 29from vectorize_client.models.supabase_config import SUPABASEConfig 30from vectorize_client.models.turbopuffer_config import TURBOPUFFERConfig 31from vectorize_client.models.weaviate_config import WEAVIATEConfig 32from pydantic import StrictStr, Field 33from typing import Union, List, Set, Optional, Dict 34from typing_extensions import Literal, Self 35 36DESTINATIONCONNECTORINPUTCONFIG_ONE_OF_SCHEMAS = ["AZUREAISEARCHConfig", "CAPELLAConfig", "DATASTAXConfig", "ELASTICConfig", "MILVUSConfig", "PINECONEConfig", "POSTGRESQLConfig", "QDRANTConfig", "SINGLESTOREConfig", "SUPABASEConfig", "TURBOPUFFERConfig", "WEAVIATEConfig"] 37 38class DestinationConnectorInputConfig(BaseModel): 39 """ 40 Configuration specific to the connector type 41 """ 42 # data type: CAPELLAConfig 43 oneof_schema_1_validator: Optional[CAPELLAConfig] = None 44 # data type: DATASTAXConfig 45 oneof_schema_2_validator: Optional[DATASTAXConfig] = None 46 # data type: ELASTICConfig 47 oneof_schema_3_validator: Optional[ELASTICConfig] = None 48 # data type: PINECONEConfig 49 oneof_schema_4_validator: Optional[PINECONEConfig] = None 50 # data type: SINGLESTOREConfig 51 oneof_schema_5_validator: Optional[SINGLESTOREConfig] = None 52 # data type: MILVUSConfig 53 oneof_schema_6_validator: Optional[MILVUSConfig] = None 54 # data type: POSTGRESQLConfig 55 oneof_schema_7_validator: Optional[POSTGRESQLConfig] = None 56 # data type: QDRANTConfig 57 oneof_schema_8_validator: Optional[QDRANTConfig] = None 58 # data type: SUPABASEConfig 59 oneof_schema_9_validator: Optional[SUPABASEConfig] = None 60 # data type: WEAVIATEConfig 61 oneof_schema_10_validator: Optional[WEAVIATEConfig] = None 62 # data type: AZUREAISEARCHConfig 63 oneof_schema_11_validator: Optional[AZUREAISEARCHConfig] = None 64 # data type: TURBOPUFFERConfig 65 oneof_schema_12_validator: Optional[TURBOPUFFERConfig] = None 66 actual_instance: Optional[Union[AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig]] = None 67 one_of_schemas: Set[str] = { "AZUREAISEARCHConfig", "CAPELLAConfig", "DATASTAXConfig", "ELASTICConfig", "MILVUSConfig", "PINECONEConfig", "POSTGRESQLConfig", "QDRANTConfig", "SINGLESTOREConfig", "SUPABASEConfig", "TURBOPUFFERConfig", "WEAVIATEConfig" } 68 69 model_config = ConfigDict( 70 validate_assignment=True, 71 protected_namespaces=(), 72 ) 73 74 75 def __init__(self, *args, **kwargs) -> None: 76 if args: 77 if len(args) > 1: 78 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 79 if kwargs: 80 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 81 super().__init__(actual_instance=args[0]) 82 else: 83 super().__init__(**kwargs) 84 85 @field_validator('actual_instance') 86 def actual_instance_must_validate_oneof(cls, v): 87 instance = DestinationConnectorInputConfig.model_construct() 88 error_messages = [] 89 match = 0 90 # validate data type: CAPELLAConfig 91 if not isinstance(v, CAPELLAConfig): 92 error_messages.append(f"Error! Input type `{type(v)}` is not `CAPELLAConfig`") 93 else: 94 match += 1 95 # validate data type: DATASTAXConfig 96 if not isinstance(v, DATASTAXConfig): 97 error_messages.append(f"Error! Input type `{type(v)}` is not `DATASTAXConfig`") 98 else: 99 match += 1 100 # validate data type: ELASTICConfig 101 if not isinstance(v, ELASTICConfig): 102 error_messages.append(f"Error! Input type `{type(v)}` is not `ELASTICConfig`") 103 else: 104 match += 1 105 # validate data type: PINECONEConfig 106 if not isinstance(v, PINECONEConfig): 107 error_messages.append(f"Error! Input type `{type(v)}` is not `PINECONEConfig`") 108 else: 109 match += 1 110 # validate data type: SINGLESTOREConfig 111 if not isinstance(v, SINGLESTOREConfig): 112 error_messages.append(f"Error! Input type `{type(v)}` is not `SINGLESTOREConfig`") 113 else: 114 match += 1 115 # validate data type: MILVUSConfig 116 if not isinstance(v, MILVUSConfig): 117 error_messages.append(f"Error! Input type `{type(v)}` is not `MILVUSConfig`") 118 else: 119 match += 1 120 # validate data type: POSTGRESQLConfig 121 if not isinstance(v, POSTGRESQLConfig): 122 error_messages.append(f"Error! Input type `{type(v)}` is not `POSTGRESQLConfig`") 123 else: 124 match += 1 125 # validate data type: QDRANTConfig 126 if not isinstance(v, QDRANTConfig): 127 error_messages.append(f"Error! Input type `{type(v)}` is not `QDRANTConfig`") 128 else: 129 match += 1 130 # validate data type: SUPABASEConfig 131 if not isinstance(v, SUPABASEConfig): 132 error_messages.append(f"Error! Input type `{type(v)}` is not `SUPABASEConfig`") 133 else: 134 match += 1 135 # validate data type: WEAVIATEConfig 136 if not isinstance(v, WEAVIATEConfig): 137 error_messages.append(f"Error! Input type `{type(v)}` is not `WEAVIATEConfig`") 138 else: 139 match += 1 140 # validate data type: AZUREAISEARCHConfig 141 if not isinstance(v, AZUREAISEARCHConfig): 142 error_messages.append(f"Error! Input type `{type(v)}` is not `AZUREAISEARCHConfig`") 143 else: 144 match += 1 145 # validate data type: TURBOPUFFERConfig 146 if not isinstance(v, TURBOPUFFERConfig): 147 error_messages.append(f"Error! Input type `{type(v)}` is not `TURBOPUFFERConfig`") 148 else: 149 match += 1 150 if match > 1: 151 # more than 1 match 152 raise ValueError("Multiple matches found when setting `actual_instance` in DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 153 elif match == 0: 154 # no match 155 raise ValueError("No match found when setting `actual_instance` in DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 156 else: 157 return v 158 159 @classmethod 160 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 161 return cls.from_json(json.dumps(obj)) 162 163 @classmethod 164 def from_json(cls, json_str: str) -> Self: 165 """Returns the object represented by the json string""" 166 instance = cls.model_construct() 167 error_messages = [] 168 match = 0 169 170 # deserialize data into CAPELLAConfig 171 try: 172 instance.actual_instance = CAPELLAConfig.from_json(json_str) 173 match += 1 174 except (ValidationError, ValueError) as e: 175 error_messages.append(str(e)) 176 # deserialize data into DATASTAXConfig 177 try: 178 instance.actual_instance = DATASTAXConfig.from_json(json_str) 179 match += 1 180 except (ValidationError, ValueError) as e: 181 error_messages.append(str(e)) 182 # deserialize data into ELASTICConfig 183 try: 184 instance.actual_instance = ELASTICConfig.from_json(json_str) 185 match += 1 186 except (ValidationError, ValueError) as e: 187 error_messages.append(str(e)) 188 # deserialize data into PINECONEConfig 189 try: 190 instance.actual_instance = PINECONEConfig.from_json(json_str) 191 match += 1 192 except (ValidationError, ValueError) as e: 193 error_messages.append(str(e)) 194 # deserialize data into SINGLESTOREConfig 195 try: 196 instance.actual_instance = SINGLESTOREConfig.from_json(json_str) 197 match += 1 198 except (ValidationError, ValueError) as e: 199 error_messages.append(str(e)) 200 # deserialize data into MILVUSConfig 201 try: 202 instance.actual_instance = MILVUSConfig.from_json(json_str) 203 match += 1 204 except (ValidationError, ValueError) as e: 205 error_messages.append(str(e)) 206 # deserialize data into POSTGRESQLConfig 207 try: 208 instance.actual_instance = POSTGRESQLConfig.from_json(json_str) 209 match += 1 210 except (ValidationError, ValueError) as e: 211 error_messages.append(str(e)) 212 # deserialize data into QDRANTConfig 213 try: 214 instance.actual_instance = QDRANTConfig.from_json(json_str) 215 match += 1 216 except (ValidationError, ValueError) as e: 217 error_messages.append(str(e)) 218 # deserialize data into SUPABASEConfig 219 try: 220 instance.actual_instance = SUPABASEConfig.from_json(json_str) 221 match += 1 222 except (ValidationError, ValueError) as e: 223 error_messages.append(str(e)) 224 # deserialize data into WEAVIATEConfig 225 try: 226 instance.actual_instance = WEAVIATEConfig.from_json(json_str) 227 match += 1 228 except (ValidationError, ValueError) as e: 229 error_messages.append(str(e)) 230 # deserialize data into AZUREAISEARCHConfig 231 try: 232 instance.actual_instance = AZUREAISEARCHConfig.from_json(json_str) 233 match += 1 234 except (ValidationError, ValueError) as e: 235 error_messages.append(str(e)) 236 # deserialize data into TURBOPUFFERConfig 237 try: 238 instance.actual_instance = TURBOPUFFERConfig.from_json(json_str) 239 match += 1 240 except (ValidationError, ValueError) as e: 241 error_messages.append(str(e)) 242 243 if match > 1: 244 # more than 1 match 245 raise ValueError("Multiple matches found when deserializing the JSON string into DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 246 elif match == 0: 247 # no match 248 raise ValueError("No match found when deserializing the JSON string into DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 249 else: 250 return instance 251 252 def to_json(self) -> str: 253 """Returns the JSON representation of the actual instance""" 254 if self.actual_instance is None: 255 return "null" 256 257 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 258 return self.actual_instance.to_json() 259 else: 260 return json.dumps(self.actual_instance) 261 262 def to_dict(self) -> Optional[Union[Dict[str, Any], AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig]]: 263 """Returns the dict representation of the actual instance""" 264 if self.actual_instance is None: 265 return None 266 267 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 268 return self.actual_instance.to_dict() 269 else: 270 # primitive type 271 return self.actual_instance 272 273 def to_str(self) -> str: 274 """Returns the string representation of the actual instance""" 275 return pprint.pformat(self.model_dump())
39class DestinationConnectorInputConfig(BaseModel): 40 """ 41 Configuration specific to the connector type 42 """ 43 # data type: CAPELLAConfig 44 oneof_schema_1_validator: Optional[CAPELLAConfig] = None 45 # data type: DATASTAXConfig 46 oneof_schema_2_validator: Optional[DATASTAXConfig] = None 47 # data type: ELASTICConfig 48 oneof_schema_3_validator: Optional[ELASTICConfig] = None 49 # data type: PINECONEConfig 50 oneof_schema_4_validator: Optional[PINECONEConfig] = None 51 # data type: SINGLESTOREConfig 52 oneof_schema_5_validator: Optional[SINGLESTOREConfig] = None 53 # data type: MILVUSConfig 54 oneof_schema_6_validator: Optional[MILVUSConfig] = None 55 # data type: POSTGRESQLConfig 56 oneof_schema_7_validator: Optional[POSTGRESQLConfig] = None 57 # data type: QDRANTConfig 58 oneof_schema_8_validator: Optional[QDRANTConfig] = None 59 # data type: SUPABASEConfig 60 oneof_schema_9_validator: Optional[SUPABASEConfig] = None 61 # data type: WEAVIATEConfig 62 oneof_schema_10_validator: Optional[WEAVIATEConfig] = None 63 # data type: AZUREAISEARCHConfig 64 oneof_schema_11_validator: Optional[AZUREAISEARCHConfig] = None 65 # data type: TURBOPUFFERConfig 66 oneof_schema_12_validator: Optional[TURBOPUFFERConfig] = None 67 actual_instance: Optional[Union[AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig]] = None 68 one_of_schemas: Set[str] = { "AZUREAISEARCHConfig", "CAPELLAConfig", "DATASTAXConfig", "ELASTICConfig", "MILVUSConfig", "PINECONEConfig", "POSTGRESQLConfig", "QDRANTConfig", "SINGLESTOREConfig", "SUPABASEConfig", "TURBOPUFFERConfig", "WEAVIATEConfig" } 69 70 model_config = ConfigDict( 71 validate_assignment=True, 72 protected_namespaces=(), 73 ) 74 75 76 def __init__(self, *args, **kwargs) -> None: 77 if args: 78 if len(args) > 1: 79 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 80 if kwargs: 81 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 82 super().__init__(actual_instance=args[0]) 83 else: 84 super().__init__(**kwargs) 85 86 @field_validator('actual_instance') 87 def actual_instance_must_validate_oneof(cls, v): 88 instance = DestinationConnectorInputConfig.model_construct() 89 error_messages = [] 90 match = 0 91 # validate data type: CAPELLAConfig 92 if not isinstance(v, CAPELLAConfig): 93 error_messages.append(f"Error! Input type `{type(v)}` is not `CAPELLAConfig`") 94 else: 95 match += 1 96 # validate data type: DATASTAXConfig 97 if not isinstance(v, DATASTAXConfig): 98 error_messages.append(f"Error! Input type `{type(v)}` is not `DATASTAXConfig`") 99 else: 100 match += 1 101 # validate data type: ELASTICConfig 102 if not isinstance(v, ELASTICConfig): 103 error_messages.append(f"Error! Input type `{type(v)}` is not `ELASTICConfig`") 104 else: 105 match += 1 106 # validate data type: PINECONEConfig 107 if not isinstance(v, PINECONEConfig): 108 error_messages.append(f"Error! Input type `{type(v)}` is not `PINECONEConfig`") 109 else: 110 match += 1 111 # validate data type: SINGLESTOREConfig 112 if not isinstance(v, SINGLESTOREConfig): 113 error_messages.append(f"Error! Input type `{type(v)}` is not `SINGLESTOREConfig`") 114 else: 115 match += 1 116 # validate data type: MILVUSConfig 117 if not isinstance(v, MILVUSConfig): 118 error_messages.append(f"Error! Input type `{type(v)}` is not `MILVUSConfig`") 119 else: 120 match += 1 121 # validate data type: POSTGRESQLConfig 122 if not isinstance(v, POSTGRESQLConfig): 123 error_messages.append(f"Error! Input type `{type(v)}` is not `POSTGRESQLConfig`") 124 else: 125 match += 1 126 # validate data type: QDRANTConfig 127 if not isinstance(v, QDRANTConfig): 128 error_messages.append(f"Error! Input type `{type(v)}` is not `QDRANTConfig`") 129 else: 130 match += 1 131 # validate data type: SUPABASEConfig 132 if not isinstance(v, SUPABASEConfig): 133 error_messages.append(f"Error! Input type `{type(v)}` is not `SUPABASEConfig`") 134 else: 135 match += 1 136 # validate data type: WEAVIATEConfig 137 if not isinstance(v, WEAVIATEConfig): 138 error_messages.append(f"Error! Input type `{type(v)}` is not `WEAVIATEConfig`") 139 else: 140 match += 1 141 # validate data type: AZUREAISEARCHConfig 142 if not isinstance(v, AZUREAISEARCHConfig): 143 error_messages.append(f"Error! Input type `{type(v)}` is not `AZUREAISEARCHConfig`") 144 else: 145 match += 1 146 # validate data type: TURBOPUFFERConfig 147 if not isinstance(v, TURBOPUFFERConfig): 148 error_messages.append(f"Error! Input type `{type(v)}` is not `TURBOPUFFERConfig`") 149 else: 150 match += 1 151 if match > 1: 152 # more than 1 match 153 raise ValueError("Multiple matches found when setting `actual_instance` in DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 154 elif match == 0: 155 # no match 156 raise ValueError("No match found when setting `actual_instance` in DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 157 else: 158 return v 159 160 @classmethod 161 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 162 return cls.from_json(json.dumps(obj)) 163 164 @classmethod 165 def from_json(cls, json_str: str) -> Self: 166 """Returns the object represented by the json string""" 167 instance = cls.model_construct() 168 error_messages = [] 169 match = 0 170 171 # deserialize data into CAPELLAConfig 172 try: 173 instance.actual_instance = CAPELLAConfig.from_json(json_str) 174 match += 1 175 except (ValidationError, ValueError) as e: 176 error_messages.append(str(e)) 177 # deserialize data into DATASTAXConfig 178 try: 179 instance.actual_instance = DATASTAXConfig.from_json(json_str) 180 match += 1 181 except (ValidationError, ValueError) as e: 182 error_messages.append(str(e)) 183 # deserialize data into ELASTICConfig 184 try: 185 instance.actual_instance = ELASTICConfig.from_json(json_str) 186 match += 1 187 except (ValidationError, ValueError) as e: 188 error_messages.append(str(e)) 189 # deserialize data into PINECONEConfig 190 try: 191 instance.actual_instance = PINECONEConfig.from_json(json_str) 192 match += 1 193 except (ValidationError, ValueError) as e: 194 error_messages.append(str(e)) 195 # deserialize data into SINGLESTOREConfig 196 try: 197 instance.actual_instance = SINGLESTOREConfig.from_json(json_str) 198 match += 1 199 except (ValidationError, ValueError) as e: 200 error_messages.append(str(e)) 201 # deserialize data into MILVUSConfig 202 try: 203 instance.actual_instance = MILVUSConfig.from_json(json_str) 204 match += 1 205 except (ValidationError, ValueError) as e: 206 error_messages.append(str(e)) 207 # deserialize data into POSTGRESQLConfig 208 try: 209 instance.actual_instance = POSTGRESQLConfig.from_json(json_str) 210 match += 1 211 except (ValidationError, ValueError) as e: 212 error_messages.append(str(e)) 213 # deserialize data into QDRANTConfig 214 try: 215 instance.actual_instance = QDRANTConfig.from_json(json_str) 216 match += 1 217 except (ValidationError, ValueError) as e: 218 error_messages.append(str(e)) 219 # deserialize data into SUPABASEConfig 220 try: 221 instance.actual_instance = SUPABASEConfig.from_json(json_str) 222 match += 1 223 except (ValidationError, ValueError) as e: 224 error_messages.append(str(e)) 225 # deserialize data into WEAVIATEConfig 226 try: 227 instance.actual_instance = WEAVIATEConfig.from_json(json_str) 228 match += 1 229 except (ValidationError, ValueError) as e: 230 error_messages.append(str(e)) 231 # deserialize data into AZUREAISEARCHConfig 232 try: 233 instance.actual_instance = AZUREAISEARCHConfig.from_json(json_str) 234 match += 1 235 except (ValidationError, ValueError) as e: 236 error_messages.append(str(e)) 237 # deserialize data into TURBOPUFFERConfig 238 try: 239 instance.actual_instance = TURBOPUFFERConfig.from_json(json_str) 240 match += 1 241 except (ValidationError, ValueError) as e: 242 error_messages.append(str(e)) 243 244 if match > 1: 245 # more than 1 match 246 raise ValueError("Multiple matches found when deserializing the JSON string into DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 247 elif match == 0: 248 # no match 249 raise ValueError("No match found when deserializing the JSON string into DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 250 else: 251 return instance 252 253 def to_json(self) -> str: 254 """Returns the JSON representation of the actual instance""" 255 if self.actual_instance is None: 256 return "null" 257 258 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 259 return self.actual_instance.to_json() 260 else: 261 return json.dumps(self.actual_instance) 262 263 def to_dict(self) -> Optional[Union[Dict[str, Any], AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig]]: 264 """Returns the dict representation of the actual instance""" 265 if self.actual_instance is None: 266 return None 267 268 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 269 return self.actual_instance.to_dict() 270 else: 271 # primitive type 272 return self.actual_instance 273 274 def to_str(self) -> str: 275 """Returns the string representation of the actual instance""" 276 return pprint.pformat(self.model_dump())
Configuration specific to the connector type
76 def __init__(self, *args, **kwargs) -> None: 77 if args: 78 if len(args) > 1: 79 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 80 if kwargs: 81 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 82 super().__init__(actual_instance=args[0]) 83 else: 84 super().__init__(**kwargs)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
86 @field_validator('actual_instance') 87 def actual_instance_must_validate_oneof(cls, v): 88 instance = DestinationConnectorInputConfig.model_construct() 89 error_messages = [] 90 match = 0 91 # validate data type: CAPELLAConfig 92 if not isinstance(v, CAPELLAConfig): 93 error_messages.append(f"Error! Input type `{type(v)}` is not `CAPELLAConfig`") 94 else: 95 match += 1 96 # validate data type: DATASTAXConfig 97 if not isinstance(v, DATASTAXConfig): 98 error_messages.append(f"Error! Input type `{type(v)}` is not `DATASTAXConfig`") 99 else: 100 match += 1 101 # validate data type: ELASTICConfig 102 if not isinstance(v, ELASTICConfig): 103 error_messages.append(f"Error! Input type `{type(v)}` is not `ELASTICConfig`") 104 else: 105 match += 1 106 # validate data type: PINECONEConfig 107 if not isinstance(v, PINECONEConfig): 108 error_messages.append(f"Error! Input type `{type(v)}` is not `PINECONEConfig`") 109 else: 110 match += 1 111 # validate data type: SINGLESTOREConfig 112 if not isinstance(v, SINGLESTOREConfig): 113 error_messages.append(f"Error! Input type `{type(v)}` is not `SINGLESTOREConfig`") 114 else: 115 match += 1 116 # validate data type: MILVUSConfig 117 if not isinstance(v, MILVUSConfig): 118 error_messages.append(f"Error! Input type `{type(v)}` is not `MILVUSConfig`") 119 else: 120 match += 1 121 # validate data type: POSTGRESQLConfig 122 if not isinstance(v, POSTGRESQLConfig): 123 error_messages.append(f"Error! Input type `{type(v)}` is not `POSTGRESQLConfig`") 124 else: 125 match += 1 126 # validate data type: QDRANTConfig 127 if not isinstance(v, QDRANTConfig): 128 error_messages.append(f"Error! Input type `{type(v)}` is not `QDRANTConfig`") 129 else: 130 match += 1 131 # validate data type: SUPABASEConfig 132 if not isinstance(v, SUPABASEConfig): 133 error_messages.append(f"Error! Input type `{type(v)}` is not `SUPABASEConfig`") 134 else: 135 match += 1 136 # validate data type: WEAVIATEConfig 137 if not isinstance(v, WEAVIATEConfig): 138 error_messages.append(f"Error! Input type `{type(v)}` is not `WEAVIATEConfig`") 139 else: 140 match += 1 141 # validate data type: AZUREAISEARCHConfig 142 if not isinstance(v, AZUREAISEARCHConfig): 143 error_messages.append(f"Error! Input type `{type(v)}` is not `AZUREAISEARCHConfig`") 144 else: 145 match += 1 146 # validate data type: TURBOPUFFERConfig 147 if not isinstance(v, TURBOPUFFERConfig): 148 error_messages.append(f"Error! Input type `{type(v)}` is not `TURBOPUFFERConfig`") 149 else: 150 match += 1 151 if match > 1: 152 # more than 1 match 153 raise ValueError("Multiple matches found when setting `actual_instance` in DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 154 elif match == 0: 155 # no match 156 raise ValueError("No match found when setting `actual_instance` in DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 157 else: 158 return v
164 @classmethod 165 def from_json(cls, json_str: str) -> Self: 166 """Returns the object represented by the json string""" 167 instance = cls.model_construct() 168 error_messages = [] 169 match = 0 170 171 # deserialize data into CAPELLAConfig 172 try: 173 instance.actual_instance = CAPELLAConfig.from_json(json_str) 174 match += 1 175 except (ValidationError, ValueError) as e: 176 error_messages.append(str(e)) 177 # deserialize data into DATASTAXConfig 178 try: 179 instance.actual_instance = DATASTAXConfig.from_json(json_str) 180 match += 1 181 except (ValidationError, ValueError) as e: 182 error_messages.append(str(e)) 183 # deserialize data into ELASTICConfig 184 try: 185 instance.actual_instance = ELASTICConfig.from_json(json_str) 186 match += 1 187 except (ValidationError, ValueError) as e: 188 error_messages.append(str(e)) 189 # deserialize data into PINECONEConfig 190 try: 191 instance.actual_instance = PINECONEConfig.from_json(json_str) 192 match += 1 193 except (ValidationError, ValueError) as e: 194 error_messages.append(str(e)) 195 # deserialize data into SINGLESTOREConfig 196 try: 197 instance.actual_instance = SINGLESTOREConfig.from_json(json_str) 198 match += 1 199 except (ValidationError, ValueError) as e: 200 error_messages.append(str(e)) 201 # deserialize data into MILVUSConfig 202 try: 203 instance.actual_instance = MILVUSConfig.from_json(json_str) 204 match += 1 205 except (ValidationError, ValueError) as e: 206 error_messages.append(str(e)) 207 # deserialize data into POSTGRESQLConfig 208 try: 209 instance.actual_instance = POSTGRESQLConfig.from_json(json_str) 210 match += 1 211 except (ValidationError, ValueError) as e: 212 error_messages.append(str(e)) 213 # deserialize data into QDRANTConfig 214 try: 215 instance.actual_instance = QDRANTConfig.from_json(json_str) 216 match += 1 217 except (ValidationError, ValueError) as e: 218 error_messages.append(str(e)) 219 # deserialize data into SUPABASEConfig 220 try: 221 instance.actual_instance = SUPABASEConfig.from_json(json_str) 222 match += 1 223 except (ValidationError, ValueError) as e: 224 error_messages.append(str(e)) 225 # deserialize data into WEAVIATEConfig 226 try: 227 instance.actual_instance = WEAVIATEConfig.from_json(json_str) 228 match += 1 229 except (ValidationError, ValueError) as e: 230 error_messages.append(str(e)) 231 # deserialize data into AZUREAISEARCHConfig 232 try: 233 instance.actual_instance = AZUREAISEARCHConfig.from_json(json_str) 234 match += 1 235 except (ValidationError, ValueError) as e: 236 error_messages.append(str(e)) 237 # deserialize data into TURBOPUFFERConfig 238 try: 239 instance.actual_instance = TURBOPUFFERConfig.from_json(json_str) 240 match += 1 241 except (ValidationError, ValueError) as e: 242 error_messages.append(str(e)) 243 244 if match > 1: 245 # more than 1 match 246 raise ValueError("Multiple matches found when deserializing the JSON string into DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 247 elif match == 0: 248 # no match 249 raise ValueError("No match found when deserializing the JSON string into DestinationConnectorInputConfig with oneOf schemas: AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig. Details: " + ", ".join(error_messages)) 250 else: 251 return instance
Returns the object represented by the json string
253 def to_json(self) -> str: 254 """Returns the JSON representation of the actual instance""" 255 if self.actual_instance is None: 256 return "null" 257 258 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 259 return self.actual_instance.to_json() 260 else: 261 return json.dumps(self.actual_instance)
Returns the JSON representation of the actual instance
263 def to_dict(self) -> Optional[Union[Dict[str, Any], AZUREAISEARCHConfig, CAPELLAConfig, DATASTAXConfig, ELASTICConfig, MILVUSConfig, PINECONEConfig, POSTGRESQLConfig, QDRANTConfig, SINGLESTOREConfig, SUPABASEConfig, TURBOPUFFERConfig, WEAVIATEConfig]]: 264 """Returns the dict representation of the actual instance""" 265 if self.actual_instance is None: 266 return None 267 268 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 269 return self.actual_instance.to_dict() 270 else: 271 # primitive type 272 return self.actual_instance
Returns the dict representation of the actual instance