Update handler.py
Browse files- handler.py +17 -17
handler.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
|
| 3 |
-
class EndpointHandler:
|
| 4 |
-
def __init__(self, path=""):
|
| 5 |
-
self.api_url = "http://
|
| 6 |
-
self.headers = {"Content-Type": "application/json"}
|
| 7 |
-
|
| 8 |
-
def __call__(self, data):
|
| 9 |
-
prompt = data.get("inputs", "")
|
| 10 |
-
payload = {
|
| 11 |
-
"model": "TanyaVM/MistralAWQ2",
|
| 12 |
-
"prompt": prompt,
|
| 13 |
-
"max_tokens": 1500,
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
response = requests.post(self.api_url, json=payload, headers=self.headers)
|
| 17 |
-
result = response.json()
|
| 18 |
return result
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
class EndpointHandler:
|
| 4 |
+
def __init__(self, path=""):
|
| 5 |
+
self.api_url = "http://vllm_generate/v1/completions"
|
| 6 |
+
self.headers = {"Content-Type": "application/json"}
|
| 7 |
+
|
| 8 |
+
def __call__(self, data):
|
| 9 |
+
prompt = data.get("inputs", "")
|
| 10 |
+
payload = {
|
| 11 |
+
"model": "TanyaVM/MistralAWQ2",
|
| 12 |
+
"prompt": prompt,
|
| 13 |
+
"max_tokens": 1500,
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
response = requests.post(self.api_url, json=payload, headers=self.headers)
|
| 17 |
+
result = response.json()
|
| 18 |
return result
|