CLI Examples
This page provides practical examples of common PaiTIENT Secure Model CLI usage scenarios.
Basic Commands
Authenticate with the CLI
bash
# Interactive login
secure-model login
# Or set environment variables
export PAITIENT_API_KEY="your-api-key"
export PAITIENT_CLIENT_ID="your-client-id"List Available Models
bash
# List all available models
secure-model list models
# Filter models by keyword
secure-model list models --filter "clinical"
# Output in JSON format
secure-model list models --output jsonModel Deployment
Basic Model Deployment
bash
# Deploy a model with default settings
secure-model deploy model --name ZimaBlueAI/HuatuoGPT-o1-8B --deployment-name clinical-assistant
# Show deployment progress
secure-model status --deployment-id dep_12345abcde
# List all deployments
secure-model list deploymentsAdvanced Deployment Options
bash
# Deploy with specific compute resources
secure-model deploy model \
--name ZimaBlueAI/HuatuoGPT-o1-8B \
--deployment-name clinical-assistant \
--compute-type gpu \
--instance-type g4dn.xlarge \
--min-replicas 1 \
--max-replicas 3 \
--auto-scaling true
# Deploy with tags
secure-model deploy model \
--name ZimaBlueAI/HuatuoGPT-o1-8B \
--deployment-name clinical-assistant \
--tags environment=production,department=clinical-research
# Deploy with timeout
secure-model deploy model \
--name ZimaBlueAI/HuatuoGPT-o1-8B \
--deployment-name clinical-assistant \
--timeout 30mText Generation
Basic Text Generation
bash
# Generate text with a simple prompt
secure-model generate \
--deployment-id dep_12345abcde \
--prompt "What are the potential side effects of metformin?"
# Pipe input from a file
cat prompt.txt | secure-model generate --deployment-id dep_12345abcde
# Save output to a file
secure-model generate \
--deployment-id dep_12345abcde \
--prompt "What are the potential side effects of metformin?" \
> response.txtAdvanced Generation Options
bash
# Generate with specific parameters
secure-model generate \
--deployment-id dep_12345abcde \
--prompt "What are the potential side effects of metformin?" \
--max-tokens 500 \
--temperature 0.7 \
--top-p 0.95 \
--stop "\n\n"
# Stream response in real-time
secure-model generate \
--deployment-id dep_12345abcde \
--prompt "What are the potential side effects of metformin?" \
--stream
# Interactive chat mode
secure-model chat --deployment-id dep_12345abcdeDeployment Management
Check Deployment Status
bash
# Get detailed deployment status
secure-model status --deployment-id dep_12345abcde
# Get deployment metrics
secure-model metrics --deployment-id dep_12345abcde
# Watch deployment status in real-time
secure-model status --deployment-id dep_12345abcde --watchUpdate Deployment
bash
# Scale replicas
secure-model update deployment \
--deployment-id dep_12345abcde \
--min-replicas 2 \
--max-replicas 5
# Update tags
secure-model update deployment \
--deployment-id dep_12345abcde \
--tags environment=staging,department=clinical-research
# Enable auto-scaling
secure-model update deployment \
--deployment-id dep_12345abcde \
--auto-scaling trueDelete Deployment
bash
# Delete a deployment
secure-model delete deployment --deployment-id dep_12345abcde
# Delete with confirmation bypass
secure-model delete deployment --deployment-id dep_12345abcde --forceWorking with Secure Batches
Create Batch Job
bash
# Create a batch job with inputs from a file
secure-model create batch \
--deployment-id dep_12345abcde \
--input-file inputs.jsonl \
--output-file outputs.jsonl
# Create a batch job with specific parameters
secure-model create batch \
--deployment-id dep_12345abcde \
--input-file inputs.jsonl \
--output-file outputs.jsonl \
--max-tokens 500 \
--temperature 0.7Monitor Batch Job
bash
# Check batch job status
secure-model status --batch-id batch_12345abcde
# Watch batch job progress
secure-model status --batch-id batch_12345abcde --watchFine-tuning Models
Prepare Data for Fine-tuning
bash
# Validate and prepare training data
secure-model prepare fine-tuning \
--input-file training_data.jsonl \
--output-file prepared_data.jsonlStart Fine-tuning
bash
# Fine-tune a model
secure-model fine-tune \
--model ZimaBlueAI/HuatuoGPT-o1-8B \
--training-file prepared_data.jsonl \
--validation-file validation_data.jsonl \
--epochs 3
# Fine-tune with advanced parameters
secure-model fine-tune \
--model ZimaBlueAI/HuatuoGPT-o1-8B \
--training-file prepared_data.jsonl \
--validation-file validation_data.jsonl \
--epochs 3 \
--learning-rate 5e-5 \
--batch-size 8Monitor Fine-tuning
bash
# Check fine-tuning status
secure-model status --fine-tuning-id ft_12345abcde
# Check fine-tuning metrics
secure-model metrics --fine-tuning-id ft_12345abcdeConfiguration and Setup
Configure CLI
bash
# Interactive configuration
secure-model configure
# Create a new profile
secure-model configure --profile productionInstall Auto-completion
bash
# For bash
secure-model completion bash > ~/.secure-model-completion.bash
echo 'source ~/.secure-model-completion.bash' >> ~/.bashrc
# For zsh
secure-model completion zsh > ~/.secure-model-completion.zsh
echo 'source ~/.secure-model-completion.zsh' >> ~/.zshrcAdvanced Usage
Using JSON Input
bash
# Deploy using JSON configuration file
secure-model deploy model --config deployment-config.json
# Generate using JSON request file
secure-model generate --request-file generate-request.jsonUsing the CLI in Scripts
bash
# Use jq to parse JSON output
DEPLOYMENT_ID=$(secure-model deploy model \
--name ZimaBlueAI/HuatuoGPT-o1-8B \
--deployment-name clinical-assistant \
--output json | jq -r '.deployment_id')
echo "Deployment ID: $DEPLOYMENT_ID"
# Wait for deployment to be ready
while true; do
STATUS=$(secure-model status --deployment-id $DEPLOYMENT_ID --output json | jq -r '.status')
echo "Current status: $STATUS"
if [ "$STATUS" = "running" ]; then
break
elif [ "$STATUS" = "failed" ]; then
echo "Deployment failed"
exit 1
fi
sleep 30
done
# Generate text once deployment is ready
secure-model generate \
--deployment-id $DEPLOYMENT_ID \
--prompt "What are the potential side effects of metformin?"Next Steps
- Learn about CLI Commands
- Understand CLI Configuration
- Review Authentication
- Check Troubleshooting