[docs]    def as_field(self) -> TagField:
        from redis.commands.search.field import TagField  # type: ignore
        return TagField(
            self.name,
            separator=self.separator,
            case_sensitive=self.case_sensitive,
            sortable=self.sortable,
            no_index=self.no_index,
        )
[docs]class NumericFieldSchema(RedisField):
    no_index: bool = False
    sortable: Optional[bool] = False
[docs]    def as_field(self) -> NumericField:
        from redis.commands.search.field import NumericField  # type: ignore
        return NumericField(self.name, sortable=self.sortable, no_index=self.no_index)
[docs]class RedisVectorField(RedisField):
    dims: int = Field(...)
    algorithm: object = Field(...)
    datatype: str = Field(default="FLOAT32")
    distance_metric: RedisDistanceMetric = Field(default="COSINE")
    initial_cap: int = Field(default=20000)
    @validator("distance_metric", pre=True)
    def uppercase_strings(cls, v: str) -> str:
        return v.upper()
    @validator("datatype", pre=True)
    def uppercase_and_check_dtype(cls, v: str) -> str:
        if v.upper() not in REDIS_VECTOR_DTYPE_MAP:
            raise ValueError(
                f"datatype must be one of {REDIS_VECTOR_DTYPE_MAP.keys()}. Got {v}"
            )
        return v.upper()
[docs]class FlatVectorField(RedisVectorField):
    algorithm: Literal["FLAT"] = "FLAT"
    block_size: int = Field(default=1000)
[docs]    def as_field(self) -> VectorField:
        from redis.commands.search.field import VectorField  # type: ignore