stability_sdk 0.2.0 → 0.3.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 +4 -4
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/LICENSE +21 -0
- data/README.md +69 -3
- data/Rakefile +10 -0
- data/exe/stability-client +25 -14
- data/exe/stability-dashboard-client +40 -0
- data/lib/dashboard_pb.rb +182 -0
- data/lib/dashboard_services_pb.rb +41 -0
- data/lib/generation_pb.rb +120 -19
- data/lib/generation_services_pb.rb +4 -0
- data/lib/stability_sdk/cli.rb +5 -0
- data/lib/stability_sdk/client.rb +96 -21
- data/lib/stability_sdk/dashboard_client.rb +31 -0
- data/lib/stability_sdk/version.rb +1 -1
- data/lib/stability_sdk.rb +2 -0
- data/stability_sdk.gemspec +5 -2
- metadata +50 -10
- data/Gemfile.lock +0 -34
- data/proto/generation.proto +0 -186
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e707d41b381676dfbc958975bae028b82a52a7828529c52db7809db125791e9
|
|
4
|
+
data.tar.gz: 9e7aafbd1c0e5638ad2bc860312e55a0b2973ec3c8423fa050730cfa15887efa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37cb8a18a1accb3cf30f6dc780781f71dfe75ad648713a2c335d1b2be41f7546c0450d88ec0ae833354db24a3d3659fe0ac8163d1f3a1a076f08e8e344282c9c
|
|
7
|
+
data.tar.gz: aa66ce05d53d3d5bd6aa661f752a5d71f61c9835804d69f38834e07bc4e5259d971816eb4d4061264cfadc9a825a425b0469c794369eb48c1080cdbf1d1342d3
|
data/.gitignore
CHANGED
data/.gitmodules
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Kosei Moriyama
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -19,8 +19,7 @@ Or install it yourself as:
|
|
|
19
19
|
$ gem install stability_sdk
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
|
-
|
|
23
|
-
First you need to create a [DreamStudio](https://beta.dreamstudio.ai/home)'s account and get an API Key of it.
|
|
22
|
+
First, you need to create a [DreamStudio](https://beta.dreamstudio.ai/home)'s account and get an API Key of it.
|
|
24
23
|
|
|
25
24
|
- Access [DreamStudio](https://beta.dreamstudio.ai/dream) and create an account if you have not had it
|
|
26
25
|
- Go to the [membership page](https://beta.dreamstudio.ai/membership)
|
|
@@ -62,9 +61,25 @@ Options:
|
|
|
62
61
|
-m, --mask_image=VAL path to mask image
|
|
63
62
|
--start_schedule=VAL start schedule for init image (must be greater than 0, 1 is full strength text prompt, no trace of image). default 1.0
|
|
64
63
|
--end_schedule=VAL end schedule for init image. default 0.01
|
|
64
|
+
--guidance_preset=VAL Guidance preset to use. See generation.GuidancePreset for supported values. default `GUIDANCE_PRESET_NONE`
|
|
65
|
+
--guidance_cuts=VAL Number of cuts to use for guidance. default 0
|
|
66
|
+
--guidance_strength=VAL Strength of the guidance. We recommend values in range [0.0,1.0]. A good default is 0.25. default nil
|
|
67
|
+
--guidance_prompt=VAL Prompt to use for guidance, defaults to `YOUR_PROMPT_TEXT` argument (above) if not specified.
|
|
68
|
+
--guidance_models=VAL Models to use for guidance. default nil
|
|
65
69
|
-v, --verbose
|
|
66
70
|
```
|
|
67
71
|
|
|
72
|
+
#### CLIP guidance
|
|
73
|
+
|
|
74
|
+
By specifying `--guidance_preset` and other `--guidance_*` options, you can use CLIP guidance, which is enabled by default on DreamStudio's web interface.
|
|
75
|
+
See also [this notebook](https://github.com/Stability-AI/stability-sdk/blob/c04381f960008f37c7392467cfaabfdf8f763e6a/nbs/demo_colab.ipynb) for more details.
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
# example
|
|
79
|
+
# [note] --steps=35 is recommended. which is also the default value of the web interface
|
|
80
|
+
STABILITY_SDK_API_KEY=xxx stability-client --guidance_preset=GUIDANCE_PRESET_FAST_BLUE --guidance_strength=0.25 --steps=35 --sampler=k_dpm_2_ancestral "A dream of a distant galaxy, by Caspar David Friedrich, matte painting trending on artstation HQ"
|
|
81
|
+
```
|
|
82
|
+
|
|
68
83
|
### SDK usage
|
|
69
84
|
|
|
70
85
|
This sample code saves a generated image as `result.png`.
|
|
@@ -72,7 +87,7 @@ This sample code saves a generated image as `result.png`.
|
|
|
72
87
|
```ruby
|
|
73
88
|
require "stability_sdk"
|
|
74
89
|
|
|
75
|
-
client = StabilitySDK::Client.new(api_key: "YOUR_API_KEY")
|
|
90
|
+
client = StabilitySDK::Client.new(api_key: "YOUR_API_KEY", timeout: 600)
|
|
76
91
|
|
|
77
92
|
prompt = "your prompot here"
|
|
78
93
|
options = {}
|
|
@@ -92,12 +107,63 @@ client.generate(prompt, options) do |answer|
|
|
|
92
107
|
end
|
|
93
108
|
```
|
|
94
109
|
|
|
110
|
+
### Dashboard API
|
|
111
|
+
|
|
112
|
+
Dashboard API is a way to interact with DreamStudio Web UIs, such as getting user info, payment info, etc.
|
|
113
|
+
|
|
114
|
+
Currently, the API key is only allowed as read-only. And this client supports only GetMe and GetOrganization actions. See also https://github.com/Stability-AI/stability-sdk/issues/23
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
# get user info
|
|
118
|
+
STABILITY_SDK_DASHBOARD_API_KEY=YOUR_API_KEY stability-dashboard-client get_me
|
|
119
|
+
|
|
120
|
+
# get organization info
|
|
121
|
+
STABILITY_SDK_DASHBOARD_API_KEY=YOUR_API_KEY stability-dashboard-client get_organization
|
|
122
|
+
|
|
123
|
+
# i.e, get remaining balance
|
|
124
|
+
STABILITY_SDK_DASHBOARD_API_KEY=YOUR_API_KEY stability-dashboard-client get_organization | jq .paymentInfo.balance
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
require "stability_sdk"
|
|
129
|
+
|
|
130
|
+
client = StabilitySDK::DashboardClient.new(api_key: "your api key")
|
|
131
|
+
res = client.get_organization
|
|
132
|
+
p res.payment_info.balance # prints a remaining balance
|
|
133
|
+
```
|
|
134
|
+
|
|
95
135
|
## Development
|
|
96
136
|
|
|
97
137
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
98
138
|
|
|
99
139
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
100
140
|
|
|
141
|
+
### update submodule to try a new feature on Stability-AI/api-interfaces
|
|
142
|
+
|
|
143
|
+
- update submodule
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
git submodule update --init # if you haven't fetched the content of the submodule yet
|
|
147
|
+
cd api-interfaces
|
|
148
|
+
|
|
149
|
+
# checkout some branch/commit you need
|
|
150
|
+
git fetch
|
|
151
|
+
git reset --hard origin/some_branch
|
|
152
|
+
|
|
153
|
+
cd ..
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- build
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
bundle exec rake protoc
|
|
160
|
+
|
|
161
|
+
git diff
|
|
162
|
+
# now you may be able to confirm that the diff is created in lib/generation_pb.rb
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- modify the `lib/stability_sdk/client.rb` to try some new features
|
|
166
|
+
|
|
101
167
|
## Contributing
|
|
102
168
|
|
|
103
169
|
Bug reports and pull requests are welcome on GitHub at https://github.com/cou929/stability-sdk-ruby.
|
data/Rakefile
CHANGED
|
@@ -8,3 +8,13 @@ Rake::TestTask.new(:test) do |t|
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
task :default => :test
|
|
11
|
+
|
|
12
|
+
desc "Parse proto file and generate output"
|
|
13
|
+
task :protoc do
|
|
14
|
+
sh "grpc_tools_ruby_protoc -I api-interfaces/src/proto/ --ruby_out=lib --grpc_out=lib api-interfaces/src/proto/generation.proto"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc "Compile a dashboard proto file"
|
|
18
|
+
task :protoc_dashboard do
|
|
19
|
+
sh "grpc_tools_ruby_protoc -I api-interfaces/src/proto/ --ruby_out=lib --grpc_out=lib api-interfaces/src/proto/dashboard.proto"
|
|
20
|
+
end
|
data/exe/stability-client
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "optparse"
|
|
4
4
|
require "mime/types"
|
|
5
|
+
require "fastimage"
|
|
5
6
|
require "logger"
|
|
6
7
|
require "stability_sdk"
|
|
7
8
|
|
|
@@ -17,20 +18,25 @@ opt.banner = "Usage: stability-client [options] YOUR_PROMPT_TEXT"
|
|
|
17
18
|
opt.separator ""
|
|
18
19
|
opt.separator "Options:"
|
|
19
20
|
opt.on("--api_key=VAL", "api key of DreamStudio account. You can also specify by a STABILITY_SDK_API_KEY environment variable") {|v| options[:api_key] = v }
|
|
20
|
-
opt.on("-H", "--height=VAL", "height of image in pixel. default 512") {|v| options[:height] = v }
|
|
21
|
-
opt.on("-W", "--width=VAL", "width of image in pixel. default 512") {|v| options[:width] = v }
|
|
22
|
-
opt.on("-C", "--cfg_scale=VAL", "CFG scale factor. default 7.0") {|v| options[:cfg_scale] = v }
|
|
23
|
-
opt.on("-A", "--sampler=VAL", "ddim, plms, k_euler, k_euler_ancestral, k_heun, k_dpm_2, k_dpm_2_ancestral, k_lms. default k_lms") {|v| options[:sampler] = v }
|
|
24
|
-
opt.on("-s", "--steps=VAL", "number of steps. default 50") {|v| options[:steps] = v }
|
|
25
|
-
opt.on("-S", "--seed=VAL", "random seed to use in integer") {|v| options[:seed] = v }
|
|
26
|
-
opt.on("-p", "--prefix=VAL", "output prefixes for artifacts. default `generation`") {|v| options[:prefix] = v }
|
|
21
|
+
opt.on("-H", "--height=VAL", Integer, "height of image in pixel. default 512") {|v| options[:height] = v }
|
|
22
|
+
opt.on("-W", "--width=VAL", Integer, "width of image in pixel. default 512") {|v| options[:width] = v }
|
|
23
|
+
opt.on("-C", "--cfg_scale=VAL", Float, "CFG scale factor. default 7.0") {|v| options[:cfg_scale] = v }
|
|
24
|
+
opt.on("-A", "--sampler=VAL", String, "ddim, plms, k_euler, k_euler_ancestral, k_heun, k_dpm_2, k_dpm_2_ancestral, k_lms. default k_lms") {|v| options[:sampler] = v }
|
|
25
|
+
opt.on("-s", "--steps=VAL", Integer, "number of steps. default 50") {|v| options[:steps] = v }
|
|
26
|
+
opt.on("-S", "--seed=VAL", Integer, "random seed to use in integer") {|v| options[:seed] = v }
|
|
27
|
+
opt.on("-p", "--prefix=VAL", String, "output prefixes for artifacts. default `generation`") {|v| options[:prefix] = v }
|
|
27
28
|
opt.on("--no-store", "do not write out artifacts") {|v| options[:no_store] = v }
|
|
28
|
-
opt.on("-n", "--num_samples=VAL", "number of samples to generate") {|v| options[:num_samples] = v }
|
|
29
|
-
opt.on("-e", "--engine=VAL", "engine to use for inference. default `stable-diffusion-v1`") {|v| options[:engine_id] = v }
|
|
30
|
-
opt.on("-i", "--init_image=VAL", "path to init image") {|v| options[:init_image] = v }
|
|
31
|
-
opt.on("-m", "--mask_image=VAL", "path to mask image") {|v| options[:mask_image] = v }
|
|
32
|
-
opt.on("--start_schedule=VAL", "start schedule for init image (must be greater than 0, 1 is full strength text prompt, no trace of image). default 1.0") {|v| options[:start_schedule] = v }
|
|
33
|
-
opt.on("--end_schedule=VAL", "end schedule for init image. default 0.01") {|v| options[:end_schedule] = v }
|
|
29
|
+
opt.on("-n", "--num_samples=VAL", Integer, "number of samples to generate. default 1") {|v| options[:num_samples] = v }
|
|
30
|
+
opt.on("-e", "--engine=VAL", String, "engine to use for inference. default `stable-diffusion-v1-5`") {|v| options[:engine_id] = v }
|
|
31
|
+
opt.on("-i", "--init_image=VAL", String, "path to init image") {|v| options[:init_image] = v }
|
|
32
|
+
opt.on("-m", "--mask_image=VAL", String, "path to mask image") {|v| options[:mask_image] = v }
|
|
33
|
+
opt.on("--start_schedule=VAL", Float, "start schedule for init image (must be greater than 0, 1 is full strength text prompt, no trace of image). default 1.0") {|v| options[:start_schedule] = v }
|
|
34
|
+
opt.on("--end_schedule=VAL", Float, "end schedule for init image. default 0.01") {|v| options[:end_schedule] = v }
|
|
35
|
+
opt.on("--guidance_preset=VAL", String,"Guidance preset to use. See generation.GuidancePreset for supported values. default `GUIDANCE_PRESET_NONE`") {|v| options[:guidance_preset] = v }
|
|
36
|
+
opt.on("--guidance_cuts=VAL", Integer, "Number of cuts to use for guidance. default 0") {|v| options[:guidance_cuts] = v }
|
|
37
|
+
opt.on("--guidance_strength=VAL", Float, "Strength of the guidance. We recommend values in range [0.0,1.0]. A good default is 0.25. default nil") {|v| options[:guidance_strength] = v }
|
|
38
|
+
opt.on("--guidance_prompt=VAL", String, "Prompt to use for guidance, defaults to `YOUR_PROMPT_TEXT` argument (above) if not specified.") {|v| options[:guidance_prompt] = v }
|
|
39
|
+
opt.on("--guidance_models=VAL", Array, "Models to use for guidance. default nil") {|v| options[:guidance_models] = v }
|
|
34
40
|
opt.on("-v", "--verbose") { logger.level = Logger::DEBUG }
|
|
35
41
|
opt.parse!(ARGV)
|
|
36
42
|
|
|
@@ -42,7 +48,12 @@ raise StabilitySDK::InsufficientParameter, "api key is required" if !options.has
|
|
|
42
48
|
|
|
43
49
|
raise StabilitySDK::InsufficientParameter, "init_image is required if mask_image is provided" if options.has_key?(:mask_image) && !options.has_key?(:init_image)
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
if options.has_key?(:init_image)
|
|
52
|
+
size = FastImage.size(options[:init_image])
|
|
53
|
+
raise StabilitySDK::InvalidParameter, "width and height of init_image must be a multiple of 64" if size[0] % 64 != 0 || size[1] % 64 != 0
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
client = StabilitySDK::Client.new(api_key: options[:api_key], logger: logger)
|
|
46
57
|
|
|
47
58
|
client.generate(prompt, options) do |answer|
|
|
48
59
|
StabilitySDK::CLI.save_answer(answer, options, logger)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
require "logger"
|
|
5
|
+
require "stability_sdk"
|
|
6
|
+
|
|
7
|
+
logger = Logger.new(STDOUT)
|
|
8
|
+
logger.level = Logger::WARN
|
|
9
|
+
|
|
10
|
+
Version = StabilitySDK::VERSION
|
|
11
|
+
|
|
12
|
+
class CLI < Thor
|
|
13
|
+
class_option :api_key
|
|
14
|
+
|
|
15
|
+
desc "get_me", "get user info"
|
|
16
|
+
def get_me
|
|
17
|
+
client = self.client(options)
|
|
18
|
+
res = client.get_me
|
|
19
|
+
puts res.to_json
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "get_organization", "get organization info"
|
|
23
|
+
def get_organization
|
|
24
|
+
client = self.client(options)
|
|
25
|
+
res = client.get_organization
|
|
26
|
+
puts res.to_json
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def client(options)
|
|
32
|
+
api_key = options[:api_key]
|
|
33
|
+
api_key = ENV["STABILITY_SDK_DASHBOARD_API_KEY"] if ENV["STABILITY_SDK_DASHBOARD_API_KEY"]
|
|
34
|
+
raise StabilitySDK::InsufficientParameter, "api key is required" if api_key.nil?
|
|
35
|
+
|
|
36
|
+
return StabilitySDK::DashboardClient.new(api_key: api_key)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
CLI.start(ARGV)
|
data/lib/dashboard_pb.rb
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
+
# source: dashboard.proto
|
|
3
|
+
|
|
4
|
+
require 'google/protobuf'
|
|
5
|
+
|
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
7
|
+
add_file("dashboard.proto", :syntax => :proto3) do
|
|
8
|
+
add_message "gooseai.OrganizationMember" do
|
|
9
|
+
optional :organization, :message, 1, "gooseai.Organization"
|
|
10
|
+
proto3_optional :user, :message, 2, "gooseai.User"
|
|
11
|
+
optional :role, :enum, 3, "gooseai.OrganizationRole"
|
|
12
|
+
optional :is_default, :bool, 4
|
|
13
|
+
end
|
|
14
|
+
add_message "gooseai.OrganizationGrant" do
|
|
15
|
+
optional :amount_granted, :double, 1
|
|
16
|
+
optional :amount_used, :double, 2
|
|
17
|
+
optional :expires_at, :uint64, 3
|
|
18
|
+
optional :granted_at, :uint64, 4
|
|
19
|
+
end
|
|
20
|
+
add_message "gooseai.OrganizationPaymentInfo" do
|
|
21
|
+
optional :balance, :double, 1
|
|
22
|
+
repeated :grants, :message, 2, "gooseai.OrganizationGrant"
|
|
23
|
+
end
|
|
24
|
+
add_message "gooseai.OrganizationAutoCharge" do
|
|
25
|
+
optional :enabled, :bool, 1
|
|
26
|
+
optional :id, :string, 2
|
|
27
|
+
optional :created_at, :uint64, 3
|
|
28
|
+
end
|
|
29
|
+
add_message "gooseai.Organization" do
|
|
30
|
+
optional :id, :string, 1
|
|
31
|
+
optional :name, :string, 2
|
|
32
|
+
optional :description, :string, 3
|
|
33
|
+
repeated :members, :message, 4, "gooseai.OrganizationMember"
|
|
34
|
+
proto3_optional :payment_info, :message, 5, "gooseai.OrganizationPaymentInfo"
|
|
35
|
+
proto3_optional :stripe_customer_id, :string, 6
|
|
36
|
+
proto3_optional :auto_charge, :message, 7, "gooseai.OrganizationAutoCharge"
|
|
37
|
+
end
|
|
38
|
+
add_message "gooseai.APIKey" do
|
|
39
|
+
optional :key, :string, 1
|
|
40
|
+
optional :is_secret, :bool, 2
|
|
41
|
+
optional :created_at, :uint64, 3
|
|
42
|
+
end
|
|
43
|
+
add_message "gooseai.User" do
|
|
44
|
+
optional :id, :string, 1
|
|
45
|
+
proto3_optional :auth_id, :string, 2
|
|
46
|
+
optional :profile_picture, :string, 3
|
|
47
|
+
optional :email, :string, 4
|
|
48
|
+
repeated :organizations, :message, 5, "gooseai.OrganizationMember"
|
|
49
|
+
repeated :api_keys, :message, 7, "gooseai.APIKey"
|
|
50
|
+
optional :created_at, :uint64, 8
|
|
51
|
+
proto3_optional :email_verified, :bool, 9
|
|
52
|
+
end
|
|
53
|
+
add_message "gooseai.CostData" do
|
|
54
|
+
optional :amount_tokens, :uint32, 1
|
|
55
|
+
optional :amount_credits, :double, 2
|
|
56
|
+
end
|
|
57
|
+
add_message "gooseai.UsageMetric" do
|
|
58
|
+
optional :operation, :string, 1
|
|
59
|
+
optional :engine, :string, 2
|
|
60
|
+
optional :input_cost, :message, 3, "gooseai.CostData"
|
|
61
|
+
optional :output_cost, :message, 4, "gooseai.CostData"
|
|
62
|
+
proto3_optional :user, :string, 5
|
|
63
|
+
optional :aggregation_timestamp, :uint64, 6
|
|
64
|
+
end
|
|
65
|
+
add_message "gooseai.CostTotal" do
|
|
66
|
+
optional :amount_tokens, :uint32, 1
|
|
67
|
+
optional :amount_credits, :double, 2
|
|
68
|
+
end
|
|
69
|
+
add_message "gooseai.TotalMetricsData" do
|
|
70
|
+
optional :input_total, :message, 1, "gooseai.CostTotal"
|
|
71
|
+
optional :output_total, :message, 2, "gooseai.CostTotal"
|
|
72
|
+
end
|
|
73
|
+
add_message "gooseai.Metrics" do
|
|
74
|
+
repeated :metrics, :message, 1, "gooseai.UsageMetric"
|
|
75
|
+
optional :total, :message, 2, "gooseai.TotalMetricsData"
|
|
76
|
+
end
|
|
77
|
+
add_message "gooseai.EmptyRequest" do
|
|
78
|
+
end
|
|
79
|
+
add_message "gooseai.GetOrganizationRequest" do
|
|
80
|
+
optional :id, :string, 1
|
|
81
|
+
end
|
|
82
|
+
add_message "gooseai.GetMetricsRequest" do
|
|
83
|
+
optional :organization_id, :string, 1
|
|
84
|
+
proto3_optional :user_id, :string, 2
|
|
85
|
+
optional :range_from, :uint64, 3
|
|
86
|
+
optional :range_to, :uint64, 4
|
|
87
|
+
optional :include_per_request_metrics, :bool, 5
|
|
88
|
+
end
|
|
89
|
+
add_message "gooseai.APIKeyRequest" do
|
|
90
|
+
optional :is_secret, :bool, 1
|
|
91
|
+
end
|
|
92
|
+
add_message "gooseai.APIKeyFindRequest" do
|
|
93
|
+
optional :id, :string, 1
|
|
94
|
+
end
|
|
95
|
+
add_message "gooseai.UpdateDefaultOrganizationRequest" do
|
|
96
|
+
optional :organization_id, :string, 1
|
|
97
|
+
end
|
|
98
|
+
add_message "gooseai.ClientSettings" do
|
|
99
|
+
optional :settings, :bytes, 1
|
|
100
|
+
end
|
|
101
|
+
add_message "gooseai.CreateAutoChargeIntentRequest" do
|
|
102
|
+
optional :organization_id, :string, 1
|
|
103
|
+
optional :monthly_maximum, :uint64, 2
|
|
104
|
+
optional :minimum_value, :uint64, 3
|
|
105
|
+
optional :amount_credits, :uint64, 4
|
|
106
|
+
end
|
|
107
|
+
add_message "gooseai.CreateChargeRequest" do
|
|
108
|
+
optional :amount, :uint64, 1
|
|
109
|
+
optional :organization_id, :string, 2
|
|
110
|
+
end
|
|
111
|
+
add_message "gooseai.GetChargesRequest" do
|
|
112
|
+
optional :organization_id, :string, 1
|
|
113
|
+
optional :range_from, :uint64, 2
|
|
114
|
+
optional :range_to, :uint64, 3
|
|
115
|
+
end
|
|
116
|
+
add_message "gooseai.Charge" do
|
|
117
|
+
optional :id, :string, 1
|
|
118
|
+
optional :paid, :bool, 2
|
|
119
|
+
optional :receipt_link, :string, 3
|
|
120
|
+
optional :payment_link, :string, 4
|
|
121
|
+
optional :created_at, :uint64, 5
|
|
122
|
+
optional :amount_credits, :uint64, 6
|
|
123
|
+
end
|
|
124
|
+
add_message "gooseai.Charges" do
|
|
125
|
+
repeated :charges, :message, 1, "gooseai.Charge"
|
|
126
|
+
end
|
|
127
|
+
add_message "gooseai.GetAutoChargeRequest" do
|
|
128
|
+
optional :organization_id, :string, 1
|
|
129
|
+
end
|
|
130
|
+
add_message "gooseai.AutoChargeIntent" do
|
|
131
|
+
optional :id, :string, 1
|
|
132
|
+
optional :payment_link, :string, 2
|
|
133
|
+
optional :created_at, :uint64, 3
|
|
134
|
+
optional :monthly_maximum, :uint64, 4
|
|
135
|
+
optional :minimum_value, :uint64, 5
|
|
136
|
+
optional :amount_credits, :uint64, 6
|
|
137
|
+
end
|
|
138
|
+
add_message "gooseai.UpdateUserInfoRequest" do
|
|
139
|
+
proto3_optional :email, :string, 1
|
|
140
|
+
end
|
|
141
|
+
add_message "gooseai.UserPasswordChangeTicket" do
|
|
142
|
+
optional :ticket, :string, 1
|
|
143
|
+
end
|
|
144
|
+
add_enum "gooseai.OrganizationRole" do
|
|
145
|
+
value :MEMBER, 0
|
|
146
|
+
value :ACCOUNTANT, 1
|
|
147
|
+
value :OWNER, 2
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
module Gooseai
|
|
153
|
+
OrganizationMember = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.OrganizationMember").msgclass
|
|
154
|
+
OrganizationGrant = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.OrganizationGrant").msgclass
|
|
155
|
+
OrganizationPaymentInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.OrganizationPaymentInfo").msgclass
|
|
156
|
+
OrganizationAutoCharge = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.OrganizationAutoCharge").msgclass
|
|
157
|
+
Organization = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.Organization").msgclass
|
|
158
|
+
APIKey = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.APIKey").msgclass
|
|
159
|
+
User = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.User").msgclass
|
|
160
|
+
CostData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.CostData").msgclass
|
|
161
|
+
UsageMetric = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.UsageMetric").msgclass
|
|
162
|
+
CostTotal = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.CostTotal").msgclass
|
|
163
|
+
TotalMetricsData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.TotalMetricsData").msgclass
|
|
164
|
+
Metrics = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.Metrics").msgclass
|
|
165
|
+
EmptyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.EmptyRequest").msgclass
|
|
166
|
+
GetOrganizationRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.GetOrganizationRequest").msgclass
|
|
167
|
+
GetMetricsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.GetMetricsRequest").msgclass
|
|
168
|
+
APIKeyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.APIKeyRequest").msgclass
|
|
169
|
+
APIKeyFindRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.APIKeyFindRequest").msgclass
|
|
170
|
+
UpdateDefaultOrganizationRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.UpdateDefaultOrganizationRequest").msgclass
|
|
171
|
+
ClientSettings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.ClientSettings").msgclass
|
|
172
|
+
CreateAutoChargeIntentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.CreateAutoChargeIntentRequest").msgclass
|
|
173
|
+
CreateChargeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.CreateChargeRequest").msgclass
|
|
174
|
+
GetChargesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.GetChargesRequest").msgclass
|
|
175
|
+
Charge = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.Charge").msgclass
|
|
176
|
+
Charges = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.Charges").msgclass
|
|
177
|
+
GetAutoChargeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.GetAutoChargeRequest").msgclass
|
|
178
|
+
AutoChargeIntent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.AutoChargeIntent").msgclass
|
|
179
|
+
UpdateUserInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.UpdateUserInfoRequest").msgclass
|
|
180
|
+
UserPasswordChangeTicket = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.UserPasswordChangeTicket").msgclass
|
|
181
|
+
OrganizationRole = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gooseai.OrganizationRole").enummodule
|
|
182
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
+
# Source: dashboard.proto for package 'gooseai'
|
|
3
|
+
|
|
4
|
+
require 'grpc'
|
|
5
|
+
require 'dashboard_pb'
|
|
6
|
+
|
|
7
|
+
module Gooseai
|
|
8
|
+
module DashboardService
|
|
9
|
+
class Service
|
|
10
|
+
|
|
11
|
+
include ::GRPC::GenericService
|
|
12
|
+
|
|
13
|
+
self.marshal_class_method = :encode
|
|
14
|
+
self.unmarshal_class_method = :decode
|
|
15
|
+
self.service_name = 'gooseai.DashboardService'
|
|
16
|
+
|
|
17
|
+
# Get info
|
|
18
|
+
rpc :GetMe, ::Gooseai::EmptyRequest, ::Gooseai::User
|
|
19
|
+
rpc :GetOrganization, ::Gooseai::GetOrganizationRequest, ::Gooseai::Organization
|
|
20
|
+
rpc :GetMetrics, ::Gooseai::GetMetricsRequest, ::Gooseai::Metrics
|
|
21
|
+
# API key management
|
|
22
|
+
rpc :CreateAPIKey, ::Gooseai::APIKeyRequest, ::Gooseai::APIKey
|
|
23
|
+
rpc :DeleteAPIKey, ::Gooseai::APIKeyFindRequest, ::Gooseai::APIKey
|
|
24
|
+
# User settings
|
|
25
|
+
rpc :UpdateDefaultOrganization, ::Gooseai::UpdateDefaultOrganizationRequest, ::Gooseai::User
|
|
26
|
+
rpc :GetClientSettings, ::Gooseai::EmptyRequest, ::Gooseai::ClientSettings
|
|
27
|
+
rpc :SetClientSettings, ::Gooseai::ClientSettings, ::Gooseai::ClientSettings
|
|
28
|
+
rpc :UpdateUserInfo, ::Gooseai::UpdateUserInfoRequest, ::Gooseai::User
|
|
29
|
+
rpc :CreatePasswordChangeTicket, ::Gooseai::EmptyRequest, ::Gooseai::UserPasswordChangeTicket
|
|
30
|
+
rpc :DeleteAccount, ::Gooseai::EmptyRequest, ::Gooseai::User
|
|
31
|
+
# Payment functions
|
|
32
|
+
rpc :CreateCharge, ::Gooseai::CreateChargeRequest, ::Gooseai::Charge
|
|
33
|
+
rpc :GetCharges, ::Gooseai::GetChargesRequest, ::Gooseai::Charges
|
|
34
|
+
rpc :CreateAutoChargeIntent, ::Gooseai::CreateAutoChargeIntentRequest, ::Gooseai::AutoChargeIntent
|
|
35
|
+
rpc :UpdateAutoChargeIntent, ::Gooseai::CreateAutoChargeIntentRequest, ::Gooseai::AutoChargeIntent
|
|
36
|
+
rpc :GetAutoChargeIntent, ::Gooseai::GetAutoChargeRequest, ::Gooseai::AutoChargeIntent
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Stub = Service.rpc_stub_class
|
|
40
|
+
end
|
|
41
|
+
end
|