Roovy SDK
A Python SDK for generating WhatsApp Flows using LLMs. Generate valid, schema-compliant WhatsApp Flow JSON from natural language descriptions.
Features
- 🚀 Simple API - Generate WhatsApp Flows with a single function call
- ✅ Schema Validation - Built-in Pydantic models ensure valid output
- 🔄 Auto-Retry - Automatic retries with error feedback for better results
- 📡 Streaming Support - Stream responses for real-time feedback
- 🔌 Provider Agnostic - Works with OpenAI, Groq, Ollama, or any OpenAI-compatible API
- 📝 Type Safe - Full type hints and Pydantic models
Installation
pip install roovy-sdk
Quick Start
from roovy_sdk import RoovyClient
# Initialize with your preferred provider
client = RoovyClient(
api_key="your-api-key",
base_url="https://api.openai.com/v1", # or any OpenAI-compatible endpoint
model="gpt-4o",
)
# Generate a WhatsApp Flow from natural language
flow = client.generate(
"Create a customer feedback form with name, email, rating (1-5 stars), and comments"
)
# Access the validated flow
print(flow.model_dump_json(indent=2, by_alias=True))
Configuration
Using Environment Variables
import os
from roovy_sdk import RoovyClient
# Set environment variables
os.environ["ROOVY_API_KEY"] = "your-api-key"
os.environ["ROOVY_BASE_URL"] = "https://api.openai.com/v1"
os.environ["ROOVY_MODEL"] = "gpt-4o"
# Client will use environment variables automatically
client = RoovyClient()
Provider Examples
OpenAI:
client = RoovyClient(
api_key="sk-...",
base_url="https://api.openai.com/v1",
model="gpt-4o",
)
Groq:
client = RoovyClient(
api_key="gsk_...",
base_url="https://api.groq.com/openai/v1",
model="llama-3.3-70b-versatile",
)
Ollama (local):
client = RoovyClient(
api_key="ollama", # any non-empty string
base_url="http://localhost:11434/v1",
model="llama3.2",
)
Advanced Usage
Streaming Generation
def on_chunk(chunk: str):
print(chunk, end="", flush=True)
flow = client.generate_stream(
"Create a booking form for a concert",
on_chunk=on_chunk,
)
Custom Retry Settings
flow = client.generate(
"Create a survey form",
max_retries=5,
temperature=0.3,
)
Custom System Prompt
flow = client.generate(
"Create a registration form",
system_prompt="You are a WhatsApp Flows expert...",
)
Direct Schema Access
from roovy_sdk.schema import (
WhatsAppFlow,
Screen,
TextInput,
Footer,
validate_flow,
)
# Build flows programmatically
screen = Screen(
id="WELCOME",
title="Welcome",
layout=SingleColumnLayout(
type="SingleColumnLayout",
children=[
TextHeading(type="TextHeading", text="Hello!"),
]
)
)
# Validate any JSON against the schema
result = validate_flow({"version": "7.2", "screens": [...]})
if result["success"]:
flow = result["data"]
Schema Reference
The SDK includes complete Pydantic models for all WhatsApp Flow components:
Text Components
TextHeading- Main headingsTextSubheading- SubheadingsTextBody- Body textTextCaption- Small captions
Input Components
TextInput- Single-line text inputTextArea- Multi-line text inputDropdown- Dropdown selectorRadioButtonsGroup- Radio button selectionChipsSelector- Multi-select chipsCheckboxGroup- Checkbox groupOptIn- Opt-in checkbox
Date/Media Components
CalendarPicker- Calendar date pickerDatePicker- Simple date pickerPhotoPicker- Photo uploadDocumentPicker- Document uploadImage- Display images
Navigation Components
Footer- Screen footer with actionButton- Action buttonEmbeddedLink- Inline link
Conditional Components
If- Conditional renderingSwitch- Switch/case rendering
Container Components
Form- Form containerSingleColumnLayout- Screen layout
API Reference
RoovyClient
RoovyClient(
api_key: str | None = None, # API key (or ROOVY_API_KEY env var)
base_url: str | None = None, # Base URL (or ROOVY_BASE_URL env var)
model: str | None = None, # Model name (or ROOVY_MODEL env var)
)
client.generate()
client.generate(
prompt: str, # Natural language description
*,
max_retries: int = 3, # Number of retry attempts
temperature: float = 0.2, # LLM temperature
system_prompt: str | None = None, # Custom system prompt
) -> WhatsAppFlow
client.generate_stream()
client.generate_stream(
prompt: str, # Natural language description
on_chunk: Callable[[str], None] | None = None, # Chunk callback
*,
temperature: float = 0.2, # LLM temperature
system_prompt: str | None = None, # Custom system prompt
) -> WhatsAppFlow
validate_flow()
from roovy_sdk import validate_flow
result = validate_flow(flow_dict)
# Returns: {"success": True, "data": WhatsAppFlow} or {"success": False, "error": ValidationError}
License
MIT License - see LICENSE for details.
Metadata
Release files for roovy-sdk 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| roovy_sdk-0.3.4.tar.gz | 27.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| roovy_sdk-0.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.8 kB
Release files / roovy_sdk-0.3.4.tar.gz
| Download URL | roovy_sdk-0.3.4.tar.gz |
|---|---|
| Size | 27.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dcdf83ef201d0d7be5056f490df645f8e5499486d2520f3d48115d5c4feead3
|
|
BLAKE2b-256 checksum How to use checksums |
b3d72c78b4524ef477a8f40cab9e16f28797a15be5c0c2ac64ba2bc7fa61a26f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / roovy_sdk-0.3.4-py3-none-any.whl
| Download URL | roovy_sdk-0.3.4-py3-none-any.whl |
|---|---|
| Size | 27.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c0393adfc9722cfab9eeea347ec10c83197a8c12e75a9419a137a6823a75c25
|
|
BLAKE2b-256 checksum How to use checksums |
214246b10722450d560497f1e469dc7788af3b0124704fc7e960bef9e04a8855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for roovy-sdk 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.