vectorize_client.models.azureblob_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, StrictBool, StrictStr, field_validator
 21from typing import Any, ClassVar, Dict, List, Optional, Union
 22from typing_extensions import Annotated
 23from typing import Optional, Set
 24from typing_extensions import Self
 25
 26class AZUREBLOBConfig(BaseModel):
 27    """
 28    Configuration for Azure Blob Storage connector
 29    """ # noqa: E501
 30    file_extensions: List[StrictStr] = Field(description="File Extensions", alias="file-extensions")
 31    idle_time: Union[Annotated[float, Field(strict=True, ge=1)], Annotated[int, Field(strict=True, ge=1)]] = Field(description="Polling Interval (seconds)", alias="idle-time")
 32    recursive: Optional[StrictBool] = Field(default=None, description="Recursively scan all folders in the bucket")
 33    path_prefix: Optional[StrictStr] = Field(default=None, description="Path Prefix", alias="path-prefix")
 34    path_metadata_regex: Optional[StrictStr] = Field(default=None, description="Path Metadata Regex", alias="path-metadata-regex")
 35    path_regex_group_names: Optional[List[StrictStr]] = Field(default=None, description="Path Regex Group Names. Example: Enter Group Name", alias="path-regex-group-names")
 36    __properties: ClassVar[List[str]] = ["file-extensions", "idle-time", "recursive", "path-prefix", "path-metadata-regex", "path-regex-group-names"]
 37
 38    @field_validator('file_extensions')
 39    def file_extensions_validate_enum(cls, value):
 40        """Validates the enum"""
 41        for i in value:
 42            if i not in set(['pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv']):
 43                raise ValueError("each list item must be one of ('pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv')")
 44        return value
 45
 46    model_config = ConfigDict(
 47        populate_by_name=True,
 48        validate_assignment=True,
 49        protected_namespaces=(),
 50    )
 51
 52
 53    def to_str(self) -> str:
 54        """Returns the string representation of the model using alias"""
 55        return pprint.pformat(self.model_dump(by_alias=True))
 56
 57    def to_json(self) -> str:
 58        """Returns the JSON representation of the model using alias"""
 59        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
 60        return json.dumps(self.to_dict())
 61
 62    @classmethod
 63    def from_json(cls, json_str: str) -> Optional[Self]:
 64        """Create an instance of AZUREBLOBConfig from a JSON string"""
 65        return cls.from_dict(json.loads(json_str))
 66
 67    def to_dict(self) -> Dict[str, Any]:
 68        """Return the dictionary representation of the model using alias.
 69
 70        This has the following differences from calling pydantic's
 71        `self.model_dump(by_alias=True)`:
 72
 73        * `None` is only added to the output dict for nullable fields that
 74          were set at model initialization. Other fields with value `None`
 75          are ignored.
 76        """
 77        excluded_fields: Set[str] = set([
 78        ])
 79
 80        _dict = self.model_dump(
 81            by_alias=True,
 82            exclude=excluded_fields,
 83            exclude_none=True,
 84        )
 85        return _dict
 86
 87    @classmethod
 88    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 89        """Create an instance of AZUREBLOBConfig from a dict"""
 90        if obj is None:
 91            return None
 92
 93        if not isinstance(obj, dict):
 94            return cls.model_validate(obj)
 95
 96        _obj = cls.model_validate({
 97            "file-extensions": obj.get("file-extensions"),
 98            "idle-time": obj.get("idle-time") if obj.get("idle-time") is not None else 30,
 99            "recursive": obj.get("recursive"),
100            "path-prefix": obj.get("path-prefix"),
101            "path-metadata-regex": obj.get("path-metadata-regex"),
102            "path-regex-group-names": obj.get("path-regex-group-names")
103        })
104        return _obj
class AZUREBLOBConfig(pydantic.main.BaseModel):
 27class AZUREBLOBConfig(BaseModel):
 28    """
 29    Configuration for Azure Blob Storage connector
 30    """ # noqa: E501
 31    file_extensions: List[StrictStr] = Field(description="File Extensions", alias="file-extensions")
 32    idle_time: Union[Annotated[float, Field(strict=True, ge=1)], Annotated[int, Field(strict=True, ge=1)]] = Field(description="Polling Interval (seconds)", alias="idle-time")
 33    recursive: Optional[StrictBool] = Field(default=None, description="Recursively scan all folders in the bucket")
 34    path_prefix: Optional[StrictStr] = Field(default=None, description="Path Prefix", alias="path-prefix")
 35    path_metadata_regex: Optional[StrictStr] = Field(default=None, description="Path Metadata Regex", alias="path-metadata-regex")
 36    path_regex_group_names: Optional[List[StrictStr]] = Field(default=None, description="Path Regex Group Names. Example: Enter Group Name", alias="path-regex-group-names")
 37    __properties: ClassVar[List[str]] = ["file-extensions", "idle-time", "recursive", "path-prefix", "path-metadata-regex", "path-regex-group-names"]
 38
 39    @field_validator('file_extensions')
 40    def file_extensions_validate_enum(cls, value):
 41        """Validates the enum"""
 42        for i in value:
 43            if i not in set(['pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv']):
 44                raise ValueError("each list item must be one of ('pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv')")
 45        return value
 46
 47    model_config = ConfigDict(
 48        populate_by_name=True,
 49        validate_assignment=True,
 50        protected_namespaces=(),
 51    )
 52
 53
 54    def to_str(self) -> str:
 55        """Returns the string representation of the model using alias"""
 56        return pprint.pformat(self.model_dump(by_alias=True))
 57
 58    def to_json(self) -> str:
 59        """Returns the JSON representation of the model using alias"""
 60        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
 61        return json.dumps(self.to_dict())
 62
 63    @classmethod
 64    def from_json(cls, json_str: str) -> Optional[Self]:
 65        """Create an instance of AZUREBLOBConfig from a JSON string"""
 66        return cls.from_dict(json.loads(json_str))
 67
 68    def to_dict(self) -> Dict[str, Any]:
 69        """Return the dictionary representation of the model using alias.
 70
 71        This has the following differences from calling pydantic's
 72        `self.model_dump(by_alias=True)`:
 73
 74        * `None` is only added to the output dict for nullable fields that
 75          were set at model initialization. Other fields with value `None`
 76          are ignored.
 77        """
 78        excluded_fields: Set[str] = set([
 79        ])
 80
 81        _dict = self.model_dump(
 82            by_alias=True,
 83            exclude=excluded_fields,
 84            exclude_none=True,
 85        )
 86        return _dict
 87
 88    @classmethod
 89    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 90        """Create an instance of AZUREBLOBConfig from a dict"""
 91        if obj is None:
 92            return None
 93
 94        if not isinstance(obj, dict):
 95            return cls.model_validate(obj)
 96
 97        _obj = cls.model_validate({
 98            "file-extensions": obj.get("file-extensions"),
 99            "idle-time": obj.get("idle-time") if obj.get("idle-time") is not None else 30,
100            "recursive": obj.get("recursive"),
101            "path-prefix": obj.get("path-prefix"),
102            "path-metadata-regex": obj.get("path-metadata-regex"),
103            "path-regex-group-names": obj.get("path-regex-group-names")
104        })
105        return _obj

