Skip to content

[Backport 3.9] Replace retired OpenAI models in tests and docs - #5130

Merged
ylwu-amzn merged 1 commit into
opensearch-project:3.9from
tonypiazza:backport/5110-to-3.9
Oct 13, 2026
Merged

ylwu-amzn merged 1 commit into
opensearch-project:3.9from
tonypiazza:backport/5110-to-3.9

Conversation

@tonypiazza

Copy link
Copy Markdown
Contributor

Description

Manual backport of #5110 to 3.9. That PR merged to main on 2026-10-05 without a backport 3.9 label, so the automation never ran and 3.9 still references models OpenAI has retired.

On 3.9 today, plugin/src/test has 7 references to gpt-3.5-turbo-instruct, which shut down on 2026-09-28, and 8 to gpt-3.5-turbo, which shuts down on 2026-10-23. The OPENAI_KEY-gated integration tests fail with:

"The model `gpt-3.5-turbo-instruct` has been deprecated"  code: model_not_found  HTTP 404

This is a clean git cherry-pick -x of 8b17b1ba4 with no conflicts and no adaptation needed.

Why it is worth doing now

It unblocks #5128, the automatic backport of #5103. That PR's four Build and Test jobs are currently waiting for workflow approval, and when they run they will fail on these same retired models rather than on anything in that PR. Merging this first means #5128 can go green on its own merits.

Independently of that, 3.9's OpenAI integration tests are failing today and the gpt-3.5-turbo half breaks in two weeks.

Testing

  • cherry-pick -x applied with no conflicts; diff is identical to the original (13 files, +118/-79)
  • :opensearch-ml-plugin:test and :opensearch-ml-common:test on this branch: 6977 tests, 0 failures
  • compileTestJava and spotlessCheck: clean
  • No gpt-3.5-turbo-instruct, gpt-3.5-turbo-0613 or bare gpt-3.5-turbo remains at any live-call site. The only remaining mentions are the deprecation warning and the retained reference example in open_ai_connector_completion_blueprint.md.

The OPENAI_KEY-gated integration tests are not run locally here, since they need a key and a cluster. They were verified on main before #5110 merged (58 tests, 0 failures, 7 skipped against the live API) and CI will exercise them on this branch.

Related Issues

Backport of #5110. Unblocks #5128.

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created. Not applicable; test and documentation changes only.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created. Not applicable; the blueprints and tutorials live in this repo.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

)

Every OPENAI_KEY-gated test and every OpenAI doc example used a model that
OpenAI has retired or is about to retire, so the tests fail against the
live API and the docs no longer work as written:

  gpt-3.5-turbo-instruct  shut down 2026-09-28
  gpt-3.5-turbo-0613      shut down 2024-09-13
  gpt-3.5-turbo           shuts down 2026-10-23 (alias of gpt-3.5-turbo-0125)
  gpt-4                   shuts down 2026-10-23 (alias of gpt-4-0613)

See https://developers.openai.com/api/docs/deprecations.

Move every model id that reaches OpenAI to gpt-4o-mini, which is not on
any deprecation list and accepts the same max_tokens and temperature
parameters. The connectors that targeted the legacy /v1/completions
endpoint move to /v1/chat/completions, because gpt-3.5-turbo-instruct was
the last model serving that endpoint:

  RestMLRemoteInferenceIT          5 connectors
  RestMLGuardrailsIT               2 connectors, plus response_filter
  RestMLConnectorReferenceGuardIT  1 connector
  TestHelper                       1 connector
  RestGenerativeSearchResponseIT   1 connector and 2 llm_model values
  RestMLRAGSearchProcessorIT       1 connector and 1 model constant
  RestMLGrpcPredictStreamIT        1 connector
  RestMLGrpcExecuteAgentStreamIT   1 connector

For the connectors moving to chat completions, the content assertions move
from choices[0].text to choices[0].message.content, and the guardrail
response_filter from $.choices[0].text to $.choices[0].message.content.

llm_model has to change alongside the connector parameter because
DefaultLlmImpl injects it as the model parameter for the OPENAI provider,
overriding the value set in the connector.

RestMLRAGSearchProcessorIT declared both OPENAI_MODEL and OPENAI_40_MODEL.
Pointing the former at gpt-4o-mini would have left two differently named
constants with the same value, so OPENAI_40_MODEL is removed and its
usages consolidated onto OPENAI_MODEL.

Also fix an error-masking bug in the RestMLRemoteInferenceIT predict
harness. verifyResponse.accept(...) ran inside the same try block as
predictRemoteModel(...), so an AssertionError raised by the verifier was
caught and rerouted into the failure path, where it was reported as an
unexpected exception instead of the assertion that actually failed. Only
the predict call stays inside the try now.

Docs: add a deprecation warning to the completion blueprint, whose legacy
/v1/completions example has no live replacement model and is retained for
reference only, and update the chat blueprint, the remote inference
tutorial, the chatbot tutorial, and the search-processors README.

Verified against the live OpenAI API with -Dgrpc=true: 58 tests, 0
failures, 7 skipped. Per-test durations confirm the OpenAI paths made real
API calls rather than returning early on a missing key.

Signed-off-by: Tony Piazza <tony.piazza@aiven.io>
(cherry picked from commit 8b17b1b)
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ Recommended focus areas for review

Possible Compilation Error

The diff shows the local variable declaration String openaiModelName = "openAI-gpt-4o-mini"; added inside setup(), while the old hunk removed the same declaration. If the field openaiModelName is still referenced elsewhere in the class (e.g., in test methods outside setup()), those references will no longer resolve because the variable is now method-scoped. Verify that openaiModelName was previously a local variable in setup() only and is not used outside this method.

String openaiModelName = "openAI-gpt-4o-mini";
modelId = registerRemoteModel(openaiConnectorEntity, openaiModelName, false);

@tonypiazza
tonypiazza deployed to ml-commons-cicd-env-require-approval October 10, 2026 01:02 — with GitHub Actions Active
@tonypiazza
tonypiazza deployed to ml-commons-cicd-env-require-approval October 10, 2026 01:02 — with GitHub Actions Active
@tonypiazza
tonypiazza deployed to ml-commons-cicd-env-require-approval October 10, 2026 01:02 — with GitHub Actions Active
@tonypiazza
tonypiazza deployed to ml-commons-cicd-env-require-approval October 10, 2026 01:02 — with GitHub Actions Active
@tonypiazza

Copy link
Copy Markdown
Contributor Author

That is a false positive. openaiModelName is a method-local in setup() with only the two uses on lines 68 and 69, and the diff only changes the string value, not the declaration. compileTestJava passes on this branch.

@tonypiazza
tonypiazza deployed to ml-commons-cicd-env-require-approval October 13, 2026 19:50 — with GitHub Actions Active
@tonypiazza
tonypiazza deployed to ml-commons-cicd-env-require-approval October 13, 2026 19:50 — with GitHub Actions Active
@ylwu-amzn
ylwu-amzn merged commit d249465 into opensearch-project:3.9 Oct 13, 2026
13 checks passed

This branch was successfully deployed

1 active deployment
ml-commons-cicd-env-require-approval — 263423e9 Deployed Oct 13, 2026 by tonypiazza via Test MLCommons Plugin on linux docker (21) #14614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants