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
Copy file name to clipboardexpand all lines: docs/source/guide/prompts_examples.md
+74-16
Original file line number
Diff line number
Diff line change
@@ -11,19 +11,78 @@ section: Prompts
11
11
date: 2025-01-15 12:11:22
12
12
---
13
13
14
+
## Example project types
14
15
15
-
## Autolabel image captions
16
+
### Text classification
17
+
18
+
Text classification is the process of assigning predefined categories or labels to segments of text based on their content. This involves analyzing the text and determining which category or label best describes its subject, sentiment, or purpose. The goal is to organize and categorize textual data in a way that makes it easier to analyze, search, and utilize.
19
+
20
+
Text classification labeling tasks are fundamental in many applications, enabling efficient data organization, improving searchability, and providing valuable insights through data analysis. Some examples include:
21
+
22
+
***Spam Detection**: Classifying emails as "spam" or "ham" (not spam).
23
+
***Sentiment Analysis**: Categorizing user reviews as "positive," "negative," or "neutral."
24
+
***Topic Categorization**: Assigning articles to categories like "politics," "sports," "technology," etc.
25
+
***Support Ticket Classification**: Labeling customer support tickets based on the issue type, such as "billing," "technical support," or "account management."
26
+
***Content Moderation**: Identifying and labeling inappropriate content on social media platforms, such as "offensive language," "hate speech," or "harassment."
27
+
28
+
### Named entity recognition (NER)
29
+
30
+
A Named Entity Recognition (NER) labeling task involves identifying and classifying named entities within text. For example, people, organizations, locations, dates, and other proper nouns. The goal is to label these entities with predefined categories that make the text easier to analyze and understand. NER is commonly used in tasks like information extraction, text summarization, and content classification.
31
+
32
+
For example, in the sentence "Heidi Opossum goes grocery shopping at Aldi in Miami" the NER task would involve identifying "Aldi" as a place or organization, "Heidi Opossum" as a person (even though, to be precise, she is an iconic opossum), and "Miami" as a location. Once labeled, this structured data can be used for various purposes such as improving search functionality, organizing information, or training machine learning models for more complex natural language processing tasks.
33
+
34
+
NER labeling is crucial for industries such as finance, healthcare, and legal services, where accurate entity identification helps in extracting key information from large amounts of text, improving decision-making, and automating workflows.
35
+
36
+
Some examples include:
37
+
38
+
***News and Media Monitoring**: Media organizations use NER to automatically tag and categorize entities such as people, organizations, and locations in news articles. This helps in organizing news content, enabling efficient search and retrieval, and generating summaries or reports.
39
+
***Intelligence and Risk Analysis**: By extracting entities such as personal names, organizations, IP addresses, and financial transactions from suspicious activity reports or communications, organizations can better assess risks and detect fraud or criminal activity.
40
+
***Specialized Document Review**: Once trained, NER can help extract industry-specific key entities for better document review, searching, and classification.
41
+
***Customer Feedback and Product Review**: Extract named entities like product names, companies, or services from customer feedback or reviews. This allows businesses to categorize and analyze feedback based on specific products, people, or regions, helping them make data-driven improvements.
42
+
43
+
### Text summarization
44
+
45
+
Text summarization involves condensing large amounts of information into concise, meaningful summaries.
46
+
47
+
Models can be trained or fine-tuned to recognize essential information within a document and generate summaries that retain the core ideas while omitting less critical details. This capability is especially valuable in today’s information-heavy landscape, where professionals across various fields are often overwhelmed by the sheer volume of text data.
48
+
49
+
Some examples include:
50
+
51
+
***Customer Support and Feedback Analysis**: Companies receive vast volumes of customer support tickets, reviews, and feedback that are often repetitive or lengthy. Auto-labeling can help summarize these inputs, focusing on core issues or themes, such as “billing issues” or “technical support.”
52
+
***News Aggregation and Media Monitoring**: News organizations and media monitoring platforms need to process and distribute news stories efficiently. Auto-labeling can summarize articles while tagging them with labels like “politics,” “economy,” or “health,” making it easier for users to find relevant stories.
53
+
***Document Summarization**: Professionals often need to quickly understand the key points in lengthy contracts, research papers, and files.
54
+
***Educational Content Summarization**: EEducators and e-learning platforms need to distill complex material into accessible summaries for students. Auto-labeling can summarize key topics and categorize them under labels like “concept,” “example,” or “important fact.”
55
+
56
+
57
+
### Image captioning and classification
58
+
59
+
Image captioning involves applying descriptive text for images. This has valuable applications across industries, particularly where visual content needs to be systematically organized, analyzed, or made accessible.
60
+
61
+
You can also use Prompts to automatically categorizing images into predefined classes or categories, ensuring consistent labeling of large image datasets.
62
+
63
+
Some examples include:
64
+
65
+
***E-commerce Product Cataloging**: Online retailers often deal with thousands of product images that require captions describing their appearance, features, or categories.
66
+
67
+
***Digital Asset Management (DAM)**: Companies managing large libraries of images, such as marketing teams, media organizations, or creative agencies, can use auto-labeling to caption, tag, and classify their assets.
68
+
69
+
***Content Moderation and Analysis**: Platforms that host user-generated content can employ image captioning to analyze and describe uploaded visuals. This helps detect inappropriate content, categorize posts (e.g., "Outdoor landscape with a sunset"), and surface relevant content to users. You may also want to train a model to classify image uploads into categories such as “safe,” “explicit,” or “spam.”
70
+
71
+
***Accessibility for Visually Impaired Users**: Image captioning is essential for making digital content more accessible to visually impaired users by providing descriptive alt-text for images on websites, apps, or documents. For instance, an image of a cat playing with yarn might generate the caption, "A fluffy orange cat playing with a ball of blue yarn."
72
+
73
+
## Example Walkthroughs
74
+
75
+
### Autolabel image captions
16
76
17
77
This example demonstrates how to set up Prompts to predict image captions.
18
78
19
79
1.[Create a new label studio project](setup_project) by importing image data via [cloud storage](storage).
20
80
81
+
If you’d like to, you can generate a dataset to test the process using [https://data.heartex.net](https://data.heartex.net).
82
+
21
83
!!! note
22
84
Prompts does not currently support image data uploaded as raw images. Only image references (HTTP URIs to images) or images imported via cloud storage are supported.
23
85
24
-
!!! info Tip
25
-
If you’d like to, you can generate a dataset to test the process using [https://data.heartex.net](https://data.heartex.net).
26
-
27
86
2. Create a [label config](setup) for image captioning, for example:
28
87
29
88
```xml
@@ -36,7 +95,6 @@ This example demonstrates how to set up Prompts to predict image captions.
36
95
```
37
96
3. Navigate to **Prompts** from the sidebar, and [create a prompt](prompts_create) for the project
38
97
39
-
!!! note
40
98
If you have not yet set up API the keys you want to use, do that now: [API keys](prompts_create#Model-provider-API-keys).
41
99
42
100
4. Add the instruction you’d like to provide the LLM to caption your images. For example:
@@ -46,12 +104,12 @@ This example demonstrates how to set up Prompts to predict image captions.
46
104
!!! note
47
105
Ensure you include `{image}` in your instructions. Click `image` above the instruction field to insert it.
48
106
49
-

107
+

50
108
51
109
!!! info Tip
52
110
You can also automatically generate the instructions using the [**Enhance Prompt** action](prompts_draft#Enhance-prompt). Before you can use this action, you must at least add the variable name `{image}` and then click **Save**.
53
111
54
-

112
+

55
113
56
114
5. Run the prompt. View predictions to accept or correct.
57
115
@@ -60,18 +118,19 @@ This example demonstrates how to set up Prompts to predict image captions.
60
118
!!! info Tip
61
119
Use the drop-down menu above the results field to change the subset of data being used (e.g. only data with Ground Truth annotations, or a small sample of records).
62
120
63
-

121
+

64
122
65
123
6. Accept the [predictions as annotations](prompts_predictions#Create-annotations-from-predictions).
66
124
67
125
68
-
## Evaluate LLM outputs for toxicity
126
+
###Evaluate LLM outputs for toxicity
69
127
70
128
This example demonstrates how to set up Prompts to evaluate if the LLM-generated output text is classified as harmful, offensive, or inappropriate.
71
129
72
130
1.[Create a new label studio project](setup_project) by importing text data of LLM-generated outputs.
73
131
74
-
You can use this preprocessed sample of the [jigsaw_toxicity](https://huggingface.co/datasets/tasksource/jigsaw_toxicity) dataset as an example. See [the appendix](#Appendix-Generate-dataset) for how this was generated.
132
+
For example: you can use the [jigsaw_toxicity](https://huggingface.co/datasets/tasksource/jigsaw_toxicity) dataset as an example. See [the appendix](#Appendix-Generate-dataset) for how you can pre-process and (optionally) downsample this dataset to use with this guide.
133
+
75
134
2. Create a [label config](setup) for toxicity detection, for example:
76
135
77
136
```xml
@@ -117,7 +176,6 @@ This example demonstrates how to set up Prompts to evaluate if the LLM-generated
117
176
118
177
3. Navigate to **Prompts** from the sidebar, and [create a prompt](prompts_create) for the project
119
178
120
-
!!! note
121
179
If you have not yet set up API the keys you want to use, do that now: [API keys](prompts_create#Model-provider-API-keys).
122
180
123
181
4. Add the instruction you’d like to provide the LLM to best evaluate the text. For example:
@@ -134,12 +192,12 @@ This example demonstrates how to set up Prompts to evaluate if the LLM-generated
134
192
!!! note
135
193
Ensure you include `{comment_text}` in your instructions. Click `comment_text` above the instruction field to insert it.
136
194
137
-

195
+

138
196
139
197
!!! info Tip
140
198
You can also automatically generate the instructions using the [**Enhance Prompt** action](prompts_draft#Enhance-prompt). Before you can use this action, you must at least add the variable name `{comment_text}` and then click **Save**.
141
199
142
-

200
+

143
201
144
202
5. Run the prompt. View predictions to accept or correct.
145
203
@@ -148,11 +206,11 @@ This example demonstrates how to set up Prompts to evaluate if the LLM-generated
148
206
!!! info Tip
149
207
Use the drop-down menu above the results field to change the subset of data being used (e.g. only data with Ground Truth annotations, or a small sample of records).
150
208
151
-

209
+

152
210
153
211
6. Accept the [predictions as annotations](prompts_predictions#Create-annotations-from-predictions).
154
212
155
-
### Appendix: Generate dataset
213
+
### Appendix: Preprocess jigsaw toxicity dataset
156
214
157
215
Download the jigsaw_toxicity dataset, then downsample/format using the following script (modify the `INPUT_PATH` and `OUTPUT_PATH` to suit your needs):
158
216
@@ -200,4 +258,4 @@ with open(OUTPUT_PATH, "w") as f:
200
258
json.dump(label_studio_tasks, f)
201
259
```
202
260
203
-
If you choose to, you could also easily change how many records to use (or use the entire dataset by removing the sample step).
261
+
If you choose to, you could also easily change how many records to use (or use the entire dataset by removing the sample step).
Copy file name to clipboardexpand all lines: docs/source/guide/prompts_overview.md
-60
Original file line number
Diff line number
Diff line change
@@ -144,63 +144,3 @@ This feedback loop allows you to iteratively fine-tune your prompts, optimizing
144
144
145
145

146
146
147
-
148
-
## Example project types
149
-
150
-
### Text classification
151
-
152
-
Text classification is the process of assigning predefined categories or labels to segments of text based on their content. This involves analyzing the text and determining which category or label best describes its subject, sentiment, or purpose. The goal is to organize and categorize textual data in a way that makes it easier to analyze, search, and utilize.
153
-
154
-
Text classification labeling tasks are fundamental in many applications, enabling efficient data organization, improving searchability, and providing valuable insights through data analysis. Some examples include:
155
-
156
-
***Spam Detection**: Classifying emails as "spam" or "ham" (not spam).
157
-
***Sentiment Analysis**: Categorizing user reviews as "positive," "negative," or "neutral."
158
-
***Topic Categorization**: Assigning articles to categories like "politics," "sports," "technology," etc.
159
-
***Support Ticket Classification**: Labeling customer support tickets based on the issue type, such as "billing," "technical support," or "account management."
160
-
***Content Moderation**: Identifying and labeling inappropriate content on social media platforms, such as "offensive language," "hate speech," or "harassment."
161
-
162
-
### Named entity recognition (NER)
163
-
164
-
A Named Entity Recognition (NER) labeling task involves identifying and classifying named entities within text. For example, people, organizations, locations, dates, and other proper nouns. The goal is to label these entities with predefined categories that make the text easier to analyze and understand. NER is commonly used in tasks like information extraction, text summarization, and content classification.
165
-
166
-
For example, in the sentence "Heidi Opossum goes grocery shopping at Aldi in Miami" the NER task would involve identifying "Aldi" as a place or organization, "Heidi Opossum" as a person (even though, to be precise, she is an iconic opossum), and "Miami" as a location. Once labeled, this structured data can be used for various purposes such as improving search functionality, organizing information, or training machine learning models for more complex natural language processing tasks.
167
-
168
-
NER labeling is crucial for industries such as finance, healthcare, and legal services, where accurate entity identification helps in extracting key information from large amounts of text, improving decision-making, and automating workflows.
169
-
170
-
Some examples include:
171
-
172
-
***News and Media Monitoring**: Media organizations use NER to automatically tag and categorize entities such as people, organizations, and locations in news articles. This helps in organizing news content, enabling efficient search and retrieval, and generating summaries or reports.
173
-
***Intelligence and Risk Analysis**: By extracting entities such as personal names, organizations, IP addresses, and financial transactions from suspicious activity reports or communications, organizations can better assess risks and detect fraud or criminal activity.
174
-
***Specialized Document Review**: Once trained, NER can help extract industry-specific key entities for better document review, searching, and classification.
175
-
***Customer Feedback and Product Review**: Extract named entities like product names, companies, or services from customer feedback or reviews. This allows businesses to categorize and analyze feedback based on specific products, people, or regions, helping them make data-driven improvements.
176
-
177
-
### Text summarization
178
-
179
-
Text summarization involves condensing large amounts of information into concise, meaningful summaries.
180
-
181
-
Models can be trained or fine-tuned to recognize essential information within a document and generate summaries that retain the core ideas while omitting less critical details. This capability is especially valuable in today’s information-heavy landscape, where professionals across various fields are often overwhelmed by the sheer volume of text data.
182
-
183
-
Some examples include:
184
-
185
-
***Customer Support and Feedback Analysis**: Companies receive vast volumes of customer support tickets, reviews, and feedback that are often repetitive or lengthy. Auto-labeling can help summarize these inputs, focusing on core issues or themes, such as “billing issues” or “technical support.”
186
-
***News Aggregation and Media Monitoring**: News organizations and media monitoring platforms need to process and distribute news stories efficiently. Auto-labeling can summarize articles while tagging them with labels like “politics,” “economy,” or “health,” making it easier for users to find relevant stories.
187
-
***Document Summarization**: Professionals often need to quickly understand the key points in lengthy contracts, research papers, and files.
188
-
***Educational Content Summarization**: EEducators and e-learning platforms need to distill complex material into accessible summaries for students. Auto-labeling can summarize key topics and categorize them under labels like “concept,” “example,” or “important fact.”
189
-
190
-
191
-
### Image captioning and classification
192
-
193
-
Image captioning involves applying descriptive text for images. This has valuable applications across industries, particularly where visual content needs to be systematically organized, analyzed, or made accessible.
194
-
195
-
You can also use Prompts to automatically categorizing images into predefined classes or categories, ensuring consistent labeling of large image datasets.
196
-
197
-
Some examples include:
198
-
199
-
***E-commerce Product Cataloging**: Online retailers often deal with thousands of product images that require captions describing their appearance, features, or categories.
200
-
201
-
***Digital Asset Management (DAM)**: Companies managing large libraries of images, such as marketing teams, media organizations, or creative agencies, can use auto-labeling to caption, tag, and classify their assets.
202
-
203
-
***Content Moderation and Analysis**: Platforms that host user-generated content can employ image captioning to analyze and describe uploaded visuals. This helps detect inappropriate content, categorize posts (e.g., "Outdoor landscape with a sunset"), and surface relevant content to users. You may also want to train a model to classify image uploads into categories such as “safe,” “explicit,” or “spam.”
204
-
205
-
***Accessibility for Visually Impaired Users**: Image captioning is essential for making digital content more accessible to visually impaired users by providing descriptive alt-text for images on websites, apps, or documents. For instance, an image of a cat playing with yarn might generate the caption, "A fluffy orange cat playing with a ball of blue yarn."
0 commit comments