Every gate in this repo compares a client to the document, and every build proves the client is well-formed. Neither answers the question a user actually has: does it work against a server. Seven languages now answer it -- go, python, typescript, dart, php, ruby, rust -- against the local cloud by default and against anything HANZO_BASE_URL names. Each probe asserts a 200 whose body decodes AND a 403 that arrives as an error, because a client that swallows a refusal and returns a zero value looks exactly like one that works. It earned its place on the first run: GET /v1/models is AiAPI.GetModels in Go and ai_api::get_models in Rust but ModelsApi.getModels in TypeScript. One document, three groupings, and nothing but a call finds it.
22 lines
756 B
Ruby
22 lines
756 B
Ruby
$LOAD_PATH.unshift '/home/z/work/hanzo/ruby-sdk/lib'
|
|
require 'hanzoai'
|
|
base = ENV.fetch('HANZO_BASE_URL')
|
|
Hanzoai.configure { |c| c.host = base.sub(%r{^https?://}, ''); c.scheme = base.start_with?('https') ? 'https' : 'http' }
|
|
fail = 0
|
|
begin
|
|
_, code, = Hanzoai::AiApi.new.get_models_with_http_info
|
|
puts " ok GET /v1/models #{code}"
|
|
rescue => e
|
|
puts " FAIL models: #{e.class}: #{e.message[0,70]}"; fail += 1
|
|
end
|
|
begin
|
|
Hanzoai::EngineApi.new.engine_status
|
|
puts " FAIL engine: unauthenticated call reported success"; fail += 1
|
|
rescue Hanzoai::ApiError => e
|
|
puts " ok GET /v1/engine/status refused: #{e.code}"
|
|
rescue => e
|
|
puts " ok refused: #{e.class}"
|
|
end
|
|
puts(fail.zero? ? 'PASS ruby' : "FAIL ruby (#{fail})")
|
|
exit(fail.zero? ? 0 : 1)
|