Jido.Messaging.BridgePlugin (Jido Messaging v1.0.0)

Copy Markdown View Source

Adapter bridge metadata struct.

Represents a registered adapter bridge with its metadata, capabilities, and optional adapter implementations.

Fields

  • :id - Unique atom identifier (e.g., :telegram, :discord)
  • :adapter_module - The module implementing Jido.Chat.Adapter
  • :label - Human-readable display name (e.g., "Telegram Adapter")
  • :capabilities - List of supported capabilities (e.g., [:text, :image, :streaming])
  • :adapters - Map of adapter type to module (e.g., %{mentions: MyMentionsAdapter})

Example

%BridgePlugin{
  id: :telegram,
  adapter_module: MyApp.TelegramAdapter,
  label: "Telegram Adapter",
  capabilities: [:text, :typing],
  adapters: %{}
}

Summary

Functions

Creates a new BridgePlugin from an adapter module.

Gets an adapter module for a specific adapter type.

Checks if the plugin supports a specific capability.

Returns the Zoi schema for BridgePlugin

Types

t()

@type t() :: %Jido.Messaging.BridgePlugin{
  adapter_module: module(),
  adapters: map(),
  capabilities: [atom()],
  id: atom(),
  label: binary()
}

Functions

from_adapter(adapter_module, opts \\ [])

@spec from_adapter(
  module(),
  keyword()
) :: t()

Creates a new BridgePlugin from an adapter module.

Automatically extracts capabilities from Jido.Messaging.AdapterBridge.

Parameters

  • adapter_module - Module implementing Jido.Chat.Adapter
  • opts - Optional overrides:
    • :id - Override the channel type as the ID
    • :label - Override the default label
    • :adapters - Map of adapter type to module

Examples

BridgePlugin.from_adapter(MyApp.TelegramAdapter)
# => %BridgePlugin{id: :telegram, label: "Telegram", ...}

BridgePlugin.from_adapter(MyAdapter, label: "My Custom Adapter")

get_adapter(bridge_plugin, adapter_type)

@spec get_adapter(t(), atom()) :: module() | nil

Gets an adapter module for a specific adapter type.

Examples

BridgePlugin.get_adapter(telegram_plugin, :mentions)
# => MyApp.TelegramMentionsAdapter

has_capability?(bridge_plugin, capability)

@spec has_capability?(t(), atom()) :: boolean()

Checks if the plugin supports a specific capability.

Examples

BridgePlugin.has_capability?(telegram_plugin, :streaming)
# => true

schema()

Returns the Zoi schema for BridgePlugin