vectorize_client.models.pinecone_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 pprint
 17import re  # noqa: F401
 18import json
 19
 20from pydantic import BaseModel, ConfigDict, Field, field_validator
 21from typing import Any, ClassVar, Dict, List, Optional
 22from typing_extensions import Annotated
 23from typing import Optional, Set
 24from typing_extensions import Self
 25
 26class PINECONEConfig(BaseModel):
 27    """
 28    Configuration for Pinecone connector
 29    """ # noqa: E501
 30    index: Annotated[str, Field(strict=True, max_length=45)] = Field(description="Index Name. Example: Enter index name")
 31    namespace: Optional[Annotated[str, Field(strict=True, max_length=45)]] = Field(default=None, description="Namespace. Example: Enter namespace")
 32    __properties: ClassVar[List[str]] = ["index", "namespace"]
 33
 34    @field_validator('index')
 35    def index_validate_regular_expression(cls, value):
 36        """Validates the regular expression"""
 37        if not re.match(r"^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$", value):
 38            raise ValueError(r"must validate the regular expression /^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$/")
 39        return value
 40
 41    @field_validator('namespace')
 42    def namespace_validate_regular_expression(cls, value):
 43        """Validates the regular expression"""
 44        if value is None:
 45            return value
 46
 47        if not re.match(r"^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$", value):
 48            raise ValueError(r"must validate the regular expression /^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$/")
 49        return value
 50
 51    model_config = ConfigDict(
 52        populate_by_name=True,
 53        validate_assignment=True,
 54        protected_namespaces=(),
 55    )
 56
 57
 58    def to_str(self) -> str:
 59        """Returns the string representation of the model using alias"""
 60        return pprint.pformat(self.model_dump(by_alias=True))
 61
 62    def to_json(self) -> str:
 63        """Returns the JSON representation of the model using alias"""
 64        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
 65        return json.dumps(self.to_dict())
 66
 67    @classmethod
 68    def from_json(cls, json_str: str) -> Optional[Self]:
 69        """Create an instance of PINECONEConfig from a JSON string"""
 70        return cls.from_dict(json.loads(json_str))
 71
 72    def to_dict(self) -> Dict[str, Any]:
 73        """Return the dictionary representation of the model using alias.
 74
 75        This has the following differences from calling pydantic's
 76        `self.model_dump(by_alias=True)`:
 77
 78        * `None` is only added to the output dict for nullable fields that
 79          were set at model initialization. Other fields with value `None`
 80          are ignored.
 81        """
 82        excluded_fields: Set[str] = set([
 83        ])
 84
 85        _dict = self.model_dump(
 86            by_alias=True,
 87            exclude=excluded_fields,
 88            exclude_none=True,
 89        )
 90        return _dict
 91
 92    @classmethod
 93    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 94        """Create an instance of PINECONEConfig from a dict"""
 95        if obj is None:
 96            return None
 97
 98        if not isinstance(obj, dict):
 99            return cls.model_validate(obj)
