Skip to content

Migrate from chat.completions to Responses API#65

Open
filip-komarzyniec wants to merge 10 commits into
mainfrom
RHOAIENG-60206-AutoRAG-migrate-to-OGX-Responses-API
Open

Migrate from chat.completions to Responses API#65
filip-komarzyniec wants to merge 10 commits into
mainfrom
RHOAIENG-60206-AutoRAG-migrate-to-OGX-Responses-API

Conversation

@filip-komarzyniec
Copy link
Copy Markdown
Collaborator

@filip-komarzyniec filip-komarzyniec commented May 19, 2026

Description

Motivation

  • Use the built-in agent loop working under the hood of Responses API,
  • stay on top of the industry standards

Changes

  • API calls change
  • small refactoring of various names so that they better represent current behaviour

Testing

Commit with updated tests will be added once manual tests are completed.

Checklist

  • Tests added/updated
  • Documentation updated
  • Code follows style guide
  • All checks passing

@filip-komarzyniec filip-komarzyniec requested review from LukaszCmielowski and jakub-walaszczyk and removed request for jakub-walaszczyk May 19, 2026 14:17
@jakub-walaszczyk
Copy link
Copy Markdown
Collaborator

@filip-komarzyniec please restore changes that introduce formatting for 80 characters per line. 120 has been fine here, and these changes make noise in the PR

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>
…s API

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>
@filip-komarzyniec filip-komarzyniec force-pushed the RHOAIENG-60206-AutoRAG-migrate-to-OGX-Responses-API branch from 3a91573 to 59d7320 Compare May 19, 2026 14:52
Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@filip-komarzyniec filip-komarzyniec force-pushed the RHOAIENG-60206-AutoRAG-migrate-to-OGX-Responses-API branch from adbece5 to 8317802 Compare May 19, 2026 14:55
Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Copy link
Copy Markdown
Collaborator

@jakub-walaszczyk jakub-walaszczyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the requested changes and consider handling chroma within the ai4rag context.

Comment thread ai4rag/rag/foundation_models/ogx.py
Comment thread ai4rag/core/experiment/experiment.py Outdated
Comment thread ai4rag/core/experiment/experiment.py Outdated
Comment thread ai4rag/core/experiment/experiment.py Outdated
Comment thread ai4rag/core/experiment/experiment.py Outdated
Comment thread ai4rag/rag/foundation_models/base_model.py
Comment thread ai4rag/rag/foundation_models/base_model.py
Comment thread ai4rag/rag/foundation_models/ogx.py
Comment thread ai4rag/rag/vector_store/ogx.py Outdated
Comment thread dev_utils/mocks.py
Comment thread ai4rag/rag/retrieval/retriever.py Outdated
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>
@filip-komarzyniec filip-komarzyniec force-pushed the RHOAIENG-60206-AutoRAG-migrate-to-OGX-Responses-API branch from 38210dc to 0cde922 Compare May 21, 2026 13:18
Signed-off-by: Filip Komarzyniec <fkomarzy@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@filip-komarzyniec filip-komarzyniec force-pushed the RHOAIENG-60206-AutoRAG-migrate-to-OGX-Responses-API branch from 52fead2 to 71460bd Compare May 21, 2026 14:00
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Comment thread ai4rag/utils/constants.py
"""Constants used for setting the generation (inference) parameters for chat models only."""

MAX_COMPLETION_TOKENS = 2048
MAX_TOKENS = 2048
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the parameter name is now max_output_tokens why do we use max_tokens? Wouldn't it be better to reflect the name of the parameter?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would, if we dropped the chat.completions support. The problem is that in the older API (completions) this param is called max_completion_tokens. In newer API (responses) it's max_output_tokens.

Now that we have some abstract constants class, I've decided to call it just max_tokensthere because it's consumed by both API interfaces.
What's more, the max_tokens is a deprecated name once used by chat.completions API so it's not totally made up by me.

The whole problem is caused by the fact that we decided earlier to leave the chat method support. No one uses it now so maybe it's better to just replace it with responses-aligned methods.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's replace it and keep proper parameters names, Thanks

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