Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /agno-agi_agno /cookbook /91_tools /gandr_tools.py
| """ | |
| Get an API key at https://gandr.ai | |
| The toolkit uses `httpx`, which installs with agno. No extra dependencies are needed. | |
| """ | |
| from pathlib import Path | |
| from agno.agent import Agent | |
| from agno.tools.gandr import GandrTools | |
| # --------------------------------------------------------------------------- | |
| # Create Agent | |
| # --------------------------------------------------------------------------- | |
| # Initialize Agent with Gandr tools | |
| agent = Agent( | |
| name="Gandr TTS Agent", | |
| description="An agent that uses Gandr for text-to-speech.", | |
| tools=[GandrTools()], | |
| ) | |
| # --------------------------------------------------------------------------- | |
| # Run Agent | |
| # --------------------------------------------------------------------------- | |
| if __name__ == "__main__": | |
| response = agent.run( | |
| """Generate a simple greeting using Text-to-Speech: | |
| Say "Welcome to Gandr. This speech is generated by an agent." | |
| """ | |
| ) | |
| # Save the generated audio. Toolkit artifacts carry raw bytes, so they are | |
| # written directly rather than through the base64 audio helper. | |
| if response.audio: | |
| output_path = Path("tmp/greeting.mp3") | |
| output_path.parent.mkdir(parents=True, exist_ok=True) | |
| output_path.write_bytes(response.audio[0].content) | |
| print(f"Audio saved to {output_path}") | |
Xet Storage Details
- Size:
- 1.33 kB
- Xet hash:
- 9660b34b1c296db356d45ca437d6fe32e7e49784fc4e3bfb0f94534ce052b4bc
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.