mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +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:
|
Raises:
|
||||||
ValueError: If no storage is configured for querying.
|
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.")
|
raise ValueError("No storage found to perform query.")
|
||||||
|
# Assign to local variable to help mypy with type narrowing
|
||||||
results = self.storage.search(
|
results = storage.search(
|
||||||
query,
|
query,
|
||||||
limit,
|
limit,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user