Spaces:
Sleeping
Sleeping
File size: 700 Bytes
b39c0ba 9002555 b39c0ba d57efd6 b39c0ba 9002555 b39c0ba 9002555 d57efd6 9002555 b39c0ba 9002555 0767396 9002555 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import os
from dotenv import load_dotenv
from fastapi import FastAPI
from db.database import engine
from db.models import Base
from llama_index.core import set_global_handler
load_dotenv()
async def startup() -> None:
Base.metadata.create_all(engine)
os.environ["LANGFUSE_SECRET_KEY"] = os.getenv("LANGFUSE_SECRET_KEY")
os.environ["LANGFUSE_PUBLIC_KEY"] = os.getenv("LANGFUSE_PUBLIC_KEY")
os.environ["LANGFUSE_HOST"] = os.getenv("LANGFUSE_HOST")
set_global_handler("langfuse")
async def shutdown() -> None:
pass
def register_events(app: FastAPI) -> FastAPI:
app.add_event_handler("startup", startup)
app.add_event_handler("shutdown", shutdown)
return app
|