Cookbook Overview¶
The VapiServe cookbook contains a collection of practical examples demonstrating various features and integration patterns. Each example is designed to be runnable and comes with detailed explanations.
Available Examples¶
Basic Example¶
The Basic Example demonstrates the simplest way to create and serve a VapiServe tool. It's a great starting point for understanding the core functionality.
Key concepts covered:
- Creating a basic tool with the @tool
decorator
- Setting up a FastAPI server with serve()
- Defining parameters and return types
Ngrok Example¶
The Ngrok Example shows how to expose your local VapiServe instance to the internet using ngrok. This is particularly useful for testing your tools with external services.
Key concepts covered: - Automatic ngrok tunnel setup - Public URL generation - Configuring ngrok options
Calendar Example¶
The Calendar Example demonstrates integrating with Google Calendar to retrieve free/busy information.
Key concepts covered: - Connecting to Google Calendar API - Handling OAuth authentication - Structuring calendar data for easy consumption
Storage Example¶
The Storage Example shows how to work with cloud storage providers like AWS S3 and Google Cloud Storage.
Key concepts covered: - File upload and download operations - Provider factory pattern - Working with multiple storage providers
Structure of Examples¶
Each example follows a consistent structure:
- Overview: A brief description of what the example demonstrates
- Prerequisites: Required dependencies and setup
- Code Walkthrough: Explanation of the key components
- Running the Example: Instructions for running the example
- Next Steps: Suggestions for extending or modifying the example
Running the Examples¶
All examples are located in the cookbook
directory of the VapiServe repository. To run an example:
Creating Your Own Examples¶
We encourage you to create your own examples based on these patterns. If you've built something interesting with VapiServe, consider contributing it to the cookbook!
To contribute an example:
- Create a new Python file in the
cookbook
directory - Follow the structure of existing examples
- Add comprehensive comments explaining your code
- Create a documentation page in
docs/cookbook/
- Submit a pull request
Example Code Repository¶
You can find all these examples in the VapiServe GitHub repository.