AsTextSerializer

A serializer that converts an object implementing the TextSerializable interface into a textual format by utilizing the textForLLM function defined in the interface.

This serializer provides functionality to encode the object into a string format suitable for textual representation and decodes it using a provided serializer for the type.

Parameters

T

The type of object being serialized/deserialized, constrained to types implementing TextSerializable.

valueSerializer

The serializer responsible for handling the underlying type operations.

Constructors

Link copied to clipboard
constructor(valueSerializer: KSerializer<T>)

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

The descriptor that provides metadata about the serialized form of the value. This descriptor corresponds to the valueSerializer's descriptor, defining the structure of the serialized data and associated information like kind and elements.

Functions

Link copied to clipboard

Provides a custom deserializer for tools using the KSerializer interface. Converts the current serializer into a specialized tool descriptor deserializer if the underlying descriptor has a primitive kind.

Link copied to clipboard
open override fun deserialize(decoder: Decoder): T

Deserializes the provided encoded data using the specified decoder and returns the resulting object of type T.

Link copied to clipboard
open override fun serialize(encoder: Encoder, value: T)

Serializes an object of type T into its textual representation.