Skip to content

Commit 651f0f2

Browse files
committed
Ignore som mypy issues
1 parent e0c653e commit 651f0f2

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/neo4j_graphrag/tool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "ToolParameter":
4848
if not param_class:
4949
raise ValueError(f"Unknown parameter type: {param_type}")
5050

51-
return param_class.model_validate(data)
51+
# Use type ignore since mypy doesn't understand dynamic class instantiation
52+
return param_class.model_validate(data) # type: ignore
5253

5354

5455
class StringParameter(ToolParameter):

tests/unit/llm/test_openai_llm.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ def test_openai_llm_with_message_history_happy_path(mock_import: Mock) -> None:
8787
assert res.content == "openai chat response"
8888
message_history.append({"role": "user", "content": question})
8989
# Use assert_called_once() instead of assert_called_once_with() to avoid issues with overloaded functions
90-
llm.client.chat.completions.create.assert_called_once()
90+
llm.client.chat.completions.create.assert_called_once() # type: ignore
9191
# Check call arguments individually
92-
call_args = llm.client.chat.completions.create.call_args[
92+
call_args = llm.client.chat.completions.create.call_args[ # type: ignore
9393
1
9494
] # Get the keyword arguments
9595
assert call_args["messages"] == message_history
@@ -123,9 +123,9 @@ def test_openai_llm_with_message_history_and_system_instruction(
123123
messages.extend(message_history)
124124
messages.append({"role": "user", "content": question})
125125
# Use assert_called_once() instead of assert_called_once_with() to avoid issues with overloaded functions
126-
llm.client.chat.completions.create.assert_called_once()
126+
llm.client.chat.completions.create.assert_called_once() # type: ignore
127127
# Check call arguments individually
128-
call_args = llm.client.chat.completions.create.call_args[
128+
call_args = llm.client.chat.completions.create.call_args[ # type: ignore
129129
1
130130
] # Get the keyword arguments
131131
assert call_args["messages"] == messages
@@ -240,9 +240,9 @@ def test_openai_llm_invoke_with_tools_with_message_history(
240240
# Verify the correct messages were passed
241241
message_history.append({"role": "user", "content": question})
242242
# Use assert_called_once() instead of assert_called_once_with() to avoid issues with overloaded functions
243-
llm.client.chat.completions.create.assert_called_once()
243+
llm.client.chat.completions.create.assert_called_once() # type: ignore
244244
# Check call arguments individually
245-
call_args = llm.client.chat.completions.create.call_args[
245+
call_args = llm.client.chat.completions.create.call_args[ # type: ignore
246246
1
247247
] # Get the keyword arguments
248248
assert call_args["messages"] == message_history
@@ -297,9 +297,9 @@ def test_openai_llm_invoke_with_tools_with_system_instruction(
297297
messages = [{"role": "system", "content": system_instruction}]
298298
messages.append({"role": "user", "content": "my text"})
299299
# Use assert_called_once() instead of assert_called_once_with() to avoid issues with overloaded functions
300-
llm.client.chat.completions.create.assert_called_once()
300+
llm.client.chat.completions.create.assert_called_once() # type: ignore
301301
# Check call arguments individually
302-
call_args = llm.client.chat.completions.create.call_args[
302+
call_args = llm.client.chat.completions.create.call_args[ # type: ignore
303303
1
304304
] # Get the keyword arguments
305305
assert call_args["messages"] == messages
@@ -384,9 +384,9 @@ def test_azure_openai_llm_with_message_history_happy_path(mock_import: Mock) ->
384384
assert res.content == "openai chat response"
385385
message_history.append({"role": "user", "content": question})
386386
# Use assert_called_once() instead of assert_called_once_with() to avoid issues with overloaded functions
387-
llm.client.chat.completions.create.assert_called_once()
387+
llm.client.chat.completions.create.assert_called_once() # type: ignore
388388
# Check call arguments individually
389-
call_args = llm.client.chat.completions.create.call_args[
389+
call_args = llm.client.chat.completions.create.call_args[ # type: ignore
390390
1
391391
] # Get the keyword arguments
392392
assert call_args["messages"] == message_history

0 commit comments

Comments
 (0)