Advanced Patterns
Multiple until Statements
Based allows for sophisticated conversation flows by supporting multiple until statements. Each until block represents a different condition and can trigger different handling paths.
Tool Schema Until Conditions
Beyond simple string conditions, Based supports tool schema until conditions that allow you to define structured data extraction directly in theuntil clause. This enables the LLM to extract typed parameters when a condition matches, providing structured data for your flow logic.
Defining Tool Schemas
Tool schemas can be defined using either a simplified format or the full OpenAI tool format: Simplified Format:Using Tool Schemas in Until Conditions
Once you’ve defined a tool schema, you can use it in anuntil clause. The AI will match user intent to the tool’s description and extract the specified parameters.
Basic Syntax (without binding):
as):
Complete Example: Mixed Conditions
You can mix string conditions with tool schema conditions in the same loop. The first matching condition is triggered:Tool schema conditions provide type-safe parameter extraction. The LLM will attempt to extract all specified parameters based on the conversation context. Required parameters should be marked in the schema’s
required array.