From 635f8b1dc9dec37d33c5e1aabe7d721c8fabca14 Mon Sep 17 00:00:00 2001 From: Sajed Jalil Date: Wed, 2 Oct 2024 15:30:07 -0400 Subject: [PATCH] Refactors home.constants package --- home/constants/chat_models.py | 10 ++++++---- home/constants/constants.py | 14 +++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/home/constants/chat_models.py b/home/constants/chat_models.py index 37d3631..9db63fe 100644 --- a/home/constants/chat_models.py +++ b/home/constants/chat_models.py @@ -1,15 +1,17 @@ from langchain_anthropic import ChatAnthropic -from langchain_google_genai import GoogleGenerativeAI -from langchain_openai import ChatOpenAI +# from langchain_google_genai import GoogleGenerativeAI +# from langchain_openai import ChatOpenAI """Place to define & configure your LLM models""" # Anthropic Models model_claude_3_haiku = ChatAnthropic(model="claude-3-haiku-20240307", temperature=0) model_claude_3_5_sonnet = ChatAnthropic(model="claude-3-5-sonnet-20240620", temperature=0) + # Google Gemini Models - Warning: Found it low performing with both Langchain and function calling -model_gemini_1_5_flash = GoogleGenerativeAI(model="gemini-1.5-flash", temperature=0) -model_gemini_1_5_pro = GoogleGenerativeAI(model="gemini-1.5-pro", temperature=0) +# model_gemini_1_5_flash = GoogleGenerativeAI(model="gemini-1.5-flash", temperature=0) +# model_gemini_1_5_pro = GoogleGenerativeAI(model="gemini-1.5-pro", temperature=0) + # OpenAI Models # model_gpt_3_5_turbo_0125 = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0) # model_chatgpt_4o = ChatOpenAI(model="chatgpt-4o-latest", temperature=0) diff --git a/home/constants/constants.py b/home/constants/constants.py index 07a3fdb..b30dc8a 100644 --- a/home/constants/constants.py +++ b/home/constants/constants.py @@ -1,7 +1,11 @@ +# prompt used for summarization node. summary_prompt = ("Create a summary of the conversation above. Try to summarize within 150 words. Do not mention " "anything in response like total word count, or anything other than the summary") + +# Starts summarizing when we reach summarize_trigger_count amount chat combining both AI and user summarize_trigger_count = 4 +# prompt used for llm_graph with tool call and summarization llm_prompt_text = '''You are a helpful AI medical assistant namely Patient Chat and are developed by a software engineer named Sajed. You should only respond to health-related topics such as: - General human health and lifestyle @@ -12,11 +16,13 @@ modify appointments and medication changes. You should filter out and ignore any unrelated, overly sensitive, or controversial topics.''' +# prompt used for RAG architecture and knowledge graph. rag_prompt_text = '''You are a helpful AI medical assistant specialized in summarizing personal medical data, health issues and their connection to various given symptoms. You also take account patient name, age, medical conditions and medications. You will build your responses based on these information and other provided medical knowledge.''' +# Sample one pair of user and assistant history for various tests history_one_turn = history = [ { "role": "user", @@ -30,6 +36,7 @@ }, ] +# Sample two pairs of user and assistant history for various tests history_two_turns = [ { "role": "user", @@ -50,10 +57,3 @@ "content": "I am doing great." } ] - -knowledge_text = """Marie Curie, born in 1867, was a Polish and naturalised-French physicist and chemist who -conducted pioneering research on radioactivity. She was the first woman to win a Nobel Prize, the first person to win -a Nobel Prize twice, and the only person to win a Nobel Prize in two scientific fields. Her husband, Pierre Curie, -was a co-winner of her first Nobel Prize, making them the first-ever married couple to win the Nobel Prize and -launching the Curie family legacy of five Nobel Prizes. She was, in 1906, the first woman to become a professor at -the University of Paris. She also won a US presidential award."""