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

1from signalwire import SWMLService
2
3service = SWMLService(name="my-service")
4service.add_verb("answer", {})
5service.add_verb("play", {"url": "https://example.com/old.mp3"})
6
7# Start over with a fresh document
8service.reset_document()
9service.add_verb("answer", {})
10service.add_verb("ai", {"prompt": {"text": "You are a helpful assistant"}})
11
12print(service.render_document())