Spaces:
Running
on
Zero
Running
on
Zero
Bellok
commited on
Commit
Β·
2d1bbbf
1
Parent(s):
25bfc9e
feat: Integrate ConflictDetector into RetrievalAPI
Browse files- Add import and initialization of ConflictDetector ('Bob the Skeptic') for conflict detection
- Incorporate conflict_detector into RetrievalAPI constructor
- Update retrieval examples with adjusted use_hybrid flags and added labels for better demo clarity
app.py
CHANGED
|
@@ -21,6 +21,7 @@ from warbler_cda.embeddings import EmbeddingProviderFactory
|
|
| 21 |
from warbler_cda.fractalstat_rag_bridge import FractalStatRAGBridge
|
| 22 |
from warbler_cda.semantic_anchors import SemanticAnchorGraph
|
| 23 |
from warbler_cda.pack_loader import PackLoader
|
|
|
|
| 24 |
|
| 25 |
# Initialize the system
|
| 26 |
print("π Initializing Warbler CDA...")
|
|
@@ -43,14 +44,19 @@ print("βοΈ Initializing FractalStat bridge...")
|
|
| 43 |
fractalstat_bridge = FractalStatRAGBridge()
|
| 44 |
print("β
FractalStat bridge initialized")
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
print("βοΈ Creating RetrievalAPI...")
|
| 47 |
api = RetrievalAPI(
|
| 48 |
semantic_anchors=semantic_anchors,
|
| 49 |
embedding_provider=embedding_provider,
|
| 50 |
fractalstat_bridge=fractalstat_bridge,
|
|
|
|
| 51 |
config={"enable_fractalstat_hybrid": True}
|
| 52 |
)
|
| 53 |
-
print("β
RetrievalAPI initialized")
|
| 54 |
|
| 55 |
# Load packs
|
| 56 |
print("π Loading Warbler packs...")
|
|
@@ -508,11 +514,13 @@ with gr.Blocks(title="Warbler CDA - FractalStat RAG") as demo:
|
|
| 508 |
|
| 509 |
gr.Examples(
|
| 510 |
examples=[
|
| 511 |
-
["hello world", 5,
|
| 512 |
-
["rotation dynamics of Saturn's moons", 5, True],
|
| 513 |
-
["
|
|
|
|
| 514 |
],
|
| 515 |
-
inputs=[query_input, max_results, use_hybrid]
|
|
|
|
| 516 |
)
|
| 517 |
|
| 518 |
with gr.Tab("System Stats"):
|
|
|
|
| 21 |
from warbler_cda.fractalstat_rag_bridge import FractalStatRAGBridge
|
| 22 |
from warbler_cda.semantic_anchors import SemanticAnchorGraph
|
| 23 |
from warbler_cda.pack_loader import PackLoader
|
| 24 |
+
from warbler_cda.conflict_detector import ConflictDetector # Add Bob the Skeptic
|
| 25 |
|
| 26 |
# Initialize the system
|
| 27 |
print("π Initializing Warbler CDA...")
|
|
|
|
| 44 |
fractalstat_bridge = FractalStatRAGBridge()
|
| 45 |
print("β
FractalStat bridge initialized")
|
| 46 |
|
| 47 |
+
print("π΅οΈ Initializing Bob the Skeptic (conflict detector)...")
|
| 48 |
+
bob_the_skeptic = ConflictDetector(embedding_provider=embedding_provider)
|
| 49 |
+
print("β
Bob the Skeptic initialized")
|
| 50 |
+
|
| 51 |
print("βοΈ Creating RetrievalAPI...")
|
| 52 |
api = RetrievalAPI(
|
| 53 |
semantic_anchors=semantic_anchors,
|
| 54 |
embedding_provider=embedding_provider,
|
| 55 |
fractalstat_bridge=fractalstat_bridge,
|
| 56 |
+
conflict_detector=bob_the_skeptic,
|
| 57 |
config={"enable_fractalstat_hybrid": True}
|
| 58 |
)
|
| 59 |
+
print("β
RetrievalAPI initialized with Bob the Skeptic")
|
| 60 |
|
| 61 |
# Load packs
|
| 62 |
print("π Loading Warbler packs...")
|
|
|
|
| 514 |
|
| 515 |
gr.Examples(
|
| 516 |
examples=[
|
| 517 |
+
["hello world", 5, False], # Semantic search for plain English
|
| 518 |
+
["rotation dynamics of Saturn's moons", 5, True], # Hybrid for technical/scientific
|
| 519 |
+
["dancing under the moon", 5, False], # Semantic for casual queries
|
| 520 |
+
["interplanetary approach maneuvers", 5, True], # Hybrid for scientific terms
|
| 521 |
],
|
| 522 |
+
inputs=[query_input, max_results, use_hybrid],
|
| 523 |
+
labels=["Plain English", "Scientific/Technical", "Casual Search", "Technical Query"]
|
| 524 |
)
|
| 525 |
|
| 526 |
with gr.Tab("System Stats"):
|