Skip to content

Commit cb745c2

Browse files
Use MagicMock for unsupported-LLM structured output test
1 parent d4c7046 commit cb745c2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/unit/experimental/components/test_entity_relation_extractor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
)
3434
from neo4j_graphrag.experimental.pipeline.exceptions import InvalidJSONError
3535
from neo4j_graphrag.llm import LLMInterface, LLMResponse
36-
from neo4j_graphrag.llm import AnthropicLLM, OpenAILLM, VertexAILLM
36+
from neo4j_graphrag.llm import OpenAILLM, VertexAILLM
3737
from unittest.mock import patch
3838

3939

@@ -461,7 +461,8 @@ async def test_extractor_structured_output_with_vertexai() -> None:
461461

462462
def test_extractor_structured_output_unsupported_llm() -> None:
463463
"""Test that use_structured_output=True raises error with unsupported LLMs."""
464-
llm = AnthropicLLM(api_key="test", model_name="claude-3-opus")
464+
llm = MagicMock(spec=LLMInterface)
465+
llm.supports_structured_output = False
465466

466467
with pytest.raises(ValueError) as exc_info:
467468
LLMEntityRelationExtractor(

0 commit comments

Comments
 (0)