eli02 commited on
Commit
5317411
·
1 Parent(s): 811aa4a

Enhance SaveInput model with Literal type for model_type and add confidence_score field

Browse files
Files changed (2) hide show
  1. main.py +2 -1
  2. static/index.html +54 -42
main.py CHANGED
@@ -63,8 +63,9 @@ class SaveInput(BaseModel):
63
  username: str
64
  query: str
65
  retrieved_text: str
66
- model_type: str
67
  reaction: str
 
68
 
69
  class SaveBatchInput(BaseModel):
70
  items: List[SaveInput]
 
63
  username: str
64
  query: str
65
  retrieved_text: str
66
+ model_type: Literal["WhereIsAI_UAE_Large_V1", "BAAI_bge_large_en_v1.5"]
67
  reaction: str
68
+ confidence_score: float
69
 
70
  class SaveBatchInput(BaseModel):
71
  items: List[SaveInput]
static/index.html CHANGED
@@ -210,51 +210,63 @@ class LoginResponse {
210
 
211
  <h4>cURL Request:</h4>
212
  <pre><code class="language-bash">curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/save \
213
- -H "Content-Type: application/json" \
214
- -H "Authorization: Bearer your-access-token" \
215
- -d '{
216
- "items": [
217
- {
218
- "user_type": "user",
219
- "username": "user123",
220
- "query": "test query",
221
- "retrieved_text": "Result 1 text",
222
- "model_type": "all-mpnet-base-v2",
223
- "reaction": "positive"
224
- }
225
- ]
226
- }'</code></pre>
 
 
 
 
 
 
 
 
 
 
227
 
228
  <h4>Flutter Implementation:</h4>
229
  <pre><code class="language-dart">class SaveInput {
230
- final String userType;
231
- final String username;
232
- final String query;
233
- final String retrievedText;
234
- final String modelType;
235
- final String reaction;
236
-
237
- SaveInput({
238
- required this.userType,
239
- required this.username,
240
- required this.query,
241
- required this.retrievedText,
242
- required this.modelType,
243
- required this.reaction,
244
- });
245
-
246
- Map<String, dynamic> toJson() {
247
- return {
248
- 'user_type': userType,
249
- 'username': username,
250
- 'query': query,
251
- 'retrieved_text': retrievedText,
252
- 'model_type': modelType,
253
- 'reaction': reaction,
254
- };
255
- }
256
- }
257
-
 
 
258
  Future<void> saveData(List<SaveInput> items, String accessToken) async {
259
  final url = Uri.parse('https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/save');
260
 
 
210
 
211
  <h4>cURL Request:</h4>
212
  <pre><code class="language-bash">curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/save \
213
+ -H "Content-Type: application/json" \
214
+ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
215
+ -d '{
216
+ "items": [
217
+ {
218
+ "user_type": "user",
219
+ "username": "user1332",
220
+ "query": "What is the seventh test of lovers of God?",
221
+ "retrieved_text": "The seventh test is that lovers of God will love those who obey Him and hate the infidels and the disobedient...",
222
+ "model_type": "WhereIsAI/UAE-Large-V1",
223
+ "reaction": "positive",
224
+ "confidence_score": 0.95
225
+ },
226
+ {
227
+ "user_type": "user",
228
+ "username": "user1332",
229
+ "query": "What is the seventh test of lovers of God?",
230
+ "retrieved_text": "The seventh test is that lovers of God will love those who obey Him and hate the infidels and the disobedient...",
231
+ "model_type": "BAAI/bge-large-en-v1.5",
232
+ "reaction": "positive",
233
+ "confidence_score": 0.92
234
+ }
235
+ ]
236
+ }'</code></pre>
237
 
238
  <h4>Flutter Implementation:</h4>
239
  <pre><code class="language-dart">class SaveInput {
240
+ final String userType;
241
+ final String username;
242
+ final String query;
243
+ final String retrievedText;
244
+ final String modelType;
245
+ final String reaction;
246
+ final double? confidenceScore;
247
+
248
+ SaveInput({
249
+ required this.userType,
250
+ required this.username,
251
+ required this.query,
252
+ required this.retrievedText,
253
+ required this.modelType,
254
+ required this.reaction,
255
+ this.confidenceScore,
256
+ });
257
+
258
+ Map<String, dynamic> toJson() {
259
+ return {
260
+ 'user_type': userType,
261
+ 'username': username,
262
+ 'query': query,
263
+ 'retrieved_text': retrievedText,
264
+ 'model_type': modelType,
265
+ 'reaction': reaction,
266
+ 'confidence_score': confidenceScore,
267
+ };
268
+ }
269
+ }
270
  Future<void> saveData(List<SaveInput> items, String accessToken) async {
271
  final url = Uri.parse('https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/save');
272