Skip to content

Commit

Permalink
Fix NameError in unit tests
Browse files Browse the repository at this point in the history
* at the same time as making mypy shut up
  • Loading branch information
leila-messallem committed Dec 18, 2024
1 parent 17db6b1 commit 3c55d3f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/neo4j_graphrag/llm/anthropic_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
from __future__ import annotations

from typing import Any, Iterable, Optional, TYPE_CHECKING, cast
from typing import Any, Iterable, Optional, TYPE_CHECKING

from pydantic import ValidationError

Expand Down Expand Up @@ -81,7 +81,7 @@ def get_messages(
raise LLMGenerationError(e.errors()) from e
messages.extend(message_history)
messages.append(UserMessage(content=input).model_dump())
return cast(Iterable[MessageParam], messages)
return messages # type: ignore

def invoke(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/neo4j_graphrag/llm/cohere_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Optional, cast
from typing import TYPE_CHECKING, Any, Optional
from pydantic import ValidationError

from neo4j_graphrag.exceptions import LLMGenerationError
Expand Down Expand Up @@ -94,7 +94,7 @@ def get_messages(
raise LLMGenerationError(e.errors()) from e
messages.extend(message_history)
messages.append(UserMessage(content=input).model_dump())
return cast(ChatMessages, messages)
return messages # type: ignore

def invoke(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/neo4j_graphrag/llm/ollama_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
from typing import Any, Optional, Sequence, TYPE_CHECKING, cast
from typing import Any, Optional, Sequence, TYPE_CHECKING

from pydantic import ValidationError

Expand Down Expand Up @@ -71,7 +71,7 @@ def get_messages(
raise LLMGenerationError(e.errors()) from e
messages.extend(message_history)
messages.append(UserMessage(content=input).model_dump())
return cast(Sequence[Message], messages)
return messages # type: ignore

def invoke(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/neo4j_graphrag/llm/openai_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from __future__ import annotations

import abc
from typing import TYPE_CHECKING, Any, Iterable, Optional, cast
from typing import TYPE_CHECKING, Any, Iterable, Optional

from pydantic import ValidationError

Expand Down Expand Up @@ -81,7 +81,7 @@ def get_messages(
raise LLMGenerationError(e.errors()) from e
messages.extend(message_history)
messages.append(UserMessage(content=input).model_dump())
return cast(Iterable[ChatCompletionMessageParam], messages)
return messages # type: ignore

def invoke(
self,
Expand Down

0 comments on commit 3c55d3f

Please sign in to comment.