sai-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +246 -0
- data/lib/sai/client.rb +183 -0
- data/lib/sai/control.rb +153 -0
- data/lib/sai/errors.rb +109 -0
- data/lib/sai/http.rb +103 -0
- data/lib/sai/learn.rb +137 -0
- data/lib/sai/machines.rb +48 -0
- data/lib/sai/sessions.rb +333 -0
- data/lib/sai/tenants.rb +174 -0
- data/lib/sai/turns.rb +72 -0
- data/lib/sai/types.rb +688 -0
- data/lib/sai/util.rb +33 -0
- data/lib/sai/version.rb +5 -0
- data/lib/sai.rb +25 -0
- metadata +57 -0
data/lib/sai/util.rb
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sai
|
|
4
|
+
# @api private
|
|
5
|
+
module Util
|
|
6
|
+
module_function
|
|
7
|
+
|
|
8
|
+
# Percent-encodes like JavaScript's encodeURIComponent (a space is %20).
|
|
9
|
+
def q(s)
|
|
10
|
+
s.to_s.encode(Encoding::UTF_8).b.gsub(%r{[^A-Za-z0-9\-_.!~*'()]}n) { |c| format("%%%02X", c.ord) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# An id string, or an object with an +id+ (a Machine, a Turn, a Tenant, ...).
|
|
14
|
+
def id_of(ref)
|
|
15
|
+
ref.is_a?(String) ? ref : ref.id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def turn_id(turn)
|
|
19
|
+
id = id_of(turn)
|
|
20
|
+
raise ArgumentError, "This turn has no id: the message was answered without starting one." if id.nil? || id.empty?
|
|
21
|
+
|
|
22
|
+
id
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def now_ms
|
|
26
|
+
Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def monotonic
|
|
30
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/sai/version.rb
ADDED
data/lib/sai.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Ruby SDK for the Sai API.
|
|
4
|
+
#
|
|
5
|
+
# - +sai.sessions+: give Sai a task on a computer and get the answer back.
|
|
6
|
+
# - +sai.learn+, +sai.judge+: turn recorded turns or a task into Simulang code, repair it, run,
|
|
7
|
+
# judge and repair it on a machine, judge turns.
|
|
8
|
+
# - +sai.control+: drive a cloud computer yourself with Simulang.
|
|
9
|
+
# - +sai.machines+, +sai.models+, +sai.files+, +sai.account+, +sai.auth+.
|
|
10
|
+
# - +sai.tenants+, +sai.tenant_machines+, +sai.usage+: your customers under an Organisation.
|
|
11
|
+
module Sai
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
require_relative "sai/version"
|
|
15
|
+
require_relative "sai/errors"
|
|
16
|
+
require_relative "sai/util"
|
|
17
|
+
require_relative "sai/http"
|
|
18
|
+
require_relative "sai/types"
|
|
19
|
+
require_relative "sai/machines"
|
|
20
|
+
require_relative "sai/turns"
|
|
21
|
+
require_relative "sai/sessions"
|
|
22
|
+
require_relative "sai/learn"
|
|
23
|
+
require_relative "sai/control"
|
|
24
|
+
require_relative "sai/tenants"
|
|
25
|
+
require_relative "sai/client"
|
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sai-sdk
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Simular, Inc.
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Hand desktop work to Sai on a computer and get the answer back, or drive
|
|
13
|
+
a cloud computer yourself.
|
|
14
|
+
executables: []
|
|
15
|
+
extensions: []
|
|
16
|
+
extra_rdoc_files: []
|
|
17
|
+
files:
|
|
18
|
+
- LICENSE
|
|
19
|
+
- README.md
|
|
20
|
+
- lib/sai.rb
|
|
21
|
+
- lib/sai/client.rb
|
|
22
|
+
- lib/sai/control.rb
|
|
23
|
+
- lib/sai/errors.rb
|
|
24
|
+
- lib/sai/http.rb
|
|
25
|
+
- lib/sai/learn.rb
|
|
26
|
+
- lib/sai/machines.rb
|
|
27
|
+
- lib/sai/sessions.rb
|
|
28
|
+
- lib/sai/tenants.rb
|
|
29
|
+
- lib/sai/turns.rb
|
|
30
|
+
- lib/sai/types.rb
|
|
31
|
+
- lib/sai/util.rb
|
|
32
|
+
- lib/sai/version.rb
|
|
33
|
+
homepage: https://platform.simular.ai/documentation
|
|
34
|
+
licenses:
|
|
35
|
+
- MIT
|
|
36
|
+
metadata:
|
|
37
|
+
source_code_uri: https://github.com/simular-ai/sai-sdk/tree/main/ruby
|
|
38
|
+
documentation_uri: https://platform.simular.ai/documentation/sdks/ruby
|
|
39
|
+
rubygems_mfa_required: 'true'
|
|
40
|
+
rdoc_options: []
|
|
41
|
+
require_paths:
|
|
42
|
+
- lib
|
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.1'
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
requirements: []
|
|
54
|
+
rubygems_version: 3.6.9
|
|
55
|
+
specification_version: 4
|
|
56
|
+
summary: Ruby SDK for the Sai API
|
|
57
|
+
test_files: []
|