venice_client 1.0.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/Gemfile +9 -0
- data/README.md +510 -0
- data/Rakefile +8 -0
- data/docs/APIKeysApi.md +334 -0
- data/docs/AnyOfChatCompletionRequestMessagesItems.md +6 -0
- data/docs/AnyOfChatCompletionRequestStop.md +6 -0
- data/docs/AnyOfChatCompletionRequestToolChoice.md +6 -0
- data/docs/AnyOfCreateEmbeddingRequestSchemaInput.md +6 -0
- data/docs/AnyOfCreateEmbeddingRequestSchemaModel.md +6 -0
- data/docs/AnyOfModelResponseModelSpecConstraints.md +6 -0
- data/docs/AnyOfModelResponseModelSpecPricing.md +6 -0
- data/docs/AnyOfUpscaleImageRequestEnhance.md +6 -0
- data/docs/AnyOfUpscaleImageRequestImage.md +6 -0
- data/docs/AnyOfapiKeysBodyExpiresAt.md +6 -0
- data/docs/AnyOfapiKeysConsumptionLimitUsd.md +6 -0
- data/docs/AnyOfapiKeysConsumptionLimitVcu.md +6 -0
- data/docs/AnyOfapiKeysGenerateWeb3KeyBodyExpiresAt.md +6 -0
- data/docs/AnyOfinlineResponse2002DataItems.md +6 -0
- data/docs/AnyOfinlineResponse2004Type.md +6 -0
- data/docs/AnyOfinlineResponse2005Type.md +6 -0
- data/docs/AnyOfinlineResponse2006Type.md +6 -0
- data/docs/AnyOfinlineResponse200ChoicesMessage.md +6 -0
- data/docs/AnyOfinlineResponse200PromptLogprobs.md +6 -0
- data/docs/ApiKeysBody.md +10 -0
- data/docs/ApiKeysConsumptionLimit.md +8 -0
- data/docs/ApiKeysGenerateWeb3KeyBody.md +13 -0
- data/docs/AudioApi.md +58 -0
- data/docs/BillingApi.md +70 -0
- data/docs/BillingUsageRequest.md +12 -0
- data/docs/BillingUsageResponse.md +8 -0
- data/docs/BillingUsageResponseData.md +14 -0
- data/docs/BillingUsageResponseInferenceDetails.md +10 -0
- data/docs/BillingUsageResponsePagination.md +10 -0
- data/docs/CharactersApi.md +52 -0
- data/docs/ChatApi.md +60 -0
- data/docs/ChatCompletionRequest.md +32 -0
- data/docs/ChatCompletionRequestFunction.md +9 -0
- data/docs/ChatCompletionRequestStreamOptions.md +7 -0
- data/docs/ChatCompletionRequestVeniceParameters.md +12 -0
- data/docs/CreateEmbeddingRequestSchema.md +11 -0
- data/docs/CreateSpeechRequestSchema.md +12 -0
- data/docs/EmbeddingsApi.md +60 -0
- data/docs/GenerateImageRequest.md +22 -0
- data/docs/ImageApi.md +270 -0
- data/docs/InlineResponse200.md +14 -0
- data/docs/InlineResponse2001.md +10 -0
- data/docs/InlineResponse20010.md +7 -0
- data/docs/InlineResponse20010Data.md +12 -0
- data/docs/InlineResponse20010DataApiTier.md +8 -0
- data/docs/InlineResponse20010DataBalances.md +8 -0
- data/docs/InlineResponse20010DataRateLimits.md +8 -0
- data/docs/InlineResponse20010DataRateLimits1.md +8 -0
- data/docs/InlineResponse20011.md +8 -0
- data/docs/InlineResponse20011Data.md +11 -0
- data/docs/InlineResponse20012.md +8 -0
- data/docs/InlineResponse20012Data.md +7 -0
- data/docs/InlineResponse20013.md +8 -0
- data/docs/InlineResponse20013Data.md +16 -0
- data/docs/InlineResponse20013Stats.md +7 -0
- data/docs/InlineResponse20014.md +10 -0
- data/docs/InlineResponse20014Data.md +9 -0
- data/docs/InlineResponse20014Usage.md +8 -0
- data/docs/InlineResponse20015.md +8 -0
- data/docs/InlineResponse2001Timing.md +10 -0
- data/docs/InlineResponse2002.md +8 -0
- data/docs/InlineResponse2003.md +8 -0
- data/docs/InlineResponse2004.md +9 -0
- data/docs/InlineResponse2005.md +9 -0
- data/docs/InlineResponse2006.md +9 -0
- data/docs/InlineResponse2007.md +8 -0
- data/docs/InlineResponse2007Data.md +15 -0
- data/docs/InlineResponse2007Usage.md +7 -0
- data/docs/InlineResponse2007UsageTrailingSevenDays.md +8 -0
- data/docs/InlineResponse2008.md +8 -0
- data/docs/InlineResponse2008Data.md +12 -0
- data/docs/InlineResponse2009.md +7 -0
- data/docs/InlineResponse200Choices.md +11 -0
- data/docs/InlineResponse200Logprobs.md +10 -0
- data/docs/InlineResponse200LogprobsTopLogprobs.md +9 -0
- data/docs/InlineResponse200Usage.md +10 -0
- data/docs/InlineResponse200VeniceParameters.md +13 -0
- data/docs/InlineResponse200VeniceParametersWebSearchCitations.md +10 -0
- data/docs/InlineResponse400.md +8 -0
- data/docs/InlineResponse401.md +7 -0
- data/docs/InlineResponse402.md +7 -0
- data/docs/InlineResponse403.md +7 -0
- data/docs/InlineResponse415.md +7 -0
- data/docs/InlineResponse429.md +7 -0
- data/docs/InlineResponse500.md +7 -0
- data/docs/InlineResponse5001.md +7 -0
- data/docs/InlineResponse503.md +7 -0
- data/docs/ModelCompatibilitySchema.md +6 -0
- data/docs/ModelResponse.md +12 -0
- data/docs/ModelResponseModelSpec.md +15 -0
- data/docs/ModelResponseModelSpecCapabilities.md +14 -0
- data/docs/ModelTraitSchema.md +6 -0
- data/docs/ModelsApi.md +160 -0
- data/docs/OneOfChatCompletionRequestResponseFormat.md +6 -0
- data/docs/PreviewApi.md +52 -0
- data/docs/SimpleGenerateImageRequest.md +18 -0
- data/docs/SpeechApi.md +58 -0
- data/docs/ToolCall.md +9 -0
- data/docs/Type.md +6 -0
- data/docs/UpscaleImageRequest.md +12 -0
- data/git_push.sh +55 -0
- data/lib/venice_client/api/api_keys_api.rb +381 -0
- data/lib/venice_client/api/audio_api.rb +74 -0
- data/lib/venice_client/api/billing_api.rb +97 -0
- data/lib/venice_client/api/characters_api.rb +70 -0
- data/lib/venice_client/api/chat_api.rb +77 -0
- data/lib/venice_client/api/embeddings_api.rb +81 -0
- data/lib/venice_client/api/image_api.rb +314 -0
- data/lib/venice_client/api/models_api.rb +185 -0
- data/lib/venice_client/api/preview_api.rb +70 -0
- data/lib/venice_client/api/speech_api.rb +74 -0
- data/lib/venice_client/api_client.rb +388 -0
- data/lib/venice_client/api_error.rb +56 -0
- data/lib/venice_client/configuration.rb +204 -0
- data/lib/venice_client/models/any_of_chat_completion_request_messages_items.rb +197 -0
- data/lib/venice_client/models/any_of_chat_completion_request_stop.rb +197 -0
- data/lib/venice_client/models/any_of_chat_completion_request_tool_choice.rb +197 -0
- data/lib/venice_client/models/any_of_create_embedding_request_schema_input.rb +197 -0
- data/lib/venice_client/models/any_of_create_embedding_request_schema_model.rb +197 -0
- data/lib/venice_client/models/any_of_model_response_model_spec_constraints.rb +197 -0
- data/lib/venice_client/models/any_of_model_response_model_spec_pricing.rb +197 -0
- data/lib/venice_client/models/any_of_upscale_image_request_enhance.rb +197 -0
- data/lib/venice_client/models/any_of_upscale_image_request_image.rb +197 -0
- data/lib/venice_client/models/any_ofapi_keys_body_expires_at.rb +197 -0
- data/lib/venice_client/models/any_ofapi_keys_consumption_limit_usd.rb +197 -0
- data/lib/venice_client/models/any_ofapi_keys_consumption_limit_vcu.rb +195 -0
- data/lib/venice_client/models/any_ofapi_keys_generate_web3_key_body_expires_at.rb +197 -0
- data/lib/venice_client/models/any_ofinline_response_200_2_data_items.rb +197 -0
- data/lib/venice_client/models/any_ofinline_response_200_4_type.rb +197 -0
- data/lib/venice_client/models/any_ofinline_response_200_5_type.rb +197 -0
- data/lib/venice_client/models/any_ofinline_response_200_6_type.rb +197 -0
- data/lib/venice_client/models/any_ofinline_response_200_choices_message.rb +197 -0
- data/lib/venice_client/models/any_ofinline_response_200_prompt_logprobs.rb +197 -0
- data/lib/venice_client/models/api_keys_body.rb +281 -0
- data/lib/venice_client/models/api_keys_consumption_limit.rb +228 -0
- data/lib/venice_client/models/api_keys_generate_web3_key_body.rb +322 -0
- data/lib/venice_client/models/billing_usage_request.rb +309 -0
- data/lib/venice_client/models/billing_usage_response.rb +228 -0
- data/lib/venice_client/models/billing_usage_response_data.rb +350 -0
- data/lib/venice_client/models/billing_usage_response_inference_details.rb +262 -0
- data/lib/venice_client/models/billing_usage_response_pagination.rb +253 -0
- data/lib/venice_client/models/chat_completion_request.rb +483 -0
- data/lib/venice_client/models/chat_completion_request_function.rb +231 -0
- data/lib/venice_client/models/chat_completion_request_stream_options.rb +207 -0
- data/lib/venice_client/models/chat_completion_request_venice_parameters.rb +302 -0
- data/lib/venice_client/models/create_embedding_request_schema.rb +294 -0
- data/lib/venice_client/models/create_speech_request_schema.rb +331 -0
- data/lib/venice_client/models/generate_image_request.rb +420 -0
- data/lib/venice_client/models/inline_response_200.rb +341 -0
- data/lib/venice_client/models/inline_response_200_1.rb +254 -0
- data/lib/venice_client/models/inline_response_200_10.rb +211 -0
- data/lib/venice_client/models/inline_response_200_10_data.rb +287 -0
- data/lib/venice_client/models/inline_response_200_10_data_api_tier.rb +227 -0
- data/lib/venice_client/models/inline_response_200_10_data_balances.rb +217 -0
- data/lib/venice_client/models/inline_response_200_10_data_rate_limits.rb +227 -0
- data/lib/venice_client/models/inline_response_200_10_data_rate_limits_1.rb +223 -0
- data/lib/venice_client/models/inline_response_200_11.rb +262 -0
- data/lib/venice_client/models/inline_response_200_11_data.rb +274 -0
- data/lib/venice_client/models/inline_response_200_12.rb +225 -0
- data/lib/venice_client/models/inline_response_200_12_data.rb +212 -0
- data/lib/venice_client/models/inline_response_200_13.rb +261 -0
- data/lib/venice_client/models/inline_response_200_13_data.rb +350 -0
- data/lib/venice_client/models/inline_response_200_13_stats.rb +212 -0
- data/lib/venice_client/models/inline_response_200_14.rb +292 -0
- data/lib/venice_client/models/inline_response_200_14_data.rb +278 -0
- data/lib/venice_client/models/inline_response_200_14_usage.rb +228 -0
- data/lib/venice_client/models/inline_response_200_15.rb +228 -0
- data/lib/venice_client/models/inline_response_200_1_timing.rb +257 -0
- data/lib/venice_client/models/inline_response_200_2.rb +228 -0
- data/lib/venice_client/models/inline_response_200_3.rb +262 -0
- data/lib/venice_client/models/inline_response_200_4.rb +277 -0
- data/lib/venice_client/models/inline_response_200_5.rb +274 -0
- data/lib/venice_client/models/inline_response_200_6.rb +274 -0
- data/lib/venice_client/models/inline_response_200_7.rb +262 -0
- data/lib/venice_client/models/inline_response_200_7_data.rb +357 -0
- data/lib/venice_client/models/inline_response_200_7_usage.rb +211 -0
- data/lib/venice_client/models/inline_response_200_7_usage_trailing_seven_days.rb +227 -0
- data/lib/venice_client/models/inline_response_200_8.rb +225 -0
- data/lib/venice_client/models/inline_response_200_8_data.rb +316 -0
- data/lib/venice_client/models/inline_response_200_9.rb +211 -0
- data/lib/venice_client/models/inline_response_200_choices.rb +312 -0
- data/lib/venice_client/models/inline_response_200_logprobs.rb +251 -0
- data/lib/venice_client/models/inline_response_200_logprobs_top_logprobs.rb +236 -0
- data/lib/venice_client/models/inline_response_200_usage.rb +253 -0
- data/lib/venice_client/models/inline_response_200_venice_parameters.rb +329 -0
- data/lib/venice_client/models/inline_response_200_venice_parameters_web_search_citations.rb +243 -0
- data/lib/venice_client/models/inline_response_400.rb +222 -0
- data/lib/venice_client/models/inline_response_401.rb +212 -0
- data/lib/venice_client/models/inline_response_402.rb +212 -0
- data/lib/venice_client/models/inline_response_403.rb +212 -0
- data/lib/venice_client/models/inline_response_415.rb +212 -0
- data/lib/venice_client/models/inline_response_429.rb +212 -0
- data/lib/venice_client/models/inline_response_500.rb +212 -0
- data/lib/venice_client/models/inline_response_500_1.rb +212 -0
- data/lib/venice_client/models/inline_response_503.rb +212 -0
- data/lib/venice_client/models/model_compatibility_schema.rb +202 -0
- data/lib/venice_client/models/model_response.rb +340 -0
- data/lib/venice_client/models/model_response_model_spec.rb +292 -0
- data/lib/venice_client/models/model_response_model_spec_capabilities.rb +352 -0
- data/lib/venice_client/models/model_trait_schema.rb +200 -0
- data/lib/venice_client/models/one_of_chat_completion_request_response_format.rb +197 -0
- data/lib/venice_client/models/simple_generate_image_request.rb +456 -0
- data/lib/venice_client/models/tool_call.rb +230 -0
- data/lib/venice_client/models/type.rb +198 -0
- data/lib/venice_client/models/upscale_image_request.rb +270 -0
- data/lib/venice_client/version.rb +14 -0
- data/lib/venice_client.rb +139 -0
- data/spec/api/api_keys_api_spec.rb +113 -0
- data/spec/api/audio_api_spec.rb +45 -0
- data/spec/api/billing_api_spec.rb +51 -0
- data/spec/api/characters_api_spec.rb +44 -0
- data/spec/api/chat_api_spec.rb +46 -0
- data/spec/api/embeddings_api_spec.rb +46 -0
- data/spec/api/image_api_spec.rb +99 -0
- data/spec/api/models_api_spec.rb +69 -0
- data/spec/api/preview_api_spec.rb +44 -0
- data/spec/api/speech_api_spec.rb +45 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/any_of_chat_completion_request_messages_items_spec.rb +34 -0
- data/spec/models/any_of_chat_completion_request_stop_spec.rb +34 -0
- data/spec/models/any_of_chat_completion_request_tool_choice_spec.rb +34 -0
- data/spec/models/any_of_create_embedding_request_schema_input_spec.rb +34 -0
- data/spec/models/any_of_create_embedding_request_schema_model_spec.rb +34 -0
- data/spec/models/any_of_model_response_model_spec_constraints_spec.rb +34 -0
- data/spec/models/any_of_model_response_model_spec_pricing_spec.rb +34 -0
- data/spec/models/any_of_upscale_image_request_enhance_spec.rb +34 -0
- data/spec/models/any_of_upscale_image_request_image_spec.rb +34 -0
- data/spec/models/any_ofapi_keys_body_expires_at_spec.rb +34 -0
- data/spec/models/any_ofapi_keys_consumption_limit_usd_spec.rb +34 -0
- data/spec/models/any_ofapi_keys_consumption_limit_vcu_spec.rb +34 -0
- data/spec/models/any_ofapi_keys_generate_web3_key_body_expires_at_spec.rb +34 -0
- data/spec/models/any_ofinline_response_200_2_data_items_spec.rb +34 -0
- data/spec/models/any_ofinline_response_200_4_type_spec.rb +34 -0
- data/spec/models/any_ofinline_response_200_5_type_spec.rb +34 -0
- data/spec/models/any_ofinline_response_200_6_type_spec.rb +34 -0
- data/spec/models/any_ofinline_response_200_choices_message_spec.rb +34 -0
- data/spec/models/any_ofinline_response_200_prompt_logprobs_spec.rb +34 -0
- data/spec/models/api_keys_body_spec.rb +61 -0
- data/spec/models/api_keys_consumption_limit_spec.rb +46 -0
- data/spec/models/api_keys_generate_web3_key_body_spec.rb +80 -0
- data/spec/models/billing_usage_request_spec.rb +78 -0
- data/spec/models/billing_usage_response_data_spec.rb +86 -0
- data/spec/models/billing_usage_response_inference_details_spec.rb +57 -0
- data/spec/models/billing_usage_response_pagination_spec.rb +58 -0
- data/spec/models/billing_usage_response_spec.rb +46 -0
- data/spec/models/chat_completion_request_function_spec.rb +52 -0
- data/spec/models/chat_completion_request_spec.rb +189 -0
- data/spec/models/chat_completion_request_stream_options_spec.rb +40 -0
- data/spec/models/chat_completion_request_venice_parameters_spec.rb +73 -0
- data/spec/models/create_embedding_request_schema_spec.rb +68 -0
- data/spec/models/create_speech_request_schema_spec.rb +81 -0
- data/spec/models/generate_image_request_spec.rb +134 -0
- data/spec/models/inline_response_200_10_data_api_tier_spec.rb +45 -0
- data/spec/models/inline_response_200_10_data_balances_spec.rb +45 -0
- data/spec/models/inline_response_200_10_data_rate_limits_1_spec.rb +45 -0
- data/spec/models/inline_response_200_10_data_rate_limits_spec.rb +46 -0
- data/spec/models/inline_response_200_10_data_spec.rb +69 -0
- data/spec/models/inline_response_200_10_spec.rb +40 -0
- data/spec/models/inline_response_200_11_data_spec.rb +64 -0
- data/spec/models/inline_response_200_11_spec.rb +50 -0
- data/spec/models/inline_response_200_12_data_spec.rb +39 -0
- data/spec/models/inline_response_200_12_spec.rb +46 -0
- data/spec/models/inline_response_200_13_data_spec.rb +93 -0
- data/spec/models/inline_response_200_13_spec.rb +49 -0
- data/spec/models/inline_response_200_13_stats_spec.rb +40 -0
- data/spec/models/inline_response_200_14_data_spec.rb +55 -0
- data/spec/models/inline_response_200_14_spec.rb +61 -0
- data/spec/models/inline_response_200_14_usage_spec.rb +45 -0
- data/spec/models/inline_response_200_15_spec.rb +45 -0
- data/spec/models/inline_response_200_1_spec.rb +57 -0
- data/spec/models/inline_response_200_1_timing_spec.rb +58 -0
- data/spec/models/inline_response_200_2_spec.rb +46 -0
- data/spec/models/inline_response_200_3_spec.rb +50 -0
- data/spec/models/inline_response_200_4_spec.rb +55 -0
- data/spec/models/inline_response_200_5_spec.rb +55 -0
- data/spec/models/inline_response_200_6_spec.rb +55 -0
- data/spec/models/inline_response_200_7_data_spec.rb +91 -0
- data/spec/models/inline_response_200_7_spec.rb +50 -0
- data/spec/models/inline_response_200_7_usage_spec.rb +39 -0
- data/spec/models/inline_response_200_7_usage_trailing_seven_days_spec.rb +45 -0
- data/spec/models/inline_response_200_8_data_spec.rb +73 -0
- data/spec/models/inline_response_200_8_spec.rb +45 -0
- data/spec/models/inline_response_200_9_spec.rb +39 -0
- data/spec/models/inline_response_200_choices_spec.rb +72 -0
- data/spec/models/inline_response_200_logprobs_spec.rb +57 -0
- data/spec/models/inline_response_200_logprobs_top_logprobs_spec.rb +51 -0
- data/spec/models/inline_response_200_spec.rb +85 -0
- data/spec/models/inline_response_200_usage_spec.rb +57 -0
- data/spec/models/inline_response_200_venice_parameters_spec.rb +80 -0
- data/spec/models/inline_response_200_venice_parameters_web_search_citations_spec.rb +57 -0
- data/spec/models/inline_response_400_spec.rb +45 -0
- data/spec/models/inline_response_401_spec.rb +39 -0
- data/spec/models/inline_response_402_spec.rb +39 -0
- data/spec/models/inline_response_403_spec.rb +40 -0
- data/spec/models/inline_response_415_spec.rb +40 -0
- data/spec/models/inline_response_429_spec.rb +39 -0
- data/spec/models/inline_response_500_1_spec.rb +40 -0
- data/spec/models/inline_response_500_spec.rb +39 -0
- data/spec/models/inline_response_503_spec.rb +40 -0
- data/spec/models/model_compatibility_schema_spec.rb +34 -0
- data/spec/models/model_response_model_spec_capabilities_spec.rb +85 -0
- data/spec/models/model_response_model_spec_spec.rb +87 -0
- data/spec/models/model_response_spec.rb +81 -0
- data/spec/models/model_trait_schema_spec.rb +34 -0
- data/spec/models/one_of_chat_completion_request_response_format_spec.rb +34 -0
- data/spec/models/simple_generate_image_request_spec.rb +134 -0
- data/spec/models/tool_call_spec.rb +51 -0
- data/spec/models/type_spec.rb +34 -0
- data/spec/models/upscale_image_request_spec.rb +69 -0
- data/spec/spec_helper.rb +110 -0
- data/venice_client.gemspec +38 -0
- metadata +522 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Venice.ai API
|
|
3
|
+
|
|
4
|
+
#The Venice.ai API.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 20250521.233203
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 3.0.68
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
module VeniceClient
|
|
15
|
+
class SimpleGenerateImageRequest
|
|
16
|
+
# This parameter is not used in Venice image generation but is supported for compatibility with OpenAI API
|
|
17
|
+
attr_accessor :background
|
|
18
|
+
|
|
19
|
+
# The model to use for image generation. Defaults to Venice's default image model. If a non-existent model is specified (ie an OpenAI model name), it will default to Venice's default image model.
|
|
20
|
+
attr_accessor :model
|
|
21
|
+
|
|
22
|
+
# auto enables safe venice mode which will blur out adult content. low disables safe venice mode.
|
|
23
|
+
attr_accessor :moderation
|
|
24
|
+
|
|
25
|
+
# Number of images to generate. Venice presently only supports 1 image per request.
|
|
26
|
+
attr_accessor :n
|
|
27
|
+
|
|
28
|
+
# This parameter is not used in Venice image generation but is supported for compatibility with OpenAI API
|
|
29
|
+
attr_accessor :output_compression
|
|
30
|
+
|
|
31
|
+
# Output format for generated images
|
|
32
|
+
attr_accessor :output_format
|
|
33
|
+
|
|
34
|
+
# A text description of the desired image.
|
|
35
|
+
attr_accessor :prompt
|
|
36
|
+
|
|
37
|
+
# This parameter is not used in Venice image generation but is supported for compatibility with OpenAI API
|
|
38
|
+
attr_accessor :quality
|
|
39
|
+
|
|
40
|
+
# Response format. URL will be a data URL.
|
|
41
|
+
attr_accessor :response_format
|
|
42
|
+
|
|
43
|
+
# Size of generated images. Default is 1024x1024
|
|
44
|
+
attr_accessor :size
|
|
45
|
+
|
|
46
|
+
# This parameter is not used in Venice image generation but is supported for compatibility with OpenAI API
|
|
47
|
+
attr_accessor :style
|
|
48
|
+
|
|
49
|
+
# This parameter is not used in Venice image generation but is supported for compatibility with OpenAI API
|
|
50
|
+
attr_accessor :user
|
|
51
|
+
|
|
52
|
+
class EnumAttributeValidator
|
|
53
|
+
attr_reader :datatype
|
|
54
|
+
attr_reader :allowable_values
|
|
55
|
+
|
|
56
|
+
def initialize(datatype, allowable_values)
|
|
57
|
+
@allowable_values = allowable_values.map do |value|
|
|
58
|
+
case datatype.to_s
|
|
59
|
+
when /Integer/i
|
|
60
|
+
value.to_i
|
|
61
|
+
when /Float/i
|
|
62
|
+
value.to_f
|
|
63
|
+
else
|
|
64
|
+
value
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def valid?(value)
|
|
70
|
+
!value || allowable_values.include?(value)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
75
|
+
def self.attribute_map
|
|
76
|
+
{
|
|
77
|
+
:'background' => :'background',
|
|
78
|
+
:'model' => :'model',
|
|
79
|
+
:'moderation' => :'moderation',
|
|
80
|
+
:'n' => :'n',
|
|
81
|
+
:'output_compression' => :'output_compression',
|
|
82
|
+
:'output_format' => :'output_format',
|
|
83
|
+
:'prompt' => :'prompt',
|
|
84
|
+
:'quality' => :'quality',
|
|
85
|
+
:'response_format' => :'response_format',
|
|
86
|
+
:'size' => :'size',
|
|
87
|
+
:'style' => :'style',
|
|
88
|
+
:'user' => :'user'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Attribute type mapping.
|
|
93
|
+
def self.openapi_types
|
|
94
|
+
{
|
|
95
|
+
:'background' => :'Object',
|
|
96
|
+
:'model' => :'Object',
|
|
97
|
+
:'moderation' => :'Object',
|
|
98
|
+
:'n' => :'Object',
|
|
99
|
+
:'output_compression' => :'Object',
|
|
100
|
+
:'output_format' => :'Object',
|
|
101
|
+
:'prompt' => :'Object',
|
|
102
|
+
:'quality' => :'Object',
|
|
103
|
+
:'response_format' => :'Object',
|
|
104
|
+
:'size' => :'Object',
|
|
105
|
+
:'style' => :'Object',
|
|
106
|
+
:'user' => :'Object'
|
|
107
|
+
}
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# List of attributes with nullable: true
|
|
111
|
+
def self.openapi_nullable
|
|
112
|
+
Set.new([
|
|
113
|
+
:'background',
|
|
114
|
+
:'moderation',
|
|
115
|
+
:'n',
|
|
116
|
+
:'output_compression',
|
|
117
|
+
:'quality',
|
|
118
|
+
:'response_format',
|
|
119
|
+
:'size',
|
|
120
|
+
:'style',
|
|
121
|
+
])
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Initializes the object
|
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
126
|
+
def initialize(attributes = {})
|
|
127
|
+
if (!attributes.is_a?(Hash))
|
|
128
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VeniceClient::SimpleGenerateImageRequest` initialize method"
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
132
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
133
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
134
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::SimpleGenerateImageRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
135
|
+
end
|
|
136
|
+
h[k.to_sym] = v
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'background')
|
|
140
|
+
self.background = attributes[:'background']
|
|
141
|
+
else
|
|
142
|
+
self.background = 'auto'
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'model')
|
|
146
|
+
self.model = attributes[:'model']
|
|
147
|
+
else
|
|
148
|
+
self.model = 'default'
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'moderation')
|
|
152
|
+
self.moderation = attributes[:'moderation']
|
|
153
|
+
else
|
|
154
|
+
self.moderation = 'auto'
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'n')
|
|
158
|
+
self.n = attributes[:'n']
|
|
159
|
+
else
|
|
160
|
+
self.n = 1
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if attributes.key?(:'output_compression')
|
|
164
|
+
self.output_compression = attributes[:'output_compression']
|
|
165
|
+
else
|
|
166
|
+
self.output_compression = 100
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'output_format')
|
|
170
|
+
self.output_format = attributes[:'output_format']
|
|
171
|
+
else
|
|
172
|
+
self.output_format = 'png'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if attributes.key?(:'prompt')
|
|
176
|
+
self.prompt = attributes[:'prompt']
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
if attributes.key?(:'quality')
|
|
180
|
+
self.quality = attributes[:'quality']
|
|
181
|
+
else
|
|
182
|
+
self.quality = 'auto'
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
if attributes.key?(:'response_format')
|
|
186
|
+
self.response_format = attributes[:'response_format']
|
|
187
|
+
else
|
|
188
|
+
self.response_format = 'b64_json'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
if attributes.key?(:'size')
|
|
192
|
+
self.size = attributes[:'size']
|
|
193
|
+
else
|
|
194
|
+
self.size = 'auto'
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if attributes.key?(:'style')
|
|
198
|
+
self.style = attributes[:'style']
|
|
199
|
+
else
|
|
200
|
+
self.style = 'natural'
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
if attributes.key?(:'user')
|
|
204
|
+
self.user = attributes[:'user']
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
209
|
+
# @return Array for valid properties with the reasons
|
|
210
|
+
def list_invalid_properties
|
|
211
|
+
invalid_properties = Array.new
|
|
212
|
+
if @prompt.nil?
|
|
213
|
+
invalid_properties.push('invalid value for "prompt", prompt cannot be nil.')
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
invalid_properties
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Check to see if the all the properties in the model are valid
|
|
220
|
+
# @return true if the model is valid
|
|
221
|
+
def valid?
|
|
222
|
+
background_validator = EnumAttributeValidator.new('Object', ['transparent', 'opaque', 'auto'])
|
|
223
|
+
return false unless background_validator.valid?(@background)
|
|
224
|
+
moderation_validator = EnumAttributeValidator.new('Object', ['low', 'auto'])
|
|
225
|
+
return false unless moderation_validator.valid?(@moderation)
|
|
226
|
+
output_format_validator = EnumAttributeValidator.new('Object', ['jpeg', 'png', 'webp'])
|
|
227
|
+
return false unless output_format_validator.valid?(@output_format)
|
|
228
|
+
return false if @prompt.nil?
|
|
229
|
+
quality_validator = EnumAttributeValidator.new('Object', ['auto', 'high', 'medium', 'low', 'hd', 'standard'])
|
|
230
|
+
return false unless quality_validator.valid?(@quality)
|
|
231
|
+
response_format_validator = EnumAttributeValidator.new('Object', ['b64_json', 'url'])
|
|
232
|
+
return false unless response_format_validator.valid?(@response_format)
|
|
233
|
+
size_validator = EnumAttributeValidator.new('Object', ['auto', '256x256', '512x512', '1024x1024', '1536x1024', '1024x1536', '1792x1024', '1024x1792'])
|
|
234
|
+
return false unless size_validator.valid?(@size)
|
|
235
|
+
style_validator = EnumAttributeValidator.new('Object', ['vivid', 'natural'])
|
|
236
|
+
return false unless style_validator.valid?(@style)
|
|
237
|
+
true
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
241
|
+
# @param [Object] background Object to be assigned
|
|
242
|
+
def background=(background)
|
|
243
|
+
validator = EnumAttributeValidator.new('Object', ['transparent', 'opaque', 'auto'])
|
|
244
|
+
unless validator.valid?(background)
|
|
245
|
+
fail ArgumentError, "invalid value for \"background\", must be one of #{validator.allowable_values}."
|
|
246
|
+
end
|
|
247
|
+
@background = background
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
251
|
+
# @param [Object] moderation Object to be assigned
|
|
252
|
+
def moderation=(moderation)
|
|
253
|
+
validator = EnumAttributeValidator.new('Object', ['low', 'auto'])
|
|
254
|
+
unless validator.valid?(moderation)
|
|
255
|
+
fail ArgumentError, "invalid value for \"moderation\", must be one of #{validator.allowable_values}."
|
|
256
|
+
end
|
|
257
|
+
@moderation = moderation
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
261
|
+
# @param [Object] output_format Object to be assigned
|
|
262
|
+
def output_format=(output_format)
|
|
263
|
+
validator = EnumAttributeValidator.new('Object', ['jpeg', 'png', 'webp'])
|
|
264
|
+
unless validator.valid?(output_format)
|
|
265
|
+
fail ArgumentError, "invalid value for \"output_format\", must be one of #{validator.allowable_values}."
|
|
266
|
+
end
|
|
267
|
+
@output_format = output_format
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
271
|
+
# @param [Object] quality Object to be assigned
|
|
272
|
+
def quality=(quality)
|
|
273
|
+
validator = EnumAttributeValidator.new('Object', ['auto', 'high', 'medium', 'low', 'hd', 'standard'])
|
|
274
|
+
unless validator.valid?(quality)
|
|
275
|
+
fail ArgumentError, "invalid value for \"quality\", must be one of #{validator.allowable_values}."
|
|
276
|
+
end
|
|
277
|
+
@quality = quality
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
281
|
+
# @param [Object] response_format Object to be assigned
|
|
282
|
+
def response_format=(response_format)
|
|
283
|
+
validator = EnumAttributeValidator.new('Object', ['b64_json', 'url'])
|
|
284
|
+
unless validator.valid?(response_format)
|
|
285
|
+
fail ArgumentError, "invalid value for \"response_format\", must be one of #{validator.allowable_values}."
|
|
286
|
+
end
|
|
287
|
+
@response_format = response_format
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
291
|
+
# @param [Object] size Object to be assigned
|
|
292
|
+
def size=(size)
|
|
293
|
+
validator = EnumAttributeValidator.new('Object', ['auto', '256x256', '512x512', '1024x1024', '1536x1024', '1024x1536', '1792x1024', '1024x1792'])
|
|
294
|
+
unless validator.valid?(size)
|
|
295
|
+
fail ArgumentError, "invalid value for \"size\", must be one of #{validator.allowable_values}."
|
|
296
|
+
end
|
|
297
|
+
@size = size
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
301
|
+
# @param [Object] style Object to be assigned
|
|
302
|
+
def style=(style)
|
|
303
|
+
validator = EnumAttributeValidator.new('Object', ['vivid', 'natural'])
|
|
304
|
+
unless validator.valid?(style)
|
|
305
|
+
fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}."
|
|
306
|
+
end
|
|
307
|
+
@style = style
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# Checks equality by comparing each attribute.
|
|
311
|
+
# @param [Object] Object to be compared
|
|
312
|
+
def ==(o)
|
|
313
|
+
return true if self.equal?(o)
|
|
314
|
+
self.class == o.class &&
|
|
315
|
+
background == o.background &&
|
|
316
|
+
model == o.model &&
|
|
317
|
+
moderation == o.moderation &&
|
|
318
|
+
n == o.n &&
|
|
319
|
+
output_compression == o.output_compression &&
|
|
320
|
+
output_format == o.output_format &&
|
|
321
|
+
prompt == o.prompt &&
|
|
322
|
+
quality == o.quality &&
|
|
323
|
+
response_format == o.response_format &&
|
|
324
|
+
size == o.size &&
|
|
325
|
+
style == o.style &&
|
|
326
|
+
user == o.user
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# @see the `==` method
|
|
330
|
+
# @param [Object] Object to be compared
|
|
331
|
+
def eql?(o)
|
|
332
|
+
self == o
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# Calculates hash code according to all attributes.
|
|
336
|
+
# @return [Integer] Hash code
|
|
337
|
+
def hash
|
|
338
|
+
[background, model, moderation, n, output_compression, output_format, prompt, quality, response_format, size, style, user].hash
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# Builds the object from hash
|
|
342
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
343
|
+
# @return [Object] Returns the model itself
|
|
344
|
+
def self.build_from_hash(attributes)
|
|
345
|
+
new.build_from_hash(attributes)
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Builds the object from hash
|
|
349
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
350
|
+
# @return [Object] Returns the model itself
|
|
351
|
+
def build_from_hash(attributes)
|
|
352
|
+
return nil unless attributes.is_a?(Hash)
|
|
353
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
354
|
+
if type =~ /\AArray<(.*)>/i
|
|
355
|
+
# check to ensure the input is an array given that the attribute
|
|
356
|
+
# is documented as an array but the input is not
|
|
357
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
358
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
359
|
+
end
|
|
360
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
361
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
362
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
363
|
+
self.send("#{key}=", nil)
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
self
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
# Deserializes the data based on type
|
|
371
|
+
# @param string type Data type
|
|
372
|
+
# @param string value Value to be deserialized
|
|
373
|
+
# @return [Object] Deserialized data
|
|
374
|
+
def _deserialize(type, value)
|
|
375
|
+
case type.to_sym
|
|
376
|
+
when :DateTime
|
|
377
|
+
DateTime.parse(value)
|
|
378
|
+
when :Date
|
|
379
|
+
Date.parse(value)
|
|
380
|
+
when :String
|
|
381
|
+
value.to_s
|
|
382
|
+
when :Integer
|
|
383
|
+
value.to_i
|
|
384
|
+
when :Float
|
|
385
|
+
value.to_f
|
|
386
|
+
when :Boolean
|
|
387
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
388
|
+
true
|
|
389
|
+
else
|
|
390
|
+
false
|
|
391
|
+
end
|
|
392
|
+
when :Object
|
|
393
|
+
# generic object (usually a Hash), return directly
|
|
394
|
+
value
|
|
395
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
396
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
397
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
398
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
399
|
+
k_type = Regexp.last_match[:k_type]
|
|
400
|
+
v_type = Regexp.last_match[:v_type]
|
|
401
|
+
{}.tap do |hash|
|
|
402
|
+
value.each do |k, v|
|
|
403
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
404
|
+
end
|
|
405
|
+
end
|
|
406
|
+
else # model
|
|
407
|
+
VeniceClient.const_get(type).build_from_hash(value)
|
|
408
|
+
end
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# Returns the string representation of the object
|
|
412
|
+
# @return [String] String presentation of the object
|
|
413
|
+
def to_s
|
|
414
|
+
to_hash.to_s
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
418
|
+
# @return [Hash] Returns the object in the form of hash
|
|
419
|
+
def to_body
|
|
420
|
+
to_hash
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
# Returns the object in the form of hash
|
|
424
|
+
# @return [Hash] Returns the object in the form of hash
|
|
425
|
+
def to_hash
|
|
426
|
+
hash = {}
|
|
427
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
428
|
+
value = self.send(attr)
|
|
429
|
+
if value.nil?
|
|
430
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
431
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
hash[param] = _to_hash(value)
|
|
435
|
+
end
|
|
436
|
+
hash
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
# Outputs non-array value in the form of hash
|
|
440
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
441
|
+
# @param [Object] value Any valid value
|
|
442
|
+
# @return [Hash] Returns the value in the form of hash
|
|
443
|
+
def _to_hash(value)
|
|
444
|
+
if value.is_a?(Array)
|
|
445
|
+
value.compact.map { |v| _to_hash(v) }
|
|
446
|
+
elsif value.is_a?(Hash)
|
|
447
|
+
{}.tap do |hash|
|
|
448
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
449
|
+
end
|
|
450
|
+
elsif value.respond_to? :to_hash
|
|
451
|
+
value.to_hash
|
|
452
|
+
else
|
|
453
|
+
value
|
|
454
|
+
end
|
|
455
|
+
end end
|
|
456
|
+
end
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Venice.ai API
|
|
3
|
+
|
|
4
|
+
#The Venice.ai API.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 20250521.233203
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 3.0.68
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
module VeniceClient
|
|
15
|
+
# A tool that can be called by the model. Currently, only functions are supported as tools.
|
|
16
|
+
class ToolCall
|
|
17
|
+
attr_accessor :function
|
|
18
|
+
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
attr_accessor :type
|
|
22
|
+
|
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
|
+
def self.attribute_map
|
|
25
|
+
{
|
|
26
|
+
:'function' => :'function',
|
|
27
|
+
:'id' => :'id',
|
|
28
|
+
:'type' => :'type'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Attribute type mapping.
|
|
33
|
+
def self.openapi_types
|
|
34
|
+
{
|
|
35
|
+
:'function' => :'Object',
|
|
36
|
+
:'id' => :'Object',
|
|
37
|
+
:'type' => :'Object'
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# List of attributes with nullable: true
|
|
42
|
+
def self.openapi_nullable
|
|
43
|
+
Set.new([
|
|
44
|
+
])
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Initializes the object
|
|
48
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
49
|
+
def initialize(attributes = {})
|
|
50
|
+
if (!attributes.is_a?(Hash))
|
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VeniceClient::ToolCall` initialize method"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
56
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::ToolCall`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
58
|
+
end
|
|
59
|
+
h[k.to_sym] = v
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if attributes.key?(:'function')
|
|
63
|
+
self.function = attributes[:'function']
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:'id')
|
|
67
|
+
self.id = attributes[:'id']
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:'type')
|
|
71
|
+
self.type = attributes[:'type']
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
76
|
+
# @return Array for valid properties with the reasons
|
|
77
|
+
def list_invalid_properties
|
|
78
|
+
invalid_properties = Array.new
|
|
79
|
+
if @function.nil?
|
|
80
|
+
invalid_properties.push('invalid value for "function", function cannot be nil.')
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
invalid_properties
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Check to see if the all the properties in the model are valid
|
|
87
|
+
# @return true if the model is valid
|
|
88
|
+
def valid?
|
|
89
|
+
return false if @function.nil?
|
|
90
|
+
true
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Checks equality by comparing each attribute.
|
|
94
|
+
# @param [Object] Object to be compared
|
|
95
|
+
def ==(o)
|
|
96
|
+
return true if self.equal?(o)
|
|
97
|
+
self.class == o.class &&
|
|
98
|
+
function == o.function &&
|
|
99
|
+
id == o.id &&
|
|
100
|
+
type == o.type
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# @see the `==` method
|
|
104
|
+
# @param [Object] Object to be compared
|
|
105
|
+
def eql?(o)
|
|
106
|
+
self == o
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Calculates hash code according to all attributes.
|
|
110
|
+
# @return [Integer] Hash code
|
|
111
|
+
def hash
|
|
112
|
+
[function, id, type].hash
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Builds the object from hash
|
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
117
|
+
# @return [Object] Returns the model itself
|
|
118
|
+
def self.build_from_hash(attributes)
|
|
119
|
+
new.build_from_hash(attributes)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Builds the object from hash
|
|
123
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
124
|
+
# @return [Object] Returns the model itself
|
|
125
|
+
def build_from_hash(attributes)
|
|
126
|
+
return nil unless attributes.is_a?(Hash)
|
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
128
|
+
if type =~ /\AArray<(.*)>/i
|
|
129
|
+
# check to ensure the input is an array given that the attribute
|
|
130
|
+
# is documented as an array but the input is not
|
|
131
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
132
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
133
|
+
end
|
|
134
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
135
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
136
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
137
|
+
self.send("#{key}=", nil)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
self
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Deserializes the data based on type
|
|
145
|
+
# @param string type Data type
|
|
146
|
+
# @param string value Value to be deserialized
|
|
147
|
+
# @return [Object] Deserialized data
|
|
148
|
+
def _deserialize(type, value)
|
|
149
|
+
case type.to_sym
|
|
150
|
+
when :DateTime
|
|
151
|
+
DateTime.parse(value)
|
|
152
|
+
when :Date
|
|
153
|
+
Date.parse(value)
|
|
154
|
+
when :String
|
|
155
|
+
value.to_s
|
|
156
|
+
when :Integer
|
|
157
|
+
value.to_i
|
|
158
|
+
when :Float
|
|
159
|
+
value.to_f
|
|
160
|
+
when :Boolean
|
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
162
|
+
true
|
|
163
|
+
else
|
|
164
|
+
false
|
|
165
|
+
end
|
|
166
|
+
when :Object
|
|
167
|
+
# generic object (usually a Hash), return directly
|
|
168
|
+
value
|
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
|
175
|
+
{}.tap do |hash|
|
|
176
|
+
value.each do |k, v|
|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
else # model
|
|
181
|
+
VeniceClient.const_get(type).build_from_hash(value)
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Returns the string representation of the object
|
|
186
|
+
# @return [String] String presentation of the object
|
|
187
|
+
def to_s
|
|
188
|
+
to_hash.to_s
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
|
193
|
+
def to_body
|
|
194
|
+
to_hash
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Returns the object in the form of hash
|
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
|
199
|
+
def to_hash
|
|
200
|
+
hash = {}
|
|
201
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
202
|
+
value = self.send(attr)
|
|
203
|
+
if value.nil?
|
|
204
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
205
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
hash[param] = _to_hash(value)
|
|
209
|
+
end
|
|
210
|
+
hash
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Outputs non-array value in the form of hash
|
|
214
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
215
|
+
# @param [Object] value Any valid value
|
|
216
|
+
# @return [Hash] Returns the value in the form of hash
|
|
217
|
+
def _to_hash(value)
|
|
218
|
+
if value.is_a?(Array)
|
|
219
|
+
value.compact.map { |v| _to_hash(v) }
|
|
220
|
+
elsif value.is_a?(Hash)
|
|
221
|
+
{}.tap do |hash|
|
|
222
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
223
|
+
end
|
|
224
|
+
elsif value.respond_to? :to_hash
|
|
225
|
+
value.to_hash
|
|
226
|
+
else
|
|
227
|
+
value
|
|
228
|
+
end
|
|
229
|
+
end end
|
|
230
|
+
end
|