Toolverse
All skills

guidance

by davila7

Control LLM output with regex and grammars, guarantee valid JSON/XML/code generation, enforce structured formats, and build multi-step workflows with Guidance - Microsoft Research's constrained generation framework

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Author
davila7
Category
Security
Views
46

About this skill

Control LLM output with regex and grammars, guarantee valid JSON/XML/code generation, enforce structured formats, and build multi-step workflows with Guidance - Microsoft Research's constrained generation framework

How to use

  1. Zainstaluj Guidance za pomocą pip install guidance. Jeśli planujesz pracować z modelami Hugging Face, dodaj [transformers]: pip install guidance[transformers]. Dla llama.cpp użyj pip install guidance[llama_cpp].

  2. Zaimportuj niezbędne komponenty: from guidance import models, gen, system, user, assistant. Moduł gen służy do definiowania miejsc, w których model powinien generować tekst, a context managery (system, user, assistant) pomagają strukturyzować konwersacje.

  3. Załaduj wybrany model. Dla OpenAI: lm = models.OpenAI("gpt-4"). Dla Claude: lm = models.Anthropic("claude-sonnet-4-5-20250929"). Guidance automatycznie obsługuje uwierzytelnianie na podstawie zmiennych środowiskowych.

  4. Zdefiniuj szablon z ograniczeniami. Użyj operatora + do łączenia tekstu statycznego z gen() dla miejsc generacji. Na przykład: result = lm + "Stolica Francji to " + gen("capital", max_tokens=5). Parametr max_tokens ogranicza długość odpowiedzi.

  5. Dla bardziej złożonych scenariuszy wykorzystaj context managery. Opakuj instrukcje systemu w with system():, pytania użytkownika w with user():, a oczekiwane odpowiedzi w with assistant():. To zapewnia prawidłowy format dla modeli opartych na czacie.

  6. Uruchom kod i dostęp do wyników. Zwrócony obiekt zawiera wszystkie zmienne zdefiniowane w gen() jako klucze słownika. Na przykład result["capital"] zwróci wygenerowaną wartość. Guidance gwarantuje, że output będzie zgodny z narzuconymi ograniczeniami.

Related skills

zendesk

by vm0-ai

Zendesk Support REST API for managing tickets, users, organizations, and support operations. Use this skill to create tickets, manage users, search, and automate customer support workflows.

Security
11100

accessibility-compliance

by wshobson

Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.

Security
2173

architect-review

by sickn33

Master software architect specializing in modern architecture patterns, clean architecture, microservices, event-driven systems, and DDD. Reviews system designs and code changes for architectural integrity, scalability, and maintainability. Use PROACTIVELY for architectural

Security
2773

skill-writer

by pytorch

Guide users through creating Agent Skills for Claude Code. Use when the user wants to create, write, author, or design a new Skill, or needs help with SKILL.md files, frontmatter, or skill structure.

Security
15116

software-security

by project-codeguard

A software security skill that integrates with Project CodeGuard to help AI coding agents write secure code and prevent common vulnerabilities. Use this skill when writing, reviewing, or modifying code to ensure secure-by-default practices are followed.

Security
1678

gmail-manager

by jeffvincent

Manage Gmail - send, read, search emails, manage labels and drafts. Use when user wants to interact with their Gmail account for email operations.

Security
17128