Enhance SaveInput model with Literal type for model_type and add confidence_score field
Browse files- main.py +2 -1
- 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:
|
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 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
<h4>Flutter Implementation:</h4>
|
229 |
<pre><code class="language-dart">class SaveInput {
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
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 |
|