vectorize_client.models.update_ai_platform_connector_request
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.bedrock1 import Bedrock1 21from vectorize_client.models.openai1 import Openai1 22from vectorize_client.models.vertex1 import Vertex1 23from vectorize_client.models.voyage1 import Voyage1 24from pydantic import StrictStr, Field 25from typing import Union, List, Set, Optional, Dict 26from typing_extensions import Literal, Self 27 28UPDATEAIPLATFORMCONNECTORREQUEST_ONE_OF_SCHEMAS = ["Bedrock1", "Openai1", "Vertex1", "Voyage1"] 29 30class UpdateAIPlatformConnectorRequest(BaseModel): 31 """ 32 UpdateAIPlatformConnectorRequest 33 """ 34 # data type: Bedrock1 35 oneof_schema_1_validator: Optional[Bedrock1] = None 36 # data type: Vertex1 37 oneof_schema_2_validator: Optional[Vertex1] = None 38 # data type: Openai1 39 oneof_schema_3_validator: Optional[Openai1] = None 40 # data type: Voyage1 41 oneof_schema_4_validator: Optional[Voyage1] = None 42 actual_instance: Optional[Union[Bedrock1, Openai1, Vertex1, Voyage1]] = None 43 one_of_schemas: Set[str] = { "Bedrock1", "Openai1", "Vertex1", "Voyage1" } 44 45 model_config = ConfigDict( 46 validate_assignment=True, 47 protected_namespaces=(), 48 ) 49 50 51 def __init__(self, *args, **kwargs) -> None: 52 if args: 53 if len(args) > 1: 54 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 55 if kwargs: 56 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 57 super().__init__(actual_instance=args[0]) 58 else: 59 super().__init__(**kwargs) 60 61 @field_validator('actual_instance') 62 def actual_instance_must_validate_oneof(cls, v): 63 instance = UpdateAIPlatformConnectorRequest.model_construct() 64 error_messages = [] 65 match = 0 66 # validate data type: Bedrock1 67 if not isinstance(v, Bedrock1): 68 error_messages.append(f"Error! Input type `{type(v)}` is not `Bedrock1`") 69 else: 70 match += 1 71 # validate data type: Vertex1 72 if not isinstance(v, Vertex1): 73 error_messages.append(f"Error! Input type `{type(v)}` is not `Vertex1`") 74 else: 75 match += 1 76 # validate data type: Openai1 77 if not isinstance(v, Openai1): 78 error_messages.append(f"Error! Input type `{type(v)}` is not `Openai1`") 79 else: 80 match += 1 81 # validate data type: Voyage1 82 if not isinstance(v, Voyage1): 83 error_messages.append(f"Error! Input type `{type(v)}` is not `Voyage1`") 84 else: 85 match += 1 86 if match > 1: 87 # more than 1 match 88 raise ValueError("Multiple matches found when setting `actual_instance` in UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 89 elif match == 0: 90 # no match 91 raise ValueError("No match found when setting `actual_instance` in UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 92 else: 93 return v 94 95 @classmethod 96 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 97 return cls.from_json(json.dumps(obj)) 98 99 @classmethod 100 def from_json(cls, json_str: str) -> Self: 101 """Returns the object represented by the json string""" 102 instance = cls.model_construct() 103 error_messages = [] 104 match = 0 105 106 # deserialize data into Bedrock1 107 try: 108 instance.actual_instance = Bedrock1.from_json(json_str) 109 match += 1 110 except (ValidationError, ValueError) as e: 111 error_messages.append(str(e)) 112 # deserialize data into Vertex1 113 try: 114 instance.actual_instance = Vertex1.from_json(json_str) 115 match += 1 116 except (ValidationError, ValueError) as e: 117 error_messages.append(str(e)) 118 # deserialize data into Openai1 119 try: 120 instance.actual_instance = Openai1.from_json(json_str) 121 match += 1 122 except (ValidationError, ValueError) as e: 123 error_messages.append(str(e)) 124 # deserialize data into Voyage1 125 try: 126 instance.actual_instance = Voyage1.from_json(json_str) 127 match += 1 128 except (ValidationError, ValueError) as e: 129 error_messages.append(str(e)) 130 131 if match > 1: 132 # more than 1 match 133 raise ValueError("Multiple matches found when deserializing the JSON string into UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 134 elif match == 0: 135 # no match 136 raise ValueError("No match found when deserializing the JSON string into UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 137 else: 138 return instance 139 140 def to_json(self) -> str: 141 """Returns the JSON representation of the actual instance""" 142 if self.actual_instance is None: 143 return "null" 144 145 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 146 return self.actual_instance.to_json() 147 else: 148 return json.dumps(self.actual_instance) 149 150 def to_dict(self) -> Optional[Union[Dict[str, Any], Bedrock1, Openai1, Vertex1, Voyage1]]: 151 """Returns the dict representation of the actual instance""" 152 if self.actual_instance is None: 153 return None 154 155 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 156 return self.actual_instance.to_dict() 157 else: 158 # primitive type 159 return self.actual_instance 160 161 def to_str(self) -> str: 162 """Returns the string representation of the actual instance""" 163 return pprint.pformat(self.model_dump())
UPDATEAIPLATFORMCONNECTORREQUEST_ONE_OF_SCHEMAS =
['Bedrock1', 'Openai1', 'Vertex1', 'Voyage1']
class
UpdateAIPlatformConnectorRequest(pydantic.main.BaseModel):
31class UpdateAIPlatformConnectorRequest(BaseModel): 32 """ 33 UpdateAIPlatformConnectorRequest 34 """ 35 # data type: Bedrock1 36 oneof_schema_1_validator: Optional[Bedrock1] = None 37 # data type: Vertex1 38 oneof_schema_2_validator: Optional[Vertex1] = None 39 # data type: Openai1 40 oneof_schema_3_validator: Optional[Openai1] = None 41 # data type: Voyage1 42 oneof_schema_4_validator: Optional[Voyage1] = None 43 actual_instance: Optional[Union[Bedrock1, Openai1, Vertex1, Voyage1]] = None 44 one_of_schemas: Set[str] = { "Bedrock1", "Openai1", "Vertex1", "Voyage1" } 45 46 model_config = ConfigDict( 47 validate_assignment=True, 48 protected_namespaces=(), 49 ) 50 51 52 def __init__(self, *args, **kwargs) -> None: 53 if args: 54 if len(args) > 1: 55 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 56 if kwargs: 57 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 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 = UpdateAIPlatformConnectorRequest.model_construct() 65 error_messages = [] 66 match = 0 67 # validate data type: Bedrock1 68 if not isinstance(v, Bedrock1): 69 error_messages.append(f"Error! Input type `{type(v)}` is not `Bedrock1`") 70 else: 71 match += 1 72 # validate data type: Vertex1 73 if not isinstance(v, Vertex1): 74 error_messages.append(f"Error! Input type `{type(v)}` is not `Vertex1`") 75 else: 76 match += 1 77 # validate data type: Openai1 78 if not isinstance(v, Openai1): 79 error_messages.append(f"Error! Input type `{type(v)}` is not `Openai1`") 80 else: 81 match += 1 82 # validate data type: Voyage1 83 if not isinstance(v, Voyage1): 84 error_messages.append(f"Error! Input type `{type(v)}` is not `Voyage1`") 85 else: 86 match += 1 87 if match > 1: 88 # more than 1 match 89 raise ValueError("Multiple matches found when setting `actual_instance` in UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 90 elif match == 0: 91 # no match 92 raise ValueError("No match found when setting `actual_instance` in UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 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 Bedrock1 108 try: 109 instance.actual_instance = Bedrock1.from_json(json_str) 110 match += 1 111 except (ValidationError, ValueError) as e: 112 error_messages.append(str(e)) 113 # deserialize data into Vertex1 114 try: 115 instance.actual_instance = Vertex1.from_json(json_str) 116 match += 1 117 except (ValidationError, ValueError) as e: 118 error_messages.append(str(e)) 119 # deserialize data into Openai1 120 try: 121 instance.actual_instance = Openai1.from_json(json_str) 122 match += 1 123 except (ValidationError, ValueError) as e: 124 error_messages.append(str(e)) 125 # deserialize data into Voyage1 126 try: 127 instance.actual_instance = Voyage1.from_json(json_str) 128 match += 1 129 except (ValidationError, ValueError) as e: 130 error_messages.append(str(e)) 131 132 if match > 1: 133 # more than 1 match 134 raise ValueError("Multiple matches found when deserializing the JSON string into UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 135 elif match == 0: 136 # no match 137 raise ValueError("No match found when deserializing the JSON string into UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 138 else: 139 return instance 140 141 def to_json(self) -> str: 142 """Returns the JSON representation of the actual instance""" 143 if self.actual_instance is None: 144 return "null" 145 146 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 147 return self.actual_instance.to_json() 148 else: 149 return json.dumps(self.actual_instance) 150 151 def to_dict(self) -> Optional[Union[Dict[str, Any], Bedrock1, Openai1, Vertex1, Voyage1]]: 152 """Returns the dict representation of the actual instance""" 153 if self.actual_instance is None: 154 return None 155 156 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 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())
UpdateAIPlatformConnectorRequest
UpdateAIPlatformConnectorRequest(*args, **kwargs)
52 def __init__(self, *args, **kwargs) -> None: 53 if args: 54 if len(args) > 1: 55 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 56 if kwargs: 57 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 58 super().__init__(actual_instance=args[0]) 59 else: 60 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.
oneof_schema_1_validator: Optional[vectorize_client.models.bedrock1.Bedrock1]
oneof_schema_2_validator: Optional[vectorize_client.models.vertex1.Vertex1]
oneof_schema_3_validator: Optional[vectorize_client.models.openai1.Openai1]
oneof_schema_4_validator: Optional[vectorize_client.models.voyage1.Voyage1]
actual_instance: Union[vectorize_client.models.bedrock1.Bedrock1, vectorize_client.models.openai1.Openai1, vectorize_client.models.vertex1.Vertex1, vectorize_client.models.voyage1.Voyage1, NoneType]
model_config =
{'validate_assignment': True, 'protected_namespaces': ()}
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
@field_validator('actual_instance')
def
actual_instance_must_validate_oneof(cls, v):
62 @field_validator('actual_instance') 63 def actual_instance_must_validate_oneof(cls, v): 64 instance = UpdateAIPlatformConnectorRequest.model_construct() 65 error_messages = [] 66 match = 0 67 # validate data type: Bedrock1 68 if not isinstance(v, Bedrock1): 69 error_messages.append(f"Error! Input type `{type(v)}` is not `Bedrock1`") 70 else: 71 match += 1 72 # validate data type: Vertex1 73 if not isinstance(v, Vertex1): 74 error_messages.append(f"Error! Input type `{type(v)}` is not `Vertex1`") 75 else: 76 match += 1 77 # validate data type: Openai1 78 if not isinstance(v, Openai1): 79 error_messages.append(f"Error! Input type `{type(v)}` is not `Openai1`") 80 else: 81 match += 1 82 # validate data type: Voyage1 83 if not isinstance(v, Voyage1): 84 error_messages.append(f"Error! Input type `{type(v)}` is not `Voyage1`") 85 else: 86 match += 1 87 if match > 1: 88 # more than 1 match 89 raise ValueError("Multiple matches found when setting `actual_instance` in UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 90 elif match == 0: 91 # no match 92 raise ValueError("No match found when setting `actual_instance` in UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 93 else: 94 return v
@classmethod
def
from_json(cls, json_str: str) -> Self:
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 Bedrock1 108 try: 109 instance.actual_instance = Bedrock1.from_json(json_str) 110 match += 1 111 except (ValidationError, ValueError) as e: 112 error_messages.append(str(e)) 113 # deserialize data into Vertex1 114 try: 115 instance.actual_instance = Vertex1.from_json(json_str) 116 match += 1 117 except (ValidationError, ValueError) as e: 118 error_messages.append(str(e)) 119 # deserialize data into Openai1 120 try: 121 instance.actual_instance = Openai1.from_json(json_str) 122 match += 1 123 except (ValidationError, ValueError) as e: 124 error_messages.append(str(e)) 125 # deserialize data into Voyage1 126 try: 127 instance.actual_instance = Voyage1.from_json(json_str) 128 match += 1 129 except (ValidationError, ValueError) as e: 130 error_messages.append(str(e)) 131 132 if match > 1: 133 # more than 1 match 134 raise ValueError("Multiple matches found when deserializing the JSON string into UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 135 elif match == 0: 136 # no match 137 raise ValueError("No match found when deserializing the JSON string into UpdateAIPlatformConnectorRequest with oneOf schemas: Bedrock1, Openai1, Vertex1, Voyage1. Details: " + ", ".join(error_messages)) 138 else: 139 return instance
Returns the object represented by the json string
def
to_json(self) -> str:
141 def to_json(self) -> str: 142 """Returns the JSON representation of the actual instance""" 143 if self.actual_instance is None: 144 return "null" 145 146 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 147 return self.actual_instance.to_json() 148 else: 149 return json.dumps(self.actual_instance)
Returns the JSON representation of the actual instance
def
to_dict( self) -> Union[Dict[str, Any], vectorize_client.models.bedrock1.Bedrock1, vectorize_client.models.openai1.Openai1, vectorize_client.models.vertex1.Vertex1, vectorize_client.models.voyage1.Voyage1, NoneType]:
151 def to_dict(self) -> Optional[Union[Dict[str, Any], Bedrock1, Openai1, Vertex1, Voyage1]]: 152 """Returns the dict representation of the actual instance""" 153 if self.actual_instance is None: 154 return None 155 156 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 157 return self.actual_instance.to_dict() 158 else: 159 # primitive type 160 return self.actual_instance
Returns the dict representation of the actual instance