Spaces:
Sleeping
Sleeping
PhilSad
commited on
Commit
·
c6f7173
1
Parent(s):
1dcf466
save
Browse files
app.py
CHANGED
|
@@ -31,18 +31,15 @@ async def proxy_mistral(request_data: Dict):
|
|
| 31 |
print("attempting to sendc the request")
|
| 32 |
print(request_data)
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
except Exception as e:
|
| 48 |
-
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 31 |
print("attempting to sendc the request")
|
| 32 |
print(request_data)
|
| 33 |
|
| 34 |
+
# Send the request to the Mistral API
|
| 35 |
+
async with httpx.AsyncClient() as client:
|
| 36 |
+
response = await client.post(url, headers=headers, json=request_data)
|
| 37 |
+
print("my response" , response)
|
| 38 |
+
|
| 39 |
+
# Check the response status
|
| 40 |
+
if response.status_code != 200:
|
| 41 |
+
raise HTTPException(status_code=response.status_code, detail=response.text)
|
| 42 |
+
print(response.json())
|
| 43 |
+
# Return the Mistral API response
|
| 44 |
+
return response.json()
|
| 45 |
+
|
|
|
|
|
|
|
|
|