malek-messaoudii
update env
91b1985
raw
history blame
664 Bytes
from services.gemini_client import get_gemini_client
from google.genai import types
async def generate_tts(text: str) -> bytes:
client = get_gemini_client()
response = client.models.generate_content(
model="gemini-2.5-flash-preview-tts",
contents=text,
config=types.GenerateContentConfig(
response_modalities=["AUDIO"],
speech_config=types.SpeechConfig(
voice_config=types.VoiceConfig(
prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name="Kore")
)
),
),
)
return response.candidates[0].content.parts[0].inline_data.data