Spaces:
Runtime error
Runtime error
Fixed THREE critical issues:
Browse filesIssue 1: Content Truncation β
FIXED
- Problem: Only 200 chars preview returned
- Fix: Modified confluence_loader to return full content
Issue 2: Wrong Pages Loaded β
FIXED
- Problem: Tool loaded random 3 pages, might miss the target page
- Fix: Added page_title parameter for specific page filtering
Issue 3: HTML Processor Bug β
FIXED (This was the root cause
- Problem: Buggy _extract_structured_text method only extracted 77 chars out of 49,319
- Fix: Rewrote to use recursive processing instead of flawed soup.descendants iteration
- Result: Now extracts 13,360 chars (173x improvement)
- app_with_confluence.py +17 -6
app_with_confluence.py
CHANGED
|
@@ -370,9 +370,12 @@ When answering questions:
|
|
| 370 |
**CRITICAL: How to Handle Confluence Information Requests**
|
| 371 |
|
| 372 |
When users ask you to "report", "list", "find", "show", or "provide" specific information from documents:
|
| 373 |
-
1. **FIRST**: Use the confluence_search tool to find the relevant document
|
| 374 |
-
2. **SECOND**: Use the confluence_loader tool to load
|
| 375 |
-
|
|
|
|
|
|
|
|
|
|
| 376 |
4. **FOURTH**: Provide the Confluence page citation/link as a reference for verification
|
| 377 |
|
| 378 |
**DO NOT** simply provide a link to a page without extracting the information first.
|
|
@@ -380,11 +383,19 @@ The user needs the actual information in your response, not just a pointer to wh
|
|
| 380 |
|
| 381 |
**Example of CORRECT behavior:**
|
| 382 |
- User asks: "Report models and corresponding versions found in the fraud-model-governance document"
|
| 383 |
-
- You should:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
|
| 385 |
**Example of INCORRECT behavior:**
|
| 386 |
- User asks: "Report models and corresponding versions found in the fraud-model-governance document"
|
| 387 |
-
- You should NOT:
|
|
|
|
|
|
|
|
|
|
| 388 |
|
| 389 |
**When to Use Confluence Tools:**
|
| 390 |
- **For compliance questions**: ALWAYS search for relevant policy documentation, extract key policies, then cite sources
|
|
@@ -426,7 +437,7 @@ def create_enhanced_agent_phase3():
|
|
| 426 |
|
| 427 |
# Create Confluence tools
|
| 428 |
search_confluence = create_confluence_search_tool(rag=rag, k=5)
|
| 429 |
-
load_confluence_page = create_confluence_loader_tool(max_pages=
|
| 430 |
|
| 431 |
# Add all tools
|
| 432 |
tools = [
|
|
|
|
| 370 |
**CRITICAL: How to Handle Confluence Information Requests**
|
| 371 |
|
| 372 |
When users ask you to "report", "list", "find", "show", or "provide" specific information from documents:
|
| 373 |
+
1. **FIRST**: Use the confluence_search tool to find the relevant document and identify its title
|
| 374 |
+
2. **SECOND**: Use the confluence_loader tool with BOTH space_key AND page_title parameters to load that specific page
|
| 375 |
+
- Example: `confluence_loader(space_key="Acquisitio", page_title="fraud-model-governance")`
|
| 376 |
+
- ALWAYS provide the page_title parameter when you know which specific page to load
|
| 377 |
+
- This ensures you get the exact page content, not random pages from the space
|
| 378 |
+
3. **THIRD**: Extract and present the requested information directly in your response from the loaded content
|
| 379 |
4. **FOURTH**: Provide the Confluence page citation/link as a reference for verification
|
| 380 |
|
| 381 |
**DO NOT** simply provide a link to a page without extracting the information first.
|
|
|
|
| 383 |
|
| 384 |
**Example of CORRECT behavior:**
|
| 385 |
- User asks: "Report models and corresponding versions found in the fraud-model-governance document"
|
| 386 |
+
- You should:
|
| 387 |
+
1. Search: `confluence_search("fraud model governance")` β finds page titled "fraud-model-governance"
|
| 388 |
+
2. Load: `confluence_loader(space_key="Acquisitio", page_title="fraud-model-governance")` β loads FULL page
|
| 389 |
+
3. Extract the model inventory table from the loaded content
|
| 390 |
+
4. Present the models and versions in a formatted list
|
| 391 |
+
5. Provide the page link for reference
|
| 392 |
|
| 393 |
**Example of INCORRECT behavior:**
|
| 394 |
- User asks: "Report models and corresponding versions found in the fraud-model-governance document"
|
| 395 |
+
- You should NOT:
|
| 396 |
+
- Search for the document β Provide only a link without extracting
|
| 397 |
+
- Load random pages without specifying page_title β Get wrong pages
|
| 398 |
+
- Hallucinate model names that aren't in the actual document
|
| 399 |
|
| 400 |
**When to Use Confluence Tools:**
|
| 401 |
- **For compliance questions**: ALWAYS search for relevant policy documentation, extract key policies, then cite sources
|
|
|
|
| 437 |
|
| 438 |
# Create Confluence tools
|
| 439 |
search_confluence = create_confluence_search_tool(rag=rag, k=5)
|
| 440 |
+
load_confluence_page = create_confluence_loader_tool(max_pages=10) # Increased to ensure all pages available for filtering
|
| 441 |
|
| 442 |
# Add all tools
|
| 443 |
tools = [
|