classVectorField(Resource):"""Vector field for use in Argilla `Dataset` `Settings`"""_model:VectorFieldModel_api:VectorsAPI_dataset:Optional["Dataset"]def__init__(self,name:str,dimensions:int,title:Optional[str]=None,_client:Optional["Argilla"]=None,)->None:"""Vector field for use in Argilla `Dataset` `Settings` Parameters: name (str): The name of the vector field dimensions (int): The number of dimensions in the vector title (Optional[str]): The title of the vector to be shown in the UI. """client=_clientorArgilla._get_default()super().__init__(api=client.api.vectors,client=client)self._model=VectorFieldModel(name=name,title=title,dimensions=dimensions)self._dataset=None@propertydefname(self)->str:returnself._model.name@name.setterdefname(self,value:str)->None:self._model.name=value@propertydeftitle(self)->Optional[str]:returnself._model.title@title.setterdeftitle(self,value:Optional[str])->None:self._model.title=value@propertydefdimensions(self)->int:returnself._model.dimensions@dimensions.setterdefdimensions(self,value:int)->None:self._model.dimensions=value@propertydefdataset(self)->"Dataset":returnself._dataset@dataset.setterdefdataset(self,value:"Dataset")->None:self._dataset=valueself._model.dataset_id=self._dataset.idself._with_client(self._dataset._client)def__repr__(self)->str:returnf"{self.__class__.__name__}(name={self.name}, title={self.title}, dimensions={self.dimensions})"@classmethoddeffrom_model(cls,model:VectorFieldModel)->"VectorField":instance=cls(name=model.name,dimensions=model.dimensions)instance._model=modelreturninstance@classmethoddeffrom_dict(cls,data:dict)->"VectorField":model=VectorFieldModel(**data)returncls.from_model(model=model)def_with_client(self,client:"Argilla")->"VectorField":# TODO: Review and simplify. Maybe only one of them is requiredself._client=clientself._api=self._client.api.vectorsreturnself
def__init__(self,name:str,dimensions:int,title:Optional[str]=None,_client:Optional["Argilla"]=None,)->None:"""Vector field for use in Argilla `Dataset` `Settings` Parameters: name (str): The name of the vector field dimensions (int): The number of dimensions in the vector title (Optional[str]): The title of the vector to be shown in the UI. """client=_clientorArgilla._get_default()super().__init__(api=client.api.vectors,client=client)self._model=VectorFieldModel(name=name,title=title,dimensions=dimensions)self._dataset=None