Skip to content

Commit c9415da

Browse files
1 parent 396d474 commit c9415da

3 files changed

Lines changed: 195 additions & 2 deletions

File tree

src/Texttospeech/AdvancedVoiceOptions.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ class AdvancedVoiceOptions extends \Google\Model
3434
*/
3535
public $lowLatencyJourneySynthesis;
3636
/**
37-
* Optional. Input only. If true, relaxes safety filters for Gemini TTS.
37+
* Optional. Input only. Deprecated, use safety_settings instead. If true,
38+
* relaxes safety filters for Gemini TTS.
3839
*
40+
* @deprecated
3941
* @var bool
4042
*/
4143
public $relaxSafetyFilters;
44+
protected $safetySettingsType = SafetySettings::class;
45+
protected $safetySettingsDataType = '';
4246

4347
/**
4448
* Optional. If true, textnorm will be applied to text input. This feature is
@@ -75,21 +79,43 @@ public function getLowLatencyJourneySynthesis()
7579
return $this->lowLatencyJourneySynthesis;
7680
}
7781
/**
78-
* Optional. Input only. If true, relaxes safety filters for Gemini TTS.
82+
* Optional. Input only. Deprecated, use safety_settings instead. If true,
83+
* relaxes safety filters for Gemini TTS.
7984
*
85+
* @deprecated
8086
* @param bool $relaxSafetyFilters
8187
*/
8288
public function setRelaxSafetyFilters($relaxSafetyFilters)
8389
{
8490
$this->relaxSafetyFilters = $relaxSafetyFilters;
8591
}
8692
/**
93+
* @deprecated
8794
* @return bool
8895
*/
8996
public function getRelaxSafetyFilters()
9097
{
9198
return $this->relaxSafetyFilters;
9299
}
100+
/**
101+
* Optional. Input only. This applies to Gemini TTS only. If set, the category
102+
* specified in the safety setting will be blocked if the harm probability is
103+
* above the threshold. Otherwise, the safety filter will be disabled by
104+
* default.
105+
*
106+
* @param SafetySettings $safetySettings
107+
*/
108+
public function setSafetySettings(SafetySettings $safetySettings)
109+
{
110+
$this->safetySettings = $safetySettings;
111+
}
112+
/**
113+
* @return SafetySettings
114+
*/
115+
public function getSafetySettings()
116+
{
117+
return $this->safetySettings;
118+
}
93119
}
94120

95121
// Adding a class alias for backwards compatibility with the previous class name.

