refactor estimation service to use structured agent
This commit is contained in:
parent
47cc1541ed
commit
96421b264c
7 changed files with 316 additions and 361 deletions
50
README.md
50
README.md
|
|
@ -5,7 +5,7 @@ A FastAPI-based insurance AI assistant that integrates with talestorm-ai for cha
|
|||
## Features
|
||||
|
||||
- **Insurance Chat**: AI-powered chat interface for insurance-related questions
|
||||
- **Insurance Estimation**: Comprehensive underwriting and pricing estimation
|
||||
- **Insurance Estimation**: AI-powered estimation using TALESTORM API for comprehensive underwriting and pricing
|
||||
- **Integration**: Seamless integration with talestorm-ai API
|
||||
- **Modern API**: Built with FastAPI for high performance and automatic documentation
|
||||
|
||||
|
|
@ -43,7 +43,8 @@ OPENAI_API_KEY=your-openai-api-key-here
|
|||
# lolly-ai Configuration
|
||||
PUBLIC_LOLLY_PORT=7310
|
||||
TALESTORM_API_KEY=your-talestorm-api-key-here
|
||||
TALESTORM_AGENT_ID=your-talestorm-agent-id-here
|
||||
TALESTORM_AGENT_ID=your-talestorm-chat-agent-id-here
|
||||
TALESTORM_ESTIMATION_AGENT_ID=your-talestorm-estimation-agent-id-here
|
||||
INSURANCE_API_BASE_URL=https://apilolly.cyberpug.ru
|
||||
|
||||
# Server Configuration
|
||||
|
|
@ -90,6 +91,51 @@ To remove volumes as well:
|
|||
docker compose down -v
|
||||
```
|
||||
|
||||
## Agent Configuration
|
||||
|
||||
The system uses two different TALESTORM agents for different purposes:
|
||||
|
||||
- **TALESTORM_AGENT_ID**: Used for general insurance chat functionality
|
||||
- **TALESTORM_ESTIMATION_AGENT_ID**: Used specifically for insurance estimation with structured output schema
|
||||
|
||||
This separation allows for specialized agents optimized for their respective tasks.
|
||||
|
||||
## Estimation Service
|
||||
|
||||
The estimation service has been refactored to use the TALESTORM API instead of local underwriting logic. This provides:
|
||||
|
||||
- **AI-Powered Analysis**: Uses advanced AI models for risk assessment and pricing
|
||||
- **Comprehensive Evaluation**: Analyzes all health factors, medications, and conditions
|
||||
- **Structured Output**: Returns detailed tier assignments and pricing for each applicant
|
||||
- **Flexible Response**: Handles both accepted and rejected applications with detailed reasoning
|
||||
|
||||
### Estimation Request Format
|
||||
|
||||
The service accepts insurance application data and returns structured estimation results:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "accepted",
|
||||
"details": {
|
||||
"dtq": false,
|
||||
"reason": "All applicants have manageable conditions...",
|
||||
"tier": 3,
|
||||
"total_price": 815.75
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"name": "Sarah Johnson",
|
||||
"applicant_type": "primary",
|
||||
"age": 39,
|
||||
"bmi": 23.38,
|
||||
"tier": 3,
|
||||
"rx_spend": 40.0,
|
||||
"message": "Type 2 diabetes well-controlled..."
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
All API endpoints are versioned under `/api/v1/`:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue