A Field represents a set of values with the same structure. Attributes: name: The name of the field. dtype: The type of the field, such as string or float. description: A human-readable description. tags: User-defined metadata in dictionary form. vec
| 28 | |
| 29 | @typechecked |
| 30 | class Field: |
| 31 | """ |
| 32 | A Field represents a set of values with the same structure. |
| 33 | |
| 34 | Attributes: |
| 35 | name: The name of the field. |
| 36 | dtype: The type of the field, such as string or float. |
| 37 | description: A human-readable description. |
| 38 | tags: User-defined metadata in dictionary form. |
| 39 | vector_index: If set to True the field will be indexed for vector similarity search. |
| 40 | vector_length: The length of the vector if the vector index is set to True. |
| 41 | vector_search_metric: The metric used for vector similarity search. |
| 42 | """ |
| 43 | |
| 44 | name: str |
| 45 | dtype: FeastType |
| 46 | description: str |
| 47 | tags: Dict[str, str] |
| 48 | vector_index: bool |
| 49 | vector_length: int |
| 50 | vector_search_metric: Optional[str] |
| 51 | |
| 52 | def __init__( |
| 53 | self, |
| 54 | *, |
| 55 | name: str, |
| 56 | dtype: FeastType, |
| 57 | description: str = "", |
| 58 | tags: Optional[Dict[str, str]] = None, |
| 59 | vector_index: bool = False, |
| 60 | vector_length: int = 0, |
| 61 | vector_search_metric: Optional[str] = None, |
| 62 | ): |
| 63 | """ |
| 64 | Creates a Field object. |
| 65 | |
| 66 | Args: |
| 67 | name: The name of the field. |
| 68 | dtype: The type of the field, such as string or float. |
| 69 | description (optional): A human-readable description. |
| 70 | tags (optional): User-defined metadata in dictionary form. |
| 71 | vector_index (optional): If set to True the field will be indexed for vector similarity search. |
| 72 | vector_search_metric (optional): The metric used for vector similarity search. |
| 73 | """ |
| 74 | self.name = name |
| 75 | self.dtype = dtype |
| 76 | self.description = description |
| 77 | self.tags = tags or {} |
| 78 | self.vector_index = vector_index |
| 79 | self.vector_length = vector_length |
| 80 | self.vector_search_metric = vector_search_metric |
| 81 | |
| 82 | def __eq__(self, other): |
| 83 | if type(self) != type(other): |
| 84 | return False |
| 85 | |
| 86 | if ( |
| 87 | self.name != other.name |
no outgoing calls