src/Texttospeech/SafetySetting.php

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
/*
3+
* Copyright 2014 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
6+
* use this file except in compliance with the License. You may obtain a copy of
7+
* the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations under
15+
* the License.
16+
*/
17+
18+
namespace Google\Service\Texttospeech;
19+
20+
class SafetySetting extends \Google\Model
21+
{
22+
/**
23+
* Default value. This value is unused.
24+
*/
25+
public const CATEGORY_HARM_CATEGORY_UNSPECIFIED = 'HARM_CATEGORY_UNSPECIFIED';
26+
/**
27+
* Content that promotes violence or incites hatred against individuals or
28+
* groups based on certain attributes.
29+
*/
30+
public const CATEGORY_HARM_CATEGORY_HATE_SPEECH = 'HARM_CATEGORY_HATE_SPEECH';
31+
/**
32+
* Content that promotes, facilitates, or enables dangerous activities.
33+
*/
34+
public const CATEGORY_HARM_CATEGORY_DANGEROUS_CONTENT = 'HARM_CATEGORY_DANGEROUS_CONTENT';
35+
/**
36+
* Abusive, threatening, or content intended to bully, torment, or ridicule.
37+
*/
38+
public const CATEGORY_HARM_CATEGORY_HARASSMENT = 'HARM_CATEGORY_HARASSMENT';
39+
/**
40+
* Content that contains sexually explicit material.
41+
*/
42+
public const CATEGORY_HARM_CATEGORY_SEXUALLY_EXPLICIT = 'HARM_CATEGORY_SEXUALLY_EXPLICIT';
43+
/**
44+
* The harm block threshold is unspecified.
45+
*/
46+
public const THRESHOLD_HARM_BLOCK_THRESHOLD_UNSPECIFIED = 'HARM_BLOCK_THRESHOLD_UNSPECIFIED';
47+
/**
48+
* Block content with a low harm probability or higher.
49+
*/
50+
public const THRESHOLD_BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE';
51+
/**
52+
* Block content with a medium harm probability or higher.
53+
*/
54+
public const THRESHOLD_BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE';
55+
/**
56+
* Block content with a high harm probability.
57+
*/
58+
public const THRESHOLD_BLOCK_ONLY_HIGH = 'BLOCK_ONLY_HIGH';
59+
/**
60+
* Do not block any content, regardless of its harm probability.
61+
*/
62+
public const THRESHOLD_BLOCK_NONE = 'BLOCK_NONE';
63+
/**
64+
* Turn off the safety filter entirely.
65+
*/
66+
public const THRESHOLD_OFF = 'OFF';
67+
/**
68+
* The harm category to apply the safety setting to.
69+
*
70+
* @var string
71+
*/
72+
public $category;
73+
/**
74+
* The harm block threshold for the safety setting.
75+
*
76+
* @var string
77+
*/
78+
public $threshold;
79+
80+
/**
81+
* The harm category to apply the safety setting to.
82+
*
83+
* Accepted values: HARM_CATEGORY_UNSPECIFIED, HARM_CATEGORY_HATE_SPEECH,
84+
* HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT,
85+
* HARM_CATEGORY_SEXUALLY_EXPLICIT
86+
*
87+
* @param self::CATEGORY_* $category
88+
*/
89+
public function setCategory($category)
90+
{
91+
$this->category = $category;
92+
}
93+
/**
94+
* @return self::CATEGORY_*
95+
*/
96+
public function getCategory()
97+
{
98+
return $this->category;
99+
}
100+
/**
101+
* The harm block threshold for the safety setting.
102+
*
103+
* Accepted values: HARM_BLOCK_THRESHOLD_UNSPECIFIED, BLOCK_LOW_AND_ABOVE,
104+
* BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGH, BLOCK_NONE, OFF
105+
*
106+
* @param self::THRESHOLD_* $threshold
107+
*/
108+
public function setThreshold($threshold)
109+
{
110+
$this->threshold = $threshold;
111+
}
112+
/**
113+
* @return self::THRESHOLD_*
114+
*/
115+
public function getThreshold()
116+
{
117+
return $this->threshold;
118+
}
119+
}
120+
121+
// Adding a class alias for backwards compatibility with the previous class name.
122+
class_alias(SafetySetting::class, 'Google_Service_Texttospeech_SafetySetting');
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/*
3+
* Copyright 2014 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
6+
* use this file except in compliance with the License. You may obtain a copy of
7+
* the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations under
15+
* the License.
16+
*/
17+
18+
namespace Google\Service\Texttospeech;
19+
20+
class SafetySettings extends \Google\Collection
21+
{
22+
protected $collection_key = 'settings';
23+
protected $settingsType = SafetySetting::class;
24+
protected $settingsDataType = 'array';
25+
26+
/**
27+
* The safety settings for the request.
28+
*
29+
* @param SafetySetting[] $settings
30+
*/
31+
public function setSettings($settings)
32+
{
33+
$this->settings = $settings;
34+
}
35+
/**
36+
* @return SafetySetting[]
37+
*/
38+
public function getSettings()
39+
{
40+
return $this->settings;
41+
}
42+
}
43+
44+
// Adding a class alias for backwards compatibility with the previous class name.
45+
class_alias(SafetySettings::class, 'Google_Service_Texttospeech_SafetySettings');

0 commit comments

Comments
 (0)