Skip to content

Commit 8f1df10

Browse files
author
RN
committed
fix: resolve Pydantic test failure and CI linting error
1 parent a983bcf commit 8f1df10

File tree

2 files changed

+9
-4
lines changed
  • libs/community

2 files changed

+9
-4
lines changed

libs/community/langchain_community/chat_models/mlx.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ def _parse_react_tool_calls(
7373
invalid_tool_calls: list[InvalidToolCall] = []
7474

7575
bracket_pattern = r"Action:\s*(?P<name>[\w.-]+)\[(?P<input>[^\]]+)\]"
76-
separate_pattern = (
77-
r"Action:\s*(?P<name>[^\n]+)\nAction Input:\s*(?P<input>[^\n]+)"
78-
)
76+
separate_pattern = r"Action:\s*(?P<name>[^\n]+)\nAction Input:\s*(?P<input>[^\n]+)"
7977

8078
matches = list(re.finditer(bracket_pattern, text))
8179
if not matches:

libs/community/tests/unit_tests/chat_models/test_mlx.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
"""Test MLX Chat wrapper."""
22

33
from importlib import import_module
4+
from typing import Any
45

56
import pytest
67
from langchain_core.messages import HumanMessage
78

89
from langchain_community.chat_models.mlx import ChatMLX
10+
from langchain_community.llms.mlx_pipeline import MLXPipeline
911

1012

1113
class _FakeTokenizer:
@@ -24,7 +26,12 @@ def apply_chat_template(
2426
return "prompt"
2527

2628

27-
class _FakeLLM:
29+
class _FakeLLM(MLXPipeline):
30+
model_id: str = "fake-model"
31+
model: Any = None
32+
tokenizer: Any = None
33+
pipeline_kwargs: dict = {}
34+
2835
def __init__(self) -> None:
2936
self.tokenizer = _FakeTokenizer()
3037

0 commit comments

Comments
 (0)