mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
refactor: replace InstanceOf[T] with plain type annotations
* refactor: replace InstanceOf[T] with plain type annotations InstanceOf[] is a Pydantic validation wrapper that adds runtime isinstance checks. Plain type annotations are sufficient here since the models already use arbitrary_types_allowed or the types are BaseModel subclasses. * refactor: convert BaseKnowledgeStorage to BaseModel * fix: update tests for BaseKnowledgeStorage BaseModel conversion * fix: correct embedder config structure in test
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from crewai.knowledge.storage.knowledge_storage import ( # type: ignore[import-untyped]
|
||||
KnowledgeStorage,
|
||||
)
|
||||
@@ -59,7 +61,7 @@ def test_knowledge_storage_invalid_embedding_config(mock_get_client: MagicMock)
|
||||
"Unsupported provider: invalid_provider"
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="Unsupported provider: invalid_provider"):
|
||||
with pytest.raises(ValidationError):
|
||||
KnowledgeStorage(
|
||||
embedder={"provider": "invalid_provider"},
|
||||
collection_name="invalid_embedding_test",
|
||||
|
||||
Reference in New Issue
Block a user