Prerequisites
Before usingOpenAITools
, ensure you have the openai
library installed and your OpenAI API key configured.
-
Install the library:
-
Set your API key: Obtain your API key from OpenAI and set it as an environment variable.
Initialization
ImportOpenAITools
and add it to your Agent’s tool list.
Usage Examples
1. Transcribing Audio
This example demonstrates an agent that transcribes an audio file.transcription_agent.py
2. Generating Images
This example demonstrates an agent that generates an image based on a text prompt.image_generation_agent.py
3. Generating Speech
This example demonstrates an agent that generates speech from text.speech_synthesis_agent.py
View more examples here.
Customization
You can customize the underlying OpenAI models used for transcription, image generation, and TTS:Toolkit Functions
TheOpenAITools
toolkit provides the following functions:
Function | Description |
---|---|
transcribe_audio | Transcribes audio from a local file path or a public URL |
generate_image | Generates images based on a text prompt |
generate_speech | Synthesizes speech from text |
Developer Resources
- View Tools
- View OpenAI Transcription Guide
- View OpenAI Image Generation Guide
- View OpenAI Text-to-Speech Guide