docs / IntroducciónIntroduction
.mini: reduce el texto que genera tu IA y recupera el mismo JSON#
Una empresa recibe quejas y consultas. Para evitar crear tickets a mano, su aplicación pide a una IA que interprete cada mensaje y genere una ficha con asunto, categoría y prioridad. Esa ficha es un ticket; el código necesita recibirlo en JSON para guardarlo y asignarlo.
JSON repite los nombres de los campos en cada ticket. La API cuenta ese texto en tokens, fragmentos que utiliza para calcular la factura. Menos tokens en la respuesta cuestan menos con el mismo modelo y tarifa. TOON también reduce repetición; .mini adapta las reglas a tu dominio mediante un contrato: campos, orden y tipos declarados una vez. El código valida la respuesta compacta, la repara cuando puede y recupera los mismos objetos JSON.
Sigue la automatización de soporte: 20 mensajes de clientes se convierten a 20 objetos JSON, con una ejecución guardada que puedes inspeccionar sin clave.
En ese ejemplo, el mismo resultado consume 443 tokens en JSON, 304 en TOON y 278 en .mini (o200k_base). Es una comparación de salida. El prompt .mini tiene 571 tokens y las correcciones también consumen tokens; mide el coste completo antes de atribuir un ahorro de dinero.
Empieza aquí#
Descarga y extrae el paquete. Desde la carpeta extraída:
python -m pip install --no-index mini_format-1.3.3-py3-none-any.whl
mini setup
El asistente te guía:
- Español o inglés.
- Un JSON de ejemplo de tu IA, tus propios campos o el caso de soporte incluido.
- Nombre y carpeta: crea
contract.json(reglas),prompt.es.md/prompt.en.md(instrucciones para la IA) yworkflow.py(validación, Repair y conversión a JSON). - Integración: elige el archivo que llama a la IA, busca en tu proyecto o selecciona Todavía no tengo un flujo. El comando para retomarlo queda en
GUIA.mdyREADME.md. - Prueba: copia
try-prompt.mda tu IA; pide 20 objetos ficticios. Comprueba la respuesta antes de guardar datos reales.
La edición automática cubre un patrón Python síncrono de chat completions + json.loads. Otros SDK o lenguajes reciben una guía para tu IA de código, con las rutas reales. Workflow.run acepta cualquier callback síncrono que reciba un prompt y devuelva texto; también hay una entrada por CLI para otros lenguajes.
Si todavía no tienes un flujo, conserva el kit. Cuando crees tu llamada a IA, ejecuta:
mini integrate ruta/a/tu/app.py --bundle .mini --lang es
Prueba el flujo sin clave#
python examples/flujo-soporte/run.py
Reproduce 20 tickets escritos por Muse con fallos introducidos para la demostración. Ejecuta las herramientas reales y guarda output/soporte/result.json e history.json. No llama a una API. Para ver el formulario local y, opcionalmente, usar una API key de OpenAI: python examples/flujo-soporte/run.py --serve.
Continúa cuando lo necesites#
- Inicio rápido: desde tu JSON hasta la aplicación.
- Integración y toolkit: callback, reparación y conexión por comando.
- Descargas: Python, Node y ejemplos.
- Especificación y perfil del toolkit: referencia técnica.
.mini se adapta a tus datos. Las 14 familias son ejemplos opcionales, no una lista de casos obligatorios. El toolkit generado utiliza Python 3.9+ y su perfil mini-domain/1; la biblioteca Node/TypeScript implementa el perfil base SPEC 1.1. MIT.
.mini: shorter AI responses, JSON for your application#
A company receives complaints and questions. To avoid creating support tickets by hand, its app asks AI to interpret each message and generate a record with a title, category and priority. That record is a ticket; the code needs JSON to store and assign it.
JSON repeats field names in every ticket. The API counts that text in tokens, pieces used to calculate the bill. Fewer response tokens cost less at the same model and rate. TOON also reduces repetition; .mini tailors the rules to your domain through a contract: fields, order and types declared once. The workflow validates the compact response, repairs it when possible and recovers the same JSON objects.
Follow support automation: 20 customer messages become 20 JSON objects, with a recorded run you can inspect without a key.
In this example, the same output takes 443 JSON tokens, 304 TOON tokens and 278 .mini tokens (o200k_base). These are output counts. The .mini prompt has 571 tokens and corrections also cost tokens; measure the full workflow before claiming monetary savings.
Start here#
Download and extract the package. From the extracted directory:
python -m pip install --no-index mini_format-1.3.3-py3-none-any.whl
mini setup
The wizard guides you through:
- Spanish or English.
- A sample JSON response from your AI, your own fields or the included support example.
- Name and directory: create
contract.json(rules),prompt.es.md/prompt.en.md(AI instructions) andworkflow.py(validation, Repair and JSON conversion). - Integration: select the file that calls AI, search your project or choose I do not have a workflow yet. The resume command is saved in
README.mdandGUIA.md. - Test: paste
try-prompt.mdinto your AI; it asks for 20 fictional objects. Check the reply before saving real data.
Automatic editing covers a synchronous Python chat completions + json.loads pattern. Other SDKs/languages receive a coding-AI guide with actual paths. Workflow.run accepts any synchronous callback that takes a prompt and returns text; a CLI bridge is available for other languages.
No workflow yet? Keep the toolkit. Once you create your AI call file, run:
mini integrate path/to/app.py --bundle .mini --lang en
Try the workflow without a key#
python examples/flujo-soporte/run.py
Replay 20 tickets authored by Muse with deliberately inserted demonstration errors. It executes the actual tools and saves output/soporte/result.json and history.json. No API call is made. For the local form and optional live OpenAI API-key mode: python examples/flujo-soporte/run.py --serve.
Continue when needed#
- Quickstart: from your JSON to your application.
- Integration and toolkit: callbacks, repair and command integration.
- Downloads: Python, Node and examples.
- Specification and toolkit profile: technical reference.
.mini adapts to your data. The 14 families are optional examples. Generated toolkits use Python 3.9+ and the mini-domain/1 profile; the Node/TypeScript library implements base SPEC 1.1. MIT.