Skip to content

Commit 33aed89

Browse files
docs: cleanlab style followon (#8436)
* update-for-style * Apply suggestions from code review Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com> * style-followon-and-remove-component * link * article --------- Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>
1 parent 2ad73df commit 33aed89

2 files changed

Lines changed: 89 additions & 86 deletions

File tree

docs/docs/Integrations/Cleanlab/integrations-cleanlab.md

Lines changed: 85 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -7,139 +7,142 @@ Unlock trustworthy Agentic, RAG, and LLM pipelines with Cleanlab's evaluation an
77

88
[Cleanlab](https://www.cleanlab.ai/) adds automation and trust to every data point going in and every prediction coming out of AI and RAG solutions.
99

10-
This Langflow integration provides 3 modular components that assess and improve the **trustworthiness** of any LLM or RAG pipeline output, enabling critical oversight for safety-sensitive, enterprise, and production GenAI applications.
10+
This Langflow integration provides three Langflow components that assess and improve the trustworthiness of any LLM or RAG pipeline output.
1111

12-
Use this bundle to:
13-
- Quantify trustworthiness of ANY LLM response with a **0-1 score**
14-
- Explain why a response may be good or bad
15-
- Evaluate **context sufficiency**, **groundedness**, **helpfulness**, and **query clarity** with quantitative scores (for RAG/Agentic pipelines with context)
16-
- Remediate low-trust responses with warnings or fallback answers
12+
Use the components in this bundle to quantify the trustworthiness of any LLM response with a score between `0` and `1`, and explain why a response may be good or bad. For RAG/Agentic pipelines with context, you can evaluate context sufficiency, groundedness, helpfulness, and query clarity with quantitative scores. Additionally, you can remediate low-trust responses with warnings or fallback answers.
1713

1814
## Prerequisites
1915

20-
Before using these components, you'll need:
16+
- [A Cleanlab API key](https://tlm.cleanlab.ai/)
2117

22-
- A [Cleanlab API key](https://tlm.cleanlab.ai/)
18+
## CleanlabEvaluator
2319

20+
This component evaluates and explains the trustworthiness of a prompt and response pair using Cleanlab. For more information on how the score works, see the [Cleanlab documentation](https://help.cleanlab.ai/tlm/).
2421

25-
## Components
22+
<details>
23+
<summary>Parameters</summary>
2624

27-
### `CleanlabEvaluator`
25+
**Inputs**
2826

29-
**Purpose:** Evaluate and explain the trustworthiness of a prompt + response pair using Cleanlab. More details on how the score works [here](https://help.cleanlab.ai/tlm/).
27+
| Name | Type | Description |
28+
|-------------------------|------------|-------------------------------------------------------------------------|
29+
| system_prompt | Message | The system message prepended to the prompt. Optional. |
30+
| prompt | Message | The user-facing input to the LLM. |
31+
| response | Message | The model's response to evaluate. |
32+
| cleanlab_api_key | Secret | Your Cleanlab API key. |
33+
| cleanlab_evaluation_model | Dropdown | Evaluation model used by Cleanlab, such as GPT-4 or Claude. This does not need to be the same model that generated the response. |
34+
| quality_preset | Dropdown | Tradeoff between evaluation speed and accuracy. |
3035

31-
#### Inputs
36+
**Outputs**
3237

33-
| Name | Type | Description |
34-
|-----------------------|------------|---------------------------------------------------------------------|
35-
| system_prompt | Message | (Optional) System message prepended to the prompt |
36-
| prompt | Message | The user-facing input to the LLM |
37-
| response | Message | OpenAI's, Claude, etc. model's response to evaluate |
38-
| cleanlab_api_key | Secret | Your Cleanlab API key |
39-
| cleanlab_evaluation_model | Dropdown | Evaluation model used by Cleanlab (GPT-4, Claude, etc.) This does not need to be the same model that generated the response. |
40-
| quality_preset | Dropdown | Tradeoff between evaluation speed and accuracy |
38+
| Name | Type | Description |
39+
|-------------------------|------------|-------------------------------------------------------------------------|
40+
| score | number | Displays the trust score between `0–1`. |
41+
| explanation | Message | Provides an explanation of the trust score. |
42+
| response | Message | Returns the original response for easy chaining to the `CleanlabRemediator` component. |
4143

42-
#### Outputs
44+
</details>
4345

44-
| Name | Type | Description |
45-
|-----------------------|------------|---------------------------------------------------------------------|
46-
| score | number | Trust score between 0–1 |
47-
| explanation | Message | Explanation of the trust score |
48-
| response | Message | Returns the original response for easy chaining to `CleanlabRemediator` component |
46+
## CleanlabRemediator
4947

50-
---
48+
This component uses the trust score from the [CleanlabEvaluator](#cleanlabevaluator) component to determine whether to show, warn about, or replace an LLM response. This component has configurables for the score threshold, warning text, and fallback message that you can customize as needed.
5149

52-
### `CleanlabRemediator`
50+
<details>
51+
<summary>Parameters</summary>
5352

54-
**Purpose:** Use the trust score from the `CleanlabEvaluator` component to determine whether to show, warn about, or replace an LLM response. This component has configurables for the score threshold, warning text, and fallback message which you can customize as needed.
53+
**Inputs**
5554

56-
#### Inputs
55+
| Name | Type | Description |
56+
|-----------------------------|------------|-------------------------------------------------------------------------|
57+
| response | Message | The response to potentially remediate. |
58+
| score | number | The trust score from `CleanlabEvaluator`. |
59+
| explanation | Message | The explanation to append if a warning is shown. Optional. |
60+
| threshold | float | The minimum trust score to pass a response unchanged. |
61+
| show_untrustworthy_response | bool | Whether to display or hide the original response with a warning if a response is deemed untrustworthy. |
62+
| untrustworthy_warning_text | Prompt | The warning text for untrustworthy responses. |
63+
| fallback_text | Prompt | The fallback message if the response is hidden. |
5764

58-
| Name | Type | Description |
59-
|-----------------------------|------------|-----------------------------------------------------------------------------|
60-
| response | Message | The response to potentially remediate |
61-
| score | number | Trust score from `CleanlabEvaluator` |
62-
| explanation | Message | (Optional) Explanation to append if warning is shown |
63-
| threshold | float | Minimum trust score to pass response unchanged |
64-
| show_untrustworthy_response| bool | Show original response with warning if untrustworthy |
65-
| untrustworthy_warning_text | Prompt | Warning text for untrustworthy responses |
66-
| fallback_text | Prompt | Fallback message if response is hidden |
65+
**Outputs**
6766

68-
#### Output
67+
| Name | Type | Description |
68+
|-------------------------|------------|-------------------------------------------------------------------------|
69+
| remediated_response | Message | The final message shown to user after remediation logic. |
6970

70-
| Name | Type | Description |
71-
|-----------------------|------------|-----------------------------------------------------------------------------|
72-
| remediated_response | Message | Final message shown to user after remediation logic |
71+
</details>
7372

73+
## CleanlabRAGEvaluator
7474

75-
See example outputs below!
75+
This component evaluates RAG and LLM pipeline outputs for trustworthiness, context sufficiency, response groundedness, helpfulness, and query ease. Learn more about Cleanlab's evaluation metrics [here](https://help.cleanlab.ai/tlm/use-cases/tlm_rag/).
7676

77-
---
77+
Additionally, use the [CleanlabRemediator](#cleanlabremediator) component with this component to remediate low-trust responses coming from the RAG pipeline.
7878

79-
### `CleanlabRAGEvaluator`
79+
<details>
80+
<summary>Parameters</summary>
8081

81-
**Purpose:** Comprehensively evaluate RAG and LLM pipeline outputs by analyzing the context, query, and response quality using Cleanlab. This component assesses trustworthiness, context sufficiency, response groundedness, helpfulness, and query ease. Learn more about Cleanlab's evaluation metrics [here](https://help.cleanlab.ai/tlm/use-cases/tlm_rag/). You can also use the `CleanlabRemediator` component with this one to remediate low-trust responses coming from the RAG pipeline.
82+
**Inputs**
8283

83-
#### Inputs
84+
| Name | Type | Description |
85+
|-----------------------------|------------|-------------------------------------------------------------------------|
86+
| cleanlab_api_key | Secret | Your Cleanlab API key. |
87+
| cleanlab_evaluation_model | Dropdown | Thevaluation model used by Cleanlab, such as GPT-4, or Claude. This does not need to be the same model that generated the response. |
88+
| quality_preset | Dropdown | The tradeoff between evaluation speed and accuracy. |
89+
| context | Message | The retrieved context from your RAG system. |
90+
| query | Message | The original user query. |
91+
| response | Message | The model's response based on the context and query. |
92+
| run_context_sufficiency | bool | Evaluate whether context supports answering the query. |
93+
| run_response_groundedness | bool | Evaluate whether the response is grounded in the context. |
94+
| run_response_helpfulness | bool | Evaluate how helpful the response is. |
95+
| run_query_ease | bool | Evaluate if the query is vague, complex, or adversarial. |
8496

85-
| Name | Type | Description |
86-
|--------------------------|-----------|----------------------------------------------------------------------------|
87-
| cleanlab_api_key | Secret | Your Cleanlab API key |
88-
| cleanlab_evaluation_model | Dropdown | Evaluation model used by Cleanlab (GPT-4, Claude, etc.) This does not need to be the same model that generated the response. |
89-
| quality_preset | Dropdown | Tradeoff between evaluation speed and accuracy |
90-
| context | Message | Retrieved context from your RAG system |
91-
| query | Message | The original user query |
92-
| response | Message | OpenAI's, Claude, etc. model's response based on the context and query |
93-
| run_context_sufficiency | bool | Evaluate whether context supports answering the query |
94-
| run_response_groundedness| bool | Evaluate whether the response is grounded in the context |
95-
| run_response_helpfulness | bool | Evaluate how helpful the response is |
96-
| run_query_ease | bool | Evaluate if the query is vague, complex, or adversarial |
97+
**Outputs**
9798

98-
#### Outputs
99+
| Name | Type | Description |
100+
|-------------------------|------------|-------------------------------------------------------------------------|
101+
| trust_score | number | The overall trust score. |
102+
| trust_explanation | Message | The explanation for the trust score. |
103+
| other_scores | dict | A dictionary of optional enabled RAG evaluation metrics. |
104+
| evaluation_summary | Message | A Markdown summary of query, context, response, and evaluation results. |
99105

100-
| Name | Type | Description |
101-
|-----------------------|------------|-----------------------------------------------------------------------------|
102-
| trust_score | number | Overall trust score |
103-
| trust_explanation | Message | Explanation for trust score |
104-
| other_scores | dict | Dictionary of optional enabled RAG evaluation metrics |
105-
| evaluation_summary | Message | Markdown summary of query, context, response, and evaluation results |
106+
</details>
106107

107-
---
108+
## Cleanlab component example flows
108109

109-
## Example Flows
110+
The following example flows show how to use the **CleanlabEvaluator** and **CleanlabRemediator** components to evaluate and remediate responses from any LLM, and how to use the `CleanlabRAGEvaluator` component to evaluate RAG pipeline outputs.
110111

111-
The following example flows show how to use the `CleanlabEvaluator` and `CleanlabRemediator` components to evaluate and remediate responses from any LLM, and how to use the `CleanlabRAGEvaluator` component to evaluate RAG pipeline outputs.
112+
### Evaluate and remediate responses from an LLM
112113

113-
### Evaluate and remediate responses from any LLM
114+
:::tip
115+
Optionally, [Download](./eval_and_remediate_cleanlab.json) the Evaluate and Remediate flow and follow along.
116+
:::
114117

115-
[Download](./eval_and_remediate_cleanlab.json) the flow to follow along!
116-
117-
This flow evaluates and remediates the trustworthiness of a response from any LLM using the `CleanlabEvaluator` and `CleanlabRemediator` components.
118+
This flow evaluates and remediates the trustworthiness of a response from any LLM using the **CleanlabEvaluator** and **CleanlabRemediator** components.
118119

119120
![Evaluate response trustworthiness](./eval_response.png)
120121

121-
Simply connect the `Message` output from any LLM component (like OpenAI, Anthropic, or Google) to the `response` input of the `CleanlabEvaluator` component, along with connecting your prompt to its `prompt` input.
122+
Connect the `Message` output from any LLM component to the `response` input of the **CleanlabEvaluator** component, and then connect the Prompt component to its `prompt` input.
122123

123-
That's it! The `CleanlabEvaluator` component will return a trust score and explanation which you can use however you'd like.
124+
The **CleanlabEvaluator** component returns a trust score and explanation from the flow.
124125

125-
The `CleanlabRemediator` component uses this trust score and user configurable settings to determine whether to output the original response, warn about it, or replace it with a fallback answer.
126+
The **CleanlabRemediator** component uses this trust score to determine whether to output the original response, warn about it, or replace it with a fallback answer.
126127

127-
The example below shows a response that was determined to be untrustworthy (score of .09) and flagged with a warning by the `CleanlabRemediator` component.
128+
This example shows a response that was determined to be untrustworthy (a score of `.09`) and flagged with a warning by the **CleanlabRemediator** component.
128129

129130
![CleanlabRemediator Example](./cleanlab_remediator_example.png)
130131

131-
If you don't want to show untrustworthy responses, you can also configure the `CleanlabRemediator` to replace the response with a fallback message.
132+
To hide untrustworthy responses, configure the **CleanlabRemediator** component to replace the response with a fallback message.
132133

133134
![CleanlabRemediator Example](./cleanlab_remediator_example_fallback.png)
134135

135136
### Evaluate RAG pipeline
136137

137-
The below flow is the `Vector Store RAG` example template, with the `CleanlabRAGEvaluator` component added to evaluate the context, query, and response. You can use the `CleanlabRAGEvaluator` with any flow that has a context, query, and response. Simply connect the `context`, `query`, and `response` outputs from any RAG pipeline to the `CleanlabRAGEvaluator` component.
138+
This example flow includes the [Vector Store RAG](/vector-store-rag) template with the **CleanlabRAGEvaluator** component added to evaluate the flow's context, query, and response.
139+
140+
To use the **CleanlabRAGEvaluator** component in a flow, connect the `context`, `query`, and `response` outputs from any RAG pipeline to the **CleanlabRAGEvaluator** component.
138141

139142
![Evaluate RAG pipeline](./eval_rag.png)
140143

141-
Here is an example of the `Evaluation Summary` output from the `CleanlabRAGEvaluator` component.
144+
Here is an example of the `Evaluation Summary` output from the **CleanlabRAGEvaluator** component.
142145

143146
![Evaluate RAG pipeline](./eval_summary_rag.png)
144147

145-
Notice how the `Evaluation Summary` includes the query, context, response, and all the evaluation results! In this example, the `Context Sufficiency` and `Response Groundedness` scores are low (0.002) because the context doesn't contain information about the query and the response is not grounded in the context.
148+
The `Evaluation Summary` includes the query, context, response, and all evaluation results. In this example, the `Context Sufficiency` and `Response Groundedness` scores are low (a score of `0.002`) because the context doesn't contain information about the query, and the response is not grounded in the context.

docs/sidebars.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ module.exports = {
240240
},
241241
{
242242
type: "doc",
243-
id: "Integrations/Composio/integrations-composio",
244-
label: "Composio",
243+
id: "Integrations/Cleanlab/integrations-cleanlab",
244+
label: "Cleanlab",
245245
},
246246
{
247247
type: "doc",
248-
id: "Integrations/Cleanlab/integrations-cleanlab",
249-
label: "Cleanlab",
248+
id: "Integrations/Composio/integrations-composio",
249+
label: "Composio",
250250
},
251251
{
252252
type: 'category',

0 commit comments

Comments
 (0)