LangSchema.Adapter behaviour (LangSchema v0.4.0)

View Source

Defines a common behavior for adapters that convert various input types into abstract schemas or JSON schemas.

The LangSchema.Adapter provides a flexible way to integrate different data structures into the LangSchema. It allows converting inputs like Struct typespecs, LangChain.FunctionParam, and Ash Resources into standardized abstract schemas or JSON schemas, making it easier to use them consistently within LangSchema.

Summary

Callbacks

Converts a given input into a JSON schema using the specified converter module.

Converts a given input into a schema using the specified converter module.

Callbacks

convert(any, converter_mod, opts)

@callback convert(any(), converter_mod :: module(), opts :: keyword()) ::
  json_schema :: map()

Converts a given input into a JSON schema using the specified converter module.

to_schema(any)

@callback to_schema(any()) :: schema :: map()

Converts a given input into a schema using the specified converter module.