import requests import json URL_EMBBED_ZH = "http://10.9.3.239:1999/api/v1/extract_feature_zh" URL_EMBBED_EN = "http://10.9.3.239:1999/api/v1/extract_feature_en" URL_EMBBED_BGE = "http://10.9.3.240:5045/api/v1/embedding" def embbeded_zh(text: list): try: r = requests.post(URL_EMBBED_ZH, data = json.dumps({ "text": text })) embs = r.json()["vectors"] return embs except Exception as ve: print(ve) return [] def embbeded_en(text: list): try: r = requests.post(URL_EMBBED_EN, data = json.dumps({ "text": text })) embs = r.json()["vectors"] return embs except Exception as ve: print(ve) return [] def embedded_bge(text: list): try: r = requests.post(URL_EMBBED_BGE, data = json.dumps({ "text": text })) embs = r.json()["embeddings"] return embs except Exception as ve: print(ve) return []