100
101        _obj = cls.model_validate({
102            "index": obj.get("index"),
103            "namespace": obj.get("namespace")
104        })
105        return _obj
class PINECONEConfig(pydantic.main.BaseModel):
 27class PINECONEConfig(BaseModel):
 28    """
 29    Configuration for Pinecone connector
 30    """ # noqa: E501
 31    index: Annotated[str, Field(strict=True, max_length=45)] = Field(description="Index Name. Example: Enter index name")
 32    namespace: Optional[Annotated[str, Field(strict=True, max_length=45)]] = Field(default=None, description="Namespace. Example: Enter namespace")
 33    __properties: ClassVar[List[str]] = ["index", "namespace"]
 34
 35    @field_validator('index')
 36    def index_validate_regular_expression(cls, value):
 37        """Validates the regular expression"""
 38        if not re.match(r"^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$", value):
 39            raise ValueError(r"must validate the regular expression /^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$/")
 40        return value
 41
 42    @field_validator('namespace')
 43    def namespace_validate_regular_expression(cls, value):
 44        """Validates the regular expression"""
 45        if value is None:
 46            return value
 47
 48        if not re.match(r"^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$", value):
 49            raise ValueError(r"must validate the regular expression /^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$/")
 50        return value
 51
 52    model_config = ConfigDict(
 53        populate_by_name=True,
 54        validate_assignment=True,
 55        protected_namespaces=(),
 56    )
 57
 58
 59    def to_str(self) -> str:
 60        """Returns the string representation of the model using alias"""
 61        return pprint.pformat(self.model_dump(by_alias=True))
 62
 63    def to_json(self) -> str:
 64        """Returns the JSON representation of the model using alias"""
 65        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
 66        return json.dumps(self.to_dict())
 67
 68    @classmethod
 69    def from_json(cls, json_str: str) -> Optional[Self]:
 70        """Create an instance of PINECONEConfig from a JSON string"""
 71        return cls.from_dict(json.loads(json_str))
 72
 73    def to_dict(self) -> Dict[str, Any]:
 74        """Return the dictionary representation of the model using alias.
 75
 76        This has the following differences from calling pydantic's
 77        `self.model_dump(by_alias=True)`:
 78
 79        * `None` is only added to the output dict for nullable fields that
 80          were set at model initialization. Other fields with value `None`
 81          are ignored.
 82        """
 83        excluded_fields: Set[str] = set([
 84        ])
 85
 86        _dict = self.model_dump(
 87            by_alias=True,
 88            exclude=excluded_fields,
 89            exclude_none=True,
 90        )
 91        return _dict
 92
 93    @classmethod
 94    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 95        """Create an instance of PINECONEConfig from a dict"""
 96        if obj is None:
 97            return None
 98
 99        if not isinstance(obj, dict):
100            return cls.model_validate(obj)
101
102        _obj = cls.model_validate({
103            "index": obj.get("index"),
104            "namespace": obj.get("namespace")
105        })
106        return _obj

Configuration for Pinecone connector

index: typing.Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), MaxLen(max_length=45)])]
namespace: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), MaxLen(max_length=45)])]]
@field_validator('index')
def index_validate_regular_expression(cls, value):
35    @field_validator('index')
36    def index_validate_regular_expression(cls, value):
37        """Validates the regular expression"""
38        if not re.match(r"^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$", value):
39            raise ValueError(r"must validate the regular expression /^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$/")
40        return value

Validates the regular expression

@field_validator('namespace')
def namespace_validate_regular_expression(cls, value):
42    @field_validator('namespace')
43    def namespace_validate_regular_expression(cls, value):
44        """Validates the regular expression"""
45        if value is None:
46            return value
47
48        if not re.match(r"^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$", value):
49            raise ValueError(r"must validate the regular expression /^(?!.*--)(?!^-)(?!.*-$)[a-z0-9-]+$/")
50        return value

Validates the regular expression

model_config = {'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': (), 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

def to_str(self) -> str:
59    def to_str(self) -> str:
60        """Returns the string representation of the model using alias"""
61        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

def to_json(self) -> str:
63    def to_json(self) -> str:
64        """Returns the JSON representation of the model using alias"""
65        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66        return json.dumps(self.to_dict())

Returns the JSON representation of the model using alias

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
68    @classmethod
69    def from_json(cls, json_str: str) -> Optional[Self]:
70        """Create an instance of PINECONEConfig from a JSON string"""
71        return cls.from_dict(json.loads(json_str))

Create an instance of PINECONEConfig from a JSON string

def to_dict(self) -> Dict[str, Any]:
73    def to_dict(self) -> Dict[str, Any]:
74        """Return the dictionary representation of the model using alias.
75
76        This has the following differences from calling pydantic's
77        `self.model_dump(by_alias=True)`:
78
79        * `None` is only added to the output dict for nullable fields that
80          were set at model initialization. Other fields with value `None`
81          are ignored.
82        """
83        excluded_fields: Set[str] = set([
84        ])
85
86        _dict = self.model_dump(
87            by_alias=True,
88            exclude=excluded_fields,
89            exclude_none=True,
90        )
91        return _dict

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 93    @classmethod
 94    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 95        """Create an instance of PINECONEConfig from a dict"""
 96        if obj is None:
 97            return None
 98
 99        if not isinstance(obj, dict):
100            return cls.model_validate(obj)
101
102        _obj = cls.model_validate({
103            "index": obj.get("index"),
104            "namespace": obj.get("namespace")
105        })
106        return _obj

Create an instance of PINECONEConfig from a dict