Jido.Chat.Capabilities (Jido Chat v1.0.0)

Copy Markdown View Source

Capabilities negotiation for adapters and participants.

Provides functions to check and filter inbound content blocks and outbound post payloads based on channel capabilities.

Summary

Functions

Returns all supported capability atoms.

Checks if a channel can deliver the given outbound postable payload.

Returns the delivery-focused capability list for an adapter module.

Returns the list of capabilities required for an inbound content block.

Filters a list of content or outbound payloads to only what the channel supports.

Checks if a capability is in the list of capabilities.

Returns a list of content or outbound payloads that the channel cannot deliver.

Types

capabilities()

@type capabilities() :: [capability()]

capability()

@type capability() ::
  :text
  | :image
  | :audio
  | :video
  | :file
  | :multi_file
  | :markdown
  | :cards
  | :modals
  | :ephemeral
  | :tool_use
  | :streaming
  | :reactions
  | :threads
  | :typing
  | :presence
  | :read_receipts
  | :assistant_events

Functions

all()

@spec all() :: capabilities()

Returns all supported capability atoms.

can_deliver?(channel_caps, postable)

@spec can_deliver?(
  capabilities(),
  Jido.Chat.Postable.t() | Jido.Chat.PostPayload.t() | map()
) ::
  boolean()
@spec can_deliver?(
  capabilities(),
  struct()
) :: boolean()

Checks if a channel can deliver the given outbound postable payload.

channel_capabilities(adapter_module)

@spec channel_capabilities(module()) :: capabilities()

Returns the delivery-focused capability list for an adapter module.

content_requires(arg1)

@spec content_requires(struct()) :: capabilities()

Returns the list of capabilities required for an inbound content block.

filter_content(content_list, channel_caps)

@spec filter_content([term()], capabilities()) :: [term()]

Filters a list of content or outbound payloads to only what the channel supports.

supports?(capabilities, capability)

@spec supports?(capabilities(), capability()) :: boolean()

Checks if a capability is in the list of capabilities.

unsupported_content(content_list, channel_caps)

@spec unsupported_content([term()], capabilities()) :: [term()]

Returns a list of content or outbound payloads that the channel cannot deliver.