Update apis/chat_api.py
Browse files- apis/chat_api.py +2 -2
apis/chat_api.py
CHANGED
|
@@ -187,7 +187,7 @@ class ChatAPIApp:
|
|
| 187 |
data_response = streamer.chat_return_dict(stream_response)
|
| 188 |
return data_response
|
| 189 |
|
| 190 |
-
async def chat_embedding(self, input, model_name, api_key
|
| 191 |
api_url = f"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_name}"
|
| 192 |
headers = {"Authorization": f"Bearer {api_key}"}
|
| 193 |
response = requests.post(api_url, headers=headers, json={"inputs": input})
|
|
@@ -202,7 +202,7 @@ class ChatAPIApp:
|
|
| 202 |
raise RuntimeError("Unexpected response format.")
|
| 203 |
|
| 204 |
|
| 205 |
-
async def embedding(self, request: QueryRequest):
|
| 206 |
try:
|
| 207 |
for attempt in range(3): # Retry logic
|
| 208 |
try:
|
|
|
|
| 187 |
data_response = streamer.chat_return_dict(stream_response)
|
| 188 |
return data_response
|
| 189 |
|
| 190 |
+
async def chat_embedding(self, input, model_name, api_key):
|
| 191 |
api_url = f"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_name}"
|
| 192 |
headers = {"Authorization": f"Bearer {api_key}"}
|
| 193 |
response = requests.post(api_url, headers=headers, json={"inputs": input})
|
|
|
|
| 202 |
raise RuntimeError("Unexpected response format.")
|
| 203 |
|
| 204 |
|
| 205 |
+
async def embedding(self, request: QueryRequest, api_key: str = Depends(extract_api_key)):
|
| 206 |
try:
|
| 207 |
for attempt in range(3): # Retry logic
|
| 208 |
try:
|