michal commited on
Commit
5640549
1 Parent(s): c4331c8
dumb-friendly.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ from langchain import OpenAI, ConversationChain, LLMChain, PromptTemplate
4
+ from langchain.chains.conversation.memory import ConversationalBufferWindowMemory
5
+ from langchain import PromptTemplate
6
+
7
+
8
+ name_of_person = "Alfred Jamesmanson"
9
+ real_person_prompt = f"""
10
+ Assistant is uses friendly and helpful language.
11
+ Assistant loves making new friends.
12
+ If at any time {name_of_person} asks to talk with a real person that {name_of_person} should only ask and they will be connected to a real person. Assistant will remind {name_of_person} that they can connect to speak to a real person whenever they would like that. If {name_of_person} asks to talk to a real person then Assistant will let {name_of_person} know they will be connected to talk to a real person right away.
13
+ """
14
+
15
+ person_details = f"""
16
+ Assistant is designed to talk to {name_of_person} and answer their questions.
17
+ {name_of_person} lives in Dallas Texas. {name_of_person} was born in Keywest Florida on January 2nd 1990.
18
+ {name_of_person} goes to college. {name_of_person} studies electrical engineering.
19
+ {name_of_person} is friends with Kelly Robin, Jesse Lambourghini and Jackson Loggin.
20
+ {name_of_person} has brown hair.
21
+ """
22
+
23
+ template = """Assistant is a large language model trained by OpenAI.
24
+
25
+ {person_details}
26
+
27
+ {real_person_prompt}
28
+
29
+ {document_text}
30
+
31
+ Assistant is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.
32
+
33
+ {name_of_person}: {human_input}
34
+ Assistant:
35
+ """
36
+
37
+ prompt = PromptTemplate(
38
+ input_variables=["human_input", "real_person_prompt", "document_text"],
39
+ template=template
40
+ )
41
+
42
+ chatgpt_chain = LLMChain(
43
+ llm=OpenAI(temperature=0),
44
+ prompt=prompt,
45
+ verbose=True,
46
+ memory=ConversationalBufferWindowMemory(k=3),
47
+ )
48
+
49
+ filename = "summary-of-benefits-paragraphs.txt"
50
+ with open(filename) as f:
51
+ document_text = f.read()
52
+
53
+ human_input = "Hi my name is Alfred Jamesmanson. I need your help Assistant. What color is my hair?"
54
+
55
+ output = chatgpt_chain.predict(
56
+ name_of_person=name_of_person,
57
+ person_details=person_details,
58
+ real_person_prompt=real_person_prompt,
59
+ document_text=document_text,
60
+ human_input=human_input,
61
+ )
62
+
63
+ print(output)
summary-of-benefits-paragraphs.txt CHANGED
@@ -4,9 +4,9 @@ EAch paragraph below is separated by a single new line.
4
  These are the summary of benefits for the plan named Humana Community HMO H1036-236. This plan is available in the county of Jefferson in Kentucky. This plan applies to the year 2023.
5
 
6
  The Pre-Enrollment Checklist includes Understanding the Benefits.
7
- Before making an enrollment decision, it is important that you fully understand our benefits and rules. If you have any questions, you can call and speak to a customer service representative at 1-800-833-2364 (TTY: 711).
8
 
9
- Understanding the Benefits. The Evidence of Coverage (EOC) provides a complete list of all coverage and services. It is important to review plan coverage, costs and benefits before you enroll. Visit Humana.com/medicare or call 1-800-833-2364 (TTY: 711) to view a copy of the Evidence of Coverage EOC.
10
  Review the provider directory (or ask your doctor) to make sure the doctors you see now are in the network. If they are not listed, it means you will likely have to select a new doctor.
11
  Review the pharmacy directory to make sure the pharmacy you use for any prescription medicines is in the network. If the pharmacy is not listed, you will likely have to select a new pharmacy for your prescriptions.
12
  Review the formulary to make sure your drugs are covered.
@@ -17,7 +17,7 @@ Except in emergency or urgent situations, we do not cover services by out-of-net
17
 
18
  To find out more about the Humana Community HMO plan, including the health and drug services it covers in this easy-to-use guide.
19
  To be eligible to join the Humana Community HMO plan, you must be entitled to Medicare Part A, be enrolled in Medicare Part B and live in our service area.
20
- If you are a member of this plan, call toll-free 1-800-457-4708. If you are not a member of this plan, call toll free 1-800-833-2364. From October 1 to March 31, call 7 days a week from 8am to 8pm. From April 1st to September 30th, you can call from Monday to Friday from 8am to 8pm. Our website is https://humana.com/medicare .
21
 
22
  Here is more information about the Humana Community (HMO).
23
  Do you have Medicare and Medicaid? If you are a dual-eligible beneficiary enrolled in both Medicare and the state's program, you may not have to pay the medical costs displayed in this booklet and your prescription drug costs will be lower, too.
@@ -223,8 +223,7 @@ The Allowance amounts cannot be combined with other benefit allowances. Limitat
223
 
