stephenlb commited on
Commit
e112dc9
·
verified ·
1 Parent(s): 6a4ff03

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md CHANGED
@@ -94,6 +94,22 @@ pipe({
94
 
95
  Optional `criteria` overrides the yes/no wording: `{"true": "...", "false": "..."}`.
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  ### `choice`: pick one option
98
 
99
  `criteria` maps each option label to a description. You get the top label,
@@ -120,6 +136,30 @@ pipe({
120
  # "confidence": 0.984}}
121
  ```
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  ### `score`: ordered scale
124
 
125
  `criteria` is an ordered list of levels (lowest first, 2 to 26 levels). `score`
@@ -146,6 +186,27 @@ pipe({
146
  # "probabilities": {"0": 0.0018, "1": 0.0542, "2": 0.9440}, "confidence": 0.796}
147
  ```
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  ### Mixing types in one call
150
 
151
  All questions in a call see the same `state` and run in one batched forward
 
94
 
95
  Optional `criteria` overrides the yes/no wording: `{"true": "...", "false": "..."}`.
96
 
97
+ Another text, different questions: tone and content checks.
98
+
99
+ ```python
100
+ pipe({
101
+ "state": "Thanks so much for the quick help, the new dashboard looks great!",
102
+ "questions": {
103
+ "polite": {"type": "noul", "instructions": "Is the text polite?"},
104
+ "complaint": {"type": "noul", "instructions": "Does the text contain a complaint?"},
105
+ "question": {"type": "noul", "instructions": "Does the text ask a question?"},
106
+ },
107
+ })["answers"]
108
+ # {"polite": {"type": "noul", "noul": 0.9991},
109
+ # "complaint": {"type": "noul", "noul": 0.0009},
110
+ # "question": {"type": "noul", "noul": 0.0080}}
111
+ ```
112
+
113
  ### `choice`: pick one option
114
 
115
  `criteria` maps each option label to a description. You get the top label,
 
136
  # "confidence": 0.984}}
137
  ```
138
 
139
+ Intent classification with four options:
140
+
141
+ ```python
142
+ pipe({
143
+ "state": "Can you add a dark mode to the mobile app? My eyes hurt at night.",
144
+ "questions": {
145
+ "intent": {
146
+ "type": "choice",
147
+ "instructions": "What is the intent of the message?",
148
+ "criteria": {
149
+ "bug_report": "Something is broken or not working as expected",
150
+ "feature_request": "Asks for new functionality or an improvement",
151
+ "praise": "Compliments or thanks",
152
+ "question": "Asks how to do something",
153
+ },
154
+ },
155
+ },
156
+ })["answers"]
157
+ # {"intent": {"type": "choice", "choice": "feature_request",
158
+ # "probabilities": {"feature_request": 0.9781, "bug_report": 0.0094,
159
+ # "question": 0.0079, "praise": 0.0046},
160
+ # "confidence": 0.907}}
161
+ ```
162
+
163
  ### `score`: ordered scale
164
 
165
  `criteria` is an ordered list of levels (lowest first, 2 to 26 levels). `score`
 
186
  # "probabilities": {"0": 0.0018, "1": 0.0542, "2": 0.9440}, "confidence": 0.796}
187
  ```
188
 
189
+ A five-point scale on mixed feedback. The distribution is spread out, so
190
+ `score` lands between levels and `confidence` is low:
191
+
192
+ ```python
193
+ pipe({
194
+ "state": "The delivery was two days late, the box was dented, but the product itself works fine.",
195
+ "questions": {
196
+ "satisfaction": {
197
+ "type": "score",
198
+ "instructions": "How satisfied is the customer overall?",
199
+ "criteria": ["Very dissatisfied", "Dissatisfied", "Neutral", "Satisfied", "Very satisfied"],
200
+ },
201
+ },
202
+ })["answers"]["satisfaction"]
203
+ # {"type": "score", "score": 1.408,
204
+ # "legend": {"0": "Very dissatisfied", "1": "Dissatisfied", "2": "Neutral",
205
+ # "3": "Satisfied", "4": "Very satisfied"},
206
+ # "probabilities": {"0": 0.1144, "1": 0.5705, "2": 0.1635, "3": 0.0957, "4": 0.0560},
207
+ # "confidence": 0.223}
208
+ ```
209
+
210
  ### Mixing types in one call
211
 
212
  All questions in a call see the same `state` and run in one batched forward