Update apis/chat_api.py
Browse files- apis/chat_api.py +2 -3
apis/chat_api.py
CHANGED
@@ -175,7 +175,7 @@ class ChatAPIApp:
|
|
175 |
data_response = streamer.chat_return_dict(stream_response)
|
176 |
return data_response
|
177 |
|
178 |
-
async def chat_embedding(texts, model_name, api_key):
|
179 |
api_url = f"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_name}"
|
180 |
headers = {"Authorization": f"Bearer {api_key}"}
|
181 |
response = requests.post(api_url, headers=headers, json={"inputs": texts})
|
@@ -186,9 +186,8 @@ class ChatAPIApp:
|
|
186 |
raise RuntimeError("The model is currently loading, please re-run the query.")
|
187 |
else:
|
188 |
raise RuntimeError("Unexpected response format.")
|
189 |
-
|
190 |
|
191 |
-
async def embedding(request: QueryRequest):
|
192 |
try:
|
193 |
for attempt in range(3): # Retry logic
|
194 |
try:
|
|
|
175 |
data_response = streamer.chat_return_dict(stream_response)
|
176 |
return data_response
|
177 |
|
178 |
+
async def chat_embedding(self, texts, model_name, api_key):
|
179 |
api_url = f"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_name}"
|
180 |
headers = {"Authorization": f"Bearer {api_key}"}
|
181 |
response = requests.post(api_url, headers=headers, json={"inputs": texts})
|
|
|
186 |
raise RuntimeError("The model is currently loading, please re-run the query.")
|
187 |
else:
|
188 |
raise RuntimeError("Unexpected response format.")
|
|
|
189 |
|
190 |
+
async def embedding(self, request: QueryRequest):
|
191 |
try:
|
192 |
for attempt in range(3): # Retry logic
|
193 |
try:
|