forked from 329162516/medprompt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht_install.py
More file actions
62 lines (53 loc) · 1.39 KB
/
t_install.py
File metadata and controls
62 lines (53 loc) · 1.39 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
from src.medprompt import bootstrap
bootstrap()
from fastapi import FastAPI
from langserve import add_routes
from medprompt.chains import get_runnable
from medprompt.tools import FhirPatientSearchTool, ConvertFhirToTextTool
from medprompt.agents import FhirAgent
from fastapi.middleware.cors import CORSMiddleware
from kink import di
from os import getenv
from src.medprompt.utils import HapiFhirServer
from src.medprompt.tools import GetMedicalRecordTool
app = FastAPI(
title="Healthcare Tools, Chains and Agents Server",
version="1.0",
description="A simple api server using Langchain's Runnable interfaces and LangServe",
)
# Set all CORS enabled origins
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
)
add_routes(
app,
FhirPatientSearchTool(),
path="/search",
)
add_routes(
app,
ConvertFhirToTextTool(),
path="/flatten",
)
# add_routes(
# app,
# FhirAgent().get_agent(),
# path="/agent",
# )
# add_routes(
# app,
# get_runnable(),
# path="/chain",
# )
# if __name__ == "__main__":
# import uvicorn
# os.environ["LANGCHAIN_DEBUG"] = "1"
# os.environ["LANGCHAIN_LOG_LEVEL"] = "DEBUG"
# os.environ["TOKENIZERS_PARALLELISM"] = "false"
# uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", 8080)))