This page requires Python familiarity. It covers helper methods available inside Python functions.
conv.utils property provides helper methods for accessing secrets, extracting and validating information from user input, and making standalone LLM calls.
get_secret
Retrieve a stored secret by name. Returns the secret value as a string or dictionary (for key/value pair secrets).
secret_name(str): The name of the secret as configured in the Secrets Vault.
strordict: The secret value.
SecretNotFoundif the secret does not exist.MissingAccessif the current agent does not have access to this secret.
extract_address
Extract a structured postal address from the latest user turn. Optionally validate against a list of known addresses.
addresses: Optional list ofAddressobjects to match against. Street name must be specified for each address.country: Optional country code to filter on (default"US").
- An
Addressinstance with available fields populated. Some fields may beNoneif not provided.
ExtractionErrorif 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
Addressinstance where thecityfield is guaranteed to be populated on a successful extraction; other fields may beNone. If extraction fails, anExtractionErroris raised instead.
ExtractionErrorif parsing fails.
Address type
Both utilities return the same Address type:
prompt_llm
Perform a standalone LLM request with a given prompt. Useful for summarizing conversations or extracting specific information.
This method requires activation for your account. If you receive a
NotImplementedError, contact PolyAI support to enable it.prompt(str): The system-level prompt containing instructions for the model.show_history(bool, optional): Whether to include conversation history in the request. DefaultFalse.return_json(bool, optional): Whether to return the response as a parsed JSON dict. DefaultFalse.model(str, optional): The LLM to use. Default"gpt-4o". Available options:"gpt-4o"– GPT-4o (default, balanced performance)"gpt-4o-mini"– GPT-4o Mini (faster, lower cost)"gpt-4.1"– GPT-4.1"gpt-4.1-mini"– GPT-4.1 Mini"gpt-4.1-nano"– GPT-4.1 Nano (fastest, lowest cost)"gpt-5.2-chat"– GPT-5.2 Chat (latest)"claude-3.5-haiku"– Claude 3.5 Haiku (fast)"claude-sonnet-4"– Claude Sonnet 4
strordict: The LLM response, parsed as JSON ifreturn_json=True.
ChatCompletionErrorif the request fails.
validate_entity
Validate an entity value against a configuration schema.
value(str): The value to validate.entity_config(EntityConfig): Configuration for the entity type. Available configs:conv.utils.EmailConfig()conv.utils.PhoneNumberConfig()conv.utils.DateConfig()conv.utils.TimeConfig()conv.utils.NumericConfig()conv.utils.CurrencyConfig()conv.utils.NameConfig()conv.utils.AlphanumericConfig()conv.utils.EnumConfig()conv.utils.FreeTextConfig()
EntityValidationResponsewithis_valid,normalized_value, and validation details. Some config types expose additional fields — for example,PhoneNumberConfigresults includecountry_codeandnumber. Available fields vary by config type.
geocode_address
Geocode a full address string using configured mapping services.
full_address(str): The complete address string to geocode.provider(str, optional): Geocoding provider ("google_maps"or"mapbox"). Default"google_maps".
- An
Addressinstance with coordinates inother_fieldsif available.
ExtractionErrorif geocoding fails or the address cannot be resolved.
This feature is available on select plans. Contact PolyAI support to check availability for your project.
extract_and_geocode_address
Extract a full address from the latest user input and geocode it in a single operation.
country(str, optional): Country code to bias extraction/geocoding. Default"US".postcodes(list[str], optional): Candidate postcodes to bias extraction.biases(list[str], optional): Nearby or full addresses to bias extraction.provider(str, optional): Geocoding provider. Default"google_maps".
- A fully geocoded
Addresswith coordinates inother_fieldsif provided.
ExtractionErrorif address extraction or geocoding fails.
This feature is available on select plans. Contact PolyAI support to check availability for your project.
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
convobject — full list of conversation methods and attributes.

