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.
11 12 13 14 15 16 |
# File 'lib/wave_dispatch.rb', line 11 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.
22 |
# File 'lib/wave_dispatch.rb', line 22 def execute(prompt) = send_req(:post, @endpoint + "/", { prompt: prompt, execute: true }) |
#route(prompt) ⇒ Object
Classify a prompt (no execution) -> “probability”, “margin”, “forward”
19 |
# File 'lib/wave_dispatch.rb', line 19 def route(prompt) = send_req(:post, @endpoint + "/", { prompt: prompt }) |
#savings ⇒ Object
This license’s savings ledger (decisions, saved_usd, saved_pct, …). Requires a license.
25 |
# File 'lib/wave_dispatch.rb', line 25 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).
31 |
# File 'lib/wave_dispatch.rb', line 31 def subscribe(plan) = send_req(:post, "#{@agents}/subscription/create", { license: @license, plan: plan }) |
#subscription ⇒ Object
This license’s agent-subscription status.
28 |
# File 'lib/wave_dispatch.rb', line 28 def subscription = send_req(:get, "#{@agents}/subscription/status?license=#{lic}") |