-
Notifications
You must be signed in to change notification settings - Fork 35
Added languageCode and multiSpeakerVoiceConfig properties to SpeechConfig #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace GenerativeAI.Types; | ||
|
|
||
| /// <summary> | ||
| /// The configuration for the multi-speaker setup. | ||
| /// </summary> | ||
| /// <seealso href="https://ai.google.dev/api/generate-content#MultiSpeakerVoiceConfig">See Official API Documentation</seealso> | ||
| public class MultiSpeakerVoiceConfig | ||
| { | ||
| /// <summary> | ||
| /// Required. All the enabled speaker voices. | ||
| /// </summary> | ||
| [JsonPropertyName("speakerVoiceConfigs")] | ||
| public List<SpeakerVoiceConfig>? SpeakerVoiceConfigs { get; set; } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using System.Text.Json.Serialization; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace GenerativeAI.Types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// The configuration for a single speaker in a multi speaker setup. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <seealso href="https://ai.google.dev/api/generate-content#SpeakerVoiceConfig">See Official API Documentation</seealso> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class SpeakerVoiceConfig | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Required. The name of the speaker to use. Should be the same as in the prompt. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [JsonPropertyName("speaker")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public string? Speaker { get; set; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Required. The configuration for the voice to use. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [JsonPropertyName("voiceConfig")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public VoiceConfig? VoiceConfig { get; set; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistency: "Required" properties are nullable types. Both properties are documented as "Required" but are declared as nullable types ( Consider one of these solutions: Option 1 (C# 11+): Use the /// <summary>
/// Required. The name of the speaker to use. Should be the same as in the prompt.
/// </summary>
[JsonPropertyName("speaker")]
- public string? Speaker { get; set; }
+ public required string Speaker { get; set; }
/// <summary>
/// Required. The configuration for the voice to use.
/// </summary>
[JsonPropertyName("voiceConfig")]
- public VoiceConfig? VoiceConfig { get; set; }
+ public required VoiceConfig VoiceConfig { get; set; }Option 2: If the properties are truly optional (e.g., for deserialization scenarios), update the documentation to remove "Required": /// <summary>
- /// Required. The name of the speaker to use. Should be the same as in the prompt.
+ /// The name of the speaker to use. Should be the same as in the prompt.
/// </summary>
[JsonPropertyName("speaker")]
public string? Speaker { get; set; }
/// <summary>
- /// Required. The configuration for the voice to use.
+ /// The configuration for the voice to use.
/// </summary>
[JsonPropertyName("voiceConfig")]
public VoiceConfig? VoiceConfig { get; set; }📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Inconsistency between "Required" documentation and nullable type.
The property is documented as "Required" but is declared as a nullable type (
List<SpeakerVoiceConfig>?). This creates confusion about the API contract.Please verify the Google API requirements and either:
?to make the property non-nullable if it is truly required, or🌐 Web query:
💡 Result:
Required fields for MultiSpeakerVoiceConfig (Google Generative AI / Gemini TTS):
Each SpeakerVoiceConfig must include:
Sources:
[1] Google Generative AI / GenerationConfig (MultiSpeakerVoiceConfig, SpeakerVoiceConfig).
[2] Cloud Text‑to‑Speech / MultiSpeakerVoiceConfig (MultispeakerPrebuiltVoice: speakerAlias, speakerId).
Remove nullable annotation to align with required API contract.
The
speakerVoiceConfigsfield is required by the Google Generative AI API, but the property is declared as nullable (List<SpeakerVoiceConfig>?). This contradicts the "Required" documentation and creates an invalid API contract.Change
public List<SpeakerVoiceConfig>? SpeakerVoiceConfigstopublic List<SpeakerVoiceConfig> SpeakerVoiceConfigs(remove the?).🤖 Prompt for AI Agents