fix(python): replace the retired gpt-4-turbo-preview default in OpenaiReranker (#4613)

OpenAI shuts down `gpt-4-turbo` and its snapshots on 2026-10-23
(https://developers.openai.com/api/docs/deprecations), so
`OpenaiReranker` fails for every user who relies on the default
`gpt-4-turbo-preview` after that date.

This changes the default to `gpt-5.6-sol`, the replacement OpenAI names
for `gpt-4-turbo` on that page, in the class, its docstring and the
integration docs page. `_rerank` also stops sending `temperature=0`: the
GPT-5 models only accept the default temperature, so keeping it would
fail the new default on its first call. The reranker still asks for
`json_object` output and the rest of the request is unchanged.

The new test calls `_rerank` with a mocked client and checks that no
`temperature` is sent. It fails on main and passes with the change. No
request was made to OpenAI.

This change was made with Claude Code.

Co-authored-by: Xuanwo <github@xuanwo.io>
This commit is contained in:
alexcastgonz
2026-10-24 06:25:44 +08:00
committed by GitHub
co-authored by Xuanwo
parent 27b65064d0
commit 8cf115b081
3 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ credentials from environment variables or a secrets manager.
## Accepted Arguments {#accepted-arguments}
| Argument | Type | Default | Description |
| --- | --- | --- | --- |
| `model_name` | `str` | `"gpt-4-turbo-preview"` | The name of the reranker model to use.|
| `model_name` | `str` | `"gpt-5.6-sol"` | The name of the reranker model to use.|
| `column` | `str` | `"text"` | The name of the column to use as input to the cross encoder model. |
| `return_score` | `str` | `"relevance"` | Options are "relevance" or "all". The type of score to return. If "relevance", will return only the `_relevance_score. If "all" is supported, will return relevance score along with the vector and/or fts scores depending on query type. |
| `api_key` | `str` | `None` | The API key to use. If None, will use the OPENAI_API_KEY environment variable.