fix: enhance Fusion Claims Intelligence AI with client status and billing period tools
- Fix _read_group override crash (dict_values not subscriptable) in sale_order.py - Migrate _fc_tool_claims_stats from deprecated read_group() to _read_group() API - Enrich client details tool with funding history, invoice status, prev-funded devices - Add Client Status Lookup tool (search by name, returns orders/invoices/next steps) - Add ADP Billing Period tool (invoiced amounts, paid/unpaid, submission deadlines) - Update AI agent system prompt with all 5 tools and usage examples
This commit is contained in:
@@ -26,7 +26,7 @@ ai['result'] = record._fc_tool_search_clients(search_term, city_filter, conditio
|
||||
<field name="code">
|
||||
ai['result'] = record._fc_tool_client_details(profile_id)
|
||||
</field>
|
||||
<field name="ai_tool_description">Get detailed information about a specific client profile including personal info, medical status, benefits, claims history, and ADP application history. Requires profile_id from a previous search.</field>
|
||||
<field name="ai_tool_description">Get detailed information about a specific client profile including personal info, medical status, benefits, claims history, ADP application history, funding history with invoice status, and previously funded devices. Requires profile_id from a previous search.</field>
|
||||
<field name="ai_tool_schema">{"type": "object", "properties": {"profile_id": {"type": "number", "description": "ID of the client profile to get details for"}}, "required": ["profile_id"]}</field>
|
||||
</record>
|
||||
|
||||
@@ -39,21 +39,56 @@ ai['result'] = record._fc_tool_client_details(profile_id)
|
||||
<field name="code">
|
||||
ai['result'] = record._fc_tool_claims_stats()
|
||||
</field>
|
||||
<field name="ai_tool_description">Get aggregated statistics about Fusion Claims data: total profiles, total orders, breakdown by sale type, breakdown by workflow status, and top cities by client count. No parameters needed.</field>
|
||||
<field name="ai_tool_description">Get aggregated statistics about Fusion Claims data: total profiles, total orders, breakdown by sale type with amounts, breakdown by ADP workflow status, and top cities by client count. No parameters needed.</field>
|
||||
<field name="ai_tool_schema">{"type": "object", "properties": {}, "required": []}</field>
|
||||
</record>
|
||||
|
||||
<!-- Tool 4: Client Status Lookup (by name) -->
|
||||
<record id="ai_tool_client_status" model="ir.actions.server">
|
||||
<field name="name">Fusion: Client Status Lookup</field>
|
||||
<field name="state">code</field>
|
||||
<field name="use_in_ai" eval="True"/>
|
||||
<field name="model_id" ref="ai.model_ai_agent"/>
|
||||
<field name="code">
|
||||
ai['result'] = record._fc_tool_client_status(client_name)
|
||||
</field>
|
||||
<field name="ai_tool_description">Look up a client's complete status by name. Returns all their orders with current ADP status, invoice details (ADP and client portions, paid/unpaid), document checklist, funding warnings, and recommended next steps for each order. Use this when someone asks "what's the status of [name]" or "how is [name]'s case going".</field>
|
||||
<field name="ai_tool_schema">{"type": "object", "properties": {"client_name": {"type": "string", "description": "The client's name (first name, last name, or full name) to look up"}}, "required": ["client_name"]}</field>
|
||||
</record>
|
||||
|
||||
<!-- Tool 5: ADP Billing Period Summary -->
|
||||
<record id="ai_tool_adp_billing" model="ir.actions.server">
|
||||
<field name="name">Fusion: ADP Billing Period</field>
|
||||
<field name="state">code</field>
|
||||
<field name="use_in_ai" eval="True"/>
|
||||
<field name="model_id" ref="ai.model_ai_agent"/>
|
||||
<field name="code">
|
||||
ai['result'] = record._fc_tool_adp_billing_period(period)
|
||||
</field>
|
||||
<field name="ai_tool_description">Get ADP billing summary for a posting period. Shows total invoiced amount to ADP, paid vs unpaid amounts, number of orders billed, submission deadline, and expected payment date. Use when asked about ADP billing, posting, or invoicing for a period.</field>
|
||||
<field name="ai_tool_schema">{"type": "object", "properties": {"period": {"type": "string", "description": "Which period to query: 'current' (default), 'previous', 'next', or a specific date in YYYY-MM-DD format"}}, "required": []}</field>
|
||||
</record>
|
||||
|
||||
<!-- ================================================================= -->
|
||||
<!-- AI TOPIC (references tools above) -->
|
||||
<!-- AI TOPIC (references all tools) -->
|
||||
<!-- ================================================================= -->
|
||||
<record id="ai_topic_client_intelligence" model="ai.topic">
|
||||
<field name="name">Fusion Claims Client Intelligence</field>
|
||||
<field name="description">Query client profiles, ADP claims, funding history, medical conditions, and device information.</field>
|
||||
<field name="instructions">You help users find information about ADP clients, claims, medical conditions, devices, and funding history. Use the Fusion search/details/stats tools to query data.</field>
|
||||
<field name="description">Query client profiles, ADP claims, funding history, billing periods, and device information.</field>
|
||||
<field name="instructions">You help users find information about ADP clients, claims, medical conditions, devices, funding history, and billing periods. Use the Fusion tools to query data.
|
||||
|
||||
Common questions and which tool to use:
|
||||
- "What is the status of [name]?" -> Use Client Status Lookup (Tool 4)
|
||||
- "What is the ADP billing for this period?" -> Use ADP Billing Period (Tool 5)
|
||||
- "Tell me about [name]'s funding history" -> Use Client Status Lookup first, then Client Details for more depth
|
||||
- "How many claims do we have?" -> Use Claims Statistics (Tool 3)
|
||||
- "Find clients in [city]" -> Use Search Client Profiles (Tool 1)</field>
|
||||
<field name="tool_ids" eval="[(6, 0, [
|
||||
ref('fusion_claims.ai_tool_search_clients'),
|
||||
ref('fusion_claims.ai_tool_client_details'),
|
||||
ref('fusion_claims.ai_tool_client_stats'),
|
||||
ref('fusion_claims.ai_tool_client_status'),
|
||||
ref('fusion_claims.ai_tool_adp_billing'),
|
||||
])]"/>
|
||||
</record>
|
||||
|
||||
@@ -62,32 +97,44 @@ ai['result'] = record._fc_tool_claims_stats()
|
||||
<!-- ================================================================= -->
|
||||
<record id="ai_agent_fusion_claims" model="ai.agent">
|
||||
<field name="name">Fusion Claims Intelligence</field>
|
||||
<field name="subtitle">Ask about clients, ADP claims, funding history, medical conditions, and devices.</field>
|
||||
<field name="subtitle">Ask about clients, ADP claims, funding history, billing periods, and devices.</field>
|
||||
<field name="llm_model">gpt-4.1</field>
|
||||
<field name="response_style">analytical</field>
|
||||
<field name="restrict_to_sources" eval="False"/>
|
||||
<field name="system_prompt">You are Fusion Claims Intelligence, an AI assistant for ADP claims management.
|
||||
<field name="system_prompt">You are Fusion Claims Intelligence, an AI assistant for ADP claims management at a mobility equipment company.
|
||||
|
||||
You help staff find information about clients, medical conditions, mobility devices, funding history, and claim status.
|
||||
You help staff find information about clients, their order status, medical conditions, mobility devices, funding history, billing periods, and claim status.
|
||||
|
||||
Capabilities:
|
||||
1. Search client profiles by name, health card number, city, or medical condition
|
||||
2. Get detailed client information including claims history and ADP applications
|
||||
2. Get detailed client information including funding history, invoice status, and previously funded devices
|
||||
3. Provide aggregated statistics about claims, funding types, and demographics
|
||||
4. Look up a client's complete status by name -- including all orders, invoices, documents, and next steps
|
||||
5. Query ADP billing period summaries -- total invoiced to ADP, paid vs unpaid, submission deadlines
|
||||
|
||||
How to handle common requests:
|
||||
- "What is the status of [name]?" -> Use the Client Status Lookup tool with the client's name
|
||||
- "What is the ADP billing this period?" -> Use the ADP Billing Period tool with period="current"
|
||||
- "What was the ADP billing last period?" -> Use the ADP Billing Period tool with period="previous"
|
||||
- "Show me [name]'s funding history" -> Use Client Status Lookup, then Client Details for full history
|
||||
- If a client is not found by profile, the system also searches by contact/partner name
|
||||
|
||||
Response guidelines:
|
||||
- Be concise and data-driven
|
||||
- Format monetary values with $ and commas
|
||||
- Format monetary values with $ and commas (e.g., $1,250.00)
|
||||
- When listing orders, always include: order number, status, amounts, and next recommended step
|
||||
- When showing billing summaries, include: period dates, total invoiced, paid vs unpaid, submission deadline
|
||||
- Include key identifiers (name, health card, city) when listing clients
|
||||
- Include order number, status, and amounts when discussing claims
|
||||
- If asked about a specific client, search first, then get details
|
||||
- Always provide the profile ID for record lookup
|
||||
- If asked about a specific client, use Client Status Lookup first (it searches by name)
|
||||
- Always indicate if invoices are paid or unpaid
|
||||
|
||||
Key terminology:
|
||||
- ADP = Assistive Devices Program (Ontario government)
|
||||
- Client Type REG = Regular (75% ADP / 25% Client), ODS/OWP/ACS = 100% ADP
|
||||
- ADP = Assistive Devices Program (Ontario government funding)
|
||||
- Client Type REG = Regular (75% ADP / 25% Client split), ODS/OWP/ACS = 100% ADP funded
|
||||
- Posting Period = 14-day ADP billing cycle; submission deadline is Wednesday 6 PM before posting day
|
||||
- Sale Types: ADP, ODSP, WSIB, Insurance, March of Dimes, Muscular Dystrophy, Hardship Funding
|
||||
- Sections: 2a = Walkers, 2b = Manual Wheelchairs, 2c = Power Bases/Scooters, 2d = Seating</field>
|
||||
- Sections: 2a = Walkers, 2b = Manual Wheelchairs, 2c = Power Bases/Scooters, 2d = Seating
|
||||
- Previously Funded = devices the client has received ADP funding for before (affects eligibility)</field>
|
||||
<field name="topic_ids" eval="[(6, 0, [ref('ai_topic_client_intelligence')])]"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user