Skip to content

Commit 9988cbc

Browse files
Merge branch 'STAGING' into DEV
2 parents 85f5bf0 + fd5ead1 commit 9988cbc

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

backend/Dockerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,18 @@ RUN apt-get update \
99
&& apt install -y tesseract-ocr \
1010
&& export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH \
1111
&& pip install --no-cache-dir --upgrade -r /code/requirements.txt
12-
CMD ["uvicorn", "score:app", "--host", "0.0.0.0", "--port", "8000"]
12+
13+
# Installing gcloud
14+
#RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
15+
16+
# Installing the package
17+
#RUN mkdir -p /usr/local/gcloud \
18+
# && tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \
19+
# && /usr/local/gcloud/google-cloud-sdk/install.sh
20+
21+
# Adding the package path to local
22+
#ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
23+
24+
CMD ["uvicorn", "score:app", "--host", "0.0.0.0", "--port", "8000"]
25+
#CMD ["gcloud", "auth", "application-default", "login", "--quiet", "--no-user-output-enabled"]
26+

backend/requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ frozenlist==1.4.1
3838
fsspec==2024.2.0
3939
google-api-core==2.18.0
4040
google-auth==2.29.0
41-
google-cloud-aiplatform==1.45.0
41+
google-cloud-aiplatform==1.46.0
4242
google-cloud-bigquery==3.19.0
4343
google-cloud-core==2.4.1
4444
google-cloud-resource-manager==1.12.3
@@ -78,6 +78,8 @@ langchain-text-splitters==0.0.1
7878
langdetect==1.0.9
7979
langsmith==0.1.31
8080
layoutparser==0.3.4
81+
langserve
82+
langchain-cli
8183
lxml==5.1.0
8284
MarkupSafe==2.1.5
8385
marshmallow==3.20.2

backend/score.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import uvicorn
99
import asyncio
1010
import base64
11-
11+
from langserve import add_routes
12+
from langchain_google_vertexai import ChatVertexAI
1213

1314

1415
def healthy_condition():
@@ -30,6 +31,9 @@ def sick():
3031
allow_methods=["*"],
3132
allow_headers=["*"],
3233
)
34+
35+
add_routes(app,ChatVertexAI(), path="/vertexai")
36+
3337
app.add_api_route("/health", health([healthy_condition, healthy]))
3438

3539
@app.post("/sources")

backend/src/gemini_llm.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from langchain_community.graphs.graph_document import Node
2626

2727
load_dotenv()
28-
logging.basicConfig(format='%(asctime)s - %(message)s',level='INFO')
28+
logging.basicConfig(format='%(asctime)s - %(message)s',level='DEBUG')
2929

3030
system_prompt = (
3131
"# Knowledge Graph Instructions for GPT-4\n"
@@ -295,7 +295,12 @@ def get_graph_from_Gemini(model_version,
295295
graph_document_list = []
296296
lst_chunk_chunkId_document=[]
297297
location = "us-central1"
298+
#project_id = "llm-experiments-387609"
298299
credentials, project_id = google.auth.default()
300+
if hasattr(credentials, "service_account_email"):
301+
logging.info(credentials.service_account_email)
302+
else:
303+
logging.info("WARNING: no service account credential. User account credential?")
299304
vertexai.init(project=project_id, location=location)
300305

301306
# combined_chunk_document_list=[]

backend/src/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import warnings
2222
from pytube import YouTube
2323
import sys
24+
from langchain.globals import set_debug
25+
set_debug(True)
2426
warnings.filterwarnings("ignore")
2527

2628
load_dotenv()

0 commit comments

Comments
 (0)