Skip to content

[PR-928]: Added USER_ID to config of CLI Model Init#808

Merged
srikanthbachala20 merged 4 commits intomasterfrom
PR-928-Debug-Model-Init
Oct 17, 2025
Merged

[PR-928]: Added USER_ID to config of CLI Model Init#808
srikanthbachala20 merged 4 commits intomasterfrom
PR-928-Debug-Model-Init

Conversation

@srikanthbachala20
Copy link
Copy Markdown
Contributor

This pull request updates the model initialization workflow to ensure that the user_id is consistently included in the model configuration files and passed to model customization functions. This improves traceability and aligns configuration files with the authenticated user context. The main changes are focused on propagating the user_id throughout the CLI and template generation processes.

User context propagation and configuration updates:

  • The user_id is now extracted from the CLI context and passed to all model customization functions (customize_ollama_model, customize_lmstudio_model, and customize_huggingface_model), ensuring that the generated config.yaml files always include the correct user identifier. [1] [2] [3] [4]
  • The get_config_template function now accepts a user_id parameter and inserts it into the generated config.yaml template, replacing the placeholder.
  • The model customization functions have been updated to write the user_id into the config.yaml file if it exists, ensuring that any further configuration changes also retain the correct user association. [1] [2] [3]

CLI and function signature improvements:

  • The init command in the CLI now uses @click.pass_context to access the current user context, and all relevant function signatures have been updated to accept and use the user_id. [1] [2] [3] [4]
  • When initializing a new model, the get_config_template function is now called with both user_id and model_type_id, ensuring the generated configuration is user-specific from the start.

These changes make the CLI more robust and ensure that all model configurations are properly associated with the authenticated user.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds propagation of authenticated user_id into model initialization workflows so generated config.yaml files are user-specific and customization helpers update user ownership metadata.

  • Added user_id parameter to get_config_template and injected into generated config.yaml.
  • Updated CLI init command to extract user_id from context and pass it to model customization functions whose signatures were expanded.
  • All model customization helpers now write user_id into existing config.yaml files.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
clarifai/utils/cli.py Added user_id handling in model customization functions (ollama, huggingface, lmstudio) and updated their signatures to inject user_id into config.
clarifai/cli/templates/model_templates.py Modified get_config_template to include user_id in generated config.
clarifai/cli/model.py Passed user_id from click context to template generation and customization functions; updated calls to new signatures.

Comment thread clarifai/cli/templates/model_templates.py
Comment thread clarifai/utils/cli.py
Comment thread clarifai/utils/cli.py
Comment thread clarifai/utils/cli.py
Comment thread clarifai/utils/cli.py
Comment thread clarifai/utils/cli.py
Comment thread clarifai/utils/cli.py
@github-actions
Copy link
Copy Markdown

Code Coverage

Package Line Rate Health
clarifai 43%
clarifai.cli 44%
clarifai.cli.templates 36%
clarifai.client 67%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 80%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.modules 0%
clarifai.rag 72%
clarifai.runners 53%
clarifai.runners.models 58%
clarifai.runners.pipeline_steps 41%
clarifai.runners.pipelines 70%
clarifai.runners.utils 63%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 60%
clarifai.utils 60%
clarifai.utils.evaluation 67%
clarifai.workflows 95%
Summary 61% (8100 / 13178)

Minimum allowed line rate is 50%

@srikanthbachala20 srikanthbachala20 merged commit da8e917 into master Oct 17, 2025
12 checks passed
@srikanthbachala20 srikanthbachala20 deleted the PR-928-Debug-Model-Init branch October 17, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants