File size: 7,232 Bytes
761169f 848b69b 2079dd4 761169f 2079dd4 761169f 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 e16caa5 2079dd4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
---
license: gemma
language:
- en
base_model:
- google/functiongemma-270m-it
pipeline_tag: text-generation
tags:
- function-calling
- infrastructure
- devops
- litertlm
---
# FunctionGemma Infrastructure Tools v8
A fine-tuned [FunctionGemma 270M](https://huggingface.co/google/functiongemma-270m-it) model for infrastructure error diagnosis and remediation. Achieves **100% accuracy** on 7 infrastructure tools when using the correct tool definitions.
## Model Details
- **Base Model**: google/functiongemma-270m-it
- **Format**: LiteRT-LM (.litertlm) - optimized for on-device inference
- **Quantization**: INT8 (Q8)
- **Size**: ~271MB
- **Training**: 50 epochs on 10,500 examples (1,500 per tool)
## Supported Tools
| Tool | Description | Use Case |
|------|-------------|----------|
| `enableCors` | Enable CORS for a specific origin | CORS policy errors, blocked cross-origin requests |
| `updateConnectionUrl` | Update service connection URL | ECONNREFUSED errors, localhost connection issues in containers |
| `setEnvVar` | Set environment variable | Missing configuration, undefined env vars |
| `addHostMapping` | Add hostname to IP mapping | DNS resolution (ENOTFOUND) errors |
| `increaseMemory` | Increase memory limit | OOMKilled errors, out of memory crashes |
| `increaseTimeout` | Increase timeout value | 504 Gateway Timeout, connection timeout errors |
| `restartService` | Restart a service | Stuck processes, stale data after deployment |
## Usage with LiteRT-LM
### Download the Model
```bash
# Using huggingface-cli
huggingface-cli download macmacmacmac/functiongemma-nextjs functiongemma-infra-v8_q8_ekv1024.litertlm
# Or using Python
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(
repo_id="macmacmacmac/functiongemma-nextjs",
filename="functiongemma-infra-v8_q8_ekv1024.litertlm"
)
```
### Required Tool Definitions
**Important**: You must use these exact tool definitions for optimal accuracy. The model was trained with these specific descriptions.
```javascript
const tools = [
{
type: "function",
function: {
name: "enableCors",
description: "Enable CORS for a specific origin to fix blocked cross-origin requests.",
parameters: {
type: "object",
properties: {
origin: { type: "string", description: "The origin to allow (e.g., http://localhost:3000)" },
methods: { type: "string", description: "Allowed HTTP methods (e.g., GET,POST,PUT,DELETE)" }
},
required: ["origin"]
}
}
},
{
type: "function",
function: {
name: "updateConnectionUrl",
description: "Update a service connection URL to fix ECONNREFUSED errors, typically changing localhost to the correct service hostname.",
parameters: {
type: "object",
properties: {
service: { type: "string", description: "The service to update (e.g., database, redis, api)" },
hostname: { type: "string", description: "The correct hostname to connect to" },
port: { type: "integer", description: "The port number to connect to" }
},
required: ["service", "hostname", "port"]
}
}
},
{
type: "function",
function: {
name: "setEnvVar",
description: "Set an environment variable to fix missing configuration errors.",
parameters: {
type: "object",
properties: {
name: { type: "string", description: "Environment variable name (e.g., DATABASE_URL, API_KEY)" },
value: { type: "string", description: "The value to set" }
},
required: ["name", "value"]
}
}
},
{
type: "function",
function: {
name: "addHostMapping",
description: "Add a hostname to IP mapping to fix DNS resolution (ENOTFOUND) errors.",
parameters: {
type: "object",
properties: {
hostname: { type: "string", description: "The hostname to map" },
ip: { type: "string", description: "The IP address to map to" }
},
required: ["hostname", "ip"]
}
}
},
{
type: "function",
function: {
name: "increaseMemory",
description: "Increase memory limit for a service to fix OOMKilled errors.",
parameters: {
type: "object",
properties: {
service: { type: "string", description: "The service/container/pod name" },
memoryMb: { type: "integer", description: "Memory limit in megabytes" }
},
required: ["service", "memoryMb"]
}
}
},
{
type: "function",
function: {
name: "increaseTimeout",
description: "Increase timeout value to fix 504 Gateway Timeout or connection timeout errors.",
parameters: {
type: "object",
properties: {
service: { type: "string", description: "The service to configure" },
timeoutMs: { type: "integer", description: "Timeout value in milliseconds" }
},
required: ["service", "timeoutMs"]
}
}
},
{
type: "function",
function: {
name: "restartService",
description: "Restart a service to apply configuration changes or fix a stuck process.",
parameters: {
type: "object",
properties: {
service: { type: "string", description: "The service/container/pod name to restart" }
},
required: ["service"]
}
}
}
];
```
### Example Usage with dad-express
```javascript
const { FunctionGemmaEngine } = require('dad-express');
const engine = new FunctionGemmaEngine({
modelPath: './functiongemma-infra-v8_q8_ekv1024.litertlm',
tools: JSON.stringify(tools)
});
// Diagnose an error
const result = await engine.call('Container api was OOMKilled - out of memory');
console.log(result.tool_calls[0].function);
// { name: 'increaseMemory', arguments: { service: 'api', memoryMb: 1024 } }
```
## Training Data
The model was trained on 10,500 synthetic examples covering common infrastructure errors:
| Error Pattern | Tool | Examples |
|--------------|------|----------|
| CORS policy errors | enableCors | 1,500 |
| ECONNREFUSED errors | updateConnectionUrl | 1,500 |
| Missing env vars | setEnvVar | 1,500 |
| DNS/ENOTFOUND errors | addHostMapping | 1,500 |
| OOMKilled errors | increaseMemory | 1,500 |
| Timeout errors | increaseTimeout | 1,500 |
| Stuck services | restartService | 1,500 |
### Sample Training Examples
```
"CORS error: No 'Access-Control-Allow-Origin' header from http://localhost:3000" → enableCors
"Error: connect ECONNREFUSED 127.0.0.1:5432 - database connection failed" → updateConnectionUrl
"Missing required environment variable: DATABASE_URL" → setEnvVar
"getaddrinfo ENOTFOUND db" → addHostMapping
"Container api was OOMKilled" → increaseMemory
"504 Gateway Timeout from backend" → increaseTimeout
"nginx container is not responding" → restartService
```
## Limitations
- Optimized for the 7 specific infrastructure tools listed above
- Requires exact tool definitions for best accuracy
- May not generalize well to error patterns not seen in training
## License
This model inherits the [Gemma license](https://ai.google.dev/gemma/terms) from the base model.
|