Module atomic_agents.lib.base.base_io_schema
Classes
class BaseIOSchema (**data: Any)
-
Base schema for input/output in the Atomic Agents framework.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class BaseIOSchema(BaseModel): """Base schema for input/output in the Atomic Agents framework.""" def __str__(self): return self.model_dump_json() def __rich__(self): json_str = self.model_dump_json() return JSON(json_str) @classmethod def __pydantic_init_subclass__(cls, **kwargs): super().__pydantic_init_subclass__(**kwargs) cls._validate_description() @classmethod def _validate_description(cls): description = cls.__doc__ if not description or not description.strip(): if cls.__module__ != "instructor.function_calls" and not hasattr(cls, "from_streaming_response"): raise ValueError(f"{cls.__name__} must have a non-empty docstring to serve as its description") @classmethod def model_json_schema(cls, *args, **kwargs): schema = super().model_json_schema(*args, **kwargs) if "description" not in schema and cls.__doc__: schema["description"] = inspect.cleandoc(cls.__doc__) if "title" not in schema: schema["title"] = cls.__name__ return schema
Ancestors
- pydantic.main.BaseModel
Subclasses
Class variables
var model_config
-
The type of the None singleton.
Static methods
def model_json_schema(*args, **kwargs)
-
Generates a JSON schema for a model class.
Args
by_alias
- Whether to use attribute aliases or not.
ref_template
- The reference template.
schema_generator
- To override the logic used to generate the JSON schema, as a subclass of
GenerateJsonSchema
with your desired modifications mode
- The mode in which to generate the schema.
Returns
The JSON schema for the given model class.