Skip to content

[RAPTOR-13895] Implement inline predictor based on DRUM score #1504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 22, 2025

Conversation

klichukb
Copy link
Collaborator

@klichukb klichukb commented Jun 6, 2025

Rationale

Agentic workflow requires running DRUM with the target custom model code in-place in a codespace session in order to test the model inline end to end.
Currently this is done using "drum server", and communicating over network. While it works, its quite a heavy and slow test, which involves processes, threads and working with stdin/stdout piping to get feedback.

The idea is to use the exiting "drum score" functionality which uses an alternative predictor, that does not spin up a web server, exposing the predictor itself to work with directly.

Provided:
input.json

{
  "model": "gpt-4o-mini",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user",   "content": "Tell me a joke about penguins." }
  ],
  "temperature": 0.7,
  "top_p": 1.0,
  "max_tokens": 256,
  "n": 1,
  "stream": false,
  "stop": null
}

And the following example

import json

payload = json.loads(open("input.json", "r").read())
code_dir = (
    '/datarobot-user-models/model_templates/python3_dummy_chat'
)

with drum_inline_predictor(target_type=TargetType.AGENTIC_WORKFLOW.value, custom_model_dir=code_dir,
                           target_name='response') as predictor:
    result = predictor.chat(payload)
    print(result)

Copy link
Collaborator

@yakov-g yakov-g left a comment

Choose a reason for hiding this comment

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

Very nice.
Maybe implement that inline.py as a test

try:
setup_required_environment_variables(options)
except Exception as exc:
print(str(exc))
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a python thing I don't know about (and this probably doesn't really matter that much), but should we send this to stderr?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nevermind. This just moves the code up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I just lift-and-shifted it, did not want to alter but it should use logger.exception() instead of this.

@mjnitz02
Copy link
Contributor

@klichukb So I ran a final test on this now after fixing around agents to support this or drum server based on a flag. It worked great for all agents across all testing vectors. Let me know if I can help add stuff to get this PR finished. Thanks!

@klichukb klichukb changed the title Demo [YOLO] Implement inline predictor based on DRUM score Jun 20, 2025
@devexp-slackbot devexp-slackbot bot changed the title [YOLO] Implement inline predictor based on DRUM score [RAPTOR-13895] Implement inline predictor based on DRUM score Jun 20, 2025
@klichukb klichukb marked this pull request as ready for review June 20, 2025 21:45
@engprod-2
Copy link

engprod-2 bot commented Jun 20, 2025

The Needs Review labels were added based on the following file changes.

Team @datarobot/core-modeling (#predictive-ai) was assigned because of changes in files:

custom_model_runner/datarobot_drum/drum/common.py
custom_model_runner/datarobot_drum/drum/drum.py
custom_model_runner/datarobot_drum/drum/main.py
custom_model_runner/datarobot_drum/drum/root_predictors/drum_inline_utils.py
custom_model_runner/datarobot_drum/drum/root_predictors/generic_predictor.py
tests/functional/test_drum_inline_utils.py

Team @datarobot/genai-systems (#genai-systems) was assigned because of changes in files:

custom_model_runner/datarobot_drum/drum/common.py
custom_model_runner/datarobot_drum/drum/drum.py
custom_model_runner/datarobot_drum/drum/main.py
custom_model_runner/datarobot_drum/drum/root_predictors/drum_inline_utils.py
custom_model_runner/datarobot_drum/drum/root_predictors/generic_predictor.py
requirements_test.txt
tests/fixtures/python3_dummy_chat/README.md
tests/fixtures/python3_dummy_chat/custom.py
tests/fixtures/python3_dummy_chat/moderation_config.yaml
tests/functional/test_drum_inline_utils.py

If you think that there are some issues with ownership, please discuss with C&A domain at #sdtk slack channel and create PR to update DRCODEOWNERS\CODEOWNERS file.

@yakov-g
Copy link
Collaborator

yakov-g commented Jun 20, 2025

Looks great!

@klichukb
Copy link
Collaborator Author

@yakov-g @mjnitz02 I tried an e2e test with moderations to make sure that the inline runner executes the moderations pipeline. Its crazy because it triples the duration of tests even with bumping 8G to 16G for the functional test suite. Installing moderations is adding more than 30 minutes, I'm not sure why this is so bad.

I'm skipping the test to get things in for the release, but I think we have to figure out how to get the test in.

@klichukb
Copy link
Collaborator Author

@datarobot/core-modeling folks, I'd need to get in for the branch cut for the agentic work, feel free to provide your review, we can address it.

@klichukb klichukb merged commit 121a0c3 into master Jun 22, 2025
30 checks passed
@svc-engprod-git1 svc-engprod-git1 deleted the yolo/really-yolo branch June 22, 2025 21:45
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.

5 participants