mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
fix: improve type narrowing in Knowledge.query with local variable
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -53,10 +53,11 @@ class Knowledge(BaseModel):
|
||||
Raises:
|
||||
ValueError: If no storage is configured for querying.
|
||||
"""
|
||||
if self.storage is None:
|
||||
storage = self.storage
|
||||
if storage is None:
|
||||
raise ValueError("No storage found to perform query.")
|
||||
|
||||
results = self.storage.search(
|
||||
# Assign to local variable to help mypy with type narrowing
|
||||
results = storage.search(
|
||||
query,
|
||||
limit,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user