Jido.AI.Promptable protocol (Jido AI v0.5.2)

View Source

Protocol for data structures that can be converted into prompts for LLMs.

Implementing this protocol allows any struct to be convertible to a string prompt via Jido.AI.Promptable.to_prompt/1.

Examples

defimpl Jido.AI.Promptable, for: MyApp.User do
  def to_prompt(user) do
    "User #{user.name} is #{user.age} years old"
  end
end

user = %MyApp.User{name: "Alice", age: 30}
Jido.AI.Promptable.to_prompt(user) #=> "User Alice is 30 years old"

Summary

Types

t()

All the types that implement this protocol.

Functions

Converts the given data structure into a prompt string suitable for an LLM.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

to_prompt(data)

@spec to_prompt(t()) :: String.t()

Converts the given data structure into a prompt string suitable for an LLM.