mirror of
https://github.com/hwchase17/langchain.git
synced 2025-10-11 20:07:52 +00:00
22 lines
444 B
Python
22 lines
444 B
Python
"""Chain server."""
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.responses import RedirectResponse
|
|
from langserve import add_routes
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/")
|
|
async def _redirect_root_to_docs() -> RedirectResponse:
|
|
return RedirectResponse("/docs")
|
|
|
|
|
|
# Edit this to add the chain you want to add
|
|
add_routes(app, NotImplemented)
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
|
|
uvicorn.run(app, host="0.0.0.0", port=8000) # noqa: S104
|