Guidance is a #Python library for superior control over #AI text generation. Easily interleave prompting, constraints like regexes/CFGs, and generation in clean Python code - no more parsing!
As AI capabilities advance, more developers are leveraging large language models (LLMs) to generate text. However, properly constraining and controlling LLM output can be challenging. Most approaches involve prompting, parsing, and chained iterations – very inefficient!
👩💻 That's what Guidance is about, a Python library that enables superior control over text generation with cleaner code.
✅ Easily interleave prompting, generation calls, constraints like regexes and context-free grammars (CFGs), and more – no painful intermediate parsing!
⚙️ Stateful control flow lets you make decisions based on prior model generation. Changing course is trivial.
🤖 Automatic tool integration pauses generation to invoke functions, then resumes – perfect for things like calculators.
🌈 Supports Transformers, LlamaCPP, VertexAI, OpenAI, and more for wide compatibility.
📈 Faster execution than chained approaches in many cases, since you can batch plain text appends.
The result? You write beautiful Python code that reads like scripts, not messy chained prompts. There is no need to design prompts that anticipate and handle all branches. Guidance handles constraint violations automatically.
Guidance stands out with cleaner logic and superior model control regardless if you are building assistants, classifiers, control flows, or more.
- 👩💻 It enables writing cleaner code that interleaves prompting, constraints, and generation without intermediate parsing. Better readability and maintainability.
- ⚡️ It offers faster execution than chaining in many cases by batching text appends. Speed is critical for production systems.
- 🎯 It provides superior control over text generation through regexes, CFGs, automatic tool integration, and more. Critical for quality output.
- 🔀 It supports stateful flows that adapt based on prior model generations. More dynamic conversations and workflows.
- 🤝 It is compatible with Transformers, LlamaCPP, VertexAI, OpenAI, and more. Write once, run anywhere.
- 👷🏽♀️ Builders: Scott Lundberg, Marco Tulio Correia Ribeiro, Harsha-Nori, Richard Edgar
- 👩🏽💼 Builders on LinkedIn: https://www.linkedin.com/in/scott-lundberg-62ba928/, https://www.linkedin.com/in/marcotcr/, https://www.linkedin.com/in/harshanori/, https://www.linkedin.com/in/richard-edgar-48aa0613/
- 👩🏽🏭 Builders on X: https://twitter.com/scottlundberg, https://twitter.com/marcotcr, https://twitter.com/HarshaNori
- 💾 Used in 391 repositories
- 👩🏽💻 Contributors: 48
- 💫 GitHub Stars: 15.3k
- 🍴 Forks: 976
- 👁️ Watch: 111
- 🪪 License: MIT
- 🔗 Links: Below 👇🏽
- GitHub Repository: https://github.com/guidance-ai/guidance
- Profile in The AI Engineer: https://github.com/theaiengineer/awesome-opensource-ai-engineering/blob/main/libraries/guidance/README.md
🧙🏽 Follow The AI Engineer for more about guidance and daily insights tailored to AI engineers. Subscribe to our newsletter. We are the AI community for hackers!
♻️ Repost this to help guidance become more popular. Support AI Open-Source Libraries!