reset_document

View as MarkdownOpen in Claude

Reset the SWML document to an empty state. This clears all sections and verbs, leaving only an empty main section. Use this to rebuild the document from scratch without creating a new service instance.

Returns

None

Example

from signalwire import SWMLService
service = SWMLService(name="my-service")
service.add_verb("answer", {})
service.add_verb("play", {"url": "https://example.com/old.mp3"})
# Start over with a fresh document
service.reset_document()
service.add_verb("answer", {})
service.add_verb("ai", {"prompt": {"text": "You are a helpful assistant"}})
print(service.render_document())