Documentation Index
Fetch the complete documentation index at: https://docs.perceptron.inc/llms.txt
Use this file to discover all available pages before exploring further.
Helpers overview
pydantic_format(MyModel, name=None, strict=None): Generate the schema from a Pydantic v2 model; optionally override the schema name; setstrict=Truefor strict enforcement.json_schema_format(schema, name="response", strict=None): Wrap a JSON Schema dict to enforce keys, enums, and structure—setstrict=Truefor strict enforcement.regex_format(pattern): Constrain short outputs (yes/no, IDs, emails) with a regex instead of a full schema.
response_format argument available on perceive, async_perceive, Client.generate, and Client.stream.
Pydantic-backed responses
Use Pydantic models to define the target shape, then passpydantic_format so the response is guaranteed to match. You can parse the result directly into the model for type-safe handling.
Strict mode (
strict=True) pushes providers to reject extra fields and invalid enums. When omitted, provider defaults apply.Raw JSON Schema
If you already have a schema, pass it directly viajson_schema_format.
Regex constraints for short answers
Useregex_format when a compact pattern is enough (e.g., binary decisions, IDs, or numeric ranges).
Streaming with structure
Client.stream and async_perceive(stream=True) support the same response_format. Streamed deltas arrive as text; the final event still respects your schema so you can parse once the stream completes.
Schema compilation can add latency the first time you use a new shape. Reuse the same schema object or Pydantic model to benefit from provider-side caching.