cleaner key display
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
from langchain.prompts import FewShotPromptTemplate, PromptTemplate
|
4 |
-
from langchain.
|
5 |
from langchain.callbacks import get_openai_callback
|
6 |
from langchain.chains import LLMChain
|
7 |
|
@@ -23,7 +23,7 @@ selected_model = st.sidebar.selectbox(
|
|
23 |
selected_dataset = st.sidebar.selectbox(
|
24 |
"Select Dataset", ["Regulatory Changes", "Dealer Risk", "Custom"]
|
25 |
)
|
26 |
-
openai_api_key = st.sidebar.text_input("OpenAI API Key", value="
|
27 |
|
28 |
|
29 |
prompt_prefix = """You are a news recommender and your job is to look at an article and decide if I would find it useful or not.
|
@@ -188,7 +188,9 @@ for index, row in predictions_data.iterrows():
|
|
188 |
st.markdown("---")
|
189 |
|
190 |
|
191 |
-
llm =
|
|
|
|
|
192 |
example_prompt = PromptTemplate(
|
193 |
input_variables=["headline", "publisher", "answer"],
|
194 |
template="Headline: {headline}\nPublisher: {publisher}\nAnswer: {answer}",
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
from langchain.prompts import FewShotPromptTemplate, PromptTemplate
|
4 |
+
from langchain.chat_models import ChatOpenAI
|
5 |
from langchain.callbacks import get_openai_callback
|
6 |
from langchain.chains import LLMChain
|
7 |
|
|
|
23 |
selected_dataset = st.sidebar.selectbox(
|
24 |
"Select Dataset", ["Regulatory Changes", "Dealer Risk", "Custom"]
|
25 |
)
|
26 |
+
openai_api_key = st.sidebar.text_input("OpenAI API Key", value="", type="password")
|
27 |
|
28 |
|
29 |
prompt_prefix = """You are a news recommender and your job is to look at an article and decide if I would find it useful or not.
|
|
|
188 |
st.markdown("---")
|
189 |
|
190 |
|
191 |
+
llm = ChatOpenAI(
|
192 |
+
temperature=0.0, openai_api_key=openai_api_key if openai_api_key != "" else " "
|
193 |
+
)
|
194 |
example_prompt = PromptTemplate(
|
195 |
input_variables=["headline", "publisher", "answer"],
|
196 |
template="Headline: {headline}\nPublisher: {publisher}\nAnswer: {answer}",
|