LemonGateway.AI (lemon_gateway v0.1.0)

View Source

Simple interface for AI chat completions.

Supports multiple providers (OpenAI, Anthropic) with a unified interface.

Summary

Functions

Generate a chat completion using the specified model.

Functions

chat_completion(model, messages, opts \\ %{})

@spec chat_completion(String.t(), [map()], map()) :: {:ok, map()} | {:error, term()}

Generate a chat completion using the specified model.

Examples

iex> messages = [%{role: "user", content: "Hello!"}]
iex> LemonGateway.AI.chat_completion("gpt-4o-mini", messages)
{:ok, %{"choices" => [%{"message" => %{"content" => "Hi there!"}}]}}