venice_client 1.0.1 → 1.0.3
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 +39 -0
- data/.gitlab-ci.yml +26 -0
- data/.openapi-generator/FILES +395 -0
- data/.openapi-generator/VERSION +1 -0
- data/.openapi-generator-ignore +23 -0
- data/.rspec +2 -0
- data/.rubocop.yml +148 -0
- data/.travis.yml +11 -0
- data/README.md +120 -390
- data/Rakefile +2 -0
- data/docs/APIKeysApi.md +236 -89
- data/docs/AssistantMessage.md +26 -0
- data/docs/AssistantMessageContent.md +15 -0
- data/docs/AudioApi.md +40 -19
- data/docs/AudioModelPricing.md +18 -0
- data/docs/AudioModelPricingInput.md +22 -0
- data/docs/BillingApi.md +50 -29
- data/docs/BillingUsageRequest.md +24 -8
- data/docs/BillingUsageResponse.md +16 -4
- data/docs/CharactersApi.md +36 -14
- data/docs/ChatApi.md +43 -22
- data/docs/ChatCompletionRequest.md +66 -28
- data/docs/ChatCompletionRequestMessagesInner.md +28 -0
- data/docs/ChatCompletionRequestResponseFormat.md +49 -0
- data/docs/ChatCompletionRequestStop.md +15 -0
- data/docs/ChatCompletionRequestStreamOptions.md +14 -3
- data/docs/ChatCompletionRequestToolChoice.md +20 -0
- data/docs/ChatCompletionRequestToolChoiceAnyOf.md +20 -0
- data/docs/ChatCompletionRequestToolChoiceAnyOfFunction.md +18 -0
- data/docs/ChatCompletionRequestVeniceParameters.md +26 -8
- data/docs/CreateApiKey200Response.md +20 -0
- data/docs/CreateApiKey200ResponseData.md +28 -0
- data/docs/CreateApiKeyRequest.md +24 -0
- data/docs/CreateApiKeyRequestExpiresAt.md +15 -0
- data/docs/CreateChatCompletion200Response.md +32 -0
- data/docs/CreateChatCompletion200ResponseChoicesInner.md +26 -0
- data/docs/CreateChatCompletion200ResponseChoicesInnerLogprobs.md +24 -0
- data/docs/CreateChatCompletion200ResponseChoicesInnerLogprobsTopLogprobsInner.md +22 -0
- data/docs/CreateChatCompletion200ResponseChoicesInnerMessage.md +28 -0
- data/docs/CreateChatCompletion200ResponseUsage.md +24 -0
- data/docs/CreateChatCompletion200ResponseVeniceParameters.md +32 -0
- data/docs/CreateChatCompletion200ResponseVeniceParametersWebSearchCitationsInner.md +24 -0
- data/docs/CreateChatCompletion400Response.md +20 -0
- data/docs/CreateChatCompletion401Response.md +18 -0
- data/docs/CreateChatCompletion402Response.md +18 -0
- data/docs/CreateChatCompletion415Response.md +18 -0
- data/docs/CreateChatCompletion429Response.md +18 -0
- data/docs/CreateChatCompletion500Response.md +18 -0
- data/docs/CreateChatCompletion503Response.md +18 -0
- data/docs/CreateChatCompletion504Response.md +18 -0
- data/docs/CreateEmbedding200Response.md +24 -0
- data/docs/CreateEmbedding200ResponseDataInner.md +22 -0
- data/docs/CreateEmbedding200ResponseUsage.md +20 -0
- data/docs/CreateEmbeddingRequestSchema.md +22 -7
- data/docs/CreateEmbeddingRequestSchemaInput.md +15 -0
- data/docs/CreateEmbeddingRequestSchemaModel.md +15 -0
- data/docs/CreateSpeech403Response.md +18 -0
- data/docs/CreateSpeechRequestSchema.md +24 -8
- data/docs/DeleteApiKey200Response.md +18 -0
- data/docs/EditImageRequest.md +20 -0
- data/docs/EmbeddingsApi.md +44 -23
- data/docs/GenerateImage200Response.md +24 -0
- data/docs/GenerateImage200ResponseTiming.md +24 -0
- data/docs/GenerateImageRequest.md +44 -18
- data/docs/GetApiKeyGenerateWeb3Key200Response.md +20 -0
- data/docs/GetApiKeyGenerateWeb3Key200ResponseData.md +18 -0
- data/docs/GetApiKeyRateLimitLogs200Response.md +20 -0
- data/docs/GetApiKeyRateLimitLogs200ResponseDataInner.md +26 -0
- data/docs/GetApiKeyRateLimits200Response.md +18 -0
- data/docs/GetApiKeyRateLimits200ResponseData.md +28 -0
- data/docs/GetApiKeyRateLimits200ResponseDataApiTier.md +20 -0
- data/docs/GetApiKeyRateLimits200ResponseDataBalances.md +22 -0
- data/docs/GetApiKeyRateLimits200ResponseDataRateLimitsInner.md +20 -0
- data/docs/GetApiKeyRateLimits200ResponseDataRateLimitsInnerRateLimitsInner.md +20 -0
- data/docs/GetApiKeys200Response.md +20 -0
- data/docs/GetApiKeys200ResponseDataInner.md +34 -0
- data/docs/GetApiKeys200ResponseDataInnerConsumptionLimits.md +22 -0
- data/docs/GetApiKeys200ResponseDataInnerUsage.md +18 -0
- data/docs/GetApiKeys200ResponseDataInnerUsageTrailingSevenDays.md +22 -0
- data/docs/GetBillingUsage200Response.md +20 -0
- data/docs/GetBillingUsage200ResponseDataInner.md +32 -0
- data/docs/GetBillingUsage200ResponseDataInnerInferenceDetails.md +24 -0
- data/docs/GetBillingUsage200ResponsePagination.md +24 -0
- data/docs/ImageApi.md +198 -102
- data/docs/ImageModelConstraints.md +22 -0
- data/docs/ImageModelConstraintsSteps.md +20 -0
- data/docs/ImageModelPricing.md +20 -0
- data/docs/ImageModelPricingGeneration.md +22 -0
- data/docs/ImageModelPricingUpscale.md +20 -0
- data/docs/ImageModelPricingUpscale2x.md +22 -0
- data/docs/ImageModelPricingUpscale4x.md +22 -0
- data/docs/ImageStylesGet200Response.md +20 -0
- data/docs/ImageStylesGet500Response.md +18 -0
- data/docs/ImageURLObject.md +18 -0
- data/docs/ImageUrl.md +20 -0
- data/docs/JsonObject.md +18 -0
- data/docs/JsonSchema.md +20 -0
- data/docs/LLMModelPricing.md +20 -0
- data/docs/LLMModelPricingInput.md +22 -0
- data/docs/LLMModelPricingOutput.md +22 -0
- data/docs/ListCharacters200Response.md +20 -0
- data/docs/ListCharacters200ResponseDataInner.md +36 -0
- data/docs/ListCharacters200ResponseDataInnerStats.md +18 -0
- data/docs/ListModelCompatibilityMapping200Response.md +22 -0
- data/docs/ListModelTraits200Response.md +22 -0
- data/docs/ListModels200Response.md +22 -0
- data/docs/ListModels200ResponseType.md +15 -0
- data/docs/ListModelsTypeParameter.md +15 -0
- data/docs/ModelResponse.md +24 -8
- data/docs/ModelResponseModelSpec.md +32 -11
- data/docs/ModelResponseModelSpecCapabilities.md +28 -10
- data/docs/ModelResponseModelSpecConstraints.md +26 -0
- data/docs/ModelResponseModelSpecPricing.md +24 -0
- data/docs/ModelsApi.md +112 -49
- data/docs/ObjectsInner.md +49 -0
- data/docs/PostApiKeyGenerateWeb3KeyRequest.md +30 -0
- data/docs/PreviewApi.md +36 -14
- data/docs/SimpleGenerateImage200Response.md +20 -0
- data/docs/SimpleGenerateImage200ResponseDataInner.md +20 -0
- data/docs/SimpleGenerateImage200ResponseDataInnerAnyOf.md +18 -0
- data/docs/SimpleGenerateImage200ResponseDataInnerAnyOf1.md +18 -0
- data/docs/SimpleGenerateImageRequest.md +36 -14
- data/docs/SpeechApi.md +40 -19
- data/docs/SystemMessage.md +22 -0
- data/docs/SystemMessageContent.md +15 -0
- data/docs/Text.md +20 -0
- data/docs/TextModelConstraints.md +20 -0
- data/docs/TextModelConstraintsTemperature.md +18 -0
- data/docs/TextModelConstraintsTopP.md +18 -0
- data/docs/ToolCall.md +18 -5
- data/docs/ToolCallFunction.md +22 -0
- data/docs/ToolMessage.md +28 -0
- data/docs/UpscaleImageRequest.md +24 -8
- data/docs/UpscaleImageRequestEnhance.md +15 -0
- data/docs/UserMessage.md +20 -0
- data/docs/UserMessageContent.md +15 -0
- data/git_push.sh +11 -9
- data/lib/venice_client/api/api_keys_api.rb +122 -65
- data/lib/venice_client/api/audio_api.rb +26 -14
- data/lib/venice_client/api/billing_api.rb +46 -23
- data/lib/venice_client/api/characters_api.rb +20 -11
- data/lib/venice_client/api/chat_api.rb +28 -16
- data/lib/venice_client/api/embeddings_api.rb +34 -22
- data/lib/venice_client/api/image_api.rb +146 -119
- data/lib/venice_client/api/models_api.rb +62 -37
- data/lib/venice_client/api/preview_api.rb +20 -11
- data/lib/venice_client/api/speech_api.rb +26 -14
- data/lib/venice_client/api_client.rb +99 -94
- data/lib/venice_client/api_error.rb +7 -5
- data/lib/venice_client/configuration.rb +129 -24
- data/lib/venice_client/models/assistant_message.rb +304 -0
- data/lib/venice_client/models/assistant_message_content.rb +104 -0
- data/lib/venice_client/models/audio_model_pricing.rb +238 -0
- data/lib/venice_client/models/audio_model_pricing_input.rb +292 -0
- data/lib/venice_client/models/billing_usage_request.rb +99 -38
- data/lib/venice_client/models/billing_usage_response.rb +68 -30
- data/lib/venice_client/models/chat_completion_request.rb +389 -61
- data/lib/venice_client/models/chat_completion_request_messages_inner.rb +106 -0
- data/lib/venice_client/models/chat_completion_request_response_format.rb +106 -0
- data/lib/venice_client/models/chat_completion_request_stop.rb +105 -0
- data/lib/venice_client/models/chat_completion_request_stream_options.rb +43 -29
- data/lib/venice_client/models/chat_completion_request_tool_choice.rb +104 -0
- data/lib/venice_client/models/chat_completion_request_tool_choice_any_of.rb +263 -0
- data/lib/venice_client/models/chat_completion_request_tool_choice_any_of_function.rb +237 -0
- data/lib/venice_client/models/chat_completion_request_venice_parameters.rb +71 -48
- data/lib/venice_client/models/{inline_response_200_8.rb → create_api_key200_response.rb} +70 -32
- data/lib/venice_client/models/{inline_response_200_8_data.rb → create_api_key200_response_data.rb} +92 -43
- data/lib/venice_client/models/{api_keys_body.rb → create_api_key_request.rb} +65 -38
- data/lib/venice_client/models/create_api_key_request_expires_at.rb +104 -0
- data/lib/venice_client/models/{inline_response_200.rb → create_chat_completion200_response.rb} +120 -42
- data/lib/venice_client/models/{inline_response_200_choices.rb → create_chat_completion200_response_choices_inner.rb} +82 -44
- data/lib/venice_client/models/{inline_response_200_logprobs.rb → create_chat_completion200_response_choices_inner_logprobs.rb} +72 -34
- data/lib/venice_client/models/{inline_response_200_logprobs_top_logprobs.rb → create_chat_completion200_response_choices_inner_logprobs_top_logprobs_inner.rb} +71 -33
- data/lib/venice_client/models/create_chat_completion200_response_choices_inner_message.rb +104 -0
- data/lib/venice_client/models/{inline_response_200_usage.rb → create_chat_completion200_response_usage.rb} +83 -33
- data/lib/venice_client/models/{inline_response_200_venice_parameters.rb → create_chat_completion200_response_venice_parameters.rb} +131 -40
- data/lib/venice_client/models/{inline_response_200_venice_parameters_web_search_citations.rb → create_chat_completion200_response_venice_parameters_web_search_citations_inner.rb} +72 -34
- data/lib/venice_client/models/{inline_response_400.rb → create_chat_completion400_response.rb} +57 -31
- data/lib/venice_client/models/{inline_response_401.rb → create_chat_completion401_response.rb} +57 -31
- data/lib/venice_client/models/{inline_response_402.rb → create_chat_completion402_response.rb} +57 -31
- data/lib/venice_client/models/create_chat_completion415_response.rb +238 -0
- data/lib/venice_client/models/create_chat_completion429_response.rb +238 -0
- data/lib/venice_client/models/create_chat_completion500_response.rb +238 -0
- data/lib/venice_client/models/create_chat_completion503_response.rb +238 -0
- data/lib/venice_client/models/create_chat_completion504_response.rb +238 -0
- data/lib/venice_client/models/{inline_response_200_14.rb → create_embedding200_response.rb} +88 -36
- data/lib/venice_client/models/{inline_response_200_14_data.rb → create_embedding200_response_data_inner.rb} +75 -35
- data/lib/venice_client/models/{inline_response_200_14_usage.rb → create_embedding200_response_usage.rb} +70 -32
- data/lib/venice_client/models/create_embedding_request_schema.rb +92 -37
- data/lib/venice_client/models/create_embedding_request_schema_input.rb +107 -0
- data/lib/venice_client/models/create_embedding_request_schema_model.rb +104 -0
- data/lib/venice_client/models/{inline_response_403.rb → create_speech403_response.rb} +57 -31
- data/lib/venice_client/models/create_speech_request_schema.rb +112 -40
- data/lib/venice_client/models/{inline_response_200_12.rb → delete_api_key200_response.rb} +58 -46
- data/lib/venice_client/models/edit_image_request.rb +260 -0
- data/lib/venice_client/models/{inline_response_200_1.rb → generate_image200_response.rb} +83 -33
- data/lib/venice_client/models/{inline_response_200_1_timing.rb → generate_image200_response_timing.rb} +96 -34
- data/lib/venice_client/models/generate_image_request.rb +289 -46
- data/lib/venice_client/models/get_api_key_generate_web3_key200_response.rb +263 -0
- data/lib/venice_client/models/{inline_response_200_12_data.rb → get_api_key_generate_web3_key200_response_data.rb} +57 -31
- data/lib/venice_client/models/{inline_response_200_13.rb → get_api_key_rate_limit_logs200_response.rb} +63 -34
- data/lib/venice_client/models/{inline_response_200_11_data.rb → get_api_key_rate_limit_logs200_response_data_inner.rb} +107 -35
- data/lib/venice_client/models/{inline_response_200_10.rb → get_api_key_rate_limits200_response.rb} +57 -31
- data/lib/venice_client/models/{inline_response_200_10_data.rb → get_api_key_rate_limits200_response_data.rb} +112 -41
- data/lib/venice_client/models/{inline_response_200_10_data_api_tier.rb → get_api_key_rate_limits200_response_data_api_tier.rb} +71 -33
- data/lib/venice_client/models/{inline_response_200_10_data_balances.rb → get_api_key_rate_limits200_response_data_balances.rb} +60 -36
- data/lib/venice_client/models/{inline_response_200_10_data_rate_limits_1.rb → get_api_key_rate_limits200_response_data_rate_limits_inner.rb} +58 -32
- data/lib/venice_client/models/{inline_response_200_10_data_rate_limits.rb → get_api_key_rate_limits200_response_data_rate_limits_inner_rate_limits_inner.rb} +70 -32
- data/lib/venice_client/models/{inline_response_200_7.rb → get_api_keys200_response.rb} +62 -34
- data/lib/venice_client/models/{inline_response_200_7_data.rb → get_api_keys200_response_data_inner.rb} +99 -56
- data/lib/venice_client/models/get_api_keys200_response_data_inner_consumption_limits.rb +287 -0
- data/lib/venice_client/models/{inline_response_200_7_usage.rb → get_api_keys200_response_data_inner_usage.rb} +57 -31
- data/lib/venice_client/models/get_api_keys200_response_data_inner_usage_trailing_seven_days.rb +292 -0
- data/lib/venice_client/models/{inline_response_200_15.rb → get_billing_usage200_response.rb} +70 -32
- data/lib/venice_client/models/{billing_usage_response_data.rb → get_billing_usage200_response_data_inner.rb} +131 -45
- data/lib/venice_client/models/{billing_usage_response_inference_details.rb → get_billing_usage200_response_data_inner_inference_details.rb} +56 -54
- data/lib/venice_client/models/{billing_usage_response_pagination.rb → get_billing_usage200_response_pagination.rb} +96 -34
- data/lib/venice_client/models/image_model_constraints.rb +292 -0
- data/lib/venice_client/models/image_model_constraints_steps.rb +265 -0
- data/lib/venice_client/models/image_model_pricing.rb +264 -0
- data/lib/venice_client/models/image_model_pricing_generation.rb +292 -0
- data/lib/venice_client/models/image_model_pricing_upscale.rb +263 -0
- data/lib/venice_client/models/image_model_pricing_upscale2x.rb +292 -0
- data/lib/venice_client/models/image_model_pricing_upscale4x.rb +292 -0
- data/lib/venice_client/models/{inline_response_200_3.rb → image_styles_get200_response.rb} +62 -34
- data/lib/venice_client/models/{inline_response_415.rb → image_styles_get500_response.rb} +57 -31
- data/lib/venice_client/models/image_url.rb +288 -0
- data/lib/venice_client/models/{inline_response_200_7_usage_trailing_seven_days.rb → image_url_object.rb} +68 -56
- data/lib/venice_client/models/json_object.rb +262 -0
- data/lib/venice_client/models/json_schema.rb +290 -0
- data/lib/venice_client/models/{inline_response_200_11.rb → list_characters200_response.rb} +62 -35
- data/lib/venice_client/models/{inline_response_200_13_data.rb → list_characters200_response_data_inner.rb} +154 -50
- data/lib/venice_client/models/{inline_response_200_13_stats.rb → list_characters200_response_data_inner_stats.rb} +57 -31
- data/lib/venice_client/models/{inline_response_200_6.rb → list_model_compatibility_mapping200_response.rb} +79 -37
- data/lib/venice_client/models/{inline_response_200_5.rb → list_model_traits200_response.rb} +79 -37
- data/lib/venice_client/models/{inline_response_200_4.rb → list_models200_response.rb} +75 -36
- data/lib/venice_client/models/list_models200_response_type.rb +104 -0
- data/lib/venice_client/models/list_models_type_parameter.rb +104 -0
- data/lib/venice_client/models/llm_model_pricing.rb +264 -0
- data/lib/venice_client/models/llm_model_pricing_input.rb +292 -0
- data/lib/venice_client/models/llm_model_pricing_output.rb +292 -0
- data/lib/venice_client/models/model_response.rb +84 -40
- data/lib/venice_client/models/model_response_model_spec.rb +62 -40
- data/lib/venice_client/models/model_response_model_spec_capabilities.rb +138 -38
- data/lib/venice_client/models/model_response_model_spec_constraints.rb +105 -0
- data/lib/venice_client/models/model_response_model_spec_pricing.rb +106 -0
- data/lib/venice_client/models/objects_inner.rb +105 -0
- data/lib/venice_client/models/{api_keys_generate_web3_key_body.rb → post_api_key_generate_web3_key_request.rb} +91 -40
- data/lib/venice_client/models/{inline_response_200_2.rb → simple_generate_image200_response.rb} +73 -35
- data/lib/venice_client/models/simple_generate_image200_response_data_inner.rb +104 -0
- data/lib/venice_client/models/simple_generate_image200_response_data_inner_any_of.rb +238 -0
- data/lib/venice_client/models/{api_keys_consumption_limit.rb → simple_generate_image200_response_data_inner_any_of1.rb} +67 -57
- data/lib/venice_client/models/simple_generate_image_request.rb +146 -54
- data/lib/venice_client/models/system_message.rb +297 -0
- data/lib/venice_client/models/system_message_content.rb +104 -0
- data/lib/venice_client/models/text.rb +298 -0
- data/lib/venice_client/models/text_model_constraints.rb +264 -0
- data/lib/venice_client/models/text_model_constraints_temperature.rb +238 -0
- data/lib/venice_client/models/text_model_constraints_top_p.rb +238 -0
- data/lib/venice_client/models/tool_call.rb +57 -31
- data/lib/venice_client/models/{chat_completion_request_function.rb → tool_call_function.rb} +59 -33
- data/lib/venice_client/models/tool_message.rb +344 -0
- data/lib/venice_client/models/upscale_image_request.rb +146 -40
- data/lib/venice_client/models/upscale_image_request_enhance.rb +105 -0
- data/lib/venice_client/models/user_message.rb +288 -0
- data/lib/venice_client/models/user_message_content.rb +104 -0
- data/lib/venice_client/version.rb +5 -4
- data/lib/venice_client.rb +134 -108
- data/openapitools.json +7 -0
- data/spec/api/api_keys_api_spec.rb +43 -41
- data/spec/api/audio_api_spec.rb +18 -16
- data/spec/api/billing_api_spec.rb +23 -21
- data/spec/api/characters_api_spec.rb +17 -15
- data/spec/api/chat_api_spec.rb +19 -17
- data/spec/api/embeddings_api_spec.rb +19 -17
- data/spec/api/image_api_spec.rb +43 -46
- data/spec/api/models_api_spec.rb +28 -26
- data/spec/api/preview_api_spec.rb +17 -15
- data/spec/api/speech_api_spec.rb +18 -16
- data/spec/models/assistant_message_content_spec.rb +21 -0
- data/spec/models/assistant_message_spec.rb +64 -0
- data/spec/models/audio_model_pricing_input_spec.rb +48 -0
- data/spec/models/audio_model_pricing_spec.rb +36 -0
- data/spec/models/billing_usage_request_spec.rb +19 -23
- data/spec/models/billing_usage_response_spec.rb +12 -16
- data/spec/models/chat_completion_request_messages_inner_spec.rb +21 -0
- data/spec/models/chat_completion_request_response_format_spec.rb +32 -0
- data/spec/models/chat_completion_request_spec.rb +74 -71
- data/spec/models/chat_completion_request_stop_spec.rb +21 -0
- data/spec/models/chat_completion_request_stream_options_spec.rb +11 -15
- data/spec/models/chat_completion_request_tool_choice_any_of_function_spec.rb +36 -0
- data/spec/models/chat_completion_request_tool_choice_any_of_spec.rb +42 -0
- data/spec/models/chat_completion_request_tool_choice_spec.rb +21 -0
- data/spec/models/chat_completion_request_venice_parameters_spec.rb +35 -32
- data/spec/models/create_api_key200_response_data_spec.rb +70 -0
- data/spec/models/create_api_key200_response_spec.rb +42 -0
- data/spec/models/create_api_key_request_expires_at_spec.rb +21 -0
- data/spec/models/create_api_key_request_spec.rb +58 -0
- data/spec/models/create_chat_completion200_response_choices_inner_logprobs_spec.rb +54 -0
- data/spec/models/create_chat_completion200_response_choices_inner_logprobs_top_logprobs_inner_spec.rb +48 -0
- data/spec/models/create_chat_completion200_response_choices_inner_message_spec.rb +21 -0
- data/spec/models/create_chat_completion200_response_choices_inner_spec.rb +68 -0
- data/spec/models/create_chat_completion200_response_spec.rb +82 -0
- data/spec/models/create_chat_completion200_response_usage_spec.rb +54 -0
- data/spec/models/create_chat_completion200_response_venice_parameters_spec.rb +82 -0
- data/spec/models/create_chat_completion200_response_venice_parameters_web_search_citations_inner_spec.rb +54 -0
- data/spec/models/create_chat_completion400_response_spec.rb +42 -0
- data/spec/models/create_chat_completion401_response_spec.rb +36 -0
- data/spec/models/create_chat_completion402_response_spec.rb +36 -0
- data/spec/models/create_chat_completion415_response_spec.rb +36 -0
- data/spec/models/create_chat_completion429_response_spec.rb +36 -0
- data/spec/models/create_chat_completion500_response_spec.rb +36 -0
- data/spec/models/create_chat_completion503_response_spec.rb +36 -0
- data/spec/models/create_chat_completion504_response_spec.rb +36 -0
- data/spec/models/create_embedding200_response_data_inner_spec.rb +52 -0
- data/spec/models/create_embedding200_response_spec.rb +58 -0
- data/spec/models/create_embedding200_response_usage_spec.rb +42 -0
- data/spec/models/create_embedding_request_schema_input_spec.rb +21 -0
- data/spec/models/create_embedding_request_schema_model_spec.rb +21 -0
- data/spec/models/create_embedding_request_schema_spec.rb +16 -20
- data/spec/models/create_speech403_response_spec.rb +36 -0
- data/spec/models/create_speech_request_schema_spec.rb +31 -34
- data/spec/models/delete_api_key200_response_spec.rb +36 -0
- data/spec/models/edit_image_request_spec.rb +42 -0
- data/spec/models/generate_image200_response_spec.rb +54 -0
- data/spec/models/generate_image200_response_timing_spec.rb +54 -0
- data/spec/models/generate_image_request_spec.rb +27 -31
- data/spec/models/get_api_key_generate_web3_key200_response_data_spec.rb +36 -0
- data/spec/models/get_api_key_generate_web3_key200_response_spec.rb +42 -0
- data/spec/models/get_api_key_rate_limit_logs200_response_data_inner_spec.rb +60 -0
- data/spec/models/get_api_key_rate_limit_logs200_response_spec.rb +46 -0
- data/spec/models/get_api_key_rate_limits200_response_data_api_tier_spec.rb +42 -0
- data/spec/models/get_api_key_rate_limits200_response_data_balances_spec.rb +48 -0
- data/spec/models/get_api_key_rate_limits200_response_data_rate_limits_inner_rate_limits_inner_spec.rb +42 -0
- data/spec/models/get_api_key_rate_limits200_response_data_rate_limits_inner_spec.rb +42 -0
- data/spec/models/get_api_key_rate_limits200_response_data_spec.rb +66 -0
- data/spec/models/get_api_key_rate_limits200_response_spec.rb +36 -0
- data/spec/models/get_api_keys200_response_data_inner_consumption_limits_spec.rb +48 -0
- data/spec/models/get_api_keys200_response_data_inner_spec.rb +88 -0
- data/spec/models/get_api_keys200_response_data_inner_usage_spec.rb +36 -0
- data/spec/models/get_api_keys200_response_data_inner_usage_trailing_seven_days_spec.rb +48 -0
- data/spec/models/get_api_keys200_response_spec.rb +46 -0
- data/spec/models/get_billing_usage200_response_data_inner_inference_details_spec.rb +54 -0
- data/spec/models/get_billing_usage200_response_data_inner_spec.rb +82 -0
- data/spec/models/get_billing_usage200_response_pagination_spec.rb +54 -0
- data/spec/models/get_billing_usage200_response_spec.rb +42 -0
- data/spec/models/image_model_constraints_spec.rb +48 -0
- data/spec/models/image_model_constraints_steps_spec.rb +42 -0
- data/spec/models/image_model_pricing_generation_spec.rb +48 -0
- data/spec/models/image_model_pricing_spec.rb +42 -0
- data/spec/models/image_model_pricing_upscale2x_spec.rb +48 -0
- data/spec/models/image_model_pricing_upscale4x_spec.rb +48 -0
- data/spec/models/image_model_pricing_upscale_spec.rb +42 -0
- data/spec/models/image_styles_get200_response_spec.rb +46 -0
- data/spec/models/image_styles_get500_response_spec.rb +36 -0
- data/spec/models/image_url_object_spec.rb +36 -0
- data/spec/models/image_url_spec.rb +46 -0
- data/spec/models/json_object_spec.rb +40 -0
- data/spec/models/json_schema_spec.rb +46 -0
- data/spec/models/list_characters200_response_data_inner_spec.rb +90 -0
- data/spec/models/list_characters200_response_data_inner_stats_spec.rb +36 -0
- data/spec/models/list_characters200_response_spec.rb +46 -0
- data/spec/models/list_model_compatibility_mapping200_response_spec.rb +52 -0
- data/spec/models/list_model_traits200_response_spec.rb +52 -0
- data/spec/models/list_models200_response_spec.rb +52 -0
- data/spec/models/list_models200_response_type_spec.rb +21 -0
- data/spec/models/list_models_type_parameter_spec.rb +21 -0
- data/spec/models/llm_model_pricing_input_spec.rb +48 -0
- data/spec/models/llm_model_pricing_output_spec.rb +48 -0
- data/spec/models/llm_model_pricing_spec.rb +42 -0
- data/spec/models/model_response_model_spec_capabilities_spec.rb +33 -36
- data/spec/models/model_response_model_spec_constraints_spec.rb +21 -0
- data/spec/models/model_response_model_spec_pricing_spec.rb +21 -0
- data/spec/models/model_response_model_spec_spec.rb +40 -37
- data/spec/models/model_response_spec.rb +32 -35
- data/spec/models/objects_inner_spec.rb +32 -0
- data/spec/models/post_api_key_generate_web3_key_request_spec.rb +76 -0
- data/spec/models/simple_generate_image200_response_data_inner_any_of1_spec.rb +36 -0
- data/spec/models/simple_generate_image200_response_data_inner_any_of_spec.rb +36 -0
- data/spec/models/simple_generate_image200_response_data_inner_spec.rb +21 -0
- data/spec/models/simple_generate_image200_response_spec.rb +42 -0
- data/spec/models/simple_generate_image_request_spec.rb +29 -33
- data/spec/models/system_message_content_spec.rb +21 -0
- data/spec/models/system_message_spec.rb +52 -0
- data/spec/models/text_model_constraints_spec.rb +42 -0
- data/spec/models/text_model_constraints_temperature_spec.rb +36 -0
- data/spec/models/text_model_constraints_top_p_spec.rb +36 -0
- data/spec/models/text_spec.rb +46 -0
- data/spec/models/tool_call_function_spec.rb +48 -0
- data/spec/models/tool_call_spec.rb +22 -25
- data/spec/models/tool_message_spec.rb +70 -0
- data/spec/models/upscale_image_request_enhance_spec.rb +21 -0
- data/spec/models/upscale_image_request_spec.rb +28 -31
- data/spec/models/user_message_content_spec.rb +21 -0
- data/spec/models/user_message_spec.rb +46 -0
- data/spec/spec_helper.rb +7 -6
- data/swagger.yaml +4791 -0
- data/update.sh +9 -0
- metadata +440 -356
- data/docs/AnyOfChatCompletionRequestMessagesItems.md +0 -6
- data/docs/AnyOfChatCompletionRequestStop.md +0 -6
- data/docs/AnyOfChatCompletionRequestToolChoice.md +0 -6
- data/docs/AnyOfCreateEmbeddingRequestSchemaInput.md +0 -6
- data/docs/AnyOfCreateEmbeddingRequestSchemaModel.md +0 -6
- data/docs/AnyOfModelResponseModelSpecConstraints.md +0 -6
- data/docs/AnyOfModelResponseModelSpecPricing.md +0 -6
- data/docs/AnyOfUpscaleImageRequestEnhance.md +0 -6
- data/docs/AnyOfUpscaleImageRequestImage.md +0 -6
- data/docs/AnyOfapiKeysBodyExpiresAt.md +0 -6
- data/docs/AnyOfapiKeysConsumptionLimitUsd.md +0 -6
- data/docs/AnyOfapiKeysConsumptionLimitVcu.md +0 -6
- data/docs/AnyOfapiKeysGenerateWeb3KeyBodyExpiresAt.md +0 -6
- data/docs/AnyOfinlineResponse2002DataItems.md +0 -6
- data/docs/AnyOfinlineResponse2004Type.md +0 -6
- data/docs/AnyOfinlineResponse2005Type.md +0 -6
- data/docs/AnyOfinlineResponse2006Type.md +0 -6
- data/docs/AnyOfinlineResponse200ChoicesMessage.md +0 -6
- data/docs/AnyOfinlineResponse200PromptLogprobs.md +0 -6
- data/docs/ApiKeysBody.md +0 -10
- data/docs/ApiKeysConsumptionLimit.md +0 -8
- data/docs/ApiKeysGenerateWeb3KeyBody.md +0 -13
- data/docs/BillingUsageResponseData.md +0 -14
- data/docs/BillingUsageResponseInferenceDetails.md +0 -10
- data/docs/BillingUsageResponsePagination.md +0 -10
- data/docs/ChatCompletionRequestFunction.md +0 -9
- data/docs/InlineResponse200.md +0 -14
- data/docs/InlineResponse2001.md +0 -10
- data/docs/InlineResponse20010.md +0 -7
- data/docs/InlineResponse20010Data.md +0 -12
- data/docs/InlineResponse20010DataApiTier.md +0 -8
- data/docs/InlineResponse20010DataBalances.md +0 -8
- data/docs/InlineResponse20010DataRateLimits.md +0 -8
- data/docs/InlineResponse20010DataRateLimits1.md +0 -8
- data/docs/InlineResponse20011.md +0 -8
- data/docs/InlineResponse20011Data.md +0 -11
- data/docs/InlineResponse20012.md +0 -8
- data/docs/InlineResponse20012Data.md +0 -7
- data/docs/InlineResponse20013.md +0 -8
- data/docs/InlineResponse20013Data.md +0 -16
- data/docs/InlineResponse20013Stats.md +0 -7
- data/docs/InlineResponse20014.md +0 -10
- data/docs/InlineResponse20014Data.md +0 -9
- data/docs/InlineResponse20014Usage.md +0 -8
- data/docs/InlineResponse20015.md +0 -8
- data/docs/InlineResponse2001Timing.md +0 -10
- data/docs/InlineResponse2002.md +0 -8
- data/docs/InlineResponse2003.md +0 -8
- data/docs/InlineResponse2004.md +0 -9
- data/docs/InlineResponse2005.md +0 -9
- data/docs/InlineResponse2006.md +0 -9
- data/docs/InlineResponse2007.md +0 -8
- data/docs/InlineResponse2007Data.md +0 -15
- data/docs/InlineResponse2007Usage.md +0 -7
- data/docs/InlineResponse2007UsageTrailingSevenDays.md +0 -8
- data/docs/InlineResponse2008.md +0 -8
- data/docs/InlineResponse2008Data.md +0 -12
- data/docs/InlineResponse2009.md +0 -7
- data/docs/InlineResponse200Choices.md +0 -11
- data/docs/InlineResponse200Logprobs.md +0 -10
- data/docs/InlineResponse200LogprobsTopLogprobs.md +0 -9
- data/docs/InlineResponse200Usage.md +0 -10
- data/docs/InlineResponse200VeniceParameters.md +0 -13
- data/docs/InlineResponse200VeniceParametersWebSearchCitations.md +0 -10
- data/docs/InlineResponse400.md +0 -8
- data/docs/InlineResponse401.md +0 -7
- data/docs/InlineResponse402.md +0 -7
- data/docs/InlineResponse403.md +0 -7
- data/docs/InlineResponse415.md +0 -7
- data/docs/InlineResponse429.md +0 -7
- data/docs/InlineResponse500.md +0 -7
- data/docs/InlineResponse5001.md +0 -7
- data/docs/InlineResponse503.md +0 -7
- data/docs/ModelCompatibilitySchema.md +0 -6
- data/docs/ModelTraitSchema.md +0 -6
- data/docs/OneOfChatCompletionRequestResponseFormat.md +0 -6
- data/docs/Type.md +0 -6
- data/lib/venice_client/models/any_of_chat_completion_request_messages_items.rb +0 -197
- data/lib/venice_client/models/any_of_chat_completion_request_stop.rb +0 -197
- data/lib/venice_client/models/any_of_chat_completion_request_tool_choice.rb +0 -197
- data/lib/venice_client/models/any_of_create_embedding_request_schema_input.rb +0 -197
- data/lib/venice_client/models/any_of_create_embedding_request_schema_model.rb +0 -197
- data/lib/venice_client/models/any_of_model_response_model_spec_constraints.rb +0 -197
- data/lib/venice_client/models/any_of_model_response_model_spec_pricing.rb +0 -197
- data/lib/venice_client/models/any_of_upscale_image_request_enhance.rb +0 -197
- data/lib/venice_client/models/any_of_upscale_image_request_image.rb +0 -197
- data/lib/venice_client/models/any_ofapi_keys_body_expires_at.rb +0 -197
- data/lib/venice_client/models/any_ofapi_keys_consumption_limit_usd.rb +0 -197
- data/lib/venice_client/models/any_ofapi_keys_consumption_limit_vcu.rb +0 -195
- data/lib/venice_client/models/any_ofapi_keys_generate_web3_key_body_expires_at.rb +0 -197
- data/lib/venice_client/models/any_ofinline_response_200_2_data_items.rb +0 -197
- data/lib/venice_client/models/any_ofinline_response_200_4_type.rb +0 -197
- data/lib/venice_client/models/any_ofinline_response_200_5_type.rb +0 -197
- data/lib/venice_client/models/any_ofinline_response_200_6_type.rb +0 -197
- data/lib/venice_client/models/any_ofinline_response_200_choices_message.rb +0 -197
- data/lib/venice_client/models/any_ofinline_response_200_prompt_logprobs.rb +0 -197
- data/lib/venice_client/models/inline_response_200_9.rb +0 -211
- data/lib/venice_client/models/inline_response_429.rb +0 -212
- data/lib/venice_client/models/inline_response_500.rb +0 -212
- data/lib/venice_client/models/inline_response_500_1.rb +0 -212
- data/lib/venice_client/models/inline_response_503.rb +0 -212
- data/lib/venice_client/models/model_compatibility_schema.rb +0 -202
- data/lib/venice_client/models/model_trait_schema.rb +0 -200
- data/lib/venice_client/models/one_of_chat_completion_request_response_format.rb +0 -197
- data/lib/venice_client/models/type.rb +0 -198
- data/spec/api_client_spec.rb +0 -225
- data/spec/base_object_spec.rb +0 -109
- data/spec/configuration_spec.rb +0 -41
- data/spec/models/any_of_chat_completion_request_messages_items_spec.rb +0 -34
- data/spec/models/any_of_chat_completion_request_stop_spec.rb +0 -34
- data/spec/models/any_of_chat_completion_request_tool_choice_spec.rb +0 -34
- data/spec/models/any_of_create_embedding_request_schema_input_spec.rb +0 -34
- data/spec/models/any_of_create_embedding_request_schema_model_spec.rb +0 -34
- data/spec/models/any_of_model_response_model_spec_constraints_spec.rb +0 -34
- data/spec/models/any_of_model_response_model_spec_pricing_spec.rb +0 -34
- data/spec/models/any_of_upscale_image_request_enhance_spec.rb +0 -34
- data/spec/models/any_of_upscale_image_request_image_spec.rb +0 -34
- data/spec/models/any_ofapi_keys_body_expires_at_spec.rb +0 -34
- data/spec/models/any_ofapi_keys_consumption_limit_usd_spec.rb +0 -34
- data/spec/models/any_ofapi_keys_consumption_limit_vcu_spec.rb +0 -34
- data/spec/models/any_ofapi_keys_generate_web3_key_body_expires_at_spec.rb +0 -34
- data/spec/models/any_ofinline_response_200_2_data_items_spec.rb +0 -34
- data/spec/models/any_ofinline_response_200_4_type_spec.rb +0 -34
- data/spec/models/any_ofinline_response_200_5_type_spec.rb +0 -34
- data/spec/models/any_ofinline_response_200_6_type_spec.rb +0 -34
- data/spec/models/any_ofinline_response_200_choices_message_spec.rb +0 -34
- data/spec/models/any_ofinline_response_200_prompt_logprobs_spec.rb +0 -34
- data/spec/models/api_keys_body_spec.rb +0 -61
- data/spec/models/api_keys_consumption_limit_spec.rb +0 -46
- data/spec/models/api_keys_generate_web3_key_body_spec.rb +0 -80
- data/spec/models/billing_usage_response_data_spec.rb +0 -86
- data/spec/models/billing_usage_response_inference_details_spec.rb +0 -57
- data/spec/models/billing_usage_response_pagination_spec.rb +0 -58
- data/spec/models/chat_completion_request_function_spec.rb +0 -52
- data/spec/models/inline_response_200_10_data_api_tier_spec.rb +0 -45
- data/spec/models/inline_response_200_10_data_balances_spec.rb +0 -45
- data/spec/models/inline_response_200_10_data_rate_limits_1_spec.rb +0 -45
- data/spec/models/inline_response_200_10_data_rate_limits_spec.rb +0 -46
- data/spec/models/inline_response_200_10_data_spec.rb +0 -69
- data/spec/models/inline_response_200_10_spec.rb +0 -40
- data/spec/models/inline_response_200_11_data_spec.rb +0 -64
- data/spec/models/inline_response_200_11_spec.rb +0 -50
- data/spec/models/inline_response_200_12_data_spec.rb +0 -39
- data/spec/models/inline_response_200_12_spec.rb +0 -46
- data/spec/models/inline_response_200_13_data_spec.rb +0 -93
- data/spec/models/inline_response_200_13_spec.rb +0 -49
- data/spec/models/inline_response_200_13_stats_spec.rb +0 -40
- data/spec/models/inline_response_200_14_data_spec.rb +0 -55
- data/spec/models/inline_response_200_14_spec.rb +0 -61
- data/spec/models/inline_response_200_14_usage_spec.rb +0 -45
- data/spec/models/inline_response_200_15_spec.rb +0 -45
- data/spec/models/inline_response_200_1_spec.rb +0 -57
- data/spec/models/inline_response_200_1_timing_spec.rb +0 -58
- data/spec/models/inline_response_200_2_spec.rb +0 -46
- data/spec/models/inline_response_200_3_spec.rb +0 -50
- data/spec/models/inline_response_200_4_spec.rb +0 -55
- data/spec/models/inline_response_200_5_spec.rb +0 -55
- data/spec/models/inline_response_200_6_spec.rb +0 -55
- data/spec/models/inline_response_200_7_data_spec.rb +0 -91
- data/spec/models/inline_response_200_7_spec.rb +0 -50
- data/spec/models/inline_response_200_7_usage_spec.rb +0 -39
- data/spec/models/inline_response_200_7_usage_trailing_seven_days_spec.rb +0 -45
- data/spec/models/inline_response_200_8_data_spec.rb +0 -73
- data/spec/models/inline_response_200_8_spec.rb +0 -45
- data/spec/models/inline_response_200_9_spec.rb +0 -39
- data/spec/models/inline_response_200_choices_spec.rb +0 -72
- data/spec/models/inline_response_200_logprobs_spec.rb +0 -57
- data/spec/models/inline_response_200_logprobs_top_logprobs_spec.rb +0 -51
- data/spec/models/inline_response_200_spec.rb +0 -85
- data/spec/models/inline_response_200_usage_spec.rb +0 -57
- data/spec/models/inline_response_200_venice_parameters_spec.rb +0 -80
- data/spec/models/inline_response_200_venice_parameters_web_search_citations_spec.rb +0 -57
- data/spec/models/inline_response_400_spec.rb +0 -45
- data/spec/models/inline_response_401_spec.rb +0 -39
- data/spec/models/inline_response_402_spec.rb +0 -39
- data/spec/models/inline_response_403_spec.rb +0 -40
- data/spec/models/inline_response_415_spec.rb +0 -40
- data/spec/models/inline_response_429_spec.rb +0 -39
- data/spec/models/inline_response_500_1_spec.rb +0 -40
- data/spec/models/inline_response_500_spec.rb +0 -39
- data/spec/models/inline_response_503_spec.rb +0 -40
- data/spec/models/model_compatibility_schema_spec.rb +0 -34
- data/spec/models/model_trait_schema_spec.rb +0 -34
- data/spec/models/one_of_chat_completion_request_response_format_spec.rb +0 -34
- data/spec/models/type_spec.rb +0 -34
- data/venice_client.gemspec +0 -38
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
#The Venice.ai API.
|
|
5
5
|
|
|
6
|
-
OpenAPI
|
|
6
|
+
The version of the OpenAPI document: 20250709.013306
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.14.0
|
|
7
10
|
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
-
Swagger Codegen version: 3.0.68
|
|
10
11
|
=end
|
|
11
12
|
|
|
12
13
|
require 'date'
|
|
14
|
+
require 'time'
|
|
13
15
|
|
|
14
16
|
module VeniceClient
|
|
15
17
|
# Create embeddings for the supplied input.
|
|
@@ -20,10 +22,8 @@ module VeniceClient
|
|
|
20
22
|
# The format to return the embeddings in. Can be either `float` or `base64`.
|
|
21
23
|
attr_accessor :encoding_format
|
|
22
24
|
|
|
23
|
-
# Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens), cannot be an empty string, and any array must be 2048 dimensions or less.
|
|
24
25
|
attr_accessor :input
|
|
25
26
|
|
|
26
|
-
# ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
|
|
27
27
|
attr_accessor :model
|
|
28
28
|
|
|
29
29
|
# This is an unused parameter and is discarded by Venice. It is supported solely for API compatibility with OpenAI.
|
|
@@ -62,14 +62,24 @@ module VeniceClient
|
|
|
62
62
|
}
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# Returns attribute mapping this model knows about
|
|
66
|
+
def self.acceptable_attribute_map
|
|
67
|
+
attribute_map
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Returns all the JSON keys this model knows about
|
|
71
|
+
def self.acceptable_attributes
|
|
72
|
+
acceptable_attribute_map.values
|
|
73
|
+
end
|
|
74
|
+
|
|
65
75
|
# Attribute type mapping.
|
|
66
76
|
def self.openapi_types
|
|
67
77
|
{
|
|
68
|
-
:'dimensions' => :'
|
|
69
|
-
:'encoding_format' => :'
|
|
70
|
-
:'input' => :'
|
|
71
|
-
:'model' => :'
|
|
72
|
-
:'user' => :'
|
|
78
|
+
:'dimensions' => :'Integer',
|
|
79
|
+
:'encoding_format' => :'String',
|
|
80
|
+
:'input' => :'CreateEmbeddingRequestSchemaInput',
|
|
81
|
+
:'model' => :'CreateEmbeddingRequestSchemaModel',
|
|
82
|
+
:'user' => :'String'
|
|
73
83
|
}
|
|
74
84
|
end
|
|
75
85
|
|
|
@@ -78,7 +88,7 @@ module VeniceClient
|
|
|
78
88
|
Set.new([
|
|
79
89
|
])
|
|
80
90
|
end
|
|
81
|
-
|
|
91
|
+
|
|
82
92
|
# Initializes the object
|
|
83
93
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
84
94
|
def initialize(attributes = {})
|
|
@@ -87,9 +97,10 @@ module VeniceClient
|
|
|
87
97
|
end
|
|
88
98
|
|
|
89
99
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
100
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
90
101
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
91
|
-
if (!
|
|
92
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::CreateEmbeddingRequestSchema`. Please check the name to make sure it's valid. List of attributes: " +
|
|
102
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
103
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::CreateEmbeddingRequestSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
93
104
|
end
|
|
94
105
|
h[k.to_sym] = v
|
|
95
106
|
}
|
|
@@ -106,10 +117,14 @@ module VeniceClient
|
|
|
106
117
|
|
|
107
118
|
if attributes.key?(:'input')
|
|
108
119
|
self.input = attributes[:'input']
|
|
120
|
+
else
|
|
121
|
+
self.input = nil
|
|
109
122
|
end
|
|
110
123
|
|
|
111
124
|
if attributes.key?(:'model')
|
|
112
125
|
self.model = attributes[:'model']
|
|
126
|
+
else
|
|
127
|
+
self.model = nil
|
|
113
128
|
end
|
|
114
129
|
|
|
115
130
|
if attributes.key?(:'user')
|
|
@@ -120,7 +135,12 @@ module VeniceClient
|
|
|
120
135
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
121
136
|
# @return Array for valid properties with the reasons
|
|
122
137
|
def list_invalid_properties
|
|
138
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
123
139
|
invalid_properties = Array.new
|
|
140
|
+
if !@dimensions.nil? && @dimensions < 1
|
|
141
|
+
invalid_properties.push('invalid value for "dimensions", must be greater than or equal to 1.')
|
|
142
|
+
end
|
|
143
|
+
|
|
124
144
|
if @input.nil?
|
|
125
145
|
invalid_properties.push('invalid value for "input", input cannot be nil.')
|
|
126
146
|
end
|
|
@@ -135,23 +155,59 @@ module VeniceClient
|
|
|
135
155
|
# Check to see if the all the properties in the model are valid
|
|
136
156
|
# @return true if the model is valid
|
|
137
157
|
def valid?
|
|
138
|
-
|
|
158
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
159
|
+
return false if !@dimensions.nil? && @dimensions < 1
|
|
160
|
+
encoding_format_validator = EnumAttributeValidator.new('String', ["float", "base64"])
|
|
139
161
|
return false unless encoding_format_validator.valid?(@encoding_format)
|
|
140
162
|
return false if @input.nil?
|
|
141
163
|
return false if @model.nil?
|
|
142
164
|
true
|
|
143
165
|
end
|
|
144
166
|
|
|
167
|
+
# Custom attribute writer method with validation
|
|
168
|
+
# @param [Object] dimensions Value to be assigned
|
|
169
|
+
def dimensions=(dimensions)
|
|
170
|
+
if dimensions.nil?
|
|
171
|
+
fail ArgumentError, 'dimensions cannot be nil'
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if dimensions < 1
|
|
175
|
+
fail ArgumentError, 'invalid value for "dimensions", must be greater than or equal to 1.'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
@dimensions = dimensions
|
|
179
|
+
end
|
|
180
|
+
|
|
145
181
|
# Custom attribute writer method checking allowed values (enum).
|
|
146
182
|
# @param [Object] encoding_format Object to be assigned
|
|
147
183
|
def encoding_format=(encoding_format)
|
|
148
|
-
validator = EnumAttributeValidator.new('
|
|
184
|
+
validator = EnumAttributeValidator.new('String', ["float", "base64"])
|
|
149
185
|
unless validator.valid?(encoding_format)
|
|
150
186
|
fail ArgumentError, "invalid value for \"encoding_format\", must be one of #{validator.allowable_values}."
|
|
151
187
|
end
|
|
152
188
|
@encoding_format = encoding_format
|
|
153
189
|
end
|
|
154
190
|
|
|
191
|
+
# Custom attribute writer method with validation
|
|
192
|
+
# @param [Object] input Value to be assigned
|
|
193
|
+
def input=(input)
|
|
194
|
+
if input.nil?
|
|
195
|
+
fail ArgumentError, 'input cannot be nil'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
@input = input
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Custom attribute writer method with validation
|
|
202
|
+
# @param [Object] model Value to be assigned
|
|
203
|
+
def model=(model)
|
|
204
|
+
if model.nil?
|
|
205
|
+
fail ArgumentError, 'model cannot be nil'
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
@model = model
|
|
209
|
+
end
|
|
210
|
+
|
|
155
211
|
# Checks equality by comparing each attribute.
|
|
156
212
|
# @param [Object] Object to be compared
|
|
157
213
|
def ==(o)
|
|
@@ -180,39 +236,33 @@ module VeniceClient
|
|
|
180
236
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
181
237
|
# @return [Object] Returns the model itself
|
|
182
238
|
def self.build_from_hash(attributes)
|
|
183
|
-
new.build_from_hash(attributes)
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# Builds the object from hash
|
|
187
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
188
|
-
# @return [Object] Returns the model itself
|
|
189
|
-
def build_from_hash(attributes)
|
|
190
239
|
return nil unless attributes.is_a?(Hash)
|
|
191
|
-
|
|
192
|
-
|
|
240
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
241
|
+
transformed_hash = {}
|
|
242
|
+
openapi_types.each_pair do |key, type|
|
|
243
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
244
|
+
transformed_hash["#{key}"] = nil
|
|
245
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
193
246
|
# check to ensure the input is an array given that the attribute
|
|
194
247
|
# is documented as an array but the input is not
|
|
195
|
-
if attributes[
|
|
196
|
-
|
|
248
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
249
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
197
250
|
end
|
|
198
|
-
elsif !attributes[
|
|
199
|
-
|
|
200
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
201
|
-
self.send("#{key}=", nil)
|
|
251
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
252
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
202
253
|
end
|
|
203
254
|
end
|
|
204
|
-
|
|
205
|
-
self
|
|
255
|
+
new(transformed_hash)
|
|
206
256
|
end
|
|
207
257
|
|
|
208
258
|
# Deserializes the data based on type
|
|
209
259
|
# @param string type Data type
|
|
210
260
|
# @param string value Value to be deserialized
|
|
211
261
|
# @return [Object] Deserialized data
|
|
212
|
-
def _deserialize(type, value)
|
|
262
|
+
def self._deserialize(type, value)
|
|
213
263
|
case type.to_sym
|
|
214
|
-
when :
|
|
215
|
-
|
|
264
|
+
when :Time
|
|
265
|
+
Time.parse(value)
|
|
216
266
|
when :Date
|
|
217
267
|
Date.parse(value)
|
|
218
268
|
when :String
|
|
@@ -242,7 +292,9 @@ module VeniceClient
|
|
|
242
292
|
end
|
|
243
293
|
end
|
|
244
294
|
else # model
|
|
245
|
-
|
|
295
|
+
# models (e.g. Pet) or oneOf
|
|
296
|
+
klass = VeniceClient.const_get(type)
|
|
297
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
246
298
|
end
|
|
247
299
|
end
|
|
248
300
|
|
|
@@ -290,5 +342,8 @@ module VeniceClient
|
|
|
290
342
|
else
|
|
291
343
|
value
|
|
292
344
|
end
|
|
293
|
-
end
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
end
|
|
348
|
+
|
|
294
349
|
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Venice.ai API
|
|
3
|
+
|
|
4
|
+
#The Venice.ai API.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 20250709.013306
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.14.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module VeniceClient
|
|
17
|
+
# Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens), cannot be an empty string, and any array must be 2048 dimensions or less.
|
|
18
|
+
module CreateEmbeddingRequestSchemaInput
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
+
def openapi_any_of
|
|
22
|
+
[
|
|
23
|
+
:'Array<Array<Integer>>',
|
|
24
|
+
:'Array<Integer>',
|
|
25
|
+
:'Array<String>',
|
|
26
|
+
:'String'
|
|
27
|
+
]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Builds the object
|
|
31
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
32
|
+
# @return [Object] Returns the model or the data itself
|
|
33
|
+
def build(data)
|
|
34
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
35
|
+
# Note:
|
|
36
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
37
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
38
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
39
|
+
# - TODO: logging when debugging is set.
|
|
40
|
+
openapi_any_of.each do |klass|
|
|
41
|
+
begin
|
|
42
|
+
next if klass == :AnyType # "nullable: true"
|
|
43
|
+
typed_data = find_and_cast_into_type(klass, data)
|
|
44
|
+
return typed_data if typed_data
|
|
45
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
55
|
+
|
|
56
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
57
|
+
def find_and_cast_into_type(klass, data)
|
|
58
|
+
return if data.nil?
|
|
59
|
+
|
|
60
|
+
case klass.to_s
|
|
61
|
+
when 'Boolean'
|
|
62
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
63
|
+
when 'Float'
|
|
64
|
+
return data if data.instance_of?(Float)
|
|
65
|
+
when 'Integer'
|
|
66
|
+
return data if data.instance_of?(Integer)
|
|
67
|
+
when 'Time'
|
|
68
|
+
return Time.parse(data)
|
|
69
|
+
when 'Date'
|
|
70
|
+
return Date.iso8601(data)
|
|
71
|
+
when 'String'
|
|
72
|
+
return data if data.instance_of?(String)
|
|
73
|
+
when 'Object' # "type: object"
|
|
74
|
+
return data if data.instance_of?(Hash)
|
|
75
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
76
|
+
if data.instance_of?(Array)
|
|
77
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
78
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
79
|
+
end
|
|
80
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
81
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
82
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
83
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
84
|
+
end
|
|
85
|
+
else # model
|
|
86
|
+
const = VeniceClient.const_get(klass)
|
|
87
|
+
if const
|
|
88
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
89
|
+
model = const.build(data)
|
|
90
|
+
return model if model
|
|
91
|
+
else
|
|
92
|
+
# raise if data contains keys that are not known to the model
|
|
93
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
94
|
+
model = const.build_from_hash(data)
|
|
95
|
+
return model if model
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
raise # if no match by now, raise
|
|
101
|
+
rescue
|
|
102
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Venice.ai API
|
|
3
|
+
|
|
4
|
+
#The Venice.ai API.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 20250709.013306
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.14.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module VeniceClient
|
|
17
|
+
# ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
|
|
18
|
+
module CreateEmbeddingRequestSchemaModel
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
+
def openapi_any_of
|
|
22
|
+
[
|
|
23
|
+
:'String'
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Builds the object
|
|
28
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
29
|
+
# @return [Object] Returns the model or the data itself
|
|
30
|
+
def build(data)
|
|
31
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
32
|
+
# Note:
|
|
33
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
34
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
35
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
36
|
+
# - TODO: logging when debugging is set.
|
|
37
|
+
openapi_any_of.each do |klass|
|
|
38
|
+
begin
|
|
39
|
+
next if klass == :AnyType # "nullable: true"
|
|
40
|
+
typed_data = find_and_cast_into_type(klass, data)
|
|
41
|
+
return typed_data if typed_data
|
|
42
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
52
|
+
|
|
53
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
54
|
+
def find_and_cast_into_type(klass, data)
|
|
55
|
+
return if data.nil?
|
|
56
|
+
|
|
57
|
+
case klass.to_s
|
|
58
|
+
when 'Boolean'
|
|
59
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
60
|
+
when 'Float'
|
|
61
|
+
return data if data.instance_of?(Float)
|
|
62
|
+
when 'Integer'
|
|
63
|
+
return data if data.instance_of?(Integer)
|
|
64
|
+
when 'Time'
|
|
65
|
+
return Time.parse(data)
|
|
66
|
+
when 'Date'
|
|
67
|
+
return Date.iso8601(data)
|
|
68
|
+
when 'String'
|
|
69
|
+
return data if data.instance_of?(String)
|
|
70
|
+
when 'Object' # "type: object"
|
|
71
|
+
return data if data.instance_of?(Hash)
|
|
72
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
73
|
+
if data.instance_of?(Array)
|
|
74
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
75
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
76
|
+
end
|
|
77
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
78
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
79
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
80
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
81
|
+
end
|
|
82
|
+
else # model
|
|
83
|
+
const = VeniceClient.const_get(klass)
|
|
84
|
+
if const
|
|
85
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
86
|
+
model = const.build(data)
|
|
87
|
+
return model if model
|
|
88
|
+
else
|
|
89
|
+
# raise if data contains keys that are not known to the model
|
|
90
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
91
|
+
model = const.build_from_hash(data)
|
|
92
|
+
return model if model
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
raise # if no match by now, raise
|
|
98
|
+
rescue
|
|
99
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
#The Venice.ai API.
|
|
5
5
|
|
|
6
|
-
OpenAPI
|
|
6
|
+
The version of the OpenAPI document: 20250709.013306
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.14.0
|
|
7
10
|
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
-
Swagger Codegen version: 3.0.68
|
|
10
11
|
=end
|
|
11
12
|
|
|
12
13
|
require 'date'
|
|
14
|
+
require 'time'
|
|
13
15
|
|
|
14
16
|
module VeniceClient
|
|
15
|
-
class
|
|
17
|
+
class CreateSpeech403Response
|
|
16
18
|
# A description of the error
|
|
17
19
|
attr_accessor :error
|
|
18
20
|
|
|
@@ -23,10 +25,20 @@ module VeniceClient
|
|
|
23
25
|
}
|
|
24
26
|
end
|
|
25
27
|
|
|
28
|
+
# Returns attribute mapping this model knows about
|
|
29
|
+
def self.acceptable_attribute_map
|
|
30
|
+
attribute_map
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns all the JSON keys this model knows about
|
|
34
|
+
def self.acceptable_attributes
|
|
35
|
+
acceptable_attribute_map.values
|
|
36
|
+
end
|
|
37
|
+
|
|
26
38
|
# Attribute type mapping.
|
|
27
39
|
def self.openapi_types
|
|
28
40
|
{
|
|
29
|
-
:'error' => :'
|
|
41
|
+
:'error' => :'String'
|
|
30
42
|
}
|
|
31
43
|
end
|
|
32
44
|
|
|
@@ -35,30 +47,34 @@ module VeniceClient
|
|
|
35
47
|
Set.new([
|
|
36
48
|
])
|
|
37
49
|
end
|
|
38
|
-
|
|
50
|
+
|
|
39
51
|
# Initializes the object
|
|
40
52
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
41
53
|
def initialize(attributes = {})
|
|
42
54
|
if (!attributes.is_a?(Hash))
|
|
43
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `VeniceClient::
|
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VeniceClient::CreateSpeech403Response` initialize method"
|
|
44
56
|
end
|
|
45
57
|
|
|
46
58
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
47
60
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
48
|
-
if (!
|
|
49
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::
|
|
61
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
62
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::CreateSpeech403Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
50
63
|
end
|
|
51
64
|
h[k.to_sym] = v
|
|
52
65
|
}
|
|
53
66
|
|
|
54
67
|
if attributes.key?(:'error')
|
|
55
68
|
self.error = attributes[:'error']
|
|
69
|
+
else
|
|
70
|
+
self.error = nil
|
|
56
71
|
end
|
|
57
72
|
end
|
|
58
73
|
|
|
59
74
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
60
75
|
# @return Array for valid properties with the reasons
|
|
61
76
|
def list_invalid_properties
|
|
77
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
62
78
|
invalid_properties = Array.new
|
|
63
79
|
if @error.nil?
|
|
64
80
|
invalid_properties.push('invalid value for "error", error cannot be nil.')
|
|
@@ -70,10 +86,21 @@ module VeniceClient
|
|
|
70
86
|
# Check to see if the all the properties in the model are valid
|
|
71
87
|
# @return true if the model is valid
|
|
72
88
|
def valid?
|
|
89
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
73
90
|
return false if @error.nil?
|
|
74
91
|
true
|
|
75
92
|
end
|
|
76
93
|
|
|
94
|
+
# Custom attribute writer method with validation
|
|
95
|
+
# @param [Object] error Value to be assigned
|
|
96
|
+
def error=(error)
|
|
97
|
+
if error.nil?
|
|
98
|
+
fail ArgumentError, 'error cannot be nil'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
@error = error
|
|
102
|
+
end
|
|
103
|
+
|
|
77
104
|
# Checks equality by comparing each attribute.
|
|
78
105
|
# @param [Object] Object to be compared
|
|
79
106
|
def ==(o)
|
|
@@ -98,39 +125,33 @@ module VeniceClient
|
|
|
98
125
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
99
126
|
# @return [Object] Returns the model itself
|
|
100
127
|
def self.build_from_hash(attributes)
|
|
101
|
-
new.build_from_hash(attributes)
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
# Builds the object from hash
|
|
105
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
106
|
-
# @return [Object] Returns the model itself
|
|
107
|
-
def build_from_hash(attributes)
|
|
108
128
|
return nil unless attributes.is_a?(Hash)
|
|
109
|
-
|
|
110
|
-
|
|
129
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
130
|
+
transformed_hash = {}
|
|
131
|
+
openapi_types.each_pair do |key, type|
|
|
132
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
133
|
+
transformed_hash["#{key}"] = nil
|
|
134
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
111
135
|
# check to ensure the input is an array given that the attribute
|
|
112
136
|
# is documented as an array but the input is not
|
|
113
|
-
if attributes[
|
|
114
|
-
|
|
137
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
138
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
115
139
|
end
|
|
116
|
-
elsif !attributes[
|
|
117
|
-
|
|
118
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
119
|
-
self.send("#{key}=", nil)
|
|
140
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
141
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
120
142
|
end
|
|
121
143
|
end
|
|
122
|
-
|
|
123
|
-
self
|
|
144
|
+
new(transformed_hash)
|
|
124
145
|
end
|
|
125
146
|
|
|
126
147
|
# Deserializes the data based on type
|
|
127
148
|
# @param string type Data type
|
|
128
149
|
# @param string value Value to be deserialized
|
|
129
150
|
# @return [Object] Deserialized data
|
|
130
|
-
def _deserialize(type, value)
|
|
151
|
+
def self._deserialize(type, value)
|
|
131
152
|
case type.to_sym
|
|
132
|
-
when :
|
|
133
|
-
|
|
153
|
+
when :Time
|
|
154
|
+
Time.parse(value)
|
|
134
155
|
when :Date
|
|
135
156
|
Date.parse(value)
|
|
136
157
|
when :String
|
|
@@ -160,7 +181,9 @@ module VeniceClient
|
|
|
160
181
|
end
|
|
161
182
|
end
|
|
162
183
|
else # model
|
|
163
|
-
|
|
184
|
+
# models (e.g. Pet) or oneOf
|
|
185
|
+
klass = VeniceClient.const_get(type)
|
|
186
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
164
187
|
end
|
|
165
188
|
end
|
|
166
189
|
|
|
@@ -208,5 +231,8 @@ module VeniceClient
|
|
|
208
231
|
else
|
|
209
232
|
value
|
|
210
233
|
end
|
|
211
|
-
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
end
|
|
237
|
+
|
|
212
238
|
end
|