KernelContent Class

Base class for all kernel contents.

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 allow self as a field name.

Constructor

KernelContent(*, inner_content: Any | None = None, ai_model_id: str | None = None, metadata: dict[str, Any] = None)

Keyword-Only Parameters

Name Description
inner_content
Required
ai_model_id
Required
metadata
Required

Methods

from_element

Create an instance from an Element.

to_dict

Convert the instance to a dictionary.

to_element

Convert the instance to an Element.

from_element

Create an instance from an Element.

abstract classmethod from_element(element: Any) -> _T

Parameters

Name Description
element
Required

to_dict

Convert the instance to a dictionary.

abstract to_dict() -> dict[str, Any]

to_element

Convert the instance to an Element.

abstract to_element() -> Any

Attributes

ai_model_id

ai_model_id: str | None

inner_content

inner_content: Annotated[Any | None, FieldInfo(annotation=NoneType, required=True, exclude=True)]

metadata

metadata: dict[str, Any]