Skip to content

Commit 81cb45e

Browse files
feat: omit default values that are not supported by all models (#310)
1 parent 3938429 commit 81cb45e

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 10.5.0
4+
5+
- Remove default values for top_p, top_k and temperature as not supported by all models
6+
37
## 10.4.0
48

59
- Add support for multimodal prompts (images only)

aleph_alpha_client/chat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ class ChatRequest:
119119
model: str
120120
messages: List[Message]
121121
maximum_tokens: Optional[int] = None
122-
temperature: float = 0.0
123-
top_k: int = 0
124-
top_p: float = 0.0
122+
temperature: Optional[float] = None
123+
top_k: Optional[int] = None
124+
top_p: Optional[float] = None
125125
stream_options: Optional[StreamOptions] = None
126126
steering_concepts: Optional[List[str]] = None
127127
response_format: Optional[ResponseFormat] = None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "aleph-alpha-client"
3-
version = "10.4.0"
3+
version = "10.5.0"
44
description = "python client to interact with Aleph Alpha api endpoints"
55
authors = [{ name = "Aleph Alpha", email = "support@aleph-alpha.com" }]
66
requires-python = ">=3.9,<3.14"

tests/test_chat.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,18 @@ def test_multimodal_message_serialization_unknown_type() -> None:
284284
with pytest.raises(ValueError) as e:
285285
message.to_json()
286286
assert str(e.value) == "The item in the prompt is not valid. Try either a string or an Image."
287+
288+
def test_request_serialization_no_default_values() -> None:
289+
request = ChatRequest(
290+
messages=[Message(role=Role.User, content="Hello, how are you?")],
291+
model="dummy-model",
292+
)
293+
assert request.to_json() == {
294+
"model": "dummy-model",
295+
"messages": [
296+
{
297+
"role": "user",
298+
"content": "Hello, how are you?"
299+
}
300+
]
301+
}

0 commit comments

Comments
 (0)