API Reference

This page contains the API reference for public objects and functions in Guidance.

functions

guidance.gen([name, max_tokens, ...])

Generate a set of tokens until a given stop criteria has been met.

guidance.select(options[, name, ...])

Choose between a set of options.

guidance.json([name, temperature])

Generate valid JSON according to the supplied JSON schema or pydantic model.

context blocks

guidance.instruction([text])

guidance.system([text])

Indicate the 'system' prompt

guidance.user([text])

Indicate the 'user' prompt

guidance.assistant([text])

Indicate the 'assistant' prompt

models

guidance.models.Model(engine[, echo])

The base guidance model object, which represents a model in a given state.

guidance.models.LlamaCpp([model, echo, ...])

guidance.models.Transformers([model, ...])

guidance.models.Anthropic(model[, ...])

Represents an Anthropic model as exposed through their remote API.

guidance.models.AzureOpenAI(model, ...[, ...])

Represents an Azure OpenAI model as exposed through their remote API.

guidance.models.Cohere(model[, tokenizer, ...])

guidance.models.GoogleAI(model[, tokenizer, ...])

guidance.models.LiteLLM(model[, tokenizer, ...])

guidance.models.OpenAI(model[, tokenizer, ...])

guidance.models.VertexAI(model[, tokenizer, ...])