View Source AI

Helpers for using AI in Elixir.

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

iex> ~LLM"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> ~LLM"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 potions to your list of dependencies in mix.exs:

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

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/potions.