comparison scobot/service/query.py @ 16:7a87ba2f00d9

reformat, fix some types, make more async
author drewp@bigasterisk.com
date Fri, 19 Jul 2024 00:49:38 -0700
parents 6ed25bcaaf1f
children 0d72635fc501
comparison
equal deleted inserted replaced
15:6ed25bcaaf1f 16:7a87ba2f00d9
46 # search(q, embedding_fn, client) 46 # search(q, embedding_fn, client)
47 47
48 48
49 @asynccontextmanager 49 @asynccontextmanager
50 async def lifespan(app: FastAPI): 50 async def lifespan(app: FastAPI):
51 app.state.index = SearchIndexRO('data/build/index0') 51 app.state.index = SearchIndexRO(Path('data/build/index0'))
52 yield 52 yield
53 53
54 app = FastAPI(lifespan=lifespan) 54 app = FastAPI(lifespan=lifespan)
55 55
56 @app.get("/sco/query") 56 @app.get("/sco/query")