Skip to content

Commit

Permalink
Merge pull request #67 from aws-samples/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
MithilShah authored Jan 22, 2024
2 parents f9c72e6 + 9bdfb35 commit 91873b1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion kendra_retriever_samples/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def read_properties_file(filename):
else:
raise Exception("Unsupported LLM: ", sys.argv[1])
else:
raise Exception("Usage: streamlit run app.py <anthropic|flanxl|flanxxl|openai|bedrock_titan|bedrock_claude|bedrock|claudev2>")
raise Exception("Usage: streamlit run app.py <anthropic|flanxl|flanxxl|openai|falcon40b|llama2|bedrock_titan|bedrock_claude|bedrock_claudev2>")

if 'chat_history' not in st.session_state:
st.session_state['chat_history'] = []
Expand Down
17 changes: 11 additions & 6 deletions kendra_retriever_samples/kendra_chat_bedrock_claudev2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@ class bcolors:
def build_chain():
region = os.environ["AWS_REGION"]
kendra_index_id = os.environ["KENDRA_INDEX_ID"]
credentials_profile_name = os.environ['AWS_PROFILE']

print(credentials_profile_name)


llm = Bedrock(
if "AWS_PROFILE" in os.environ:
credentials_profile_name = os.environ['AWS_PROFILE']
print("Using " + credentials_profile_name + " profile.")
llm = Bedrock(
credentials_profile_name=credentials_profile_name,
region_name = region,
model_kwargs={"max_tokens_to_sample":300,"temperature":1,"top_k":250,"top_p":0.999,"anthropic_version":"bedrock-2023-05-31"},
model_id="anthropic.claude-v2"
)
)
else:
llm = Bedrock(
region_name = region,
model_kwargs={"max_tokens_to_sample":300,"temperature":1,"top_k":250,"top_p":0.999,"anthropic_version":"bedrock-2023-05-31"},
model_id="anthropic.claude-v2"
)

retriever = AmazonKendraRetriever(index_id=kendra_index_id,top_k=5,region_name=region)

Expand Down
2 changes: 1 addition & 1 deletion kendra_retriever_samples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
langchain==0.0.326
langchain==0.0.329
boto3>=1.28.27
openai
anthropic
Expand Down

0 comments on commit 91873b1

Please sign in to comment.