KingNish commited on
Commit
e6162d3
1 Parent(s): 9f408e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -108,6 +108,21 @@ async def suggestions(q: str, region: str = "wt-wt"):
108
  except Exception as e:
109
  raise HTTPException(status_code=500, detail=f"Error getting search suggestions: {e}")
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  @app.get("/api/maps")
112
  async def maps(
113
  q: str,
 
108
  except Exception as e:
109
  raise HTTPException(status_code=500, detail=f"Error getting search suggestions: {e}")
110
 
111
+ @app.get("/api/chat")
112
+ async def chat(
113
+ q: str,
114
+ model: str = "gpt-3.5"
115
+ ):
116
+ """Perform a text search."""
117
+ try:
118
+ with WEBS() as webs:
119
+ results = webs.chat(keywords=q, model=model)
120
+ return JSONResponse(content=jsonable_encoder(results))
121
+ except Exception as e:
122
+ raise HTTPException(status_code=500, detail=f"Error getting chat results: {e}")
123
+
124
+
125
+
126
  @app.get("/api/maps")
127
  async def maps(
128
  q: str,