Text To Speech Tool
This Tool enables LLMs to synthesize speech from text using Text to Speech Engines and Text to Speech Drivers.
import os
from griptape.drivers import ElevenLabsTextToSpeechDriver
from griptape.engines import TextToSpeechEngine
from griptape.structures import Agent
from griptape.tools.text_to_speech.tool import TextToSpeechTool
driver = ElevenLabsTextToSpeechDriver(
api_key=os.environ["ELEVEN_LABS_API_KEY"],
model="eleven_multilingual_v2",
voice="Matilda",
)
tool = TextToSpeechTool(
engine=TextToSpeechEngine(
text_to_speech_driver=driver,
),
)
Agent(tools=[tool]).run("Generate audio from this text: 'Hello, world!'")