Skip to content

Commit

Permalink
fix: handle optional storage with null checks (#1808)
Browse files Browse the repository at this point in the history
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: João Moura <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and joaomdmoura authored Dec 28, 2024
1 parent 97fc44c commit 2433819
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/crewai/knowledge/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ def query(self, query: List[str], limit: int = 3) -> List[Dict[str, Any]]:
"""
Query across all knowledge sources to find the most relevant information.
Returns the top_k most relevant chunks.
Raises:
ValueError: If storage is not initialized.
"""

if self.storage is None:
raise ValueError("Storage is not initialized.")

results = self.storage.search(
query,
limit,
Expand Down

0 comments on commit 2433819

Please sign in to comment.