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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: unsloth/Llama-3.2-1B-Instruct-bnb-4bit
|
| 3 |
+
tags:
|
| 4 |
+
- text-generation-inference
|
| 5 |
+
- transformers
|
| 6 |
+
- unsloth
|
| 7 |
+
- llama
|
| 8 |
+
- gguf
|
| 9 |
+
- ollama
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Kubernetes CLI Assistant Model
|
| 17 |
+
|
| 18 |
+
- **Developed by:** dereklck / felix97
|
| 19 |
+
- **License:** Apache-2.0
|
| 20 |
+
- **Fine-tuned from model:** [unsloth/Llama-3.2-1B-Instruct-bnb-4bit](https://huggingface.co/unsloth/Llama-3.2-1B-Instruct-bnb-4bit)
|
| 21 |
+
- **Model type:** GGUF (compatible with Ollama)
|
| 22 |
+
- **Language:** English
|
| 23 |
+
|
| 24 |
+
This Llama-based model was fine-tuned to assist users with Kubernetes `kubectl` commands. It has two primary features:
|
| 25 |
+
|
| 26 |
+
1. **Generating accurate `kubectl` commands** based on user instructions.
|
| 27 |
+
2. **Politely requesting additional information** if the instruction is incomplete or ambiguous.
|
| 28 |
+
|
| 29 |
+
The model focuses strictly on these two tasks to provide efficient and accurate assistance for Kubernetes command-line operations.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## How to Use the Model
|
| 34 |
+
|
| 35 |
+
This section provides instructions on how to run the model using Ollama with the provided Modelfile.
|
| 36 |
+
|
| 37 |
+
### Prerequisites
|
| 38 |
+
|
| 39 |
+
- Install [Ollama](https://github.com/jmorganca/ollama) on your system.
|
| 40 |
+
- Ensure you have access to the model hosted on Hugging Face: `hf.co/dereklck/kubectl_operator_1b_peft_gguf`.
|
| 41 |
+
|
| 42 |
+
### Steps
|
| 43 |
+
|
| 44 |
+
1. **Create the Modelfile**
|
| 45 |
+
|
| 46 |
+
Save the following content as a file named `Modelfile`:
|
| 47 |
+
|
| 48 |
+
```plaintext
|
| 49 |
+
FROM hf.co/dereklck/kubectl_operator_1b_peft_gguf
|
| 50 |
+
|
| 51 |
+
PARAMETER temperature 0.3
|
| 52 |
+
PARAMETER stop "</s>"
|
| 53 |
+
|
| 54 |
+
TEMPLATE """
|
| 55 |
+
You are an AI assistant that helps users with Kubernetes `kubectl` commands.
|
| 56 |
+
|
| 57 |
+
**Your Behavior Guidelines:**
|
| 58 |
+
|
| 59 |
+
1. **For clear and complete instructions:**
|
| 60 |
+
- Provide only the exact `kubectl` command needed to fulfill the user's request.
|
| 61 |
+
- Do not include extra explanations, placeholders, or context.
|
| 62 |
+
- Enclose the command within a code block with `bash` syntax highlighting.
|
| 63 |
+
|
| 64 |
+
2. **For incomplete or ambiguous instructions:**
|
| 65 |
+
- Politely ask the user for the specific missing information.
|
| 66 |
+
- Do not provide any commands or placeholders in your response.
|
| 67 |
+
- Respond in plain text, clearly stating what information is needed.
|
| 68 |
+
|
| 69 |
+
**Important Rules:**
|
| 70 |
+
|
| 71 |
+
- Do not generate CLI commands containing placeholders (e.g., `<pod_name>`, `<resource_name>`).
|
| 72 |
+
- Ensure all CLI commands are complete, valid, and executable as provided.
|
| 73 |
+
- If user input is insufficient to form a complete command, ask for clarification instead of using placeholders.
|
| 74 |
+
- Provide only the necessary CLI command output without any additional text.
|
| 75 |
+
|
| 76 |
+
### Instruction:
|
| 77 |
+
{{ .Prompt }}
|
| 78 |
+
|
| 79 |
+
### Response:
|
| 80 |
+
{{ .Response }}
|
| 81 |
+
</s>
|
| 82 |
+
"""
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
2. **Create the Model with Ollama**
|
| 86 |
+
|
| 87 |
+
Open your terminal and run the following command to create the model:
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
ollama create kubectl_cli_assistant -f Modelfile
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
This command tells Ollama to create a new model named `kubectl_cli_assistant` using the configuration specified in `Modelfile`.
|
| 94 |
+
|
| 95 |
+
3. **Run the Model**
|
| 96 |
+
|
| 97 |
+
Start interacting with your model:
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
ollama run kubectl_cli_assistant
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
This will initiate the model and prompt you for input based on the template provided.
|
| 104 |
+
|
| 105 |
+
Alternatively, you can provide an instruction directly:
|
| 106 |
+
|
| 107 |
+
```bash
|
| 108 |
+
ollama run kubectl_cli_assistant -p "List all pods in all namespaces."
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
**Example Output:**
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
kubectl get pods --all-namespaces
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## Model Details
|
| 120 |
+
|
| 121 |
+
### Purpose
|
| 122 |
+
|
| 123 |
+
The model assists users by:
|
| 124 |
+
|
| 125 |
+
- **Generating accurate `kubectl` commands** based on natural language instructions.
|
| 126 |
+
- **Politely requesting additional information** if the instruction is incomplete or ambiguous.
|
| 127 |
+
|
| 128 |
+
### Intended Users
|
| 129 |
+
|
| 130 |
+
- Kubernetes administrators
|
| 131 |
+
- DevOps engineers
|
| 132 |
+
- Developers working with Kubernetes clusters
|
| 133 |
+
|
| 134 |
+
### Training Process
|
| 135 |
+
|
| 136 |
+
- **Base Model:** Unsloth's Llama-3.2-1B-Instruct-bnb-4bit
|
| 137 |
+
- **Fine-tuning:** Leveraged the Unsloth framework and Hugging Face's TRL library for efficient training.
|
| 138 |
+
- **Training Data:** Custom dataset focused on Kubernetes `kubectl` command usage and clarification requests, containing approximately 1,000 entries:
|
| 139 |
+
- **500 entries** for `kubectl` command generation.
|
| 140 |
+
- **500 entries** for polite clarification requests when information is insufficient.
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
## Model Features
|
| 145 |
+
|
| 146 |
+
### 1. Command Generation in Bash Format
|
| 147 |
+
|
| 148 |
+
When the model generates CLI commands, it provides them in `bash` format, enclosed within code blocks for easy execution and clarity. This allows users to copy and paste the commands directly into their terminal.
|
| 149 |
+
|
| 150 |
+
### 2. Handling Ambiguity with Polite Clarifications
|
| 151 |
+
|
| 152 |
+
If the instruction is incomplete or ambiguous, the model will politely ask for the specific missing information instead of making assumptions. This ensures accuracy and prevents the execution of incorrect commands.
|
| 153 |
+
|
| 154 |
+
---
|
| 155 |
+
|
| 156 |
+
## Examples
|
| 157 |
+
|
| 158 |
+
### Example 1: Generating a Command
|
| 159 |
+
|
| 160 |
+
**Instruction:**
|
| 161 |
+
|
| 162 |
+
```
|
| 163 |
+
List all pods in all namespaces.
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
**Response:**
|
| 167 |
+
|
| 168 |
+
```bash
|
| 169 |
+
kubectl get pods --all-namespaces
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
---
|
| 173 |
+
|
| 174 |
+
### Example 2: Handling Ambiguity
|
| 175 |
+
|
| 176 |
+
**Instruction:**
|
| 177 |
+
|
| 178 |
+
```
|
| 179 |
+
Delete the resource.
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
**Response:**
|
| 183 |
+
|
| 184 |
+
```
|
| 185 |
+
Could you please specify the type and name of the resource you want to delete?
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
---
|
| 189 |
+
|
| 190 |
+
### Example 3: Additional Command
|
| 191 |
+
|
| 192 |
+
**Instruction:**
|
| 193 |
+
|
| 194 |
+
```
|
| 195 |
+
Create a namespace called 'production'.
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
**Response:**
|
| 199 |
+
|
| 200 |
+
```bash
|
| 201 |
+
kubectl create namespace production
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
---
|
| 205 |
+
|
| 206 |
+
## Limitations and Considerations
|
| 207 |
+
|
| 208 |
+
- **Accuracy:** The model may occasionally produce incorrect commands. Always review the output before execution.
|
| 209 |
+
- **No General Explanations:** This model is strictly limited to generating `kubectl` commands and requesting additional information if needed. It does **not** provide general explanations about Kubernetes concepts.
|
| 210 |
+
- **Security:** Be cautious when executing generated commands, especially in production environments.
|
| 211 |
+
|
| 212 |
+
---
|
| 213 |
+
|
| 214 |
+
## Feedback and Contributions
|
| 215 |
+
|
| 216 |
+
We welcome any comments or participation to improve the model and dataset. If you encounter issues or have suggestions for improvement:
|
| 217 |
+
|
| 218 |
+
- **GitHub:** [Unsloth Repository](https://github.com/unslothai/unsloth)
|
| 219 |
+
- **Contact:** Reach out to the developer, **dereklck**, for further assistance.
|
| 220 |
+
|
| 221 |
+
---
|
| 222 |
+
|
| 223 |
+
**Note:** This model provides assistance in generating `kubectl` commands based on user input. Always verify the generated commands in a safe environment before executing them in a production cluster.
|
| 224 |
+
|
| 225 |
+
---
|
| 226 |
+
|
| 227 |
+
## Summary
|
| 228 |
+
|
| 229 |
+
The **Kubernetes CLI Assistant Model** is a specialized tool designed to help users generate accurate `kubectl` commands or request necessary additional information when the instructions are incomplete. By focusing strictly on these two tasks, the model ensures effectiveness and reliability for users who need quick command-line assistance for Kubernetes operations.
|
| 230 |
+
|
| 231 |
+
---
|