# Custom tool definitions here
sales_top_customers:
type: tool
description: "Get the top 20 customers by lifetime value."
sql: |
sel top 20 * from dim_customers order by customer_lifetime_value desc;
sales_customer_profile:
type: tool
description: "Get customer profile and metrics."
sql: |
sel dim_customers.*, customer_nk as customer_email from dim_customers
join key_customer
on dim_customers.customer_key = key_customer.customer_key
where dim_customers.customer_key = :customer_key;
parameters:
customer_key:
description: "The key (integer) for the customer to lookup."
sales_cube:
type: cube
description: "Get the key sales metrics: USD amount and number of orders."
sql: |
sel customer_key, extract(year from order_date) sales_year, extract(month from order_date) sales_month, gift_card_amount_usd, amount amount_usd
from fct_orders o
measures:
gift_amount_usd:
description: "Total gift card amount used for the order in USD"
expression: "SUM(gift_card_amount_usd)"
total_amount_usd:
description: "Total order amount in USD"
expression: "SUM(amount_usd)"
order_count:
description: "Total number of orders"
expression: "COUNT(1)"
dimensions:
customer_key:
description: "Key for the customer"
expression: "customer_key"
sales_year:
description: "Year of the sale"
expression: "sales_year"
sales_month:
description: "Month of the sale"
expression: "sales_month"
sales_prompt:
type: prompt
description: "my prompt description"
prompt: |
You are a data analyst working for a sales team.
Your task is to analyze the sales data using the tools you have and provide insights.
All your answers must be based on the data you retrieve using the tools, and you must be ready to provide data for your answers.
sales_glossary:
type: glossary
customer:
definition: "A person or organization that purchases goods or services from our business."
synonyms:
- Clients
sales:
definition: "The key metrics related to completed orders: USD amount and number of orders."
synonyms:
- revenue
- sales figures
tools:
- sales_cube