{ "cells": [ { "cell_type": "markdown", "id": "0cd0e718-beac-4442-ac45-fffb26698d33", "metadata": { "tags": [] }, "source": [ "# Install packages, need to write a requirement later\n", "!pip install instructorembedding sentence-transformers gradio langchain unstructured chromadb pdf2image pdfminer pdfminer.six" ] }, { "cell_type": "code", "execution_count": 2, "id": "4d086ed6-eb66-4ded-b701-dac062e19521", "metadata": { "tags": [] }, "outputs": [], "source": [ "import boto3\n", "import sagemaker\n", "from sagemaker.predictor import Predictor\n", "from sagemaker.serializers import JSONSerializer\n", "from sagemaker.deserializers import JSONDeserializer\n", "from langchain.embeddings import HuggingFaceInstructEmbeddings\n", "from langchain.document_loaders import UnstructuredURLLoader, UnstructuredPDFLoader\n", "from langchain.document_loaders.csv_loader import CSVLoader\n", "from langchain.text_splitter import RecursiveCharacterTextSplitter\n", "from langchain.vectorstores import Chroma\n", "import json\n", "import gradio as gr" ] }, { "cell_type": "code", "execution_count": 12, "id": "a2d81908-6026-47b6-bd0d-ade2771eacdd", "metadata": { "tags": [] }, "outputs": [], "source": [ "def loadCleanDocsearch(embeddings):\n", " print(\"Getting fresh docsearch...\")\n", "\n", " # define URL sources\n", " urls = [\n", " 'https://www.dssinc.com/blog/2022/8/9/dss-inc-announces-appointment-of-brion-bailey-as-director-of-federal-business-development',\n", " 'https://www.dssinc.com/blog/2022/6/21/suicide-prevention-manager-enabling-the-veterans-affairs-to-achieve-high-reliability-in-suicide-risk-identification',\n", " 'https://www.dssinc.com/blog/2022/3/21/march-22-is-diabetes-alertness-day-a-helpful-reminder-to-monitor-and-prevent-diabetes',\n", " 'https://www.dssinc.com/blog/2023/5/24/supporting-the-vas-high-reliability-organization-journey-through-suicide-prevention',\n", " 'https://www.dssinc.com/blog/2022/12/19/dss-theradoc-helps-battle-super-bugs-for-better-veteran-health',\n", " 'https://www.dssinc.com/blog/2022/9/19/crescenz-va-medical-center-cmcvamc-deploys-the-dss-iconic-data-patient-case-manager-pcm-solution',\n", " 'https://www.dssinc.com/blog/2022/5/9/federal-news-network-the-importance-of-va-supply-chain-modernization'\n", " ]\n", "\n", " # load and split\n", " loaders = UnstructuredURLLoader(urls=urls)\n", " data = loaders.load()\n", " text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=50)\n", " texts = text_splitter.split_documents(data)\n", " print(\"Sources split into the following number of \\\"texts\\\":\", len(texts))\n", "\n", " # get object\n", " docsearch = Chroma.from_texts([t.page_content for t in texts],\n", " metadatas=[{\"src\": \"DSS\"} for t in texts],\n", " embedding=embeddings)\n", " print(\"Done getting fresh docsearch.\")\n", "\n", " return docsearch\n", "\n", "def resetDocsearch():\n", " global docsearch\n", " global msgs\n", " \n", " foreignIDs = docsearch.get(where= {\"src\":\"foreign\"})['ids']\n", "\n", " if foreignIDs != []:\n", " docsearch.delete(ids=foreignIDs)\n", " \n", " clearStuff()\n", " msgs = [{}]\n", " return None\n", " \n", "def addURLsource(url):\n", " print(\"Adding new source...\")\n", " \n", " global docsearch\n", "\n", " # load and split\n", " loaders = UnstructuredURLLoader(urls=[url])\n", " data = loaders.load()\n", " text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n", " texts = text_splitter.split_documents(data)\n", " print(\"New source split into the following number of \\\"texts\\\":\", len(texts))\n", "\n", " # add new sources\n", " docsearch.add_texts([t.page_content for t in texts], metadatas=[{\"src\": \"foreign\"} for t in texts])\n", " \n", " # restart convo, as the old messages confuse the AI\n", " clearStuff()\n", "\n", " print(\"Done adding new source.\")\n", " \n", " return None, None\n", "\n", "def addCSVsource(url):\n", " print(\"Adding new source...\")\n", " \n", " global docsearch\n", "\n", " # load and split\n", " loaders = CSVLoader(urls=[url])\n", " data = loaders.load()\n", " text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n", " texts = text_splitter.split_documents(data)\n", " print(\"New source split into the following number of \\\"texts\\\":\", len(texts))\n", "\n", " # add new sources\n", " docsearch.add_texts([t.page_content for t in texts], metadatas=[{\"src\": \"foreign\"} for t in texts])\n", " \n", " # restart convo, as the old messages confuse the AI\n", " clearStuff()\n", "\n", " print(\"Done adding new source.\")\n", " \n", " return None, None\n", "\n", "def addPDFsource(url):\n", " print(\"Adding new source...\")\n", "\n", " global docsearch\n", " \n", " # load and split\n", " loaders = UnstructuredPDFLoader(url)\n", " data = loaders.load()\n", " text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n", " texts = text_splitter.split_documents(data)\n", " print(\"New source split into the following number of \\\"texts\\\":\", len(texts))\n", "\n", " # add new sources\n", " docsearch.add_texts([t.page_content for t in texts], metadatas=[{\"src\": \"foreign\"} for t in texts])\n", " \n", " # restart convo, as the old messages confuse the AI\n", " clearStuff()\n", "\n", " print(\"Done adding new source.\")\n", " \n", " return None, None\n", "\n", "def msgs2chatbot(msgs):\n", " # the gradio chatbot object is used to display the conversation\n", " # it needs the msgs to be in List[List] format where the inner list is 2 elements: user message, chatbot response message\n", " chatbot = []\n", " \n", " for msg in msgs:\n", " if msg['role'] == 'user':\n", " chatbot.append([msg['content'], \"\"])\n", " elif msg['role'] == 'assistant':\n", " chatbot[-1][1] = msg['content']\n", "\n", " return chatbot\n", "\n", "def getPrediction(newMsg):\n", " global msgs\n", " global docsearch\n", " global predictor\n", " \n", " # add new message to msgs object\n", " msgs.append({\"role\":\"user\", \"content\": newMsg})\n", "\n", " # edit system message to include the correct context\n", " msgs[0] = {\"role\": \"system\",\n", " \"content\": f\"\"\"\n", " You are a helpful AI assistant.\n", " Use your knowledge to answer the user's question if they asked a question.\n", " If the answer to a question is not in your knowledge, just admit you do not know the answer and do not fabricate information.\n", " DO NOT use phrases like \"Based on the information provided\" or other similar phrases. \n", " Refer to the information provided below as \"your knowledge\". \n", " State all answers as if they are ground truth, DO NOT mention where you got the information.\n", " \n", " YOUR KNOWLEDGE: {\" \".join([tup[0].page_content for tup in docsearch.similarity_search_with_score(newMsg, k=5) if tup[1]<=.85])}\"\"\"}\n", "\n", " # get response from endpoint\n", "\n", " responseObject = predictor.predict({\"inputs\": [msgs],\n", " \"parameters\": {\"max_new_tokens\": 750, \"top_p\": 0.9, \"temperature\": 0.5}},\n", " initial_args={'CustomAttributes': \"accept_eula=true\"})\n", "# responseObject = predictor.predict(payload, custom_attributes=\"accept_eula=true\")\n", "\n", " \n", " responseMsg = responseObject[0]['generation']['content'].strip()\n", "\n", " # add response to msgs object\n", " msgs.append({\"role\":\"assistant\", \"content\": responseMsg})\n", " \n", " # print msgs object for debugging\n", " print(msgs)\n", " \n", " # convert msgs to chatbot object to be displayed\n", " chatbot = msgs2chatbot(msgs)\n", "\n", " return chatbot, \"\"\n", "\n", "def clearStuff():\n", " global msgs\n", " msgs = [{}]\n", " return None" ] }, { "cell_type": "code", "execution_count": 7, "id": "c56c588d-1bca-448f-bba9-96f61e5bab33", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "load INSTRUCTOR_Transformer\n", "max_seq_length 512\n", "Getting fresh docsearch...\n", "Sources split into the following number of \"texts\": 36\n", "Done getting fresh docsearch.\n" ] } ], "source": [ "# Create a SageMaker client\n", "sagemaker_client = boto3.client('sagemaker')\n", "sagemaker_session = sagemaker.Session()\n", "\n", "# Create a predictor object\n", "predictor = Predictor(endpoint_name='meta-textgeneration-llama-2-13b-f-2023-08-08-23-37-15-947',\n", " sagemaker_session=sagemaker_session,\n", " serializer=JSONSerializer(),\n", " deserializer=JSONDeserializer())\n", "\n", "embeddings = HuggingFaceInstructEmbeddings(model_name=\"hkunlp/instructor-xl\")\n", "\n", "# Create a docsearch object\n", "docsearch = loadCleanDocsearch(embeddings)\n", "\n", "# Create messages list with system message\n", "msgs = [{}]" ] }, { "cell_type": "code", "execution_count": 13, "id": "0572e3b3-2805-4db5-9d23-dac40842c58c", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7864\n", "Running on public URL: https://a6c9c06b85c90192e3.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" }, { "name": "stdout", "output_type": "stream", "text": [ "[{'role': 'system', 'content': '\\n You are a helpful AI assistant.\\n Use your knowledge to answer the user\\'s question if they asked a question.\\n If the answer to a question is not in your knowledge, just admit you do not know the answer and do not fabricate information.\\n DO NOT use phrases like \"Based on the information provided\" or other similar phrases. \\n Refer to the information provided below as \"your knowledge\". \\n State all answers as if they are ground truth, DO NOT mention where you got the information.\\n \\n YOUR KNOWLEDGE: Formerly the President of a federally focused consulting company, Bailey has over 25 years of sales and business development experience, managing product portfolios and sales of disruptive and innovative technology and equipment solutions for the healthcare market – both in the public and private sectors.\\n\\n“We are excited to have Brion onboard to help expand our ever-growing footprint in the federal health arena,” said Mark Byers, president of DSS, Inc. “He brings a deep level of sales and business development expertise in supporting cutting-edge and disruptive healthcare innovations.” Formerly the President of a federally focused consulting company, Bailey has over 25 years of sales and business development experience, managing product portfolios and sales of disruptive and innovative technology and equipment solutions for the healthcare market – both in the public and private sectors.\\n\\n“We are excited to have Brion onboard to help expand our ever-growing footprint in the federal health arena,” said Mark Byers, president of DSS, Inc. “He brings a deep level of sales and business development expertise in supporting cutting-edge and disruptive healthcare innovations.” As VP of Strategic Accounts for the U.S. Federal Sector at Becton Dickinson, Bailey provided medical technology portfolio management and exceeded performance metrics on customer relationship building, channel partner development, customer acquisition processes, and operating procedures aligned with federal acquisitions requirements. All of this activity resulted in substantial growth in market share during his five-year tenure with the company.\\n\\nBailey has a Master of Science in Marketing from St. Thomas University and a Bachelor of Business Administration from Florida International University. He resides in Central Florida with his wife and son.\\n\\nFor more information on DSS, Inc.’s Federal Health IT solutions, please click here. As VP of Strategic Accounts for the U.S. Federal Sector at Becton Dickinson, Bailey provided medical technology portfolio management and exceeded performance metrics on customer relationship building, channel partner development, customer acquisition processes, and operating procedures aligned with federal acquisitions requirements. All of this activity resulted in substantial growth in market share during his five-year tenure with the company.\\n\\nBailey has a Master of Science in Marketing from St. Thomas University and a Bachelor of Business Administration from Florida International University. He resides in Central Florida with his wife and son.\\n\\nFor more information on DSS, Inc.’s Federal Health IT solutions, please click here. DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies.'}, {'role': 'user', 'content': 'who is brion bailey'}, {'role': 'assistant', 'content': 'Based on the information provided, Brion Bailey is the Director of Business Development for the Federal Health division of Document Storage Systems, Inc. (DSS, Inc.). He has over 25 years of sales and business development experience, specifically in supporting disruptive healthcare innovations. Prior to joining DSS, Inc., Bailey was the President of a federally focused consulting company, where he managed product portfolios and sales of innovative technology and equipment solutions for the healthcare market. He has also worked at Becton Dickinson as VP of Strategic Accounts for the U.S. Federal Sector, where he provided medical technology portfolio management and exceeded performance metrics. Bailey holds a Master of Science in Marketing from St. Thomas University and a Bachelor of Business Administration from Florida International University. He resides in Central Florida with his wife and son.'}]\n", "[{'role': 'system', 'content': '\\n You are a helpful AI assistant.\\n Use your knowledge to answer the user\\'s question if they asked a question.\\n If the answer to a question is not in your knowledge, just admit you do not know the answer and do not fabricate information.\\n DO NOT use phrases like \"Based on the information provided\" or other similar phrases. \\n Refer to the information provided below as \"your knowledge\". \\n State all answers as if they are ground truth, DO NOT mention where you got the information.\\n \\n YOUR KNOWLEDGE: DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies. DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies. Next\\n DSS, Inc. Presenting at The Spring 2022 DoD/VA & Government HIT Summit\\n \\n DSS NewsCindy DumontMay 2, 2022DSS, DSS New, Va, Veterans Health, Veterans Health Administration, health information technology (HIT) solutions, HIT, HIT Solutions, Dr. David LaBorde, The Spring 2022 DoD/VA & Government HIT, Dr. Barbara Van Dahlen Next\\n DSS, Inc. Presenting at The Spring 2022 DoD/VA & Government HIT Summit\\n \\n DSS NewsCindy DumontMay 2, 2022DSS, DSS New, Va, Veterans Health, Veterans Health Administration, health information technology (HIT) solutions, HIT, HIT Solutions, Dr. David LaBorde, The Spring 2022 DoD/VA & Government HIT, Dr. Barbara Van Dahlen DSS Federal Health\\n\\nTwitter\\n\\nLinkedIn0\\n\\n0 Likes\\n\\nPrevious\\n DSS, Inc. Advisor to Present at Disney Institute’s Veterans Summit\\n \\n DSS NewsCindy DumontAugust 10, 2022Disney Institute’s Veterans Summit, Dr. Barbara Van Dahlen, Veterans in the Workplace, Heroes Work Here initiative, suicide prevention for Veterans, The Inclusive Approach to Care, General Mike Linnington Ret., CEO of the Wounded Warrior Project, Mark Elliot, Give an Hour, Veterans, Veterans mental health\\n\\nNext\\n Contracting Officers: Celebrating the Unsung Heroes at the VA\\n \\n Customer ServiceCindy DumontJuly 27, 2022Contracting Officers, VA, Department of Veterans Affairs, Procurement, federal health IT solutions, DSS, Health IT'}, {'role': 'user', 'content': 'who is brion bailey'}, {'role': 'assistant', 'content': 'Based on the information provided, Brion Bailey is the Director of Business Development for the Federal Health division of Document Storage Systems, Inc. (DSS, Inc.). He has over 25 years of sales and business development experience, specifically in supporting disruptive healthcare innovations. Prior to joining DSS, Inc., Bailey was the President of a federally focused consulting company, where he managed product portfolios and sales of innovative technology and equipment solutions for the healthcare market. He has also worked at Becton Dickinson as VP of Strategic Accounts for the U.S. Federal Sector, where he provided medical technology portfolio management and exceeded performance metrics. Bailey holds a Master of Science in Marketing from St. Thomas University and a Bachelor of Business Administration from Florida International University. He resides in Central Florida with his wife and son.'}, {'role': 'user', 'content': 'did dss join mission daybreak?'}, {'role': 'assistant', 'content': 'Based on the information provided, there is no mention of DSS joining Mission Daybreak. The information provided only mentions DSS as a leading provider of health information technology (HIT) solutions for federal, private, and public healthcare organizations, and their involvement in various events and initiatives related to healthcare and technology. There is no mention of any partnership or involvement with Mission Daybreak.'}]\n", "Adding new source...\n", "New source split into the following number of \"texts\": 5\n", "Done adding new source.\n", "[{'role': 'system', 'content': '\\n You are a helpful AI assistant.\\n Use your knowledge to answer the user\\'s question if they asked a question.\\n If the answer to a question is not in your knowledge, just admit you do not know the answer and do not fabricate information.\\n DO NOT use phrases like \"Based on the information provided\" or other similar phrases. \\n Refer to the information provided below as \"your knowledge\". \\n State all answers as if they are ground truth, DO NOT mention where you got the information.\\n \\n YOUR KNOWLEDGE: DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies. DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies. Next\\n DSS, Inc. Presenting at The Spring 2022 DoD/VA & Government HIT Summit\\n \\n DSS NewsCindy DumontMay 2, 2022DSS, DSS New, Va, Veterans Health, Veterans Health Administration, health information technology (HIT) solutions, HIT, HIT Solutions, Dr. David LaBorde, The Spring 2022 DoD/VA & Government HIT, Dr. Barbara Van Dahlen Next\\n DSS, Inc. Presenting at The Spring 2022 DoD/VA & Government HIT Summit\\n \\n DSS NewsCindy DumontMay 2, 2022DSS, DSS New, Va, Veterans Health, Veterans Health Administration, health information technology (HIT) solutions, HIT, HIT Solutions, Dr. David LaBorde, The Spring 2022 DoD/VA & Government HIT, Dr. Barbara Van Dahlen DSS Federal Health\\n\\nTwitter\\n\\nLinkedIn0\\n\\n0 Likes\\n\\nPrevious\\n DSS, Inc. Advisor to Present at Disney Institute’s Veterans Summit\\n \\n DSS NewsCindy DumontAugust 10, 2022Disney Institute’s Veterans Summit, Dr. Barbara Van Dahlen, Veterans in the Workplace, Heroes Work Here initiative, suicide prevention for Veterans, The Inclusive Approach to Care, General Mike Linnington Ret., CEO of the Wounded Warrior Project, Mark Elliot, Give an Hour, Veterans, Veterans mental health\\n\\nNext\\n Contracting Officers: Celebrating the Unsung Heroes at the VA\\n \\n Customer ServiceCindy DumontJuly 27, 2022Contracting Officers, VA, Department of Veterans Affairs, Procurement, federal health IT solutions, DSS, Health IT'}, {'role': 'user', 'content': 'did dss join mission daybreak?'}, {'role': 'assistant', 'content': 'Based on the information provided, there is no mention of DSS joining Mission Daybreak. The press releases and articles provided only mention DSS, Inc. and its various initiatives and announcements related to healthcare and technology. Therefore, I cannot answer the question of whether DSS joined Mission Daybreak, as there is no information provided to suggest that such an event occurred.'}]\n", "[{'role': 'system', 'content': '\\n You are a helpful AI assistant.\\n Use your knowledge to answer the user\\'s question if they asked a question.\\n If the answer to a question is not in your knowledge, just admit you do not know the answer and do not fabricate information.\\n DO NOT use phrases like \"Based on the information provided\" or other similar phrases. \\n Refer to the information provided below as \"your knowledge\". \\n State all answers as if they are ground truth, DO NOT mention where you got the information.\\n \\n YOUR KNOWLEDGE: DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies. DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies. Next\\n DSS, Inc. Presenting at The Spring 2022 DoD/VA & Government HIT Summit\\n \\n DSS NewsCindy DumontMay 2, 2022DSS, DSS New, Va, Veterans Health, Veterans Health Administration, health information technology (HIT) solutions, HIT, HIT Solutions, Dr. David LaBorde, The Spring 2022 DoD/VA & Government HIT, Dr. Barbara Van Dahlen Next\\n DSS, Inc. Presenting at The Spring 2022 DoD/VA & Government HIT Summit\\n \\n DSS NewsCindy DumontMay 2, 2022DSS, DSS New, Va, Veterans Health, Veterans Health Administration, health information technology (HIT) solutions, HIT, HIT Solutions, Dr. David LaBorde, The Spring 2022 DoD/VA & Government HIT, Dr. Barbara Van Dahlen DSS Federal Health\\n\\nTwitter\\n\\nLinkedIn0\\n\\n0 Likes\\n\\nPrevious\\n DSS, Inc. Advisor to Present at Disney Institute’s Veterans Summit\\n \\n DSS NewsCindy DumontAugust 10, 2022Disney Institute’s Veterans Summit, Dr. Barbara Van Dahlen, Veterans in the Workplace, Heroes Work Here initiative, suicide prevention for Veterans, The Inclusive Approach to Care, General Mike Linnington Ret., CEO of the Wounded Warrior Project, Mark Elliot, Give an Hour, Veterans, Veterans mental health\\n\\nNext\\n Contracting Officers: Celebrating the Unsung Heroes at the VA\\n \\n Customer ServiceCindy DumontJuly 27, 2022Contracting Officers, VA, Department of Veterans Affairs, Procurement, federal health IT solutions, DSS, Health IT'}, {'role': 'user', 'content': 'Did DSS join mission daybreak?'}, {'role': 'assistant', 'content': 'Based on the information provided, there is no mention of DSS joining Mission Daybreak.'}]\n", "Adding new source...\n", "New source split into the following number of \"texts\": 5\n", "Done adding new source.\n", "[{'role': 'system', 'content': '\\n You are a helpful AI assistant.\\n Use your knowledge to answer the user\\'s question if they asked a question.\\n If the answer to a question is not in your knowledge, just admit you do not know the answer and do not fabricate information.\\n DO NOT use phrases like \"Based on the information provided\" or other similar phrases. \\n Refer to the information provided below as \"your knowledge\". \\n State all answers as if they are ground truth, DO NOT mention where you got the information.\\n \\n YOUR KNOWLEDGE: That’s what led the VA to create Mission Daybreak, a $20 million U.S. Department of Veterans Affairs grand challenge to reduce Veteran suicides. This year the VA received 1,371 submissions during Phase One of the Challenge, the deadline for which was July 8, 2022.\\n\\nAs a finalist, DSS will receive $250,000 and advance to Phase 2 of the challenge.\\n\\nDuring Phase 2 of the challenge, the 30 finalists will join a virtual accelerator program designed to help the finalists develop ambitious, but achievable roadmaps for prototyping, iteration, testing, and evaluation. Technology partners supporting the accelerator include Amazon and Microsoft. Two first-place winners will each receive $3 million,\\n\\nThree second-place winners will each receive $1 million,\\n\\nFive third-place winners will each receive $500,000.\\n\\nDSS Inc.’s years of experience helping the VA with data interoperability makes all this possible. DSS is excited to bring the latest ML technology to the VA and put it to work serving veterans. Phase 2 winners will be announced in November and DSS hopes to have great news to share then! Visit missiondaybreak.net for more information.\\n\\nTo learn more about how DSS, Inc. supports the VA and veterans please click here.\\n\\nDSS News\\n\\nCindy Dumont\\n\\nMission Daybreak,\\n\\nDSS,\\n\\nDSS News,\\n\\nsuicide prevention for Veterans,\\n\\nMachine Learning,\\n\\nVA Suicide prevention challenge\\n\\nTwitter\\n\\nLinkedIn0\\n\\n0 Likes DSS News\\n\\nCindy Dumont\\n\\nMission Daybreak,\\n\\nDSS,\\n\\nDSS News,\\n\\nsuicide prevention for Veterans,\\n\\nMachine Learning,\\n\\nVA Suicide prevention challenge\\n\\nTwitter\\n\\nLinkedIn0\\n\\n0 Likes\\n\\nPrevious\\n Customer Service Week 2022: DSS Support Services Team Brings Highest-Level of Customer Support for the Fed Health IT Arena \\n \\n Customer ServiceCindy DumontOctober 3, 2022DSS, Customer Service Week, VA, Department of Veterans Affairs, Customer Service Week 2022, full lifecycle support approach, DSS Support Services team\\n\\nNext\\n VHA Awards Dialysis Electronic Medical Record Software and Maintenance Electronic Health Record Contract to DSS, Inc.\\n \\n DSS NewsCindy DumontSeptember 20, 2022Veterans Healthcare Administration, DSS CyberRen, DSS, Diasyst software, Dialysis EHR, Renal Care for Veterans, HRO, Mark Byers, EHR, Veterans DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies. DSS, Inc. Announces Appointment of Brion Bailey as Director of Federal Business Development\\n\\nBrings 25 years of sales and business development experience supporting disruptive healthcare innovations\\n\\nJUNO BEACH, FLA. AUGUST 09, 2022 — Document Storage Systems, Inc. (DSS, Inc.), a leading provider of health information technology (HIT) solutions for federal, private and public health care organizations, today announced that Brion Bailey has joined the company as the Director of Business Development for its Federal Health division.\\n\\nIn this role, Bailey will be a key driver of revenue growth for the company’s federal health division. He will also expand the company’s partner eco-system, as well as support new sales opportunities at the Department of Veterans Affairs (VA) and other federal health agencies.'}, {'role': 'user', 'content': 'Did DSS join mission daybreak?'}, {'role': 'assistant', 'content': 'Based on the information provided, DSS did join Mission Daybreak as a finalist. According to the text, DSS will receive $250,000 and advance to Phase 2 of the challenge.'}]\n" ] } ], "source": [ "with gr.Blocks() as demo:\n", " gr.HTML(\"\")\n", " gr.Markdown(\"## DSS LLM Demo: Chat with Llama 2\")\n", "\n", " with gr.Column():\n", " chatbot = gr.Chatbot()\n", " \n", " with gr.Row():\n", " with gr.Column():\n", " newMsg = gr.Textbox(label=\"New Message Box\", placeholder=\"New Message\", show_label=False)\n", " with gr.Column():\n", " with gr.Row():\n", " submit = gr.Button(\"Submit\")\n", " clear = gr.Button(\"Clear\")\n", " with gr.Row():\n", " with gr.Column():\n", " newSRC = gr.Textbox(label=\"New source link/path Box\", placeholder=\"New source link/path\", show_label=False)\n", " with gr.Column():\n", " with gr.Row():\n", " addURL = gr.Button(\"Add URL Source\")\n", " addPDF = gr.Button(\"Add PDF Source\")\n", " reset = gr.Button(\"Reset Sources\")\n", "\n", " submit.click(getPrediction, [newMsg], [chatbot, newMsg])\n", " clear.click(clearStuff, None, chatbot, queue=False)\n", " \n", " addURL.click(addURLsource, newSRC, [newSRC, chatbot])\n", " addPDF.click(addPDFsource, newSRC, [newSRC, chatbot])\n", " reset.click(resetDocsearch, None, chatbot)\n", "\n", " gr.Markdown(\"\"\"*Note: \n", " \n", " To add a URL source, place a full hyperlink in the bottom textbox and click the 'Add URL Source' button.\n", " \n", " To add a PDF source, place a relative file path in the bottom textbox and click the 'Add PDF Source' button.\n", " \n", " The database for contextualization includes 8 public DSS website articles upon initialization.\n", " \n", " When the 'Reset Sources' button is clicked, the database is completely wiped. (Some knowledge may be preserved through the conversation history if left uncleared.)*\"\"\")\n", "\n", "\n", "demo.queue()\n", "demo.launch(share=True)" ] }, { "cell_type": "code", "execution_count": null, "id": "e200839d-9f90-4651-8212-decc75d1e3e3", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "conda_pytorch_p310", "language": "python", "name": "conda_pytorch_p310" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.10" } }, "nbformat": 4, "nbformat_minor": 5 }