Update app.py
Browse files
app.py
CHANGED
|
@@ -2,32 +2,6 @@ from fastapi import FastAPI
|
|
| 2 |
from pydantic import BaseModel
|
| 3 |
from typing import Tuple, List
|
| 4 |
|
| 5 |
-
class RankingExecInfo:
|
| 6 |
-
def __init__(
|
| 7 |
-
self, prompt, response: str, input_token_count: int, output_token_count: int
|
| 8 |
-
):
|
| 9 |
-
self.prompt = prompt
|
| 10 |
-
self.response = response
|
| 11 |
-
self.input_token_count = input_token_count
|
| 12 |
-
self.output_token_count = output_token_count
|
| 13 |
-
|
| 14 |
-
def __repr__(self):
|
| 15 |
-
return str(self.__dict__)
|
| 16 |
-
|
| 17 |
-
class Result:
|
| 18 |
-
def __init__(
|
| 19 |
-
self,
|
| 20 |
-
query: str,
|
| 21 |
-
hits: List[Dict[str, Any]],
|
| 22 |
-
ranking_exec_summary: Optional[List[RankingExecInfo]] = None,
|
| 23 |
-
):
|
| 24 |
-
self.query = query
|
| 25 |
-
self.hits = hits
|
| 26 |
-
self.ranking_exec_summary = ranking_exec_summary
|
| 27 |
-
|
| 28 |
-
def __repr__(self):
|
| 29 |
-
return str(self.__dict__)
|
| 30 |
-
|
| 31 |
class RerankRequest(BaseModel):
|
| 32 |
query: str
|
| 33 |
hits: List(Tuple(int, str))
|
|
|
|
| 2 |
from pydantic import BaseModel
|
| 3 |
from typing import Tuple, List
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
class RerankRequest(BaseModel):
|
| 6 |
query: str
|
| 7 |
hits: List(Tuple(int, str))
|