diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fd03e14..e2faaa35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/chatlas/_provider_openai.py b/chatlas/_provider_openai.py index 9ca3e55d..a210f30d 100644 --- a/chatlas/_provider_openai.py +++ b/chatlas/_provider_openai.py @@ -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", } diff --git a/tests/test_set_model_params.py b/tests/test_set_model_params.py index 93cafd4e..58bee734 100644 --- a/tests/test_set_model_params.py +++ b/tests/test_set_model_params.py @@ -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()