metadata
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 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
# 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.
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
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 from the base model.