mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 07:38:29 +00:00
fix: use isinstance for proper type narrowing in Knowledge.query
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user