added Claude in interface 2

This commit is contained in:
Mayank Aamseek
2024-03-11 17:05:11 +05:30
parent 28c984f90a
commit 56a002dd41
+27 -4
View File
@@ -14,7 +14,7 @@ import os
import pandas as pd
import util
REDIRECT_URI = 'http://172.29.20.126:8502'
REDIRECT_URI = 'http://localhost:8502'
user_list = ['maamseek@aarete.com', 'smahdavian@aarete.com', 'ahinge@aarete.com', 'akadam@aarete.com'
, 'piragavarapu@aarete.com', 'umistry@aarete.com', 'ahutchison@aarete.com', 'bgrunst@aarete.com', 'ddimeglio@aarete.com'
, 'vnair@aarete.com']
@@ -65,7 +65,8 @@ if st.session_state.user_info['mail'] in user_list:
with llm_row[0]:
st.write("**Langauge Model**")
with llm_row[1]:
llm_selected = st.selectbox('Langauge Model',('Llama 2 Chat 13B', 'Llama 2 Chat 70B', 'Titan Text Express'), label_visibility = "collapsed")
llm_selected = st.selectbox('Langauge Model',('Claude 2', 'Claude Instant', 'Llama 2 Chat 13B', 'Llama 2 Chat 70B'
, 'Titan Text Express'), label_visibility = "collapsed")
page_list = []
with open(os.path.join(SOURCE_DIRECTORY, file_name), 'r') as infile:
@@ -97,12 +98,13 @@ if st.session_state.user_info['mail'] in user_list:
)
RETRIEVER = DB.as_retriever(search_kwargs={"filter": {"$or": page_list}, "k": 4})
# if "LLM" not in st.session_state:
if llm_selected == 'Titan Text Express':
LLM = Bedrock(
model_id="amazon.titan-text-express-v1",
client=bedrock_runtime,
model_kwargs={
"maxTokenCount": 4096,
"maxTokenCount": 512,
"stopSequences": [],
"temperature": 0,
"topP": 1,
@@ -118,7 +120,7 @@ if st.session_state.user_info['mail'] in user_list:
# "topP": 0.9,
}
)
else:
elif llm_selected == 'Llama 2 Chat 13B':
LLM = Bedrock(
model_id="meta.llama2-13b-chat-v1",
client=bedrock_runtime,
@@ -128,6 +130,27 @@ if st.session_state.user_info['mail'] in user_list:
# "topP": 0.9,
}
)
elif llm_selected == 'Claude Instant':
LLM = Bedrock(
model_id="anthropic.claude-instant-v1",
client=bedrock_runtime,
model_kwargs={
# "max_tokens_to_sample": 512,
"temperature": 0,
# "topP": 0.9,
}
)
elif llm_selected == 'Claude 2':
LLM = Bedrock(
model_id="anthropic.claude-v2:1",
client=bedrock_runtime,
model_kwargs={
# "max_tokens_to_sample": 512,
"temperature": 0,
# "topP": 0.9,
}
)
st.session_state["LLM"] = LLM
template = """