haive.core.graph.state_graph.serializableΒΆ

from typing import Any, Dict. Serialization support for BaseGraph.

This module provides serialization and deserialization utilities for BaseGraph, enabling graphs to be stored, loaded, and exchanged with minimal information loss.

ClassesΒΆ

SerializableBranch

Serializable representation of a Branch.

SerializableGraph

Serializable representation of the BaseGraph.

SerializableNode

Serializable representation of a Node.

TypeReference

Reference to a type that can be serialized.

Module ContentsΒΆ

class haive.core.graph.state_graph.serializable.SerializableBranch(/, **data)[source]ΒΆ

Bases: pydantic.BaseModel

Serializable representation of a Branch.

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.

Parameters:

data (Any)

model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class haive.core.graph.state_graph.serializable.SerializableGraph(/, **data)[source]ΒΆ

Bases: pydantic.BaseModel

Serializable representation of the BaseGraph.

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.

Parameters:

data (Any)

classmethod from_dict(data)[source]ΒΆ

Create from a dictionary.

Parameters:

data (dict[str, Any])

classmethod from_graph(graph)[source]ΒΆ

Create a serializable representation from a BaseGraph.

Return type:

Any

classmethod from_json(json_str)[source]ΒΆ

Create from JSON string.

Return type:

Any

to_dict()[source]ΒΆ

Convert to a dictionary for serialization.

Return type:

Any

to_graph()[source]ΒΆ

Convert serializable representation back to a BaseGraph.

Return type:

Any

to_json(**kwargs)[source]ΒΆ

Convert to JSON string.

Return type:

Any

model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class haive.core.graph.state_graph.serializable.SerializableNode(/, **data)[source]ΒΆ

Bases: pydantic.BaseModel

Serializable representation of a Node.

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.

Parameters:

data (Any)

model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class haive.core.graph.state_graph.serializable.TypeReference(/, **data)[source]ΒΆ

Bases: pydantic.BaseModel

Reference to a type that can be serialized.

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.

Parameters:

data (Any)

classmethod from_type(type_obj)[source]ΒΆ

From Type.

Parameters:

type_obj – [TODO: Add description]

Returns:

Add return description]

Return type:

[TODO

resolve()[source]ΒΆ

Resolve the reference back to a type.

Return type:

Any

model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].