VibeSpec is an AI-powered assistant that helps you create API definitions using TypeSpec from natural language descriptions. It converts your service ideas into structured, well-documented TypeSpec definitions that are ready to implement.
_ ___ __ _____
| | / (_) /_ ___ / ___/____ ___ _____
| | / / / __ \/ _ \\__ \/ __ \/ _ \/ ___/
| |/ / / /_/ / __/__/ / /_/ / __/ /__
|___/_/_.___/\___/____/ .___/\___/\___/
/_/
- Conversational Interface: Describe your API needs in natural language.
- Guided Design Process: VibeSpec helps you refine your API definitions iteratively.
- TypeSpec Code Generation: Produces syntactically correct TypeSpec code with proper documentation.
- Best Practice Recommendations: Suggests improvements for robustness, maintainability, and performance.
- Text-to-Speech Support: Uses
pyttsx3for local speech synthesis. - Speech Recognition: Supports microphone input using Azure Cognitive Services Speech SDK.
- Exit Command: Allows users to exit the session by typing "exitnow" or saying it via speech input.
- Python 3.7+
- Azure OpenAI API access
- Azure Cognitive Services Speech SDK access
pyttsx3for local text-to-speech
-
Clone the repository:
git clone https://github.com/yourusername/vibespec.git cd vibespec -
Install dependencies:
pip install openai azure-cognitiveservices-speech python-dotenv pyttsx3 -
Create a
.envfile in the project root with the following variables:AZURE_OPENAI_API_ENDPOINT=your_azure_openai_endpoint AZURE_OPENAI_API_KEY=your_azure_openai_key AZURE_OPENAI_API_VERSION=your_azure_openai_version AZURE_TTS_REGION=your_azure_tts_region AZURE_TTS_API_KEY=your_azure_tts_key SPEECH_KEY=your_azure_speech_key SPEECH_REGION=your_azure_speech_region
-
Start VibeSpec:
python vibespec.py --text # For text input python vibespec.py # For speech input -
Describe your API or service requirements in natural language.
-
VibeSpec will guide you through refining your API design, asking clarifying questions when needed.
-
When you're ready for code generation, VibeSpec will ask for your permission to create a TypeSpec draft.
-
Review the generated TypeSpec code and iterate as needed.
-
Type
exitnowor say "exit now" to end the session.
- User: "I want to create an API for a pet adoption service."
- VibeSpec: Asks about specific requirements, data models, and operations.
- User: Provides details about pets, adoption process, etc.
- VibeSpec: "I'm ready to create a TypeSpec draft for your pet adoption service. Would you like me to proceed?"
- User: "Yes, please."
- VibeSpec: Generates complete TypeSpec code for the pet adoption service API.
VibeSpec leverages Azure OpenAI's GPT-4 models to understand your requirements and generate TypeSpec definitions. The assistant is designed to:
- Parse your natural language descriptions.
- Guide you to a comprehensive API design.
- Generate valid TypeSpec code with proper documentation.
- Help you refine the design iteratively.
The generated TypeSpec code follows best practices and can be directly used with the TypeSpec compiler. The output includes:
- Service definition.
- Data models with documentation.
- Operation specifications with parameters and responses.
- Error handling definitions.
- If you encounter connection errors, the application will automatically retry up to 3 times.
- Check your
.envfile if you get authentication errors. - Ensure you have proper network connectivity to Azure services.