Skip to content
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

Fix missing pipeline implementations. #1514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manstis
Copy link
Contributor

@manstis manstis commented Jan 30, 2025

This PR does not need a corresponding Jira item.

Description

It was possible for a User to configure a pipeline to use a provider that did not support a given feature.

In such scenarios get_model_pipeline(<feature>) returned None leading to RTEs.

This PR ensures a NOP implementation is returned if an explicit implementation does not exist.

Testing

See "Steps to test"

Steps to test

  1. Configure ANSIBLE_AI_MODEL_MESH_CONFIG to include:
ModelPipelineChatBot:
  provider: dummy
  1. Start the service
  2. Try to load the Home Page.

Scenarios tested

See "Steps to test"

Production deployment

  • This code change is ready for production on its own
  • This code change requires the following considerations before going to production:

@manstis manstis requested a review from goneri January 30, 2025 12:27
@@ -91,6 +99,20 @@ def test_default_fallback_playbook_explanation(self):
log,
)

# 'dummy' does not have a ChatBot pipeline
@override_settings(ANSIBLE_AI_MODEL_MESH_CONFIG=json.dumps(CHATBOT))
Copy link
Contributor

Choose a reason for hiding this comment

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

We can do without the json.dumps call here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ANSIBLE_AI_MODEL_MESH_CONFIG must be a string containing either JSON or YAML.

Using a dict is not supported (remember, the value is loaded from an environment variable).

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, CHATBOT can just be a plain YAML string :-)


return {k: v_or_default(k, v) for k, v in REGISTRY[pipeline_provider].items()}


Copy link
Contributor

Choose a reason for hiding this comment

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

Since this runs during the module loading, it will be a bit tricky to properly unit-test it. I feel like it would be better to isolate this in a dedicated function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like you're right (I've added a test but it's not being detected as covering this code).

I'll move it out.

@manstis manstis force-pushed the fix_missing_pipeline_implementations branch 4 times, most recently from 2e1700d to edd5623 Compare January 30, 2025 14:49
@manstis manstis force-pushed the fix_missing_pipeline_implementations branch from edd5623 to 189e0da Compare January 30, 2025 14:51
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