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