Jev (jev_elixir v0.1.0)

Copy Markdown

A small DSL for structured decisions from Jev providers.

Configure a provider and key in runtime config:

config :jev,
  provider: :typesafe,
  api_key: System.fetch_env!("TYPESAFE_API_KEY")

Use provider: :openrouter with an OpenRouter API key to route the same calls through OpenRouter's Decisions API.

ask/2, choose/3, score/3, and analyze/3 return normalized answers. They raise Jev.Error when configuration, transport, or response handling fails. ask?/2 returns a boolean and has the same error behavior.

Summary

Functions

Evaluates several typed questions against one state and returns a keyed map.

Evaluates a yes/no question, returning {:yes | :no, probability}.

Evaluates a yes/no question and returns a boolean at the requested threshold.

Chooses one value from the provided options, returning {choice, probability}.

Scores state on ordered levels, returning {score, confidence}.

Functions

analyze(state, questions, opts \\ [])

@spec analyze(term(), map() | keyword(), keyword()) :: map()

Evaluates several typed questions against one state and returns a keyed map.

ask(instruction, opts)

@spec ask(String.t(), keyword()) :: {:yes | :no, float()}

Evaluates a yes/no question, returning {:yes | :no, probability}.

ask?(instruction, opts)

@spec ask?(String.t(), keyword()) :: boolean()

Evaluates a yes/no question and returns a boolean at the requested threshold.

choose(instruction, options, opts \\ [])

@spec choose(String.t(), list() | map(), keyword()) :: {term(), float()}

Chooses one value from the provided options, returning {choice, probability}.

score(instruction, levels, opts \\ [])

@spec score(String.t(), list(), keyword()) :: {number(), float()}

Scores state on ordered levels, returning {score, confidence}.