diff --git a/app/agents/voice/automatic/prompts/system.py b/app/agents/voice/automatic/prompts/system.py index fb671db..3e1bb82 100644 --- a/app/agents/voice/automatic/prompts/system.py +++ b/app/agents/voice/automatic/prompts/system.py @@ -1,18 +1,17 @@ from app.core.logger import logger from app.core.config import ENABLE_SEARCH_GROUNDING from app.agents.voice.automatic.types import TTSProvider - SYSTEM_PROMPT = """ SYSTEM ROLE - You are “Breeze Automatic”, a friendly voice assistant created by Breeze (owned by Juspay), helping D2C business owners with analytics and insights. + You are "Breeze Automatic", a friendly voice assistant created by Breeze (owned by Juspay), helping D2C business owners with analytics and insights. TONE & STYLE Speak conversationally in Indian English, as though chatting live. Begin every session with: - “Hey, whatsup? How can I help you today?” + "Hey, whatsup? How can I help you today?" Keep replies short (50-100 words), clear, natural. No jargon, emojis, Markdown, or special characters. VOICE & PACING - Use varied sentence lengths and natural pauses. Include rhetorical questions (“Need a quick sales recap?”) and affirmations (“Sure thing.”). Use tone shifts to highlight changes. + Use varied sentence lengths and natural pauses. Include rhetorical questions ("Need a quick sales recap?") and affirmations ("Sure thing."). Use tone shifts to highlight changes. STRUCTURE & DIRECT RESPONSE PROTOCOL Every response should include: @@ -28,8 +27,8 @@ NUMBERS & ROUNDING Always convert numbers to the Indian numbering system using hundred, thousand, lakh, and crore. - For large numbers, round to a nearby, natural-sounding significant figure to keep it easy on the ear. For example, convert "753,644.76" into "around 7 lakh 54 thousand rupees". Use qualifiers like “around”, “approximately”, or “roughly” to signal rounding. - Avoid using paise or decimals. Say only the rounded rupee value. For small, clear numbers like “₹899” or “124 orders”, you may speak them exactly. Choose what sounds most natural for speech — the goal is smooth, human-like delivery. + For large numbers, round to a nearby, natural-sounding significant figure to keep it easy on the ear. For example, convert "753,644.76" into "around 7 lakh 54 thousand rupees". Use qualifiers like "around", "approximately", or "roughly" to signal rounding. + Avoid using paise or decimals. Say only the rounded rupee value. For small, clear numbers like "₹899" or "124 orders", you may speak them exactly. Choose what sounds most natural for speech — the goal is smooth, human-like delivery. CRORE CONVERSION RULES When converting large numbers: @@ -37,9 +36,9 @@ Convert to crore by dividing the number by 1,00,00,000. For 9-digit numbers, place the decimal after the first two digits to get approximate crores (e.g. 344,215,267 becomes ~34.42 crores). Round naturally to a significant figure that sounds smooth when spoken. For example: - 296,636,734 → “around 29 crore 66 lakh rupees” - 344,215,267 → “roughly 34 crore 42 lakh rupees” - Avoid common errors like dropping a digit and saying “2.97 crores” instead of “29.7 crores”. + 296,636,734 → "around 29 crore 66 lakh rupees" + 344,215,267 → "roughly 34 crore 42 lakh rupees" + Avoid common errors like dropping a digit and saying "2.97 crores" instead of "29.7 crores". Always double-check digit length to avoid underestimation. If the amount is less than 1 crore, express in lakhs or thousands as needed. @@ -56,23 +55,32 @@ 1. Direct Answers Only Provide exactly what was asked—no extra analysis or commentary. 2. Optional Follow-Up - After your direct answer, invite the user to dive deeper (e.g., “Want to see performance metrics for this?”). - Time & Date Handling + After your direct answer, invite the user to dive deeper (e.g., "Want to see performance metrics for this?"). + Time & Date Handling 1. Interactive Timeframes - - If the user does not specify a period for a timeframe-dependent tool, ask: - “Which timeframe would you like to use?” + - *USE today as the default time frame* - Once set, persist that timeframe for all subsequent queries until the user explicitly requests a change. - 2. Explicit Only - Never assume a default period—always confirm the user's intended range. - 3. Resolve “Today” Explicitly - For any tool call requiring a relative date or time range, first invoke `get_current_time` and use that exact timestamp to disambiguate relative terms like “today,” “this week,” or “last month.” + 2. Default Timeframe Protocol + - **CRITICAL**: When a user asks for data without specifying a timeframe, AUTOMATICALLY and IMMEDIATELY: + a) Call `getCurrentTime` to get today's date and time + b) Use `get_formatted_time_range` to create start and end timestamps for today + c) Fetch the requested data for today without asking permission + d) Present the data with "Here is your [data type] for today: [data]" + e) ONLY AFTER showing the data, ask: "Do you want me to fetch for any other specific timeframe?" + - **DO NOT ASK FIRST** - Always fetch today's data automatically + - Example: User: "get my sales data" → Voice: "Here is your sales data for today: [shows data]. Do you want me to fetch for any other specific timeframe?" + 3. Resolve "Today" Explicitly + For any tool call requiring a relative date or time range, first invoke `getCurrentTime` and use that exact timestamp to disambiguate relative terms like "today," "this week," or "last month." + To get today's timeframe: + - Call `getCurrentTime` to get current date + - Call `get_formatted_time_range` with the current date to get the start and end of day timestamps Error & Clarification 1. Automated Retry If a tool call fails for a recoverable reason (e.g., minor formatting issues), retry internally up to 3 TIMES - do not involve the user. 2. Smart Clarify If a request is ambiguous, ask a focused follow-up rather than guessing. 3. Graceful Degradation - For unrecoverable errors, apologize briefly (“Sorry, I encountered an issue.”) and ask how to proceed. + For unrecoverable errors, apologize briefly ("Sorry, I encountered an issue.") and ask how to proceed. Tone & Personalization - Keep replies warm, concise, and user-focused. - Celebrate successes, gently propose next steps on dips. @@ -83,7 +91,7 @@ IDENTITY If asked about identity, say: - “I'm your AI sidekick. Think of me as your extra brain for your D2C business. Whether it's digging through data, summarizing reports, or prepping for your next big move — I'm here to help you work smarter.” + "I'm your AI sidekick. Think of me as your extra brain for your D2C business. Whether it's digging through data, summarizing reports, or prepping for your next big move — I'm here to help you work smarter." Never mention or describe your internal architecture, training methods, underlying model, or who built you. Always redirect the conversation to your purpose: assisting with business insights. """ diff --git a/app/agents/voice/automatic/tools/breeze/analytics.py b/app/agents/voice/automatic/tools/breeze/analytics.py index 7e784b8..c4f1c83 100644 --- a/app/agents/voice/automatic/tools/breeze/analytics.py +++ b/app/agents/voice/automatic/tools/breeze/analytics.py @@ -241,7 +241,7 @@ async def get_breeze_address_data(params: FunctionCallParams): get_breeze_sales_data_function = FunctionSchema( name="get_breeze_sales_data", - description="Fetches sales data (gross sales, net sales, discounts, shipping, tax, total sales) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00').", + description="Fetches sales data (gross sales, net sales, discounts, shipping, tax, total sales) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00'). If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your sales data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties={ "startTime": { "type": "string", @@ -257,7 +257,7 @@ async def get_breeze_address_data(params: FunctionCallParams): get_breeze_orders_data_function = FunctionSchema( name="get_breeze_orders_data", - description="Fetches order data (total orders, average order value, total sales) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00').", + description="Fetches order data (total orders, average order value, total sales) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00'). If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your orders data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties={ "startTime": { "type": "string", @@ -273,7 +273,7 @@ async def get_breeze_address_data(params: FunctionCallParams): get_breeze_checkout_data_function = FunctionSchema( name="get_breeze_checkout_data", - description="Fetches checkout conversion funnel data (e.g., clicked checkout, logged in, placed order) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00').", + description="Fetches checkout conversion funnel data (e.g., clicked checkout, logged in, placed order) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00'). If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your checkout data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties={ "startTime": { "type": "string", @@ -289,7 +289,7 @@ async def get_breeze_address_data(params: FunctionCallParams): get_breeze_conversion_data_function = FunctionSchema( name="get_breeze_conversion_data", - description="Fetches conversion rate data (total sessions, orders placed, conversion rate) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00').", + description="Fetches conversion rate data (total sessions, orders placed, conversion rate) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00'). If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your conversion data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties={ "startTime": { "type": "string", @@ -305,7 +305,7 @@ async def get_breeze_address_data(params: FunctionCallParams): get_breeze_marketing_data_function = FunctionSchema( name="get_breeze_marketing_data", - description="Fetches marketing attribution data (UTM source, medium, campaign, etc.) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00').", + description="Fetches marketing attribution data (UTM source, medium, campaign, etc.) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00'). If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your marketing attribution data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties={ "startTime": { "type": "string", @@ -321,7 +321,7 @@ async def get_breeze_address_data(params: FunctionCallParams): get_breeze_address_data_function = FunctionSchema( name="get_breeze_address_data", - description="Fetches address-related analytics (e.g., total logged-in users, users with prefilled addresses, address validation metrics) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00').", + description="Fetches address-related analytics (e.g., total logged-in users, users with prefilled addresses, address validation metrics) from Breeze analytics for a given shop and time range. Time should be provided in IST (e.g., '2025-06-20 00:00:00'). If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your address analytics for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties={ "startTime": { "type": "string", diff --git a/app/agents/voice/automatic/tools/dummy/analytics.py b/app/agents/voice/automatic/tools/dummy/analytics.py index 04c8710..54a3d55 100644 --- a/app/agents/voice/automatic/tools/dummy/analytics.py +++ b/app/agents/voice/automatic/tools/dummy/analytics.py @@ -156,161 +156,161 @@ async def get_breeze_weekly_ad_spend_and_roas(params: FunctionCallParams): get_sr_success_rate_function = FunctionSchema( name="get_sr_success_rate_by_time", - description="Calculates overall success rate (SR) for transactions.", + description="Calculates overall success rate (SR) for transactions. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your success rate for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) payment_method_wise_sr_function = FunctionSchema( name="get_payment_method_wise_sr_by_time", - description="Fetches success rate (SR) by payment method.", + description="Fetches success rate (SR) by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your payment method success rate for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) failure_transactional_data_function = FunctionSchema( name="get_failure_transactional_data", - description="Retrieves data for failed transactions.", + description="Retrieves data for failed transactions. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your failure data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) success_transactional_data_function = FunctionSchema( name="get_success_transactional_data", - description="Retrieves count of successful transactions by payment method.", + description="Retrieves count of successful transactions by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your successful transactions data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) gmv_order_value_payment_method_wise_function = FunctionSchema( name="get_gmv_order_value_payment_method_wise", - description="Retrieves Gross Merchandise Value (GMV) by payment method.", + description="Retrieves Gross Merchandise Value (GMV) by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your GMV data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) average_ticket_payment_wise_function = FunctionSchema( name="get_average_ticket_payment_wise", - description="Calculates average ticket size by payment method.", + description="Calculates average ticket size by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your average ticket size data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) get_weekly_sr_success_rate_function = FunctionSchema( name="get_weekly_sr_success_rate", - description="Calculates weekly overall success rate (SR) for transactions.", + description="Calculates weekly overall success rate (SR) for transactions. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly success rate data: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) weekly_payment_method_wise_sr_function = FunctionSchema( name="get_weekly_payment_method_wise_sr", - description="Fetches weekly success rate (SR) by payment method.", + description="Fetches weekly success rate (SR) by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly payment method success rate data: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) weekly_failure_transactional_data_function = FunctionSchema( name="get_weekly_failure_transactional_data", - description="Retrieves weekly data for failed transactions.", + description="Retrieves weekly data for failed transactions. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly failure data: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) weekly_success_transactional_data_function = FunctionSchema( name="get_weekly_success_transactional_data", - description="Retrieves weekly count of successful transactions by payment method.", + description="Retrieves weekly count of successful transactions by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly successful transactions data: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) weekly_gmv_order_value_payment_method_wise_function = FunctionSchema( name="get_weekly_gmv_order_value_payment_method_wise", - description="Retrieves weekly Gross Merchandise Value (GMV) by payment method.", + description="Retrieves weekly Gross Merchandise Value (GMV) by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly GMV data: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) weekly_average_ticket_payment_wise_function = FunctionSchema( name="get_weekly_average_ticket_payment_wise", - description="Calculates weekly average ticket size by payment method.", + description="Calculates weekly average ticket size by payment method. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly average ticket size data: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_daily_sales_breakdown_function = FunctionSchema( name="get_breeze_daily_sales_breakdown", - description="Retrieves the sales breakdown for today.", + description="Retrieves the sales breakdown for today. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your daily sales breakdown for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_daily_orders_breakdown_function = FunctionSchema( name="get_breeze_daily_orders_breakdown", - description="Retrieves the orders breakdown for today.", + description="Retrieves the orders breakdown for today. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your daily orders breakdown for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_daily_conversion_breakdown_function = FunctionSchema( name="get_breeze_daily_conversion_breakdown", - description="Retrieves the conversion breakdown for today.", + description="Retrieves the conversion breakdown for today. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your daily conversion breakdown for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_daily_payment_success_rate_function = FunctionSchema( name="get_breeze_daily_payment_success_rate", - description="Retrieves the payment success rate for today.", + description="Retrieves the payment success rate for today. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your daily payment success rate for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_daily_average_order_value_function = FunctionSchema( name="get_breeze_daily_average_order_value", - description="Retrieves the average order value for today.", + description="Retrieves the average order value for today. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your daily average order value for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_weekly_sales_breakdown_function = FunctionSchema( name="get_breeze_weekly_sales_breakdown", - description="Retrieves the sales breakdown for the week.", + description="Retrieves the sales breakdown for the week. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly sales breakdown: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_weekly_orders_breakdown_function = FunctionSchema( name="get_breeze_weekly_orders_breakdown", - description="Retrieves the orders breakdown for the week.", + description="Retrieves the orders breakdown for the week. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly orders breakdown: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_weekly_conversion_breakdown_function = FunctionSchema( name="get_breeze_weekly_conversion_breakdown", - description="Retrieves the conversion breakdown for the week.", + description="Retrieves the conversion breakdown for the week. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly conversion breakdown: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_weekly_payment_success_rate_function = FunctionSchema( name="get_breeze_weekly_payment_success_rate", - description="Retrieves the payment success rate for the week.", + description="Retrieves the payment success rate for the week. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly payment success rate: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_weekly_average_order_value_function = FunctionSchema( name="get_breeze_weekly_average_order_value", - description="Retrieves the average order value for the week.", + description="Retrieves the average order value for the week. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly average order value: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) breeze_weekly_ad_spend_and_roas_function = FunctionSchema( name="get_breeze_weekly_ad_spend_and_roas", - description="Retrieves the ad spend and ROAS for the week.", + description="Retrieves the ad spend and ROAS for the week. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your weekly ad spend and ROAS data: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) diff --git a/app/agents/voice/automatic/tools/juspay/analytics.py b/app/agents/voice/automatic/tools/juspay/analytics.py index 8143a4c..4acf3e2 100644 --- a/app/agents/voice/automatic/tools/juspay/analytics.py +++ b/app/agents/voice/automatic/tools/juspay/analytics.py @@ -285,14 +285,14 @@ async def merchant_offer_analytics(params: FunctionCallParams): get_sr_success_rate_function = FunctionSchema( name="get_sr_success_rate_by_time", - description="Get the overall payment success rate for all transactions within a specified time range. Use this to understand the general health of the payment system.", + description="Get the overall payment success rate for all transactions within a specified time range. Use this to understand the general health of the payment system. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your payment success rate for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) payment_analytics_by_dimension_function = FunctionSchema( name="get_payment_analytics_by_dimension", - description="Retrieves time-bound KPIs—total transaction volume, success rate, and transaction count—broken down by the selected dimension. Useful to analyze performance by gateway, instrument category, or specific instrument type (e.g., Visa, Mastercard). Always aim to extract as many dimensions as possible for a comprehensive snapshot.", + description="Retrieves time-bound KPIs—total transaction volume, success rate, and transaction count—broken down by the selected dimension. Useful to analyze performance by gateway, instrument category, or specific instrument type (e.g., Visa, Mastercard). Always aim to extract as many dimensions as possible for a comprehensive snapshot. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your payment analytics for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties={ **time_input_schema["properties"], "dimension": { @@ -306,35 +306,35 @@ async def merchant_offer_analytics(params: FunctionCallParams): failure_transactional_data_function = FunctionSchema( name="get_failure_transactional_data_by_time", - description="Get a list of the top transaction failure reasons and the payment methods they occurred on within a specified time range. Use this to diagnose the most common payment issues.", + description="Get a list of the top transaction failure reasons and the payment methods they occurred on within a specified time range. Use this to diagnose the most common payment issues. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your payment failure data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) success_transactional_data_function = FunctionSchema( name="get_success_transactional_data_by_time", - description="Get the total count of successful transactions for each payment method within a specified time range. Use this to see which payment methods are most popular.", + description="Get the total count of successful transactions for each payment method within a specified time range. Use this to see which payment methods are most popular. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your successful transactions data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) gmv_order_value_payment_method_wise_function = FunctionSchema( name="get_gmv_order_value_payment_method_wise_by_time", - description="Get the total Gross Merchandise Value (GMV) for each payment method within a specified time range. The results can be summed to calculate the total payment method GMV/sales. Use this to understand the revenue contribution of each payment method and the overall sales performance.", + description="Get the total Gross Merchandise Value (GMV) for each payment method within a specified time range. The results can be summed to calculate the total payment method GMV/sales. Use this to understand the revenue contribution of each payment method and the overall sales performance. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your GMV data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) average_ticket_payment_wise_function = FunctionSchema( name="get_average_ticket_payment_wise_by_time", - description="Get the average transaction value (ticket size) for each payment method within a specified time range. Use this to analyze customer spending habits across different payment options.", + description="Get the average transaction value (ticket size) for each payment method within a specified time range. Use this to analyze customer spending habits across different payment options. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your average ticket size data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) merchant_offer_analytics_function = FunctionSchema( name="merchant_offer_analytics", - description="Fetches a list of all active merchant offers and their performance data. Use this to find out what the current offers are, how they are performing, and to diagnose any errors related to offer application.", + description="Fetches a list of all active merchant offers and their performance data. Use this to find out what the current offers are, how they are performing, and to diagnose any errors related to offer application. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your merchant offers data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", properties=time_input_schema["properties"], required=time_input_schema["required"], ) diff --git a/app/tools/providers/juspay/juspay_tools.py b/app/tools/providers/juspay/juspay_tools.py index 7f1fd0a..c1cafa1 100644 --- a/app/tools/providers/juspay/juspay_tools.py +++ b/app/tools/providers/juspay/juspay_tools.py @@ -28,37 +28,37 @@ get_sr_success_rate_declaration = { "name": "getSRSuccessRateByTime", - "description": "This tool calculates the overall success rate (SR) for transactions over a specified time interval.", + "description": "This tool calculates the overall success rate (SR) for transactions over a specified time interval. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your success rate for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", "parameters": time_input_schema } payment_method_wise_sr_declaration = { "name": "getPaymentMethodWiseSRByTime", - "description": "This tool fetches a breakdown of the success rate (SR) by payment method over a specified time interval.", + "description": "This tool fetches a breakdown of the success rate (SR) by payment method over a specified time interval. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your payment method success rate for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", "parameters": time_input_schema } failure_transactional_data_declaration = { "name": "getFailureTransactionalData", - "description": "This tool retrieves transactional data for failed transactions. The returned data highlights the top failure reasons and their associated payment methods.", + "description": "This tool retrieves transactional data for failed transactions. The returned data highlights the top failure reasons and their associated payment methods. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your failure data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", "parameters": time_input_schema } success_transactional_data_declaration = { "name": "getSuccessTransactionalData", - "description": "This tool retrieves the count of successful transactions (i.e. those with a payment_status of SUCCESS) for each payment method over a specified time interval.", + "description": "This tool retrieves the count of successful transactions (i.e. those with a payment_status of SUCCESS) for each payment method over a specified time interval. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your successful transactions data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", "parameters": time_input_schema } gmv_order_value_payment_method_wise_declaration = { "name": "getGMVOrderValuePaymentMethodWise", - "description": "This tool retrieves the Gross Merchandise Value (GMV) for each payment method over a specified time interval.", + "description": "This tool retrieves the Gross Merchandise Value (GMV) for each payment method over a specified time interval. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your GMV data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", "parameters": time_input_schema } average_ticket_payment_wise_declaration = { "name": "getAverageTicketPaymentWise", - "description": "This tool calculates the average ticket size for each payment method over a specified time interval.", + "description": "This tool calculates the average ticket size for each payment method over a specified time interval. If user requests data without timeframe, automatically call getCurrentTime then get_formatted_time_range to get today's timestamps, pass them to this tool, show results as 'Here is your average ticket size data for today: [data]', then ask 'Do you want me to fetch for any other specific timeframe?'. DO NOT ask first - fetch today's data immediately without permission.", "parameters": time_input_schema }