Skip to content

Commit 662a0cc

Browse files
Anri-LombardRobinPicard
authored andcommitted
Align tests
1 parent 2aae0b5 commit 662a0cc

File tree

3 files changed

+6
-39
lines changed

3 files changed

+6
-39
lines changed

outlines/models/lmstudio.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ def format_chat_model_input(self, model_input: Chat) -> "LMStudioChat":
109109
else:
110110
raise ValueError(
111111
f"Invalid content type: {type(content)}. "
112-
"Content must be a string or a list."
112+
"The content must be a string or a list containing a string "
113+
"and a list of images."
113114
)
114115
elif role == "assistant":
115116
chat.add_assistant_response(content)
116117
else:
117-
raise ValueError(f"Unsupported message role: {role}")
118+
raise ValueError(f"Unsupported role: {role}")
118119

119120
return chat
120121

tests/models/test_lmstudio.py

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ def test_lmstudio_direct(model_no_model_name):
9898
assert isinstance(result, str)
9999

100100

101-
@pytest.mark.api_call
102-
def test_lmstudio_call(model):
103-
result = model("Respond with one word. Not more.")
104-
assert isinstance(result, str)
105-
106-
107101
@pytest.mark.api_call
108102
def test_lmstudio_simple_vision(image, model):
109103
# This is not using a vision model, so it's not able to describe
@@ -116,7 +110,7 @@ def test_lmstudio_simple_vision(image, model):
116110

117111

118112
@pytest.mark.api_call
119-
def test_lmstudio_chat_with_image(image, model):
113+
def test_lmstudio_chat(image, model):
120114
result = model.generate(
121115
Chat(
122116
[
@@ -132,16 +126,6 @@ def test_lmstudio_chat_with_image(image, model):
132126
assert isinstance(result, str)
133127

134128

135-
@pytest.mark.api_call
136-
def test_lmstudio_chat(model):
137-
chat = Chat(messages=[
138-
{"role": "system", "content": "You are a helpful assistant."},
139-
{"role": "user", "content": "Say hello."},
140-
])
141-
result = model.generate(chat, None)
142-
assert isinstance(result, str)
143-
144-
145129
@pytest.mark.api_call
146130
def test_lmstudio_json(model):
147131
class Foo(BaseModel):
@@ -238,13 +222,6 @@ async def test_lmstudio_async_direct(async_model_no_model_name):
238222
assert isinstance(result, str)
239223

240224

241-
@pytest.mark.api_call
242-
@pytest.mark.asyncio
243-
async def test_lmstudio_async_call(async_model):
244-
result = await async_model("Respond with one word. Not more.")
245-
assert isinstance(result, str)
246-
247-
248225
@pytest.mark.api_call
249226
@pytest.mark.asyncio
250227
async def test_lmstudio_async_simple_vision(image, async_model):
@@ -259,7 +236,7 @@ async def test_lmstudio_async_simple_vision(image, async_model):
259236

260237
@pytest.mark.api_call
261238
@pytest.mark.asyncio
262-
async def test_lmstudio_async_chat_with_image(image, async_model):
239+
async def test_lmstudio_async_chat(image, async_model):
263240
result = await async_model.generate(
264241
Chat(
265242
[
@@ -275,17 +252,6 @@ async def test_lmstudio_async_chat_with_image(image, async_model):
275252
assert isinstance(result, str)
276253

277254

278-
@pytest.mark.api_call
279-
@pytest.mark.asyncio
280-
async def test_lmstudio_async_chat(async_model):
281-
chat = Chat(messages=[
282-
{"role": "system", "content": "You are a helpful assistant."},
283-
{"role": "user", "content": "Say hello."},
284-
])
285-
result = await async_model.generate(chat, None)
286-
assert isinstance(result, str)
287-
288-
289255
@pytest.mark.api_call
290256
@pytest.mark.asyncio
291257
async def test_lmstudio_async_json(async_model):

tests/models/test_lmstudio_type_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_lmstudio_type_adapter_input_chat_invalid_role(adapter):
126126
chat_input = Chat(messages=[
127127
{"role": "unknown", "content": "hello"},
128128
])
129-
with pytest.raises(ValueError, match="Unsupported message role"):
129+
with pytest.raises(ValueError, match="Unsupported role"):
130130
_ = adapter.format_input(chat_input)
131131

132132

0 commit comments

Comments
 (0)