Configuration for Azure Blob Storage connector

file_extensions: List[Annotated[str, Strict(strict=True)]]
idle_time: Union[Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])], Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])]]
recursive: Optional[Annotated[bool, Strict(strict=True)]]
path_prefix: Optional[Annotated[str, Strict(strict=True)]]
path_metadata_regex: Optional[Annotated[str, Strict(strict=True)]]
path_regex_group_names: Optional[List[Annotated[str, Strict(strict=True)]]]
@field_validator('file_extensions')
def file_extensions_validate_enum(cls, value):
39    @field_validator('file_extensions')
40    def file_extensions_validate_enum(cls, value):
41        """Validates the enum"""
42        for i in value:
43            if i not in set(['pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv']):
44                raise ValueError("each list item must be one of ('pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv')")
45        return value

Validates the enum

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:
54    def to_str(self) -> str:
55        """Returns the string representation of the model using alias"""
56        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

def to_json(self) -> str:
58    def to_json(self) -> str:
59        """Returns the JSON representation of the model using alias"""
60        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61        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]:
63    @classmethod
64    def from_json(cls, json_str: str) -> Optional[Self]:
65        """Create an instance of AZUREBLOBConfig from a JSON string"""
66        return cls.from_dict(json.loads(json_str))

Create an instance of AZUREBLOBConfig from a JSON string

def to_dict(self) -> Dict[str, Any]:
68    def to_dict(self) -> Dict[str, Any]:
69        """Return the dictionary representation of the model using alias.
70
71        This has the following differences from calling pydantic's
72        `self.model_dump(by_alias=True)`:
73
74        * `None` is only added to the output dict for nullable fields that
75          were set at model initialization. Other fields with value `None`
76          are ignored.
77        """
78        excluded_fields: Set[str] = set([
79        ])
80
81        _dict = self.model_dump(
82            by_alias=True,
83            exclude=excluded_fields,
84            exclude_none=True,
85        )
86        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]:
 88    @classmethod
 89    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 90        """Create an instance of AZUREBLOBConfig from a dict"""
 91        if obj is None:
 92            return None
 93
 94        if not isinstance(obj, dict):
 95            return cls.model_validate(obj)
 96
 97        _obj = cls.model_validate({
 98            "file-extensions": obj.get("file-extensions"),
 99            "idle-time": obj.get("idle-time") if obj.get("idle-time") is not None else 30,
100            "recursive": obj.get("recursive"),
101            "path-prefix": obj.get("path-prefix"),
102            "path-metadata-regex": obj.get("path-metadata-regex"),
103            "path-regex-group-names": obj.get("path-regex-group-names")
104        })
105        return _obj

Create an instance of AZUREBLOBConfig from a dict