Nous.CodeRuntime.Request (nous v0.17.1)

Copy Markdown View Source

What to run, what it may call, and who gets the answer.

Deliberately absent: tuning knobs. There is no timeout, no memory cap and no instruction budget here. Budgets are provider configuration, validated when the provider is configured, because a per-request budget is a per-request way for a caller — and therefore, one refactor later, for a model — to ask for more rope. A program cannot request a longer deadline for itself.

owner is the process that receives {:code_run, ref, %Nous.CodeRuntime.Result{}}.

Summary

Functions

Build a request, validating the shape a provider is entitled to assume.

Types

t()

@type t() :: %Nous.CodeRuntime.Request{
  bindings: [Nous.CodeRuntime.Binding.t()],
  owner: pid(),
  program: String.t()
}

Functions

new(program, bindings, owner)

@spec new(String.t(), [Nous.CodeRuntime.Binding.t()], pid()) ::
  {:ok, t()} | {:error, {:contract, String.t()}}

Build a request, validating the shape a provider is entitled to assume.

Returns {:error, {:contract, message}} rather than raising: a malformed request is seam misuse by Nous itself, and the tool call that carried it should fail cleanly rather than take down the run.