Loads Nous.Profiles from an eval store.
{:ok, profile} =
Nous.Eval.Profiles.fetch(
{Nous.Eval.Store.File, root: "priv/eval"},
{:label, "support_agent", "production"}
)
agent = Nous.new("openai:gpt-4o", instructions: @base, tools: tools, profile: profile)Nous.new/2 takes only a %Nous.Profile{}: resolving one from a store is
I/O with its own failure modes, so it is an explicit step here. A ref is
{:id, "sha256:…"}, {:version, name, n} or {:label, name, label} (see
Nous.Eval.Store.profile_ref/0); a label that was never set is
{:error, :not_found}, never a fallback to another version.
Whoever can write the store controls the text of every agent that loads
from it. For production, prefer promoting a profile, exporting it to a
file (Nous.Profile.encode/1), reviewing it in version control and
loading it with Nous.Profile.load!/1.
Summary
Functions
Opens store and fetches the profile ref names.
Fetches the profile ref names from module with its open state.
Functions
@spec fetch({module(), keyword()}, Nous.Eval.Store.profile_ref()) :: {:ok, Nous.Profile.t()} | {:error, term()}
Opens store and fetches the profile ref names.
store is {module, init_opts}: a Nous.Eval.Store module and the
options for its init/1. See fetch/3 for an already open store.
@spec fetch(module(), term(), Nous.Eval.Store.profile_ref()) :: {:ok, Nous.Profile.t()} | {:error, term()}
Fetches the profile ref names from module with its open state.
Fails closed: besides the store's own checks, the profile is re-encoded
and its content hash recomputed, and it must be what ref names (same id,
same name and version, or the label's name). A mismatch is
{:error, %Nous.Errors.ProfileError{reason: :id_mismatch}} or
{:error, {:corrupt_profile, ref}}. A store without the profile callbacks
is {:error, {:unsupported, module}}.