elixir_ai icon indicating copy to clipboard operation
elixir_ai copied to clipboard

AI helpers for Elixir projects

AI

Helpers for using AI in Elixir. Currently requires the OpenAI package.

Includes ~l sigil and chat/1 function for OpenAI generation.

iex> ~l"model:gpt-3.5-turbo user: how do I build an igloo in 10 words?"
[
  model: "gpt-3.5-turbo",
  messages: [%{role: "user", content: "how do I build an igloo in 10 words?"}]
]
iex> ~l"model:gpt-3.5-turbo user: how do I build an igloo in 10 words?" |> chat()
{:ok, "Stack snow blocks in circle, decreasing size upward, till enclosed"}

Installation

If available in Hex, the package can be installed by adding ai to your list of dependencies in mix.exs:

def deps do
  [
    {:ai, "~> 0.3.4"},
  ]
end

Why?

Here's why!