Wardrik. Setup
(wardrik v0.1.0-rc.1)
Copy Markdown
Builds %Wardrik{} from Wardrik.start_link/1's options, and each agent's options.
Summary
Functions
Returns the options WardrikCore.start_agent/2 takes for the agent opts describe.
Returns an agent's :policy as a list of policies. nil is [].
Builds a policy from its rules. Returns a WardrikPolicy or nil as given.
Returns the price of the model spec, in US dollars per million tokens.
Builds a %Wardrik{} from Wardrik.start_link/1's options.
Functions
Returns the options WardrikCore.start_agent/2 takes for the agent opts describe.
Adds Wardrik's events, prices, credentials and keys, spending, middleware and policies. The
agent's own :policy is held alongside Wardrik's.
@spec policies(WardrikPolicy.t() | [WardrikPolicy.t()] | keyword() | map() | nil) :: [ WardrikPolicy.t() ]
Returns an agent's :policy as a list of policies. nil is [].
@spec policy(WardrikPolicy.t() | keyword() | map() | nil) :: WardrikPolicy.t() | nil
Builds a policy from its rules. Returns a WardrikPolicy or nil as given.
Returns the price of the model spec, in US dollars per million tokens.
# Its own rates
Wardrik.Setup.price("acme:model-1", input: 0.5, output: 1.5)
# Another model's catalog price, 10% more
Wardrik.Setup.price("zai_coding_plan:glm-5.1", priced_as: "zai:glm-5.1", markup: 0.1)Options
:inputand:output- rates. Both required unless:priced_asis set.:cache_readand:cache_write- optional rates.:priced_as- a model whose catalog price to use. Can't be combined with rates.:markup- added on top, as0.1for 10%.0unless set.
Raises ArgumentError if the price is invalid.
Builds a %Wardrik{} from Wardrik.start_link/1's options.