Skip to content

validate_unit

Verify if a unit name is valid and compatible with the database.

Purpose

Check unit compatibility before creating custom activities to prevent errors.

Parameters

Parameter Type Required Description
unit_name string Yes Unit to validate (e.g., "kilogram")
database string Yes Database version

Returns

  • valid: Boolean
  • standard_name: Official unit name
  • symbol: Unit symbol
  • category: Unit type (mass, energy, etc.)
  • alternative_names: Other valid names
  • suggestions: Alternatives if invalid

Example

Prompt: Validate that kilowatt hour is a valid unit

Tips

  • Use full names: "kilowatt hour" not "kWh"
  • Always validate before create_activity
  • Check suggestions for alternatives