Skip to content

Conversation

@mogith-pn
Copy link
Contributor

Why

  • Current model upload process fails, when the config.yaml in upload folder doesn't exists, which creates a bitter user experience.

How

CLI User Interaction Enhancements:

  • Added new helper functions to clarifai/utils/cli.py for prompting required, optional, integer, and yes/no fields, as well as for printing formatted sections and field help in the CLI. These functions improve the user experience when interactively creating model configurations during clarifai model upload process and config.yaml was not present in the upload folder.

  • This change also prompts user to select clarifai context during upload process, effectively allows user to switch between different contexts.

Constants Update:

  • Added documentation URLs as constants (CONFIG_GUIDE_URL, CLI_LOGIN_DOC_URL) in clarifai/utils/constants.py to provide users with helpful links during CLI interactions.

Type Hinting:

  • Updated type hints in clarifai/utils/cli.py to use Optional for improved clarity and type safety.

Tests

Testing Improvements:

  • Added and updated tests in tests/cli/test_model_cli.py to verify the creation of config.yaml via CLI prompts and to ensure file operations use UTF-8 encoding.

Notes

@github-actions
Copy link

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 44%
clarifai.cli.templates 33%
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 61%
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 61%
clarifai.utils.evaluation 67%
clarifai.workflows 95%
Summary 62% (8512 / 13747)

Minimum allowed line rate is 50%

@christineyu123
Copy link
Contributor

One suggestion based on our slack discussion: is it possible to clean the code so: 1) first we return a message pointing to user config.yaml is missing and refer to a doc page 2) then we ask if user want to stop and prep the yaml or start interactivity to create on-the-fly, and we only trigger the "def` that creates the file if user types "y"

The goal is try to have all the complex interactivity process in one function def xxxxx that we can trigger only if user type y and also if anything goes wrong, we can just remove that line and delete that standalone function in future.

Make sense? @mogith-pn will let you see how about it, but feel free to merge it as-is.

@mogith-pn
Copy link
Contributor Author

One suggestion based on our slack discussion: is it possible to clean the code so: 1) first we return a message pointing to user config.yaml is missing and refer to a doc page 2) then we ask if user want to stop and prep the yaml or start interactivity to create on-the-fly, and we only trigger the "def` that creates the file if user types "y"

The goal is try to have all the complex interactivity process in one function def xxxxx that we can trigger only if user type y and also if anything goes wrong, we can just remove that line and delete that standalone function in future.

Make sense? @mogith-pn will let you see how about it, but feel free to merge it as-is.

@christineyu123 Made the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants