Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /agno-agi_agno /cookbook /91_tools /cartesia_tools.py
| """ | |
| Get an API key from https://play.cartesia.ai/keys | |
| Run `uv pip install cartesia` to install the dependencies. | |
| """ | |
| from agno.agent import Agent | |
| from agno.tools.cartesia import CartesiaTools | |
| from agno.utils.audio import write_audio_to_file | |
| # --------------------------------------------------------------------------- | |
| # Create Agent | |
| # --------------------------------------------------------------------------- | |
| # Initialize Agent with Cartesia tools | |
| agent = Agent( | |
| name="Cartesia TTS Agent", | |
| description="An agent that uses Cartesia for text-to-speech.", | |
| tools=[CartesiaTools()], | |
| ) | |
| # --------------------------------------------------------------------------- | |
| # Run Agent | |
| # --------------------------------------------------------------------------- | |
| if __name__ == "__main__": | |
| response = agent.run( | |
| """Generate a simple greeting using Text-to-Speech: | |
| Say "Welcome to Cartesia, the advanced speech synthesis platform. This speech is generated by an agent." | |
| """ | |
| ) | |
| # Save the generated audio | |
| if response.audio: | |
| write_audio_to_file( | |
| audio=response.audio[0].content, filename="tmp/greeting.mp3" | |
| ) | |
Xet Storage Details
- Size:
- 1.18 kB
- Xet hash:
- 49189e8d75b1e9425840439c4c7ab455eb8270172cb97fb78ff63630326a99ec
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.