Skip to content

Commit

Permalink
Update Model and Voice with new attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
haguro committed Jan 26, 2024
1 parent 77fd583 commit 18a2991
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 40 deletions.
105 changes: 71 additions & 34 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ type Language struct {
}

type Model struct {
CanBeFineTuned bool `json:"can_be_finetuned"`
CanDoTextToSpeech bool `json:"can_do_text_to_speech"`
CanDoVoiceConversion bool `json:"can_do_voice_conversion"`
Description string `json:"description"`
Languages []Language `json:"languages"`
ModelId string `json:"model_id"`
Name string `json:"name"`
TokenCostFactor float32 `json:"token_cost_factor"`
CanBeFineTuned bool `json:"can_be_finetuned"`
CanDoTextToSpeech bool `json:"can_do_text_to_speech"`
CanDoVoiceConversion bool `json:"can_do_voice_conversion"`
CanUseSpeakerBoost bool `json:"can_use_speaker_boost"`
CanUseStyle bool `json:"can_use_style"`
Description string `json:"description"`
Languages []Language `json:"languages"`
MaxCharactersRequestFreeUser int `json:"max_characters_request_free_user"`
MaxCharactersRequestSubscribedUser int `json:"max_characters_request_subscribed_user"`
ModelId string `json:"model_id"`
Name string `json:"name"`
RequiresAlphaAccess bool `json:"requires_alpha_access"`
ServesProVoices bool `json:"serves_pro_voices"`
TokenCostFactor float32 `json:"token_cost_factor"`
}

