Skip to content

Commit daf0612

Browse files
fix: Return consistent response for 'what is the asset value' query. (#663)
* Updated the prompt and now giving the consistent response for the 'what is the asset value' question * Updated the prompts into to a generic way for asset values
1 parent 3df581e commit daf0612

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

infra/main.bicep

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ var functionAppSqlPrompt = '''Generate a valid T-SQL query to find {query} for t
158158
ALWAYS select Client Name (Column: Client) in the query.
159159
Query filters are IMPORTANT. Add filters like AssetType, AssetDate, etc. if needed.
160160
When answering scheduling or time-based meeting questions, always use the StartTime column from ClientMeetings table. Use correct logic to return the most recent past meeting (last/previous) or the nearest future meeting (next/upcoming), and ensure only StartTime column is used for meeting timing comparisons.
161-
For asset values: if question is about total \"asset value\"/\"portfolio value\"/\"AUM\" → return SUM of latest investments; if about \"current asset/investment value\" → return all latest investments without SUM.
161+
For asset values: If the question is about "asset value", "total asset value", "portfolio value", or "AUM" → ALWAYS return the SUM of the latest investments (do not return individual rows). If the question is about "current asset value" or "current investment value" → return all latest investments without SUM.
162+
For trend queries: If the question contains "how did change", "over the last", "trend", or "progression" → return time series data for the requested period with SUM for each time period and show chronological progression.
162163
Only return the generated SQL query. Do not return anything else.'''
163164

164165
var functionAppCallTranscriptSystemPrompt = '''You are an assistant who supports wealth advisors in preparing for client meetings.

src/App/backend/agents/agent_factory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ async def get_sql_agent(cls) -> dict:
183183
- Do not use client name for filtering
184184
- Assets table contains snapshots by date; do not sum values across dates
185185
- Use StartTime for time-based filtering (meetings)
186-
- For asset values: if question is about total "asset value"/"portfolio value"/"AUM" → return SUM of latest investments; if about "current asset/investment value" → return all latest investments without SUM.
186+
- For asset values: If the question is about "asset value", "total asset value", "portfolio value", or "AUM" → ALWAYS return the SUM of the latest investments (do not return individual rows). If the question is about "current asset value" or "current investment value" → return all latest investments without SUM.
187+
- For trend queries: If the question contains "how did change", "over the last", "trend", or "progression" → return time series data for the requested period with SUM for each time period and show chronological progression.
187188
- Only return the raw T-SQL query. No explanations or comments.
188189
"""
189190

0 commit comments

Comments
 (0)