tool
Adapted from the Griptape AI Framework documentation.
Bases:
ArtifactFileOutputMixin
, BaseTool
Attributes
Name | Type | Description |
---|---|---|
text_to_speech_driver | BaseTextToSpeechDriver | The text to audio generation driver used to generate the speech audio. |
output_dir | Optional[str] | If provided, the generated audio will be written to disk in output_dir. |
output_file | Optional[str] | If provided, the generated audio will be written to disk as output_file. |
Source Code in griptape/tools/text_to_speech/tool.py
@define class TextToSpeechTool(ArtifactFileOutputMixin, BaseTool): """A tool that can be used to generate speech from input text. Attributes: text_to_speech_driver: The text to audio generation driver used to generate the speech audio. output_dir: If provided, the generated audio will be written to disk in output_dir. output_file: If provided, the generated audio will be written to disk as output_file. """ text_to_speech_driver: BaseTextToSpeechDriver = field(kw_only=True) @activity( config={ "description": "Can be used to generate speech from the provided input text.", "schema": Schema({Literal("text", description="The literal text to be converted to speech."): str}), }, ) def text_to_speech(self, params: dict[str, Any]) -> AudioArtifact | ErrorArtifact: text = params["values"]["text"] output_artifact = self.text_to_speech_driver.run_text_to_audio(prompts=[text]) if self.output_dir or self.output_file: self._write_to_file(output_artifact) return output_artifact
text_to_speech_driver = field(kw_only=True)
class-attribute instance-attribute
text_to_speech(params)
Source Code in griptape/tools/text_to_speech/tool.py
@activity( config={ "description": "Can be used to generate speech from the provided input text.", "schema": Schema({Literal("text", description="The literal text to be converted to speech."): str}), }, ) def text_to_speech(self, params: dict[str, Any]) -> AudioArtifact | ErrorArtifact: text = params["values"]["text"] output_artifact = self.text_to_speech_driver.run_text_to_audio(prompts=[text]) if self.output_dir or self.output_file: self._write_to_file(output_artifact) return output_artifact
- On this page
- Attributes
- text_to_speech(params)
Could this page be better? Report a problem or suggest an addition!