Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Bug fixes

* `ChatDatabricks()` no longer drops the assistant's reply from the conversation when a GPT-OSS endpoint streams typed content. The typed part array was merged into the accumulated completion before it was normalized, so every later text delta was appended to it one character at a time and the finished turn came back empty. (#409)
* `params(top_k=)` is no longer sent as `top_logprobs` for OpenAI-based providers (the two are unrelated; OpenAI has no `top_k` sampling parameter). `top_k` is now dropped with the standard unsupported-parameter warning (#412)
* `.to_solver()` no longer corrupts the system prompt or the prior turns it reads out of Inspect AI's message state. The system prompt was being set to the `repr()` of the `ChatMessageSystem` object rather than its text, and message content arriving in Inspect AI's `str` form (rather than as a list of `Content`) was iterated one character at a time. (#407)
* `ChatGoogle()` no longer raises `ValueError: Unknown content type: ContentThinking` on the second and later turns when `reasoning` is enabled; thinking content is now replayed to the model as thought parts, and the `thought_signature` on thought parts is preserved (previously only tool-call parts kept it). (#403)
* `ChatOllama()` now distinguishes a remote endpoint it can't reach from a genuinely missing local install, and validates a supplied `model` against `/api/tags` at construction time instead of only when `model` is omitted. (#393)
Expand Down
4 changes: 0 additions & 4 deletions chatlas/_provider_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,16 +600,12 @@ def translate_model_params(self, params: StandardModelParams) -> "SubmitInputArg
# determine whether to include `message.output_text.logprobs`
res["log_probs"] = params["log_probs"] # type: ignore

if "top_k" in params:
res["top_logprobs"] = params["top_k"]

return res

def supported_model_params(self) -> set[StandardModelParamNames]:
return {
"temperature",
"top_p",
"top_k",
"max_tokens",
"log_probs",
}
Expand Down
11 changes: 11 additions & 0 deletions tests/test_set_model_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ def test_set_model_params_anthropic_unsupported():
chat.set_model_params(frequency_penalty=0.1)


def test_translate_model_params_openai_drops_top_k():
"""OpenAI has no top_k sampling param; it must not map to top_logprobs (#412)."""
chat = ChatOpenAI()
provider = chat.provider

result = provider.translate_model_params({"top_k": 50}) # type: ignore

assert "top_logprobs" not in result
assert "top_k" not in result


def test_translate_model_params_openai():
"""Test OpenAI provider's translate_model_params method."""
chat = ChatOpenAI()
Expand Down