Skip to content

Commit 21fb486

Browse files
committed
using azure AI, a med chatbot
1 parent accc3b7 commit 21fb486

15 files changed

+272
-1
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
# medLLM
1+
## running the end point:
2+
uvicorn main:app --reload
3+
or
4+
uvicorn main:app --reload --port 8001
5+
6+

__pycache__/main.cpython-312.pyc

868 Bytes
Binary file not shown.

helpers/__init__.py

Whitespace-only changes.
157 Bytes
Binary file not shown.
498 Bytes
Binary file not shown.

helpers/openai_client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
3+
# Uncomment the code below if you are using the OpenAI API directly
4+
# from openai import OpenAI
5+
# openai_client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
6+
7+
8+
# Comment the code below if you are not using the AzureOpenAI endpoint
9+
from openai import AzureOpenAI
10+
11+
12+
openai_client = AzureOpenAI(
13+
azure_endpoint=os.getenv("AZURE_ENDPOINT"),
14+
api_version=os.getenv("API_VERSION"),
15+
api_key=os.getenv("API_KEY")
16+
)
17+
18+
19+
20+
# TODO: We need to support more LLMs for test case generation.
21+
# Hence, it will make sense to have a standard class which people can inherit to use the LLM of their choice.
22+
# We want to encapsulate the logic of LLM calling.

main.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from dotenv import load_dotenv
2+
from fastapi import FastAPI, HTTPException
3+
from pydantic import BaseModel
4+
from openai import OpenAI
5+
import json
6+
import os
7+
import requests
8+
9+
# Replace this with your OpenAI API key
10+
load_dotenv(dotenv_path=".env") # Loads the .env file
11+
12+
from routers.answer import answer_router
13+
from fastapi.middleware.cors import CORSMiddleware
14+
15+
# exit()
16+
17+
# Initialize FastAPI app
18+
app = FastAPI()
19+
app.include_router(answer_router, prefix="")
20+
21+
# Add CORS middleware
22+
app.add_middleware(
23+
CORSMiddleware,
24+
allow_origins=["http://localhost:3005"], # Or use ["*"] to allow all origins (for development only)
25+
allow_credentials=True,
26+
allow_methods=["*"],
27+
allow_headers=["*"],
28+
)
29+
30+
# To run the app, use: uvicorn main:app --reload

requirements.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
annotated-types==0.7.0
2+
anyio==4.6.2.post1
3+
certifi==2024.8.30
4+
charset-normalizer==3.4.0
5+
click==8.1.7
6+
distro==1.9.0
7+
exceptiongroup==1.2.2
8+
fastapi==0.115.4
9+
h11==0.14.0
10+
httpcore==1.0.6
11+
httpx==0.27.2
12+
idna==3.10
13+
jiter==0.7.0
14+
openai==1.54.3
15+
pydantic==2.9.2
16+
pydantic_core==2.23.4
17+
python-dotenv==1.0.1
18+
requests==2.32.3
19+
sniffio==1.3.1
20+
starlette==0.41.2
21+
tqdm==4.67.0
22+
typing_extensions==4.12.2
23+
urllib3==2.2.3
24+
uvicorn==0.32.0

routers/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)