Class: VeniceClient::ImageApi
- Inherits:
-
Object
- Object
- VeniceClient::ImageApi
- Defined in:
- lib/venice_client/api/image_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#generate_image(opts = {}) ⇒ InlineResponse2001
/api/v1/image/generate Generate an image based on input parameters.
-
#generate_image_with_http_info(opts = {}) ⇒ Array<(InlineResponse2001, Integer, Hash)>
/api/v1/image/generate Generate an image based on input parameters.
-
#image_styles_get(opts = {}) ⇒ InlineResponse2003
/api/v1/image/styles List available image styles that can be used with the generate API.
-
#image_styles_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2003, Integer, Hash)>
/api/v1/image/styles List available image styles that can be used with the generate API.
-
#initialize(api_client = ApiClient.default) ⇒ ImageApi
constructor
A new instance of ImageApi.
-
#simple_generate_image(opts = {}) ⇒ InlineResponse2002
/api/v1/image/generations Generate an image based on input parameters using an OpenAI compatible endpoint.
-
#simple_generate_image_with_http_info(opts = {}) ⇒ Array<(InlineResponse2002, Integer, Hash)>
/api/v1/image/generations Generate an image based on input parameters using an OpenAI compatible endpoint.
-
#upscale_image(opts = {}) ⇒ String
/api/v1/image/upscale Upscale or enhance an image based on the supplied parameters.
-
#upscale_image_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
/api/v1/image/upscale Upscale or enhance an image based on the supplied parameters.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
14 15 16 |
# File 'lib/venice_client/api/image_api.rb', line 14 def api_client @api_client end |
Instance Method Details
#generate_image(opts = {}) ⇒ InlineResponse2001
/api/v1/image/generate Generate an image based on input parameters
25 26 27 28 |
# File 'lib/venice_client/api/image_api.rb', line 25 def generate_image(opts = {}) data, _status_code, _headers = generate_image_with_http_info(opts) data end |
#generate_image_with_http_info(opts = {}) ⇒ Array<(InlineResponse2001, Integer, Hash)>
/api/v1/image/generate Generate an image based on input parameters
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/venice_client/api/image_api.rb', line 36 def generate_image_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImageApi.generate_image ...' end # resource path local_var_path = '/image/generate' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'image/jpeg', 'image/png', 'image/webp']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Accept-Encoding'] = opts[:'accept_encoding'] if !opts[:'accept_encoding'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) return_type = opts[:return_type] || 'InlineResponse2001' auth_names = opts[:auth_names] || ['BearerAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImageApi#generate_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#image_styles_get(opts = {}) ⇒ InlineResponse2003
/api/v1/image/styles List available image styles that can be used with the generate API.
80 81 82 83 |
# File 'lib/venice_client/api/image_api.rb', line 80 def image_styles_get(opts = {}) data, _status_code, _headers = image_styles_get_with_http_info(opts) data end |
#image_styles_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2003, Integer, Hash)>
/api/v1/image/styles List available image styles that can be used with the generate API.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/venice_client/api/image_api.rb', line 89 def image_styles_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImageApi.image_styles_get ...' end # resource path local_var_path = '/image/styles' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] || 'InlineResponse2003' auth_names = opts[:auth_names] || ['BearerAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImageApi#image_styles_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#simple_generate_image(opts = {}) ⇒ InlineResponse2002
/api/v1/image/generations Generate an image based on input parameters using an OpenAI compatible endpoint. This endpoint does not support the full feature set of the Venice Image Generation endpoint, but is compatible with the existing OpenAI endpoint.
132 133 134 135 |
# File 'lib/venice_client/api/image_api.rb', line 132 def simple_generate_image(opts = {}) data, _status_code, _headers = simple_generate_image_with_http_info(opts) data end |
#simple_generate_image_with_http_info(opts = {}) ⇒ Array<(InlineResponse2002, Integer, Hash)>
/api/v1/image/generations Generate an image based on input parameters using an OpenAI compatible endpoint. This endpoint does not support the full feature set of the Venice Image Generation endpoint, but is compatible with the existing OpenAI endpoint.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/venice_client/api/image_api.rb', line 143 def simple_generate_image_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImageApi.simple_generate_image ...' end # resource path local_var_path = '/images/generations' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Accept-Encoding'] = opts[:'accept_encoding'] if !opts[:'accept_encoding'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) return_type = opts[:return_type] || 'InlineResponse2002' auth_names = opts[:auth_names] || ['BearerAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImageApi#simple_generate_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#upscale_image(opts = {}) ⇒ String
/api/v1/image/upscale Upscale or enhance an image based on the supplied parameters. Using a scale of 1 with enhance enabled will only run the enhancer. The image can be provided either as a multipart form-data file upload or as a base64-encoded string in a JSON request.
188 189 190 191 |
# File 'lib/venice_client/api/image_api.rb', line 188 def upscale_image(opts = {}) data, _status_code, _headers = upscale_image_with_http_info(opts) data end |
#upscale_image_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
/api/v1/image/upscale Upscale or enhance an image based on the supplied parameters. Using a scale of 1 with enhance enabled will only run the enhancer. The image can be provided either as a multipart form-data file upload or as a base64-encoded string in a JSON request.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/venice_client/api/image_api.rb', line 198 def upscale_image_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImageApi.upscale_image ...' end # resource path local_var_path = '/image/upscale' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['image/png', 'application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data']) # form parameters form_params = opts[:form_params] || {} form_params['enhance'] = opts[:'enhance'] if !opts[:'enhance'].nil? form_params['enhanceCreativity'] = opts[:'enhance_creativity'] if !opts[:'enhance_creativity'].nil? form_params['enhancePrompt'] = opts[:'enhance_prompt'] if !opts[:'enhance_prompt'].nil? form_params['image'] = opts[:'image'] if !opts[:'image'].nil? form_params['replication'] = opts[:'replication'] if !opts[:'replication'].nil? form_params['scale'] = opts[:'scale'] if !opts[:'scale'].nil? # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) return_type = opts[:return_type] || 'String' auth_names = opts[:auth_names] || ['BearerAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImageApi#upscale_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |