Abhaykoul commited on
Commit
cae0bd9
1 Parent(s): ff7bae6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -1,6 +1,6 @@
1
  from fastapi import FastAPI, HTTPException, Query
2
  from fastapi.responses import JSONResponse
3
- from webscout import WEBS, transcriber, LLM
4
  from typing import Optional, List, Dict, Union
5
  from fastapi.encoders import jsonable_encoder
6
  from bs4 import BeautifulSoup
@@ -20,6 +20,19 @@ async def root():
20
  async def health_check():
21
  return {"status": "OK"}
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  @app.get("/api/search")
24
  async def search(
25
  q: str,
 
1
  from fastapi import FastAPI, HTTPException, Query
2
  from fastapi.responses import JSONResponse
3
+ from webscout import WEBS, transcriber, LLM,
4
  from typing import Optional, List, Dict, Union
5
  from fastapi.encoders import jsonable_encoder
6
  from bs4 import BeautifulSoup
 
20
  async def health_check():
21
  return {"status": "OK"}
22
 
23
+
24
+ @app.get("/api/fastAI")
25
+ async def fast_ai_endpoint(user: str, model: str = "llama3-70b", system: str = "Answer as concisely as possible."):
26
+ """Get a response from the Snova AI service."""
27
+ fast_ai.model = model
28
+ fast_ai.system = system
29
+ try:
30
+ response = await asyncio.to_thread(fast_ai.generate_response, user)
31
+ return JSONResponse(content={"response": response})
32
+ except Exception as e:
33
+ raise HTTPException(status_code=500, detail=f"Error during Snova AI request: {e}")
34
+
35
+
36
  @app.get("/api/search")
37
  async def search(
38
  q: str,