Image-Text-to-Text
MLX
Safetensors
qwen3_5
clairic
cloudflare
systemone
structured-output
information-extraction
multimodal
custom-code
conversational
4-bit precision
Instructions to use mlx-community/clairic-flash-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/clairic-flash-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("mlx-community/clairic-flash-4bit") config = load_config("mlx-community/clairic-flash-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use mlx-community/clairic-flash-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/clairic-flash-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mlx-community/clairic-flash-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use mlx-community/clairic-flash-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/clairic-flash-4bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mlx-community/clairic-flash-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/clairic-flash-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/clairic-flash-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mlx-community/clairic-flash-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 6,111 Bytes
ae97c5d | 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 | from __future__ import annotations
from typing import Any
from jsonschema import Draft202012Validator, SchemaError
COMMON = {"type", "instructions", "nullable"}
NUMERIC = {"integer", "decimals", "unit"}
GRAMMAR_NUMBER = {"minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "enum"}
OPTIONS = {
"text": {"knowledge", "minLength", "maxLength", "pattern", "enum"},
"number": NUMERIC | GRAMMAR_NUMBER | {"knowledge", "source_only"},
"compute": NUMERIC | {"null_threshold"},
"date": {"null_threshold", "source_only"},
"time": {"null_threshold", "source_only"},
"datetime": {"null_threshold", "source_only"},
"duration": NUMERIC | {"null_threshold"},
"boolean": set(),
"enum": {"enum"},
"object": {"properties"},
"list": {"items", "max_items", "knowledge", "source_only"} | NUMERIC | {"enum"},
"estimate": {"min", "max", "scale", "step", "unit"},
"forecast": {"min", "max", "scale", "step", "unit", "horizon", "interval"},
}
def item_spec(spec: dict[str, Any]) -> dict[str, Any]:
item = spec["items"]
return dict(item) if isinstance(item, dict) else {"type": item}
def validate_public_fields(fields: dict[str, dict[str, Any]]) -> None:
_validate_public_fields(fields, set())
def _validate_public_fields(
fields: dict[str, dict[str, Any]], checked_scalar_schemas: set[tuple[str, ...]]
) -> None:
for name, spec in fields.items():
kind = spec.get("type") if isinstance(spec, dict) else None
if not isinstance(kind, str) or kind not in OPTIONS:
raise ValueError(f"field {name}: unknown field type")
unknown = spec.keys() - COMMON - OPTIONS[kind]
if unknown:
raise ValueError(f"field {name}: unknown options {sorted(unknown)}")
if "instructions" in spec and (not isinstance(spec["instructions"], str)):
raise ValueError(f"field {name}: instructions must be a string")
if "nullable" in spec and (not isinstance(spec["nullable"], bool)):
raise ValueError(f"field {name}: nullable must be true or false")
if "source_only" in spec:
if not isinstance(spec["source_only"], bool):
raise ValueError(f"field {name}: source_only must be true or false")
if kind == "list" and spec.get("items") not in ("date", "number"):
raise ValueError(
f"field {name}: source_only lists require date or number items"
)
if spec["source_only"] and "null_threshold" in spec:
raise ValueError(
f"field {name}: source_only does not support typed null_threshold"
)
if spec["source_only"] and spec.get("knowledge"):
raise ValueError(
f"field {name}: source_only cannot permit knowledge answers"
)
if "enum" in spec and (not isinstance(spec["enum"], list) or not spec["enum"]):
raise ValueError(f"field {name}: enum must be a nonempty array")
if kind == "enum" and "enum" not in spec:
raise ValueError(f"field {name}: enum values are required")
if kind == "object":
properties = spec.get("properties")
if not isinstance(properties, dict) or not properties:
raise ValueError(f"field {name}: object properties are required")
if any(
(
not isinstance(child, dict)
or child.get("type") not in ("text", "number", "boolean", "enum")
for child in properties.values()
)
):
raise ValueError(
f"field {name}: row properties must be text, number, boolean or enum"
)
if any((child.get("source_only") for child in properties.values())):
raise ValueError(
f"field {name}: source_only is supported on scalar numbers and number lists, not row properties"
)
_validate_public_fields(properties, checked_scalar_schemas)
from . import schema as zs
zs.validate_fields(properties)
if kind == "list":
if "items" not in spec:
raise ValueError(f"list {name}: items are required")
child = item_spec(spec)
if isinstance(spec["items"], dict) and child.get("type") != "object":
raise ValueError(f"list {name}: structured items must be objects")
if child.get("type") == "object":
_validate_public_fields({name + "[]": child}, checked_scalar_schemas)
if spec.keys() & (NUMERIC | {"knowledge", "enum"}):
raise ValueError(
f"list {name}: put numeric or knowledge options on row properties"
)
maximum = spec.get("max_items")
if "max_items" in spec and (
isinstance(maximum, bool) or not isinstance(maximum, int) or maximum < 0
):
raise ValueError(
f"list {name}: max_items must be a nonnegative integer"
)
if kind in ("text", "number", "boolean", "enum", "object"):
from . import ar
try:
schema = ar.schema(spec)
scalar_key = None
if schema.keys() == {"type"}:
schema_type = schema["type"]
scalar_key = (
tuple(schema_type)
if isinstance(schema_type, list)
else (schema_type,)
)
if scalar_key is None or scalar_key not in checked_scalar_schemas:
Draft202012Validator.check_schema(schema)
if scalar_key is not None:
checked_scalar_schemas.add(scalar_key)
except SchemaError as error:
raise ValueError(
f"field {name}: invalid schema constraint: {error.message}"
) from error
|