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