Update README.md
Browse files
README.md
CHANGED
|
@@ -1,421 +1,97 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
- `intent.type`
|
| 8 |
- `intent.subtype`
|
| 9 |
- `intent.decision_phase`
|
| 10 |
- `iab_content`
|
| 11 |
-
- calibrated confidence
|
| 12 |
-
-
|
| 13 |
-
|
| 14 |
-
The repo is beyond the original v0.1 baseline. It now includes:
|
| 15 |
-
|
| 16 |
-
- shared config and label ownership
|
| 17 |
-
- reusable model runtime
|
| 18 |
-
- calibrated confidence and threshold gating
|
| 19 |
-
- combined inference with fallback/policy logic
|
| 20 |
-
- request/response validation in the demo API
|
| 21 |
-
- repeatable evaluation and regression suites
|
| 22 |
-
- full-TSV IAB taxonomy retrieval support through tier4
|
| 23 |
-
- a local embedding index for taxonomy-node retrieval over IAB content paths
|
| 24 |
-
- a separate synthetic full-intent-taxonomy augmentation dataset for non-IAB heads
|
| 25 |
-
- a dedicated intent-type difficulty dataset and held-out benchmark with `easy`, `medium`, and `hard` cases
|
| 26 |
-
- a dedicated decision-phase difficulty dataset and held-out benchmark with `easy`, `medium`, and `hard` cases
|
| 27 |
-
|
| 28 |
-
Generated model weights are intentionally not committed.
|
| 29 |
-
|
| 30 |
-
## Current Taxonomy
|
| 31 |
-
|
| 32 |
-
### `intent.type`
|
| 33 |
-
|
| 34 |
-
- `informational`
|
| 35 |
-
- `exploratory`
|
| 36 |
-
- `commercial`
|
| 37 |
-
- `transactional`
|
| 38 |
-
- `support`
|
| 39 |
-
- `personal_reflection`
|
| 40 |
-
- `creative_generation`
|
| 41 |
-
- `chit_chat`
|
| 42 |
-
- `ambiguous`
|
| 43 |
-
- `prohibited`
|
| 44 |
-
|
| 45 |
-
### `intent.decision_phase`
|
| 46 |
|
| 47 |
-
|
| 48 |
-
- `research`
|
| 49 |
-
- `consideration`
|
| 50 |
-
- `decision`
|
| 51 |
-
- `action`
|
| 52 |
-
- `post_purchase`
|
| 53 |
-
- `support`
|
| 54 |
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
- `product_discovery`
|
| 59 |
-
- `comparison`
|
| 60 |
-
- `evaluation`
|
| 61 |
-
- `deal_seeking`
|
| 62 |
-
- `provider_selection`
|
| 63 |
-
- `signup`
|
| 64 |
-
- `purchase`
|
| 65 |
-
- `booking`
|
| 66 |
-
- `download`
|
| 67 |
-
- `contact_sales`
|
| 68 |
-
- `task_execution`
|
| 69 |
-
- `onboarding_setup`
|
| 70 |
-
- `troubleshooting`
|
| 71 |
-
- `account_help`
|
| 72 |
-
- `billing_help`
|
| 73 |
-
- `follow_up`
|
| 74 |
-
- `emotional_reflection`
|
| 75 |
|
| 76 |
-
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
-
- retrieval output supports `tier1`, `tier2`, `tier3`, and optional `tier4`
|
| 80 |
|
| 81 |
-
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
- applies calibration artifacts when present
|
| 89 |
-
- computes `commercial_score`
|
| 90 |
-
- applies fallback when confidence is too weak or policy-safe blocking is required
|
| 91 |
-
- emits a schema-validated combined envelope
|
| 92 |
-
|
| 93 |
-
## What The System Does Not Do
|
| 94 |
-
|
| 95 |
-
- it is not a multi-turn memory system
|
| 96 |
-
- it is not a production-optimized low-latency serving path
|
| 97 |
-
- it is not yet trained on large real-traffic human-labeled intent data
|
| 98 |
-
- combined decision logic is still heuristic, even though it is materially stronger than the original baseline
|
| 99 |
-
|
| 100 |
-
## Project Layout
|
| 101 |
-
|
| 102 |
-
- [config.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/config.py): labels, thresholds, artifact paths, model paths
|
| 103 |
-
- [model_runtime.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/model_runtime.py): shared calibrated inference runtime
|
| 104 |
-
- [combined_inference.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/combined_inference.py): composed system response
|
| 105 |
-
- [inference_intent_type.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/inference_intent_type.py): direct `intent_type` inference entrypoint
|
| 106 |
-
- [inference_iab_classifier.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/inference_iab_classifier.py): direct supervised `iab_content` inference entrypoint
|
| 107 |
-
- [schemas.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/schemas.py): request/response validation
|
| 108 |
-
- [demo_api.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/demo_api.py): local validated API
|
| 109 |
-
- [iab_taxonomy.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/iab_taxonomy.py): full taxonomy parser/index
|
| 110 |
-
- [iab_classifier.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/iab_classifier.py): supervised IAB runtime with taxonomy-aware parent fallback
|
| 111 |
-
- [iab_retrieval.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/iab_retrieval.py): optional shadow retrieval baseline
|
| 112 |
-
- [training/build_full_intent_taxonomy_dataset.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/build_full_intent_taxonomy_dataset.py): separate synthetic intent augmentation dataset
|
| 113 |
-
- [training/build_intent_type_difficulty_dataset.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/build_intent_type_difficulty_dataset.py): extra `intent_type` augmentation plus held-out difficulty benchmark
|
| 114 |
-
- [training/build_decision_phase_difficulty_dataset.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/build_decision_phase_difficulty_dataset.py): extra `decision_phase` augmentation plus held-out difficulty benchmark
|
| 115 |
-
- [training/build_subtype_difficulty_dataset.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/build_subtype_difficulty_dataset.py): extra `intent_subtype` augmentation plus held-out difficulty benchmark
|
| 116 |
-
- [training/build_subtype_dataset.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/build_subtype_dataset.py): subtype dataset generation from existing corpora
|
| 117 |
-
- [training/train_iab.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/train_iab.py): train the supervised IAB classifier head
|
| 118 |
-
- [training/build_iab_taxonomy_embeddings.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/build_iab_taxonomy_embeddings.py): build local IAB node embedding artifacts
|
| 119 |
-
- [training/run_full_training_pipeline.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/training/run_full_training_pipeline.py): full multi-head training/calibration/eval pipeline
|
| 120 |
-
- [evaluation/run_evaluation.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/evaluation/run_evaluation.py): repeatable benchmark runner
|
| 121 |
-
- [evaluation/run_regression_suite.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/evaluation/run_regression_suite.py): known-failure regression runner
|
| 122 |
-
- [evaluation/run_iab_mapping_suite.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/evaluation/run_iab_mapping_suite.py): IAB behavior-lock regression runner
|
| 123 |
-
- [evaluation/run_iab_quality_suite.py](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/evaluation/run_iab_quality_suite.py): curated IAB quality-target runner
|
| 124 |
-
- [known_limitations.md](/Users/manikumargouni/Desktop/AdMesh/protocol/agentic-intent-classifier/known_limitations.md): current gaps and caveats
|
| 125 |
-
|
| 126 |
-
## Setup
|
| 127 |
-
|
| 128 |
-
```bash
|
| 129 |
-
python3 -m venv .venv
|
| 130 |
-
source .venv/bin/activate
|
| 131 |
-
pip install -r agentic-intent-classifier/requirements.txt
|
| 132 |
```
|
| 133 |
|
| 134 |
-
## Inference
|
| 135 |
-
|
| 136 |
-
Run one query locally:
|
| 137 |
-
|
| 138 |
```bash
|
| 139 |
-
cd
|
| 140 |
-
python3 training/
|
| 141 |
-
python3
|
| 142 |
-
python3 combined_inference.py "Which CRM should I buy for a 3-person startup?"
|
| 143 |
```
|
| 144 |
|
| 145 |
-
|
| 146 |
|
| 147 |
```bash
|
| 148 |
-
cd
|
| 149 |
-
python3 inference_intent_type.py "best shoes under 100"
|
| 150 |
-
```
|
| 151 |
-
|
| 152 |
-
Run the demo API:
|
| 153 |
-
|
| 154 |
-
```bash
|
| 155 |
-
cd agentic-intent-classifier
|
| 156 |
python3 demo_api.py
|
| 157 |
```
|
| 158 |
|
| 159 |
-
Example request:
|
| 160 |
-
|
| 161 |
```bash
|
| 162 |
curl -sS -X POST http://127.0.0.1:8008/classify \
|
| 163 |
-H 'Content-Type: application/json' \
|
| 164 |
-
-d '{"text":"I
|
| 165 |
-
```
|
| 166 |
-
|
| 167 |
-
Infra endpoints:
|
| 168 |
-
|
| 169 |
-
```bash
|
| 170 |
-
curl -sS http://127.0.0.1:8008/health
|
| 171 |
-
curl -sS http://127.0.0.1:8008/version
|
| 172 |
-
```
|
| 173 |
-
|
| 174 |
-
Train only the IAB classifier head:
|
| 175 |
-
|
| 176 |
-
```bash
|
| 177 |
-
cd agentic-intent-classifier
|
| 178 |
-
python3 training/train_iab.py
|
| 179 |
-
python3 training/calibrate_confidence.py --head iab_content
|
| 180 |
-
```
|
| 181 |
-
|
| 182 |
-
The online `iab_content` path now uses the compact supervised classifier. Retrieval is still available as an optional shadow baseline.
|
| 183 |
-
|
| 184 |
-
Build the optional retrieval shadow index:
|
| 185 |
-
|
| 186 |
-
```bash
|
| 187 |
-
cd agentic-intent-classifier
|
| 188 |
-
python3 training/build_iab_taxonomy_embeddings.py
|
| 189 |
-
```
|
| 190 |
-
|
| 191 |
-
By default the shadow retrieval path uses `Alibaba-NLP/gte-Qwen2-1.5B-instruct`. The retrieval runtime applies the model's query-side instruction format and last-token pooling, matching the Hugging Face usage guidance. If you want to point retrieval at a different embedding model, set `IAB_RETRIEVAL_MODEL_NAME_OVERRIDE` before building the index.
|
| 192 |
-
|
| 193 |
-
Open-source users can swap in their own embedding model, but the contract is:
|
| 194 |
-
|
| 195 |
-
- query embeddings and taxonomy-node embeddings must be produced by the same model and model revision
|
| 196 |
-
- after changing models, you must rebuild `artifacts/iab/taxonomy_embeddings.pt`
|
| 197 |
-
- the repository only tests and supports the default model path out of the box
|
| 198 |
-
- not every Hugging Face embedding model is drop-in compatible with this runtime; some require custom pooling, query instructions, or `trust_remote_code`
|
| 199 |
-
|
| 200 |
-
Example override:
|
| 201 |
-
|
| 202 |
-
```bash
|
| 203 |
-
cd agentic-intent-classifier
|
| 204 |
-
export IAB_RETRIEVAL_MODEL_NAME_OVERRIDE=mixedbread-ai/mxbai-embed-large-v1
|
| 205 |
-
python3 training/build_iab_taxonomy_embeddings.py
|
| 206 |
-
```
|
| 207 |
-
|
| 208 |
-
This writes:
|
| 209 |
-
|
| 210 |
-
- `artifacts/iab/taxonomy_nodes.json`
|
| 211 |
-
- `artifacts/iab/taxonomy_embeddings.pt`
|
| 212 |
-
|
| 213 |
-
## Training
|
| 214 |
-
|
| 215 |
-
### Full local pipeline
|
| 216 |
-
|
| 217 |
-
```bash
|
| 218 |
-
cd agentic-intent-classifier
|
| 219 |
-
python3 training/run_full_training_pipeline.py
|
| 220 |
-
```
|
| 221 |
-
|
| 222 |
-
This pipeline now does:
|
| 223 |
-
|
| 224 |
-
1. build separate full-intent-taxonomy augmentation data
|
| 225 |
-
2. build separate `intent_type` difficulty augmentation + benchmark
|
| 226 |
-
3. train `intent_type`
|
| 227 |
-
4. build subtype corpus
|
| 228 |
-
5. build separate `intent_subtype` difficulty augmentation + benchmark
|
| 229 |
-
6. train `intent_subtype`
|
| 230 |
-
7. build separate `decision_phase` difficulty augmentation + benchmark
|
| 231 |
-
8. train `decision_phase`
|
| 232 |
-
9. train `iab_content`
|
| 233 |
-
10. calibrate all classifier heads, including `iab_content`
|
| 234 |
-
11. run regression/evaluation unless `--skip-full-eval` is used
|
| 235 |
-
|
| 236 |
-
### Build datasets individually
|
| 237 |
-
|
| 238 |
-
Separate full-intent augmentation:
|
| 239 |
-
|
| 240 |
-
```bash
|
| 241 |
-
cd agentic-intent-classifier
|
| 242 |
-
python3 training/build_full_intent_taxonomy_dataset.py
|
| 243 |
-
```
|
| 244 |
-
|
| 245 |
-
Intent-type difficulty augmentation and benchmark:
|
| 246 |
-
|
| 247 |
-
```bash
|
| 248 |
-
cd agentic-intent-classifier
|
| 249 |
-
python3 training/build_intent_type_difficulty_dataset.py
|
| 250 |
-
```
|
| 251 |
-
|
| 252 |
-
Decision-phase difficulty augmentation and benchmark:
|
| 253 |
-
|
| 254 |
-
```bash
|
| 255 |
-
cd agentic-intent-classifier
|
| 256 |
-
python3 training/build_decision_phase_difficulty_dataset.py
|
| 257 |
-
```
|
| 258 |
-
|
| 259 |
-
Subtype difficulty augmentation and benchmark:
|
| 260 |
-
|
| 261 |
-
```bash
|
| 262 |
-
cd agentic-intent-classifier
|
| 263 |
-
python3 training/build_subtype_difficulty_dataset.py
|
| 264 |
```
|
| 265 |
|
| 266 |
-
|
| 267 |
|
| 268 |
-
```
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
```bash
|
| 276 |
-
cd agentic-intent-classifier
|
| 277 |
-
python3 training/build_iab_taxonomy_embeddings.py
|
| 278 |
-
```
|
| 279 |
-
|
| 280 |
-
### Train heads individually
|
| 281 |
-
|
| 282 |
-
```bash
|
| 283 |
-
cd agentic-intent-classifier
|
| 284 |
-
python3 training/train.py
|
| 285 |
-
python3 training/train_subtype.py
|
| 286 |
-
python3 training/train_decision_phase.py
|
| 287 |
-
```
|
| 288 |
-
|
| 289 |
-
### Calibration
|
| 290 |
-
|
| 291 |
-
```bash
|
| 292 |
-
cd agentic-intent-classifier
|
| 293 |
-
python3 training/calibrate_confidence.py --head intent_type
|
| 294 |
-
python3 training/calibrate_confidence.py --head intent_subtype
|
| 295 |
-
python3 training/calibrate_confidence.py --head decision_phase
|
| 296 |
-
```
|
| 297 |
-
|
| 298 |
-
## Evaluation
|
| 299 |
-
|
| 300 |
-
Full evaluation:
|
| 301 |
-
|
| 302 |
-
```bash
|
| 303 |
-
cd agentic-intent-classifier
|
| 304 |
-
python3 evaluation/run_evaluation.py
|
| 305 |
```
|
| 306 |
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
```bash
|
| 310 |
-
cd agentic-intent-classifier
|
| 311 |
-
python3 evaluation/run_regression_suite.py
|
| 312 |
-
```
|
| 313 |
-
|
| 314 |
-
IAB behavior-lock regression:
|
| 315 |
-
|
| 316 |
-
```bash
|
| 317 |
-
cd agentic-intent-classifier
|
| 318 |
-
python3 evaluation/run_iab_mapping_suite.py
|
| 319 |
-
```
|
| 320 |
-
|
| 321 |
-
IAB quality-target evaluation:
|
| 322 |
-
|
| 323 |
-
```bash
|
| 324 |
-
cd agentic-intent-classifier
|
| 325 |
-
python3 evaluation/run_iab_quality_suite.py
|
| 326 |
-
```
|
| 327 |
-
|
| 328 |
-
Threshold sweeps:
|
| 329 |
-
|
| 330 |
-
```bash
|
| 331 |
-
cd agentic-intent-classifier
|
| 332 |
-
python3 evaluation/sweep_intent_threshold.py
|
| 333 |
-
```
|
| 334 |
-
|
| 335 |
-
Artifacts are written to:
|
| 336 |
|
|
|
|
|
|
|
| 337 |
- `artifacts/calibration/`
|
| 338 |
-
- `artifacts/evaluation/latest/`
|
| 339 |
-
|
| 340 |
-
## Google Colab
|
| 341 |
-
|
| 342 |
-
Use Colab for the full retraining pass if local memory is limited.
|
| 343 |
-
|
| 344 |
-
Clone once:
|
| 345 |
-
|
| 346 |
-
```bash
|
| 347 |
-
%cd /content
|
| 348 |
-
!git clone https://github.com/GouniManikumar12/agentic-intent-classifier.git
|
| 349 |
-
%cd /content/agentic-intent-classifier
|
| 350 |
-
```
|
| 351 |
-
|
| 352 |
-
If the repo is already cloned and you want the latest code, pull manually:
|
| 353 |
-
|
| 354 |
-
```bash
|
| 355 |
-
!git pull origin main
|
| 356 |
-
```
|
| 357 |
-
|
| 358 |
-
Full pipeline:
|
| 359 |
-
|
| 360 |
-
```bash
|
| 361 |
-
!python training/run_full_training_pipeline.py
|
| 362 |
-
```
|
| 363 |
-
|
| 364 |
-
If full evaluation is too heavy for the current Colab runtime:
|
| 365 |
-
|
| 366 |
-
```bash
|
| 367 |
-
!python training/run_full_training_pipeline.py \
|
| 368 |
-
--iab-embedding-batch-size 32 \
|
| 369 |
-
--skip-full-eval
|
| 370 |
-
```
|
| 371 |
-
|
| 372 |
-
Then run eval separately after training:
|
| 373 |
-
|
| 374 |
-
```bash
|
| 375 |
-
!python evaluation/run_regression_suite.py
|
| 376 |
-
!python evaluation/run_iab_mapping_suite.py
|
| 377 |
-
!python evaluation/run_iab_quality_suite.py
|
| 378 |
-
!python evaluation/run_evaluation.py
|
| 379 |
-
```
|
| 380 |
-
|
| 381 |
-
## Current Saved Metrics
|
| 382 |
-
|
| 383 |
-
Generate fresh metrics with:
|
| 384 |
-
|
| 385 |
-
```bash
|
| 386 |
-
cd agentic-intent-classifier
|
| 387 |
-
python3 evaluation/run_evaluation.py
|
| 388 |
-
```
|
| 389 |
-
|
| 390 |
-
Do not treat any checked-in summary as canonical unless it was regenerated after the current code and artifacts were built. The IAB path is now retrieval-based, so older saved reports from the deleted hierarchy stack are not meaningful.
|
| 391 |
-
|
| 392 |
-
## Latency Note
|
| 393 |
-
|
| 394 |
-
`combined_inference.py` is a debugging/offline path, not a production latency path.
|
| 395 |
-
|
| 396 |
-
Current production truth:
|
| 397 |
-
|
| 398 |
-
- per-request CLI execution is not a sub-50ms architecture
|
| 399 |
-
- production serving should use a long-lived API process with preloaded models
|
| 400 |
-
- if sub-50ms becomes a hard requirement, the serving path will need:
|
| 401 |
-
- persistent loaded models
|
| 402 |
-
- runtime optimization
|
| 403 |
-
- likely fewer model passes or a shared multi-head model
|
| 404 |
-
|
| 405 |
-
## Current Status
|
| 406 |
-
|
| 407 |
-
Current repo status:
|
| 408 |
-
|
| 409 |
-
- full 10-class `intent.type` taxonomy is wired
|
| 410 |
-
- subtype and phase heads are present
|
| 411 |
-
- difficulty benchmarks are wired for `intent_type`, `intent_subtype`, and `decision_phase`
|
| 412 |
-
- full-TSV IAB taxonomy retrieval is wired through tier4
|
| 413 |
-
- separate full-intent augmentation dataset is in place
|
| 414 |
-
- evaluation/runtime memory handling is improved for large IAB splits
|
| 415 |
|
| 416 |
-
|
| 417 |
|
| 418 |
-
-
|
| 419 |
-
-
|
| 420 |
-
- confidence quality on borderline commercial queries
|
| 421 |
-
- real-traffic supervision beyond synthetic data
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-classification
|
| 6 |
+
base_model: distilbert-base-uncased
|
| 7 |
+
metrics:
|
| 8 |
+
- accuracy
|
| 9 |
+
- f1
|
| 10 |
+
tags:
|
| 11 |
+
- intent-classification
|
| 12 |
+
- multitask
|
| 13 |
+
- iab
|
| 14 |
+
- conversational-ai
|
| 15 |
+
- adtech
|
| 16 |
+
- calibrated-confidence
|
| 17 |
+
license: apache-2.0
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# admesh/agentic-intent-classifier
|
| 21 |
+
|
| 22 |
+
Production-ready intent + IAB classifier bundle for conversational traffic.
|
| 23 |
+
|
| 24 |
+
This package combines multitask intent modeling, supervised IAB classification, and confidence calibration to support safe monetization decisions in real time.
|
| 25 |
+
|
| 26 |
+
## What It Predicts
|
| 27 |
|
| 28 |
- `intent.type`
|
| 29 |
- `intent.subtype`
|
| 30 |
- `intent.decision_phase`
|
| 31 |
- `iab_content`
|
| 32 |
+
- per-head calibrated confidence
|
| 33 |
+
- fallback/policy/opportunity decision envelope
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
## Why It Is Useful
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
- Single package for intent, phase, subtype, and IAB routing
|
| 38 |
+
- Calibrated thresholds for safer downstream decisions
|
| 39 |
+
- Works out of the box with `combined_inference.py` and `demo_api.py`
|
| 40 |
+
- Easy local run, Colab run, or server integration
|
| 41 |
|
| 42 |
+
## Links
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
- Hugging Face model: https://huggingface.co/admesh/agentic-intent-classifier
|
| 45 |
+
- GitHub source: https://github.com/GouniManikumar12/agentic-intent-classifier
|
| 46 |
|
| 47 |
+
## Quick Start
|
|
|
|
| 48 |
|
| 49 |
+
```python
|
| 50 |
+
from huggingface_hub import snapshot_download
|
| 51 |
|
| 52 |
+
local_dir = snapshot_download(
|
| 53 |
+
repo_id="admesh/agentic-intent-classifier",
|
| 54 |
+
repo_type="model",
|
| 55 |
+
)
|
| 56 |
+
print(local_dir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
```
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
```bash
|
| 60 |
+
cd "<LOCAL_DIR_FROM_PRINT>"
|
| 61 |
+
python3 training/pipeline_verify.py
|
| 62 |
+
python3 combined_inference.py "Which laptop should I buy for college?"
|
|
|
|
| 63 |
```
|
| 64 |
|
| 65 |
+
## API Mode
|
| 66 |
|
| 67 |
```bash
|
| 68 |
+
cd "<LOCAL_DIR_FROM_PRINT>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
python3 demo_api.py
|
| 70 |
```
|
| 71 |
|
|
|
|
|
|
|
| 72 |
```bash
|
| 73 |
curl -sS -X POST http://127.0.0.1:8008/classify \
|
| 74 |
-H 'Content-Type: application/json' \
|
| 75 |
+
-d '{"text":"I need CRM for a 5 person startup"}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
```
|
| 77 |
|
| 78 |
+
## Reproducible Revision
|
| 79 |
|
| 80 |
+
```python
|
| 81 |
+
local_dir = snapshot_download(
|
| 82 |
+
repo_id="admesh/agentic-intent-classifier",
|
| 83 |
+
repo_type="model",
|
| 84 |
+
revision="0584798f8efee6beccd778b0afa06782ab5add60",
|
| 85 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
```
|
| 87 |
|
| 88 |
+
## Included Folders
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
+
- `multitask_intent_model_output/`
|
| 91 |
+
- `iab_classifier_model_output/`
|
| 92 |
- `artifacts/calibration/`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
## Notes
|
| 95 |
|
| 96 |
+
- Use the three folders above together for expected behavior.
|
| 97 |
+
- If integrating in production, prefer long-lived API processes with preloaded models.
|
|
|
|
|
|