fix: use isinstance for proper type narrowing in Knowledge.query

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2024-12-27 20:55:45 +00:00
parent 2d23ef7e12
commit 2c12b91083

View File

@@ -54,9 +54,9 @@ class Knowledge(BaseModel):
ValueError: If no storage is configured for querying.
"""
storage = self.storage
if storage is None:
if not isinstance(storage, KnowledgeStorage):
raise ValueError("No storage found to perform query.")
# Assign to local variable to help mypy with type narrowing
# Using isinstance check for proper type narrowing
results = storage.search(
query,
limit,