Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 11, 2026·2 min de lectura

Guidance — Constrained Generation in Python

Guidance gives you constrained generation (regex, select lists, grammars) in Python. `pip install guidance`, then run with Transformers or other backends.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Stage only · 29/100Stage only
Superficie agent
Cualquier agent MCP/CLI
Tipo
Script
Instalación
Single
Confianza
Confianza: Established
Entrada
README.md
Comando CLI universal
npx tokrepo install dc8ec1af-aae5-4af4-b355-dffcad6efaf7
Introducción

Guidance gives you constrained generation (regex, select lists, grammars) in Python. pip install guidance, then run with Transformers or other backends.

  • Best for: teams who need controllable formats (IDs, enums, templates) and want stronger guarantees than best-effort prompting
  • Works with: Python, Guidance primitives (gen, select), model backends like Transformers/LlamaCpp/OpenAI (per repo)
  • Setup time: 10 minutes

Quantitative Notes

  • Install command: pip install guidance (repo)
  • Setup time ~10 minutes
  • GitHub stars (verified): see Source & Thanks

Practical Notes

Use Guidance as a safety layer when you can't afford invalid formats. Start with simple constraints (regex for numbers/IDs, select() for enums), then graduate to richer grammars. In agent pipelines, put constraints right before boundaries: DB writes, API calls, tool arguments, and routing decisions.

Safety note: Constraints can increase compute; budget latency by keeping grammars small and prompts focused.

FAQ

Q: What is constrained generation? A: You restrict the model to outputs that match a pattern (regex), belong to a list, or follow a grammar—reducing invalid responses.

Q: Do I need a specific model? A: No. The repo mentions multiple backends; you pick one that fits your environment (local Transformers, llama.cpp, hosted APIs).

Q: Where does it help most? A: Any step that must be parseable: routing labels, IDs, enums, JSON-like fields, or template-bound strings.


🙏

Fuente y agradecimientos

GitHub: https://github.com/guidance-ai/guidance Owner avatar: https://avatars.githubusercontent.com/u/142035062?v=4 License (SPDX): MIT GitHub stars (verified via api.github.com/repos/guidance-ai/guidance): 21,453

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados