Skip to content

hawku-com/middle_ai_sdk

Repository files navigation

Middle AI SDK

This is the Elixir SDK for Middle AI. It provides functions to track your users LLM usage.

Configuration

Set your API key in your application configuration:

config :middle_ai, api_key: <YOUR_API_KEY>

Usage

Wrap your LLM calls the following way

trace = MiddleAi.start_trace("trace_name", model, %{max_tokens: max_tokens, temperature: temperature}, user_id, prompt)

{:ok, output} = OpenAI.completions(
    model: model,
    prompt: prompt,
    max_tokens: max_tokens,
    temperature: temperature,
    ...
  )

MiddleAi.end_trance(trace, output)

Releases

No releases published

Packages

No packages published

Languages