vectorize_client.models.firecrawl_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, StrictStr, field_validator 21from typing import Any, ClassVar, Dict, List 22from typing import Optional, Set 23from typing_extensions import Self 24 25class FIRECRAWLConfig(BaseModel): 26 """ 27 Configuration for Firecrawl connector 28 """ # noqa: E501 29 endpoint: StrictStr = Field(description="Endpoint. Example: Choose which api endpoint to use") 30 request: Dict[str, Any] = Field(description="Request Body. Example: JSON config for firecrawl's /crawl or /scrape endpoint.") 31 __properties: ClassVar[List[str]] = ["endpoint", "request"] 32 33 @field_validator('endpoint') 34 def endpoint_validate_enum(cls, value): 35 """Validates the enum""" 36 if value not in set(['Crawl', 'Scrape']): 37 raise ValueError("must be one of enum values ('Crawl', 'Scrape')") 38 return value 39 40 model_config = ConfigDict( 41 populate_by_name=True, 42 validate_assignment=True, 43 protected_namespaces=(), 44 ) 45 46 47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True)) 50 51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 54 return json.dumps(self.to_dict()) 55 56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of FIRECRAWLConfig from a JSON string""" 59 return cls.from_dict(json.loads(json_str)) 60 61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 """ 71 excluded_fields: Set[str] = set([ 72 ]) 73 74 _dict = self.model_dump( 75 by_alias=True, 76 exclude=excluded_fields, 77 exclude_none=True, 78 ) 79 return _dict 80 81 @classmethod 82 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 83 """Create an instance of FIRECRAWLConfig from a dict""" 84 if obj is None: 85 return None 86 87 if not isinstance(obj, dict): 88 return cls.model_validate(obj) 89 90 _obj = cls.model_validate({ 91 "endpoint": obj.get("endpoint") if obj.get("endpoint") is not None else 'Crawl', 92 "request": obj.get("request") 93 }) 94 return _obj
class
FIRECRAWLConfig(pydantic.main.BaseModel):
26class FIRECRAWLConfig(BaseModel): 27 """ 28 Configuration for Firecrawl connector 29 """ # noqa: E501 30 endpoint: StrictStr = Field(description="Endpoint. Example: Choose which api endpoint to use") 31 request: Dict[str, Any] = Field(description="Request Body. Example: JSON config for firecrawl's /crawl or /scrape endpoint.") 32 __properties: ClassVar[List[str]] = ["endpoint", "request"] 33 34 @field_validator('endpoint') 35 def endpoint_validate_enum(cls, value): 36 """Validates the enum""" 37 if value not in set(['Crawl', 'Scrape']): 38 raise ValueError("must be one of enum values ('Crawl', 'Scrape')") 39 return value 40 41 model_config = ConfigDict( 42 populate_by_name=True, 43 validate_assignment=True, 44 protected_namespaces=(), 45 ) 46 47 48 def to_str(self) -> str: 49 """Returns the string representation of the model using alias""" 50 return pprint.pformat(self.model_dump(by_alias=True)) 51 52 def to_json(self) -> str: 53 """Returns the JSON representation of the model using alias""" 54 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 return json.dumps(self.to_dict()) 56 57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of FIRECRAWLConfig from a JSON string""" 60 return cls.from_dict(json.loads(json_str)) 61 62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 """ 72 excluded_fields: Set[str] = set([ 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 return _dict 81 82 @classmethod 83 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 84 """Create an instance of FIRECRAWLConfig from a dict""" 85 if obj is None: 86 return None 87 88 if not isinstance(obj, dict): 89 return cls.model_validate(obj) 90 91 _obj = cls.model_validate({ 92 "endpoint": obj.get("endpoint") if obj.get("endpoint") is not None else 'Crawl', 93 "request": obj.get("request") 94 }) 95 return _obj
Configuration for Firecrawl connector
@field_validator('endpoint')
def
endpoint_validate_enum(cls, value):
34 @field_validator('endpoint') 35 def endpoint_validate_enum(cls, value): 36 """Validates the enum""" 37 if value not in set(['Crawl', 'Scrape']): 38 raise ValueError("must be one of enum values ('Crawl', 'Scrape')") 39 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:
48 def to_str(self) -> str: 49 """Returns the string representation of the model using alias""" 50 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
def
to_json(self) -> str:
52 def to_json(self) -> str: 53 """Returns the JSON representation of the model using alias""" 54 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 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]:
57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of FIRECRAWLConfig from a JSON string""" 60 return cls.from_dict(json.loads(json_str))
Create an instance of FIRECRAWLConfig from a JSON string
def
to_dict(self) -> Dict[str, Any]:
62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 """ 72 excluded_fields: Set[str] = set([ 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 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 valueNone
are ignored.
@classmethod
def
from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82 @classmethod 83 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 84 """Create an instance of FIRECRAWLConfig from a dict""" 85 if obj is None: 86 return None 87 88 if not isinstance(obj, dict): 89 return cls.model_validate(obj) 90 91 _obj = cls.model_validate({ 92 "endpoint": obj.get("endpoint") if obj.get("endpoint") is not None else 'Crawl', 93 "request": obj.get("request") 94 }) 95 return _obj
Create an instance of FIRECRAWLConfig from a dict