Skip to content

Commit

Permalink
redis[patch]: fix initialization of RedisConfig.index_schema (#19)
Browse files Browse the repository at this point in the history
fix schema init
  • Loading branch information
ccurme authored Sep 16, 2024
1 parent cb9b42b commit 8eba944
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libs/redis/langchain_redis/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Any, Dict, List, Optional, Type

from pydantic import BaseModel, ConfigDict, Field, model_validator
from pydantic import BaseModel, ConfigDict, Field, SkipValidation, model_validator
from redis import Redis
from redisvl.schema import IndexSchema, StorageType # type: ignore[import]
from typing_extensions import Self
from typing_extensions import Annotated, Self
from ulid import ULID


Expand Down Expand Up @@ -83,14 +83,17 @@ class RedisConfig(BaseModel):
embedding_field: str = "embedding"
default_tag_separator: str = "|"
metadata_schema: Optional[List[Dict[str, Any]]] = Field(default_factory=list)
index_schema: Optional[IndexSchema] = Field(default=None, alias="schema")
index_schema: Annotated[Optional[IndexSchema], SkipValidation()] = Field(
default=None, alias="schema"
)
schema_path: Optional[str] = None
return_keys: bool = False
custom_keys: Optional[List[str]] = None
embedding_dimensions: Optional[int] = None

model_config = ConfigDict(
arbitrary_types_allowed=True,
populate_by_name=True,
)

@model_validator(mode="before")
Expand Down

0 comments on commit 8eba944

Please sign in to comment.