new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Pydantic · API reference · all subjects

configdict

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

cache_strings configuration in JSON parsing

The cache_strings setting controls how Python strings are cached during JSON parsing and validation. Available in v2.7.0+. Can be set via ConfigDict or pydantic_core.from_json. Values: True or 'all' (cache all strings, default), 'keys' (cache only dictionary keys, pydantic_core.from_json or Json type only), False or 'none' (no caching).

ConfigDict options for JSON schema customization

ConfigDict options relevant to JSON schema generation are: title (sets the model title), json_schema_extra (adds extra information to JSON schema, accepts dict or Callable), json_schema_mode_override (overrides the default mode for JSON schema generation), field_title_generator (a function that programmatically generates field titles), and model_title_generator (a function that programmatically generates the model title).

ConfigDict extra configuration option values

The extra configuration value can take three values: 'ignore' (providing extra data is ignored, the default), 'forbid' (providing extra data is not permitted), or 'allow' (providing extra data is allowed and stored in the __pydantic_extra__ dictionary attribute). The validation methods have an optional extra argument that will override the extra configuration value for that validation call.

ConfigDict from_attributes option

from_attributes is a configuration option that enables validation of arbitrary objects by getting attributes on the object corresponding to field names. This feature is useful for integration with object-relational mappings (ORMs) and can be set either in model_config or as a parameter to model_validate().

ConfigDict frozen option

frozen is a configuration option that makes models immutable. When set to True, attempting to change the values of instance attributes will raise ValidationError. In Pydantic V1, this was achieved with allow_mutation=False, which is deprecated in V2.

Give your agent this brain