From c341b542c5a4a46417772c0b854481ad723f28f2 Mon Sep 17 00:00:00 2001 From: Ryan Melvin <rmelvin@uabmc.edu> Date: Wed, 24 May 2023 10:33:59 -0500 Subject: [PATCH] use azure api --- app.py | 13 ++++++++++--- deploy/Dockerfile | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index aca557d..ef00e29 100644 --- a/app.py +++ b/app.py @@ -3,7 +3,7 @@ import streamlit as st from langchain.vectorstores import FAISS from langchain.embeddings import OpenAIEmbeddings -from langchain.chat_models import ChatOpenAI +from langchain.chat_models import AzureChatOpenAI from langchain.prompts import ( ChatPromptTemplate, SystemMessagePromptTemplate, @@ -72,7 +72,7 @@ st.markdown(""" Brought to you by the Anesthesiology MPOG Steering Committee, Informatics, and Data Science teams -_Not affiliated with MPOG. Uses external resources. Not approved for use with PHI or sensitive data._ +_Not affiliated with MPOG. Not approved for use with PHI._ All submissions are recorded for potential review by the MPOG Steering Committee. @@ -89,7 +89,14 @@ You can trick generative AIs into saying whatever you want. If you succeed in tr As always, use your best judgment. An AI can do the wrong thing at the worst time. """) -chat = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo") +chat = AzureChatOpenAI( + openai_api_base="https://nlp-openai-svc.openai.azure.com", + openai_api_version="2023-03-15-preview", + deployment_name="ChatGPT35Turbo", + openai_api_key=OPENAI_API_KEY, + openai_api_type = "azure", + temperature=0 +) # Load vectorstore embedding = OpenAIEmbeddings() vectordb = FAISS.load_local("faiss_index", embedding) diff --git a/deploy/Dockerfile b/deploy/Dockerfile index 7f18931..09b3a78 100644 --- a/deploy/Dockerfile +++ b/deploy/Dockerfile @@ -19,7 +19,7 @@ RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ # Check if repo has been updated since last build ADD "https://gitlab.rc.uab.edu/anes_ai/mpog-helper-openai/commits?per_page=1" latest_commit RUN rm -rf latest_commit -RUN git clone https://gitlab.rc.uab.edu/anes_ai/mpog-helper-openai.git . +RUN git clone -b feature/azure2 https://gitlab.rc.uab.edu/anes_ai/mpog-helper-openai.git . #COPY .streamlit/secrets.toml /deploy/.streamlit/ -- GitLab