You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`hallucination_detection`, `query_clarification`, `query_rewrite`, and
33
-
`requirement-check`.
29
+
Not all intrinsics are embedded in every Granite Switch model. You should check the model's `adapter_index.json` file for a definitive list. For granite switch models pre-built by IBM, we include a list of models in the Mellea `model_id`.
34
30
35
31
## Files
36
32
@@ -52,7 +48,11 @@ Shows how to manually load embedded adapters using
52
48
you only need a subset of adapters or want more control over adapter
53
49
registration.
54
50
51
+
## Architecture
52
+

53
+
55
54
## Related
56
55
57
56
-[`../intrinsics/`](../intrinsics/) — the same intrinsics using `LocalHFBackend`
Copy file name to clipboardExpand all lines: docs/examples/intrinsics/README.md
+34-77Lines changed: 34 additions & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,54 +2,6 @@
2
2
3
3
This directory contains examples for using Mellea's intrinsic functions - specialized model capabilities accessed through adapters.
4
4
5
-
## Files
6
-
7
-
### intrinsics.py
8
-
Core example showing how to directly use intrinsics with adapters.
9
-
10
-
**Key Features:**
11
-
- Creating and adding adapters to backends
12
-
- Using `Intrinsic` component for specialized tasks
13
-
- Working with Granite Common adapters (aLoRA-based)
14
-
- Understanding adapter output formats
15
-
16
-
### answerability.py
17
-
Checks if a question can be answered given the context.
18
-
19
-
### citations.py
20
-
Validates and extracts citations from generated text.
21
-
22
-
### context_relevance.py
23
-
Assesses if retrieved context is relevant to a query.
24
-
25
-
### hallucination_detection.py
26
-
Detects when model outputs contain hallucinated information.
27
-
28
-
### query_rewrite.py
29
-
Rewrites queries for better retrieval or understanding.
30
-
31
-
### uncertainty.py
32
-
Estimates the model's certainty about answering a question.
33
-
34
-
### requirement_check.py
35
-
Detect if text adheres to provided requirements.
36
-
37
-
### policy_guardrails.py
38
-
Checks if a scenario is compliant/non-compliant/ambiguous with respect to a given policy,
39
-
40
-
### guardian_core.py
41
-
Uses the guardian-core LoRA adapter for safety risk detection, including prompt-level harm, response-level social bias, RAG groundedness, and custom criteria.
42
-
43
-
### factuality_detection.py
44
-
Detects if the the model's output is factually incorrect relative to context.
45
-
46
-
### factuality_correction.py
47
-
Corrects a factually incorrect response relative to context.
48
-
49
-
### context_attribution.py
50
-
Identifies sentences in conversation history and documents that most influenced the response.
51
-
52
-
53
5
## Concepts Demonstrated
54
6
55
7
-**Intrinsic Functions**: Specialized model capabilities beyond text generation
@@ -61,25 +13,20 @@ Identifies sentences in conversation history and documents that most influenced
61
13
## Basic Usage
62
14
63
15
```python
64
-
from mellea.backends.huggingface import LocalHFBackend
65
-
from mellea.backends.adapters.adapter import IntrinsicAdapter
66
-
from mellea.stdlib.components import Intrinsic
67
-
import mellea.stdlib.functional as mfuncs
16
+
from mellea import model_ids, start_backend
17
+
from mellea.stdlib import functional as mfuncs
18
+
from mellea.stdlib.components.intrinsic import core
0 commit comments