The Partnership Agent now includes comprehensive citation functionality that provides detailed references to source documents when answering questions.
The setup now includes 8 comprehensive documents with rich content:
-
Partnership Agreement Template (
doc1) - Templates category- Partnership formation requirements
- Revenue sharing structure (Tier 1: 30-35%, Tier 2: 20-25%, Tier 3: 10-15%)
- Minimum contribution requirements
- Performance metrics
-
Revenue Sharing Guidelines (
doc2) - Guidelines category- Detailed calculation methods
- Payment terms (monthly/quarterly)
- Minimum payment threshold ($100)
- Tax withholding requirements
-
Partnership Compliance Requirements (
doc3) - Policies category- Documentation standards
- Financial reporting requirements
- Partner verification processes
- Audit requirements
-
Standard Partnership Contract (
doc4) - Contracts category- Intellectual property rights
- Liability distribution
- Termination procedures (90-day notice)
- Dispute resolution
-
Partner Onboarding Process (
doc5) - Guidelines category- Initial assessment criteria
- Documentation and setup requirements
- Training and certification (85% minimum score)
- System integration steps
-
Dispute Resolution Framework (
doc6) - Policies category- Direct negotiation process
- Mediation procedures
- Arbitration process
- Escalation triggers
-
Performance Metrics and KPIs (
doc7) - Guidelines category- Revenue performance metrics
- Operational excellence standards (4.5/5.0 customer satisfaction)
- Strategic alignment measures
- Review schedules
-
Data Security and Privacy Policy (
doc8) - Policies category- Data classification levels
- Security controls (AES-256 encryption, TLS 1.3)
- Access controls and auditing
- Privacy compliance (GDPR, CCPA)
Enhanced mapping includes:
- Support for
sourcePath,lastModified, andmetadatafields - Improved text analysis with English stopwords
- Keyword fields for exact matching
-
Run the setup script:
./setup/start-partnership-agent.sh
-
Use the dedicated citation test script:
./setup/test-citations.sh
Start the console app and try these prompts that should generate rich citations:
- "What are the revenue sharing percentages for different partner tiers?"
- "What is the minimum payment threshold for revenue sharing?"
- "How often are revenue sharing payments made?"
- "What compliance documentation and audit requirements must partners follow?"
- "What is the minimum credit score requirement for partner verification?"
- "How often are compliance reviews conducted?"
- "What are the minimum performance standards partners must maintain?"
- "What customer satisfaction score is required?"
- "What is the minimum score required for platform certification?"
- "What is the termination notice period for partnerships?"
- "How many hours of ongoing education are required annually?"
- "What encryption standards are required for data protection?"
When the citation feature is working correctly, responses should include:
{
"answer": "Based on the relevant documents...",
"confidence_level": "high",
"source_documents": ["Revenue Sharing Guidelines", "Partnership Agreement Template"],
"citations": [
{
"document_id": "doc2",
"document_title": "Revenue Sharing Guidelines",
"category": "guidelines",
"excerpt": "Tier 1 (Strategic Partners): 30% of net revenue, paid monthly",
"start_position": 1450,
"end_position": 1502,
"relevance_score": 0.92,
"context_before": "Partner shares are distributed according to contribution tiers:",
"context_after": "- Tier 2 (Operational Partners): 20% of net revenue"
}
],
"has_complete_answer": true,
"follow_up_suggestions": [...]
}- Document Identification: Each citation includes document ID, title, and category
- Precise Text Excerpts: Exact text passages that support the answer
- Position Tracking: Character start/end positions for precise referencing
- Relevance Scoring: Confidence scores based on query/answer term matching
- Context Awareness: Before/after text for better understanding
- Multiple Sources: Citations from multiple documents when relevant
- No Citations Generated: Ensure Elasticsearch is running and documents are indexed
- Empty Response: Check that the FAQAgent is using the CitationService
- API Errors: Verify user secrets are set and services are registered
# Check Elasticsearch status
curl -s "http://localhost:9200/_cluster/health"
# Verify document count (should be 8)
curl -s "http://localhost:9200/partnership-documents/_count"
# Test direct search
curl -s "http://localhost:9200/partnership-documents/_search?q=revenue"The citation feature is now fully functional and integrated into the Partnership Agent. Users can:
- Ask detailed questions about partnership agreements, revenue sharing, compliance, etc.
- Receive precise citations showing exactly where information comes from
- Trust the responses with confidence scores and source verification
- Follow up with related questions based on suggestions
The enhanced document set provides comprehensive coverage of partnership scenarios and will generate meaningful citations for most business partnership questions.