conv.utils
property provides helper methods for extracting and validating information from the most recent user input during a conversation. These helpers are LLM-powered and return typed objects you can store in conv.state
or use in your logic.
These utilities are opt-in and may not be enabled in your workspace. Contact your admin to request access.
extract_address
Extract a structured postal address from the latest user turn. Optionally validate against a list of known addresses.
addresses
: Optional list ofAddress
objects to match against. Street name must be specified for each address.country
: Optional country code to filter on (default"US"
).
- An
Address
instance with available fields populated. Some fields may beNone
if not provided.
ExtractionError
if parsing fails.
extract_city
Extract a valid city name (and optionally state/country) from the latest user turn.
city_spellings
: Optional list of spelled-out city names to match.states
: Optional list of states to filter on.country
: Optional country code to filter on (default"US"
).
- An
Address
instance where thecity
field is populated; other fields may beNone
.
ExtractionError
if parsing fails.
Address
type
Both utilities return the same Address
type:
Notes
- Latency: Each method may take a few seconds to complete due to LLM processing.
- Validation: Providing allowed values (addresses, city spellings, or states) can improve accuracy.
- Scope: Operates on the most recent user input, including alternate transcript hypotheses.
See also
conv
object — full list of conversation methods and attributes.