Class: WaveDispatch::Client
- Inherits:
-
Object
- Object
- WaveDispatch::Client
- Defined in:
- lib/wave_dispatch.rb
Instance Method Summary collapse
-
#execute(prompt) ⇒ Object
Classify and run on the edge if your plan allows it.
-
#initialize(license = ENV["WAVE_LICENSE"], endpoint: "https://dispatch.wave.online", agents_endpoint: ENV["WAVE_AGENTS_ENDPOINT"] || "https://dispatch-agents.wave.online") ⇒ Client
constructor
A new instance of Client.
-
#route(prompt) ⇒ Object
Classify a prompt (no execution) -> “probability”, “margin”, “forward”.
-
#savings ⇒ Object
This license’s savings ledger (decisions, saved_usd, saved_pct, …).
-
#subscribe(plan) ⇒ Object
Start/replace a programmatic subscription (plan: agent_starter | agent_pro | agent_scale).
-
#subscription ⇒ Object
This license’s agent-subscription status.
Constructor Details
#initialize(license = ENV["WAVE_LICENSE"], endpoint: "https://dispatch.wave.online", agents_endpoint: ENV["WAVE_AGENTS_ENDPOINT"] || "https://dispatch-agents.wave.online") ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 |
# File 'lib/wave_dispatch.rb', line 12 def initialize(license = ENV["WAVE_LICENSE"], endpoint: "https://dispatch.wave.online", agents_endpoint: ENV["WAVE_AGENTS_ENDPOINT"] || "https://dispatch-agents.wave.online") @license = license @endpoint = endpoint @agents = agents_endpoint end |
Instance Method Details
#execute(prompt) ⇒ Object
Classify and run on the edge if your plan allows it.
23 |
# File 'lib/wave_dispatch.rb', line 23 def execute(prompt) = send_req(:post, @endpoint + "/", { prompt: prompt, execute: true }) |
#route(prompt) ⇒ Object
Classify a prompt (no execution) -> “probability”, “margin”, “forward”
20 |
# File 'lib/wave_dispatch.rb', line 20 def route(prompt) = send_req(:post, @endpoint + "/", { prompt: prompt }) |
#savings ⇒ Object
This license’s savings ledger (decisions, saved_usd, saved_pct, …). Requires a license.
26 |
# File 'lib/wave_dispatch.rb', line 26 def savings = send_req(:get, "#{@agents}/ledger/summary?license=#{lic}") |
#subscribe(plan) ⇒ Object
Start/replace a programmatic subscription (plan: agent_starter | agent_pro | agent_scale).
32 |
# File 'lib/wave_dispatch.rb', line 32 def subscribe(plan) = send_req(:post, "#{@agents}/subscription/create", { license: @license, plan: plan }) |
#subscription ⇒ Object
This license’s agent-subscription status.
29 |
# File 'lib/wave_dispatch.rb', line 29 def subscription = send_req(:get, "#{@agents}/subscription/status?license=#{lic}") |