mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +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.
|
ValueError: If no storage is configured for querying.
|
||||||
"""
|
"""
|
||||||
storage = self.storage
|
storage = self.storage
|
||||||
if storage is None:
|
if not isinstance(storage, KnowledgeStorage):
|
||||||
raise ValueError("No storage found to perform query.")
|
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(
|
results = storage.search(
|
||||||
query,
|
query,
|
||||||
limit,
|
limit,
|
||||||
|
|||||||
Reference in New Issue
Block a user