Skip to content

Commit

Permalink
allow search_settings or settings
Browse files Browse the repository at this point in the history
  • Loading branch information
emrgnt-cmplxty committed Oct 5, 2024
1 parent a14d677 commit 3208333
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "r2r"
readme = "README.md"
version = "3.2.7"
version = "3.2.8"

description = "SciPhi R2R"
authors = ["Owen Colegrove <owen@sciphi.ai>"]
Expand Down
36 changes: 35 additions & 1 deletion py/shared/abstractions/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ class VectorSearchSettings(R2RSerializable):
filters: dict[str, Any] = Field(
default_factory=dict,
description="Filters to apply to the vector search",
deprecated=True,
)
search_filters: dict[str, Any] = Field(
default_factory=dict,
description="Filters to apply to the vector search",
)
search_limit: int = Field(
default=10,
Expand Down Expand Up @@ -283,12 +288,29 @@ def model_dump(self, *args, **kwargs):
]
return dump

def __init__(self, **data):
# Either filters or search filters is supported
data["filters"] = {
**data.get("filters", {}),
**data.get("search_filters", {}),
}
data["search_filters"] = {
**data.get("filters", {}),
**data.get("search_filters", {}),
}
super().__init__(**data)


class KGSearchSettings(R2RSerializable):

filters: dict[str, Any] = Field(
default_factory=dict,
description="Filters to apply to the KG search",
description="Filters to apply to the vector search",
deprecated=True,
)
search_filters: dict[str, Any] = Field(
default_factory=dict,
description="Filters to apply to the vector search",
)

selected_collection_ids: list[UUID] = Field(
Expand Down Expand Up @@ -346,3 +368,15 @@ class Config:
"__Community__": 20,
},
}

def __init__(self, **data):
# Either filters or search filters is supported
data["filters"] = {
**data.get("filters", {}),
**data.get("search_filters", {}),
}
data["search_filters"] = {
**data.get("filters", {}),
**data.get("search_filters", {}),
}
super().__init__(**data)

0 comments on commit 3208333

Please sign in to comment.