We need to implement a command-line interface (CLI) for downloading and managing models in FastMLX. This CLI should offer commands similar to those in Ollama, providing a user-friendly way to interact with FastMLX from the terminal.
Proposed Commands
fastmlx run <model_name>: Test the selected model in the terminal
fastmlx pull <model_name>: Download a specified model
fastmlx rm <model_name>: Remove a specified model
fastmlx list: List all downloaded models
Implementation Details
1. Create a new Python file for the CLI client
File name: cli.py
Location: In the root of the FastMLX package
2. Update fastmlx.py
Add necessary endpoints to support CLI operations
Ensure the API can handle model management requests
3. CLI Client Features
Use argparse for command-line argument parsing
Implement async HTTP requests to interact with the FastMLX API
Use rich library for improved terminal output
4. Error Handling
Implement proper error handling for network issues, API errors, etc.
Provide clear error messages to the user
5. Documentation
Update the README.md with instructions on how to use the CLI
Add inline comments and docstrings for better code maintainability
Acceptance Criteria
[ ] All proposed commands are implemented and working as expected
[ ] CLI client can communicate with the FastMLX API successfully
[ ] Error handling is robust and user-friendly
[ ] Code is well-documented and follows the project's coding standards
[ ] README.md is updated with CLI usage instructions
[ ] Manual testing has been performed for all commands
Additional Notes
Consider adding a progress bar for model download/removal operations
Explore the possibility of adding a fastmlx update command for updating models in the future
Description
We need to implement a command-line interface (CLI) for downloading and managing models in FastMLX. This CLI should offer commands similar to those in Ollama, providing a user-friendly way to interact with FastMLX from the terminal.
Proposed Commands
fastmlx run <model_name>
: Test the selected model in the terminalfastmlx pull <model_name>
: Download a specified modelfastmlx rm <model_name>
: Remove a specified modelfastmlx list
: List all downloaded modelsImplementation Details
1. Create a new Python file for the CLI client
cli.py
2. Update
fastmlx.py
3. CLI Client Features
argparse
for command-line argument parsingrich
library for improved terminal output4. Error Handling
5. Documentation
Acceptance Criteria
Additional Notes
fastmlx update
command for updating models in the futureRelated Issues/PRs