Skip to content

Commit 5488643

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: add base_voice to PromptedVoice in GAOS SDK
PiperOrigin-RevId: 1000425265
1 parent 78f6d34 commit 5488643

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

‎google/genai/_gaos/types/voices/promptedvoice.py‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
1919

2020
from __future__ import annotations
21-
from .. import BaseModel
22-
from typing_extensions import TypedDict
21+
from .. import BaseModel, UNSET_SENTINEL
22+
from pydantic import model_serializer
23+
from typing import Optional
24+
from typing_extensions import NotRequired, TypedDict
2325

2426

2527
class PromptedVoiceParam(TypedDict):
@@ -32,6 +34,14 @@ class PromptedVoiceParam(TypedDict):
3234
r"""Required. The natural-language prompt describing the desired voice, e.g.
3335
\"A deep, booming male voice of a massive evil ogre in his middle years.\"
3436
"""
37+
base_voice: NotRequired[str]
38+
r"""Optional. The name or ID of an existing base voice to edit or remix.
39+
Use the voice name for prebuilt voices (e.g., `Puck`) or the voice ID for
40+
previously created voices (e.g., `voice_abc123`). This can be any
41+
prompted or replicated voice that the user has access to.
42+
When present, `input` describes relative alterations to make to the base
43+
voice.
44+
"""
3545

3646

3747
class PromptedVoice(BaseModel):
@@ -44,3 +54,28 @@ class PromptedVoice(BaseModel):
4454
r"""Required. The natural-language prompt describing the desired voice, e.g.
4555
\"A deep, booming male voice of a massive evil ogre in his middle years.\"
4656
"""
57+
58+
base_voice: Optional[str] = None
59+
r"""Optional. The name or ID of an existing base voice to edit or remix.
60+
Use the voice name for prebuilt voices (e.g., `Puck`) or the voice ID for
61+
previously created voices (e.g., `voice_abc123`). This can be any
62+
prompted or replicated voice that the user has access to.
63+
When present, `input` describes relative alterations to make to the base
64+
voice.
65+
"""
66+
67+
@model_serializer(mode="wrap")
68+
def serialize_model(self, handler):
69+
optional_fields = set(["base_voice"])
70+
serialized = handler(self)
71+
m = {}
72+
73+
for n, f in type(self).model_fields.items():
74+
k = f.alias or n
75+
val = serialized.get(k, serialized.get(n))
76+
77+
if val != UNSET_SENTINEL:
78+
if val is not None or k not in optional_fields:
79+
m[k] = val
80+
81+
return m

0 commit comments

Comments
 (0)