type TextToSpeechRequest struct {
Expand All @@ -41,17 +47,18 @@ type AddVoiceResponse struct {
}

type Voice struct {
AvailableForTiers []string `json:"available_for_tiers"`
Category string `json:"category"`
Description string `json:"description"`
FineTuning FineTuning `json:"fine_tuning"`
Labels map[string]string `json:"labels"`
Name string `json:"name"`
PreviewUrl string `json:"preview_url"`
Samples []VoiceSample `json:"samples"`
Settings VoiceSettings `json:"settings,omitempty"`
Sharing VoiceSharing `json:"sharing"`
VoiceId string `json:"voice_id"`
AvailableForTiers []string `json:"available_for_tiers"`
Category string `json:"category"`
Description string `json:"description"`
FineTuning FineTuning `json:"fine_tuning"`
HighQualityBaseModelIds []string `json:"high_quality_base_model_ids"`
Labels map[string]string `json:"labels"`
Name string `json:"name"`
PreviewUrl string `json:"preview_url"`
Samples []VoiceSample `json:"samples"`
Settings VoiceSettings `json:"settings,omitempty"`
Sharing VoiceSharing `json:"sharing"`
VoiceId string `json:"voice_id"`
}

type VoiceSettings struct {
Expand All @@ -62,12 +69,27 @@ type VoiceSettings struct {
}

type VoiceSharing struct {
ClonedByCount int `json:"cloned_by_count"`
HistoryItemSampleId string `json:"history_item_sample_id"`
LikedByCount int `json:"liked_by_count"`
OriginalVoiceId string `json:"original_voice_id"`
PublicOwnerId string `json:"public_owner_id"`
Status string `json:"status"`
ClonedByCount int `json:"cloned_by_count"`
DateUnix int `json:"date_unix"`
Description string `json:"description"`
DisableAtUnix bool `json:"disable_at_unix"`
EnabledInLibrary bool `json:"enabled_in_library"`
FinancialRewardEnabled bool `json:"financial_reward_enabled"`
FreeUsersAllowed bool `json:"free_users_allowed"`
HistoryItemSampleId string `json:"history_item_sample_id"`
Labels map[string]string `json:"labels"`
LikedByCount int `json:"liked_by_count"`
LiveModerationEnabled bool `json:"live_moderation_enabled"`
Name string `json:"name"`
NoticePeriod int `json:"notice_period"`
OriginalVoiceId string `json:"original_voice_id"`
PublicOwnerId string `json:"public_owner_id"`
Rate float32 `json:"rate"`
ReviewMessage string `json:"review_message"`
ReviewStatus string `json:"review_status"`
Status string `json:"status"`
VoiceMixingAllowed bool `json:"voice_mixing_allowed"`
WhitelistedEmails []string `json:"whitelisted_emails"`
}

type VoiceSample struct {
Expand All @@ -79,15 +101,30 @@ type VoiceSample struct {
}

type FineTuning struct {
FineTuningRequested bool `json:"fine_tuning_requested"`
FineTuningState string `json:"finetuning_state"`
IsAllowedToFineTune bool `json:"is_allowed_to_fine_tune"`
Language string `json:"language"`
ModelId string `json:"model_id"`
SliceIds []string `json:"slice_ids"`
VerificationAttempts []VerificationAttempt `json:"verification_attempts"`
VerificationAttemptsCount int `json:"verification_attempts_count"`
VerificationFailures []string `json:"verification_failures"`
FineTuningRequested bool `json:"fine_tuning_requested"`
FineTuningState string `json:"finetuning_state"`
IsAllowedToFineTune bool `json:"is_allowed_to_fine_tune"`
Language string `json:"language"`
ManualVerification ManualVerification `json:"manual_verification"`
ManualVerificationRequested bool `json:"manual_verification_requested"`
SliceIds []string `json:"slice_ids"`
VerificationAttempts []VerificationAttempt `json:"verification_attempts"`
VerificationAttemptsCount int `json:"verification_attempts_count"`
VerificationFailures []string `json:"verification_failures"`
}

type ManualVerification struct {
ExtraText string `json:"extra_text"`
Files []File `json:"files"`
RequestTimeUnix int `json:"request_time_unix"`
}

type File struct {
FileId string `json:"file_id"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
SizeBytes int `json:"size_bytes"`
UploadDateUnix int `json:"upload_date_unix"`
}

type VerificationAttempt struct {
Expand Down
94 changes: 88 additions & 6 deletions request_bodies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ var testRespBodies = map[string][]byte{
"can_be_finetuned": true,
"can_do_text_to_speech": true,
"can_do_voice_conversion": true,
"can_use_speaker_boost": true,
"can_use_style": false,
"token_cost_factor": 0,
"max_characters_request_free_user": 1000,
"max_characters_request_subscribed_user": 10000,
"requires_alpha_access": false,
"serves_pro_voices": true,
"description": "TestModelDescription",
"languages": [
{
Expand Down Expand Up @@ -55,6 +61,20 @@ var testRespBodies = map[string][]byte{
"fine_tuning": {
"model_id": "string",
"language": "string",
"manual_verification_requested": true,
"manual_verification": {
"extra_text": "string",
"files": [
{
"file_id": "string",
"file_name": "string",
"mime_type": "string",
"size_bytes": 0,
"upload_date_unix": 0
}
],
"request_time_unix": 0
},
"is_allowed_to_fine_tune": true,
"fine_tuning_requested": true,
"finetuning_state": "not_started",
Expand Down Expand Up @@ -92,17 +112,41 @@ var testRespBodies = map[string][]byte{
"available_for_tiers": [
"string"
],
"high_quality_base_model_ids": [
"string"
],
"settings": {
"stability": 0,
"similarity_boost": 0
},
"sharing": {
"status": "string",
"cloned_by_count": 0,
"date_unix": 0,
"description": "string",
"disable_at_unix": true,
"enabled_in_library": false,
"financial_reward_enabled": true,
"free_users_allowed": true,
"labels": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"liked_by_count": 10,
"live_moderation_enabled": false,
"name": "string",
"notice_period": 2,
"history_item_sample_id": "string",
"original_voice_id": "string",
"public_owner_id": "string",
"liked_by_count": 0,
"cloned_by_count": 0
"rate": 0.8,
"review_message": "string",
"review_status": "string",
"status": "string",
"voice_mixing_allowed": false,
"whitelisted_emails": [
"foo@example.com"
]
}
}
]
Expand Down Expand Up @@ -138,6 +182,20 @@ var testRespBodies = map[string][]byte{
"fine_tuning": {
"model_id": "string",
"language": "string",
"manual_verification_requested": true,
"manual_verification": {
"extra_text": "string",
"files": [
{
"file_id": "string",
"file_name": "string",
"mime_type": "string",
"size_bytes": 0,
"upload_date_unix": 0
}
],
"request_time_unix": 0
},
"is_allowed_to_fine_tune": true,
"fine_tuning_requested": true,
"finetuning_state": "not_started",
Expand Down Expand Up @@ -175,19 +233,43 @@ var testRespBodies = map[string][]byte{
"available_for_tiers": [
"string"
],
"high_quality_base_model_ids": [
"string"
],
"settings": {
"stability": 0.3,
"similarity_boost": 0.7,
"style": 0.4,
"use_speaker_boost": false
},
"sharing": {
"status": "string",
"cloned_by_count": 0,
"date_unix": 0,
"description": "string",
"disable_at_unix": true,
"enabled_in_library": false,
"financial_reward_enabled": true,
"free_users_allowed": true,
"labels": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"liked_by_count": 10,
"live_moderation_enabled": false,
"name": "string",
"notice_period": 2,
"history_item_sample_id": "string",
"original_voice_id": "string",
"public_owner_id": "string",
"liked_by_count": 0,
"cloned_by_count": 0
"rate": 0.8,
"review_message": "string",
"review_status": "string",
"status": "string",
"voice_mixing_allowed": false,
"whitelisted_emails": [
"foo@example.com"
]
}
}`),
"TestGetSampleAudio": []byte("testaudiobytes"),
Expand Down

0 comments on commit 18a2991

Please sign in to comment.