Spaces:
Running
Running
File size: 1,414 Bytes
1c6c5d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
import os
from common.base.api_base_async import BaseAsyncAPI
from common.base.api_base import BaseAPI
class RfpRecommend(BaseAPI):
def __init__(self):
super().__init__(
url=os.getenv("RFP_RECOMMENDATION_URL"),
headers={"x-api-key": os.getenv("RFP_RECOMMENDATION_API_KEY")},
total_retries=5,
backoff_factor=10
)
def __call__(self, candid_entity_id: int):
results = self.get(candid_entity_id=candid_entity_id)
return results
class Inferencing(BaseAsyncAPI):
def __init__(self):
super().__init__(
url=os.getenv("AUTOCODING_API_URL"),
headers={"x-api-key": os.getenv("AUTOCODING_API_KEY")}
)
async def __call__(self, text: str, taxonomy: str = "pcs",
chunk: bool = False, high_precision: bool = False
):
result = self.post(payload={
"text": text,
"taxonomy": taxonomy,
"chunk": chunk,
"high_precision": high_precision
})
return result
class Entities(BaseAsyncAPI):
def __init__(self):
super().__init__(
url=os.getenv("DOCUMENT_API_URL").replace("/analyze", "/entities"),
headers={"x-api-key": os.getenv("DOCUMENT_API_KEY")}
)
async def __call__(self, text: str):
result = self.post(payload={"text": text})
return result
|