224
  For the Humana Spending Account Card , the allowances listed below will be loaded onto this prepaid card. Each allowance is separate from any other allowance listed. Allowances shown are accessed by using this card. Allowance amounts cannot be combined with other benefit allowances. Limitations and restrictions may apply. This includes the Humana Flex Allowance and the OTC Allowance .
225
 
226
- The Special Supplemental Benefits for the Chronically Ill (SSBCI) Humana
227
- Flexible Care Assistance is available to members with chronic health conditions, who are participating in care management services, and meet program criteria. Eligible members may receive medical expense assistance and other additional benefits, either primarily health related or non-primarily health related, to address the member's unique individual needs. Benefits are limited up to $1,000 per year and must be coordinated and authorized by a care manager. There is no cost to participate.
228
 
229
  For routine Chiropractic services , there is a $0 copay per visit for unlimited visits.
230
 
 
4
  These are the summary of benefits for the plan named Humana Community HMO H1036-236. This plan is available in the county of Jefferson in Kentucky. This plan applies to the year 2023.
5
 
6
  The Pre-Enrollment Checklist includes Understanding the Benefits.
7
+ Before making an enrollment decision, it is important that you fully understand our benefits and rules. If you have any questions, you can call and speak to a customer service representative at 1-800-833-2364 (TTY 711).
8
 
9
+ Understanding the Benefits. The Evidence of Coverage (EOC) provides a complete list of all coverage and services. It is important to review plan coverage, costs and benefits before you enroll. Visit Humana.com/medicare or call 1-800-833-2364 (TTY 711) to view a copy of the Evidence of Coverage EOC.
10
  Review the provider directory (or ask your doctor) to make sure the doctors you see now are in the network. If they are not listed, it means you will likely have to select a new doctor.
11
  Review the pharmacy directory to make sure the pharmacy you use for any prescription medicines is in the network. If the pharmacy is not listed, you will likely have to select a new pharmacy for your prescriptions.
12
  Review the formulary to make sure your drugs are covered.
 
17
 
18
  To find out more about the Humana Community HMO plan, including the health and drug services it covers in this easy-to-use guide.
19
  To be eligible to join the Humana Community HMO plan, you must be entitled to Medicare Part A, be enrolled in Medicare Part B and live in our service area.
20
+ If you are a member of this plan, call toll-free 1-800-457-4708. If you are not a member of this plan, call toll free 1-800-833-2364. From October 1 to March 31, call 7 days a week from 8am to 8pm. From April 1st to September 30th, you can call from Monday to Friday from 8am to 8pm. Our website is humana.com/medicare .
21
 
22
  Here is more information about the Humana Community (HMO).
23
  Do you have Medicare and Medicaid? If you are a dual-eligible beneficiary enrolled in both Medicare and the state's program, you may not have to pay the medical costs displayed in this booklet and your prescription drug costs will be lower, too.
 
223
 
224
  For the Humana Spending Account Card , the allowances listed below will be loaded onto this prepaid card. Each allowance is separate from any other allowance listed. Allowances shown are accessed by using this card. Allowance amounts cannot be combined with other benefit allowances. Limitations and restrictions may apply. This includes the Humana Flex Allowance and the OTC Allowance .
225
 
226
+ The Special Supplemental Benefits for the Chronically Ill (SSBCI) Humana Flexible Care Assistance is available to members with chronic health conditions, who are participating in care management services, and meet program criteria. Eligible members may receive medical expense assistance and other additional benefits, either primarily health related or non-primarily health related, to address the member's unique individual needs. Benefits are limited up to $1,000 per year and must be coordinated and authorized by a care manager. There is no cost to participate.
 
227
 
228
  For routine Chiropractic services , there is a $0 copay per visit for unlimited visits.
229
 
summary-search.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from langchain.embeddings.openai import OpenAIEmbeddings
3
+ from langchain.text_splitter import CharacterTextSplitter
4
+ from langchain.vectorstores.faiss import FAISS
5
+ from langchain.docstore.document import Document
6
+ from langchain.prompts import PromptTemplate
7
+
8
+ from langchain.chains.question_answering import load_qa_chain
9
+ from langchain.llms import OpenAI
10
+
11
+ def test_document(filename, query):
12
+
13
+ with open(filename) as f:
14
+ article = f.read()
15
+ text_splitter = CharacterTextSplitter(chunk_size=2000, chunk_overlap=0)
16
+ texts = text_splitter.split_text(article)
17
+
18
+ embeddings = OpenAIEmbeddings()
19
+ docsearch = FAISS.from_texts(texts, embeddings)
20
+
21
+ chain = load_qa_chain(OpenAI(temperature=0), chain_type="stuff")
22
+
23
+ docs = docsearch.similarity_search(query)
24
+
25
+ out = chain.run(input_documents=docs, question=query)
26
+ print(out)
27
+
28
+
29
+
30
+ document = "Summary-of-Benefits-original.txt"
31
+ print("document", document)
32
+ query = "What is my copay?"
33
+ query = "What is my copay for a mamography?"
34
+ test_document(document, query)
35
+
36
+ query = "What is my copay for a mamography?"
37
+ document = "summary-of-benefits-paragraphs.txt"
38
+ print("document", document)
39
+ test_document(document, query)