Skip to content

Commit b647efa

Browse files
fix(types): resolve mypy 1.19.1 errors in valkey_storage
- Remove explicit variable annotations using unfollowed glide types (VectorFieldAttributesHnsw | VectorFieldAttributesFlat, list[Field]) which triggered [no-any-unimported] errors on lines 533 and 550 - Remove unused Field import - Remove two unused type: ignore[arg-type] comments on hset() calls that mypy 1.19.1 no longer requires (glide stub now accepts dict[str, str | bytes] directly)
1 parent 444e900 commit b647efa

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

lib/crewai/src/crewai/memory/storage/valkey_storage.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
ConnectionError,
2323
DataType,
2424
DistanceMetricType,
25-
Field,
2625
FtCreateOptions,
2726
FtSearchLimit,
2827
FtSearchOptions,
@@ -530,7 +529,6 @@ async def _ensure_vector_index(self) -> None:
530529

531530
try:
532531
# Build vector field attributes using the concrete subclass
533-
vector_attrs: VectorFieldAttributesHnsw | VectorFieldAttributesFlat
534532
if self._index_algorithm == "HNSW":
535533
algorithm = VectorAlgorithm.HNSW
536534
vector_attrs = VectorFieldAttributesHnsw(
@@ -547,7 +545,7 @@ async def _ensure_vector_index(self) -> None:
547545
)
548546

549547
# Build schema
550-
schema: list[Field] = [
548+
schema = [
551549
VectorField("embedding", algorithm, vector_attrs),
552550
TagField("scope"),
553551
TagField("categories", separator=","),
@@ -690,7 +688,7 @@ async def asave(self, records: list[MemoryRecord]) -> None:
690688
# Store record hash (Valkey Search will auto-index it)
691689
await client.hset(
692690
record_key,
693-
record_dict, # type: ignore[arg-type] # str keys are valid str|bytes
691+
record_dict,
694692
)
695693

696694
# Update all index structures
@@ -846,7 +844,7 @@ async def _aupdate(self, record: MemoryRecord) -> None:
846844
# Store updated record hash
847845
await client.hset(
848846
record_key,
849-
record_dict, # type: ignore[arg-type] # str keys are valid str|bytes
847+
record_dict,
850848
)
851849

852850
# Add to new indexes

0 commit comments

Comments
 (0)