├── .env ├── .gitignore ├── LICENSE ├── PersonalGPT ├── Jarvis.py ├── __init__.py ├── engine.py ├── env_vars.py ├── ingest.py └── main.py ├── README.md ├── assets └── micro.png ├── requirements.txt ├── run_PersonalGPT.py ├── setup.py └── source_documents └── state_of_the_union.txt /.env: -------------------------------------------------------------------------------- 1 | PERSIST_DIRECTORY=db 2 | MODEL_TYPE=GPT4All 3 | MODEL_PATH=models/ggml-gpt4all-j-v1.3-groovy.bin 4 | EMBEDDINGS_MODEL_NAME=all-MiniLM-L6-v2 5 | MODEL_N_CTX=1000 6 | TARGET_SOURCE_CHUNKS=4 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pywhatkit_dbs.txt 2 | ./vscode 3 | /venv/ 4 | test*.* 5 | /db 6 | __pycache__ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /PersonalGPT/Jarvis.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import wikipedia 3 | import pyjokes 4 | import webbrowser 5 | from os import * 6 | import pywhatkit 7 | import sys 8 | from .engine import takeCommand, speak 9 | from .main import PersonalGPT 10 | 11 | def wishme(): 12 | speak('Hello Sir,') 13 | hour = int(datetime.datetime.now().hour) 14 | 15 | if hour>=5 and hour<12: speak('Good Morning') 16 | elif hour>=12 and hour<16: speak('Good Afternoon') 17 | elif hour>=16 and hour<20: speak('Good Evening') 18 | else: speak('Good Night') 19 | 20 | speak('I am Jarvis. How can I help You now?') 21 | 22 | websites=['facebook','instagram', 'linkedin', 'yahoo', 'twitter', 'gmail','google','youtube','amazon'] 23 | apps=['browser', 'notepad', 'terminal'] 24 | yes=['yes','yup','yeah','sure','ok','why not'] 25 | 26 | def call(query): 27 | #This is the main executable function 28 | 29 | if 'wishme' in query: wishme() 30 | elif 'load gpt' in query: 31 | speak('loading gpt') 32 | gpt = PersonalGPT() 33 | elif ('load documents' or 'load my documents') in query: 34 | speak('loading your files now') 35 | gpt = PersonalGPT() 36 | gpt.from_my_docs() 37 | elif ('search my files now' in query )or ('serach in gpt' in query) : 38 | gpt.ask_query() 39 | 40 | elif 'wikipedia' in query: 41 | speak('Searching for wikipedia') 42 | queryy = query.replace('wikipedia','') 43 | results = wikipedia.summary(queryy, 2) 44 | speak(f'According to wikipedia, {results}') 45 | 46 | elif 'search' in query: 47 | queryy = query.replace('search','') 48 | link = f"https://www.google.com/search?q={queryy}" 49 | webbrowser.open(link) 50 | 51 | elif 'open' in query: 52 | queryy = query.replace('open','') 53 | try: 54 | if websites in queryy: 55 | webbrowser.open(f'http://www.{queryy}.com/') 56 | elif apps in queryy: 57 | startfile(f'{queryy}') 58 | except: print(f"{queryy} cant be opened now") 59 | 60 | elif 'run speedtest' in query: 61 | webbrowser.open('https://www.speedtest.net/') 62 | elif 'time' in query: 63 | strTime = datetime.datetime.now().strftime('%H:%M:%S') 64 | speak(f'Sir, the time is {strTime}') 65 | elif 'date' in query: 66 | strDate = datetime.datetime.now().strftime('%Y-%m-%d') 67 | speak(f'Sir, the date is {strDate}') 68 | elif 'play' in query: 69 | song = query.replace('play', '') 70 | ans = takeCommand('from which player do you want to playing') 71 | if 'youtube' in ans: 72 | speak(f'playing {song} on youtube') 73 | pywhatkit.playonyt(song) 74 | else: 75 | speak("Can't playing sir right now") 76 | 77 | elif 'send messege' in query: 78 | speak('send messege to whom?') 79 | number = takeCommand('Tell me the number, Sir ') 80 | message = takeCommand('Tell me the message, Sir') 81 | pywhatkit.sendwhatmsg_instantly(number, message) 82 | 83 | elif 'text to handwriting' in query: 84 | messege = takeCommand('tell the messege you want to convert') 85 | pywhatkit.text_to_handwriting(messege,'tth.png') 86 | 87 | elif 'send mail' in query: 88 | name = takeCommand('send mail to whom?') 89 | messege = takeCommand('tell the messege') 90 | pywhatkit.send_mail(name,'',messege) 91 | 92 | elif 'joke' in query: 93 | joke = pyjokes.get_joke('en','neutral') 94 | speak(joke) 95 | choice = takeCommand("do you want one more?") 96 | if choice in yes: 97 | call('joke') 98 | elif 'sceenshot' in query: 99 | speak('Taking screenshot') 100 | pywhatkit.take_screenshot() 101 | 102 | elif ('end' in query) or ('quit' in query) : 103 | speak('quiting program') 104 | sys.exit(0) 105 | else: 106 | speak('cannot find anything') 107 | 108 | if __name__ == '__main__': 109 | wishme() 110 | call(takeCommand('Ask me Something, Master')) 111 | #This whole program takes lot of time to write and frutefully execute. 112 | #I am Swarnodip Nag, a programmer like you. 113 | #This file is to dedicate all of you in the world for their education purpose and research purpose only. 114 | #Thank you. Keep upgrading and have fun ;) -------------------------------------------------------------------------------- /PersonalGPT/__init__.py: -------------------------------------------------------------------------------- 1 | from .main import PersonalGPT 2 | from .engine import speak, takeCommand 3 | from .env_vars import * 4 | from .ingest import Ingest 5 | from .Jarvis import call, wishme 6 | 7 | __all__=[ 8 | "PersonalGPT", 9 | "speak", 10 | "takeCommand", 11 | "Ingest", 12 | "call", 13 | "wishme" 14 | ] -------------------------------------------------------------------------------- /PersonalGPT/engine.py: -------------------------------------------------------------------------------- 1 | import pyttsx3 2 | import speech_recognition as sr 3 | 4 | engine = pyttsx3.init() 5 | voices = engine.getProperty('voices') 6 | engine.setProperty('voice' , voices[1].id ) 7 | 8 | 9 | def speak(audio): 10 | engine.say(audio) 11 | engine.runAndWait() 12 | 13 | 14 | def takeCommand(say=None): 15 | #This function takes command and recognize by google 16 | if say: speak(say) 17 | r = sr.Recognizer() 18 | with sr.Microphone() as source: 19 | print('Listening...') 20 | ''' 21 | r.pause_threshold = 1 22 | r.phrase_threshold = 1 23 | r.operation_timeout = 10 24 | r.non_speaking_duration = 0 25 | r.energy_threshold = 400 26 | ''' 27 | r.adjust_for_ambient_noise(source) 28 | audios = r.listen(source) 29 | 30 | try: 31 | print('Recognizing') 32 | queryy = r.recognize_google(audios, language='en-IN') 33 | return queryy.lower() 34 | except Exception as e: 35 | return None 36 | -------------------------------------------------------------------------------- /PersonalGPT/env_vars.py: -------------------------------------------------------------------------------- 1 | # This file is for configuration of the langchain package. 2 | # The configuration is loaded from the langchain.config module. 3 | # 4 | # The configuration is a dictionary with the following keys: 5 | # 6 | # MODEL_TYPE: The type of model to use. 7 | # MODEL: The name of the model to use. 8 | # MODEL_PATH: The path to the model to use. 9 | # EMBEDDINGS_MODEL_NAME: The name of the embeddings model to use. 10 | # MODEL_N_CTX: The number of tokens to process 11 | # TARGET_SOURCE_CHUNKS: The number of chunks to split the source into 12 | # INGEST_THREADS: The number of threads to use for ingestion 13 | # SOURCE_DIRECTORY: The folder to store the source documents 14 | # PERSIST_DIRECTORY: The folder to store 15 | # LOADER_MAP: A dictionary mapping file extensions to Document Loader classes 16 | 17 | import os 18 | # Import the Document Loaders 19 | from langchain.document_loaders import ( 20 | CSVLoader, 21 | PDFMinerLoader, 22 | TextLoader, 23 | EverNoteLoader, 24 | UnstructuredExcelLoader, 25 | UnstructuredEPubLoader, 26 | UnstructuredHTMLLoader, 27 | UnstructuredMarkdownLoader, 28 | UnstructuredODTLoader, 29 | UnstructuredPowerPointLoader, 30 | UnstructuredWordDocumentLoader, 31 | ) 32 | 33 | # Set model name and path 34 | MODEL_TYPE='Cohere' 35 | API_KEY='n0oQcCiDDdduOa5R6p9f7Sluadpp5ckcIPJ7mMb3' 36 | MODEL='ggml-gpt4all-j-v1.3-groovy.bin' 37 | MODEL_PATH=f'models/{MODEL}' 38 | EMBEDDINGS_MODEL_NAME='all-MiniLM-L6-v2' 39 | MODEL_N_CTX=1000 40 | TARGET_SOURCE_CHUNKS=4 41 | 42 | # Set Voice model 43 | VOICE_REC_ENGINE='SpeechRecognition' 44 | VOICE_ENGINE='pyttsx3' 45 | 46 | #define root directory 47 | ROOT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) 48 | # Define the folder for storing database 49 | SOURCE_DIRECTORY = os.path.join(ROOT_DIRECTORY,"source_documents") 50 | PERSIST_DIRECTORY = os.path.join(ROOT_DIRECTORY,"db") 51 | 52 | # Change this to the number of threads you want to use for ingestion 53 | INGEST_THREADS = os.cpu_count() or 8 54 | 55 | # Map the Document Loader to its file extension 56 | LOADER_MAP = { 57 | ".csv": (CSVLoader, {}), 58 | ".doc": (UnstructuredWordDocumentLoader, {}), 59 | ".docx": (UnstructuredWordDocumentLoader, {}), 60 | ".enex": (EverNoteLoader, {}), 61 | ".epub": (UnstructuredEPubLoader, {}), 62 | ".html": (UnstructuredHTMLLoader, {}), 63 | ".md": (UnstructuredMarkdownLoader, {}), 64 | ".odt": (UnstructuredODTLoader, {}), 65 | ".pdf": (PDFMinerLoader, {}), 66 | ".ppt": (UnstructuredPowerPointLoader, {}), 67 | ".pptx": (UnstructuredPowerPointLoader, {}), 68 | ".txt": (TextLoader, {"encoding": "utf8"}), 69 | ".xls": (UnstructuredExcelLoader,{}), 70 | ".xlsx": (UnstructuredExcelLoader,{}), 71 | } 72 | -------------------------------------------------------------------------------- /PersonalGPT/ingest.py: -------------------------------------------------------------------------------- 1 | # This file is for Loading the data to Vector Database 2 | 3 | from langchain.text_splitter import RecursiveCharacterTextSplitter 4 | from langchain.vectorstores import DeepLake 5 | from langchain.embeddings import HuggingFaceInstructEmbeddings, OpenAIEmbeddings, CohereEmbeddings, LlamaCppEmbeddings 6 | from langchain.docstore.document import Document 7 | from tqdm import tqdm 8 | from typing import List 9 | from glob import glob 10 | from multiprocessing import Pool 11 | from .engine import speak 12 | 13 | # import environment vars from env_vars.py file 14 | from .env_vars import * 15 | 16 | chunk_size = 500 17 | chunk_overlap = 50 18 | 19 | class Ingest: 20 | def __init__(self) -> None: 21 | match MODEL_TYPE: 22 | case 'OpenAI': 23 | self.embeddings= OpenAIEmbeddings(openai_api_key=API_KEY) 24 | case 'Cohere': 25 | self.embeddings = CohereEmbeddings(cohere_api_key=API_KEY) 26 | case 'LlamaCpp': 27 | self.embeddings = LlamaCppEmbeddings() 28 | case _default_: 29 | self.embeddings = HuggingFaceInstructEmbeddings(model_name=EMBEDDINGS_MODEL_NAME) 30 | 31 | def load_single_document(self, file_path: str) -> List[Document]: 32 | """Loads single document at a time 33 | Args: 34 | file_path (str): Take filepath, where the file is that you want to load 35 | 36 | Raises: 37 | ValueError: If file not found or file extension not supported 38 | 39 | Returns: 40 | List[Document]: Content of the file 41 | """ 42 | ext = "." + file_path.rsplit(".", 1)[-1] 43 | if ext in LOADER_MAP: 44 | loader_class, loader_args = LOADER_MAP[ext] 45 | loader = loader_class(file_path, **loader_args) 46 | return loader.load() 47 | 48 | raise ValueError(f"Unsupported file extension '{ext}'") 49 | 50 | def load_documents(self, source_dir: str, ignored_files: List[str] = []) -> List[Document]: 51 | """ 52 | Loads all documents from the source documents directory, ignoring specified files 53 | """ 54 | all_files = [] 55 | for ext in LOADER_MAP: 56 | all_files.extend( 57 | glob.glob(os.path.join(source_dir, f"**/*{ext}"), recursive=True) 58 | ) 59 | filtered_files = [file_path for file_path in all_files if file_path not in ignored_files] 60 | 61 | with Pool(processes=INGEST_THREADS) as pool: 62 | results = [] 63 | with tqdm(total=len(filtered_files), desc='Loading new documents', ncols=80) as pbar: 64 | for i, docs in enumerate(pool.imap_unordered(self.load_single_document, filtered_files)): 65 | results.extend(docs) 66 | pbar.update() 67 | 68 | return results 69 | 70 | def process_documents(self, ignored_files: List[str] = []) -> List[Document]: 71 | """ 72 | Load documents and split in chunks 73 | """ 74 | print(f"Loading documents from {SOURCE_DIRECTORY}") 75 | documents = self.load_documents(SOURCE_DIRECTORY, ignored_files) 76 | if not documents: 77 | print("No new documents to load") 78 | exit(0) 79 | print(f"Loaded {len(documents)} new documents from {SOURCE_DIRECTORY}") 80 | text_splitter = RecursiveCharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=chunk_overlap) 81 | texts = text_splitter.split_documents(documents) 82 | print(f"Split into {len(texts)} chunks of text (max. {chunk_size} tokens each)") 83 | return texts 84 | 85 | def does_vectorstore_exist(self, persist_directory: str) -> bool: 86 | 87 | if os.path.exists(os.path.join(persist_directory, 'index')): 88 | if os.path.exists(os.path.join(persist_directory, 'chroma-collections.parquet')) and os.path.exists(os.path.join(persist_directory, 'chroma-embeddings.parquet')): 89 | list_index_files = glob.glob(os.path.join(persist_directory, 'index/*.bin')) 90 | list_index_files += glob.glob(os.path.join(persist_directory, 'index/*.pkl')) 91 | # At least 3 documents are needed in a working vectorstore 92 | if len(list_index_files) > 3: 93 | return True 94 | return False 95 | def load(self): 96 | # Create embeddings 97 | if self.does_vectorstore_exist(PERSIST_DIRECTORY): 98 | # Update and store locally vectorstore 99 | speak(f"Appending to existing vectorstore at {PERSIST_DIRECTORY}") 100 | self.db = DeepLake(embedding_function=self.embeddings, dataset_path=PERSIST_DIRECTORY, verbose=False) 101 | collection = self.db.get() 102 | texts = self.process_documents([metadata['source'] for metadata in collection['metadatas']]) 103 | speak(f"Creating embeddings. May take some minutes...") 104 | self.db.add_documents(texts) 105 | else: 106 | # Create and store locally vectorstore 107 | speak("Creating new vectorstore") 108 | texts = self.process_documents() 109 | speak(f"Creating embeddings. May take some minutes...") 110 | self.db = DeepLake.from_documents(texts, self.embeddings, dataset_path=PERSIST_DIRECTORY, verbose=False) 111 | speak(f"Ingestion complete!") 112 | return self.db 113 | -------------------------------------------------------------------------------- /PersonalGPT/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from langchain.chains import RetrievalQA,LLMChain 3 | from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler 4 | from langchain.llms import ( 5 | LlamaCpp, 6 | GPT4All, 7 | Cohere, 8 | OpenAI 9 | ) 10 | from langchain import PromptTemplate 11 | from .env_vars import * 12 | from .ingest import Ingest 13 | from .engine import takeCommand, speak 14 | 15 | class PersonalGPT(Ingest): 16 | """_summary_ 17 | 18 | Args: 19 | Ingest (_type_): _description_ 20 | """ 21 | def __init__(self): 22 | super(Ingest,self).__init__() 23 | # activate/deactivate the streaming StdOut callback for LLMs 24 | callbacks = [StreamingStdOutCallbackHandler()] 25 | self.FLAG=False 26 | # Prepare the LLM 27 | match MODEL_TYPE: 28 | case "LlamaCpp": 29 | self.llm = LlamaCpp(model_path=MODEL_PATH, n_ctx=MODEL_N_CTX, callbacks=callbacks, verbose=False) 30 | case "GPT4All": 31 | self.llm = GPT4All(model=MODEL_PATH, n_ctx=MODEL_N_CTX, backend='gptj', callbacks=callbacks, verbose=False) 32 | case "Cohere": 33 | self.llm = Cohere(cohere_api_key=API_KEY, max_tokens=2000, callbacks=callbacks, verbose=False) 34 | case "OpenAI": 35 | self.llm = OpenAI(openai_api_key=API_KEY, temperature=0.7, max_tokens=256, callbacks=callbacks, verbose=False) 36 | case _default: 37 | print(f"Model {MODEL_TYPE} not supported!") 38 | exit; 39 | def from_my_docs(self, flag=True): 40 | db = super().load() 41 | retriever = db.as_retriever(search_kwargs={"k": TARGET_SOURCE_CHUNKS}) 42 | self.qa = RetrievalQA.from_chain_type(llm=self.llm, chain_type="stuff", retriever=retriever) 43 | self.FLAG=flag 44 | 45 | def ask_query(self): 46 | # Interactive questions and answers 47 | while True: 48 | query = takeCommand("Ask a query Master,") 49 | if query == "exit": 50 | break 51 | #print(f"{self.llm}") 52 | # Get the answer from the chain 53 | if self.FLAG: res = self.qa.run(query) 54 | else: 55 | prompt = PromptTemplate(input_variables=['question'], 56 | template=''' 57 | Question: {question} 58 | Answer: ''') 59 | self.chain = LLMChain(llm=self.llm, prompt=prompt) 60 | res = self.chain.run(query) 61 | 62 | # Speak the result 63 | speak(f"Question You've asked: {query} and the Answer is: {res}") 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PersonalGPT 2 | Your own GPT-powered Personal Assistant to whom you can ORDER or INSTRUCT to do some task or search for something using your VOICE commands. 3 | Built with [LangChain](https://github.com/hwchase17/langchain), [GPT4All](https://github.com/nomic-ai/gpt4all), [LlamaCpp](https://github.com/ggerganov/llama.cpp), [Chroma](https://www.trychroma.com/) and [SentenceTransformers](https://www.sbert.net/). 4 | -Also Supports OpenAI's GPT3, GPT4 model, Cohere. 5 | 6 | This project is Highly Inspired by [privateGPT](https://github.com/imartinez/privateGPT) for GPT assistance making but this project uses [DeepLake VectorStores](https://github.com/activeloopai/deeplake) to store your dataset/files. 7 | 8 | # Installing dependencies 9 | 10 | On Windows: 11 | ```shell 12 | pip install -r requirements.txt 13 | ``` 14 | On Linux / Mac: 15 | ``` 16 | pip3 install -r requirements.txt 17 | ``` 18 | # Setting Environment Variables 19 | 20 | Open the `PersonalGPT/env_vars.py` 21 | 22 | and edit the variables appropriately in the `env_vars.py` file. 23 | 24 | ``` 25 | MODEL_TYPE: supports LlamaCpp, GPT4All, OpenAI & Cohere 26 | PERSIST_DIRECTORY: is the folder you want your vectorstore in 27 | MODEL_PATH: Path to your GPT4All or LlamaCpp supported LLM 28 | MODEL_N_CTX: Maximum token limit for the LLM model 29 | MODEL_N_BATCH: Number of tokens in the prompt that are fed into the model at a time. Optimal value differs a lot depending on the model (8 works well for GPT4All, and 1024 is better for LlamaCpp) 30 | EMBEDDINGS_MODEL_NAME: SentenceTransformers embeddings model name (see https://www.sbert.net/docs/pretrained_models.html) 31 | TARGET_SOURCE_CHUNKS: The amount of chunks (sources) that will be used to answer a question 32 | VOICE_MODEL=pyttsx3 33 | VOICE_REC_ENGINE=SpeechRecognition 34 | API_KEY=OpeAI or Cohere API Key 35 | ``` 36 | 37 | ## Instructions for ingesting your own dataset 38 | 39 | Put any and all your files into the `source_documents` directory 40 | 41 | The supported extensions are: 42 | 43 | - `.csv`: CSV, 44 | - `.docx`: Word Document, 45 | - `.doc`: Word Document, 46 | - `.enex`: EverNote, 47 | - `.eml`: Email, 48 | - `.epub`: EPub, 49 | - `.html`: HTML File, 50 | - `.md`: Markdown, 51 | - `.msg`: Outlook Message, 52 | - `.odt`: Open Document Text, 53 | - `.pdf`: Portable Document Format (PDF), 54 | - `.pptx`: PowerPoint Document, 55 | - `.ppt`: PowerPoint Document, 56 | - `.txt`: Text file (UTF-8), 57 | - `.xls`: Excel Spreadsheet 58 | - `.xlsx`: Excel Spreadsheet 59 | 60 | Give the following command to ingest all the data. 61 | 62 | # Run PersonalGPT 63 | On Windows: 64 | ```shell 65 | python run_PersonalGPT.py 66 | ``` 67 | On Linux / Mac: 68 | ```shell 69 | python3 run_PersonalGPT.py 70 | ``` 71 | ### Now Give Voice commands whatever you use 72 | ```shell 73 | open browser 74 | load my files 75 | ask gpt 76 | tell me a joke 77 | open youtube 78 | ``` 79 | and many more 80 | 81 | This module is free to use, modify, share 82 | 83 | Contribution is open for everyone, if you find some issue feel free to pull an Issue request or you've fixed this then do a PR 84 | 85 | Thank You, for reading this. 86 | -------------------------------------------------------------------------------- /assets/micro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swarno-Coder/PersonalGPT/c17445bd3ad51abf21c23490ed04c296a5c54a7d/assets/micro.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyttsx3 2 | speechRecognition 3 | webbrowser 4 | pywhatkit 5 | pyjokes 6 | wikipedia 7 | google 8 | langchain 9 | gpt4all 10 | llama-cpp-python 11 | openai 12 | cohere 13 | deeplake 14 | urllib3 15 | pdfminer.six 16 | python-dotenv==1.0.0 17 | unstructured==0.6.6 18 | extract-msg==0.41.1 19 | tabulate==0.9.0 20 | pandoc==2.3 21 | pypandoc==1.11 22 | tqdm==4.65.0 23 | glob 24 | kaldi 25 | -------------------------------------------------------------------------------- /run_PersonalGPT.py: -------------------------------------------------------------------------------- 1 | from PersonalGPT import takeCommand, call 2 | 3 | while True: 4 | com = takeCommand(say=None) 5 | if 'hey jarvis' in com: 6 | com = com.replace('hey jarvis' ,'') 7 | call(com) -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='PersonalGPT', 5 | version='0.1', 6 | description="Your Personal GPT powered assistance, do whatever you want to do with your voice commands", 7 | url="https://github.com/Swarno-coder/PersonalGPT", 8 | packages=['PersonalGPT'], 9 | author="Swarnodip Nag", 10 | author_email="official.swarnodipnag@gmail.com" 11 | ) -------------------------------------------------------------------------------- /source_documents/state_of_the_union.txt: -------------------------------------------------------------------------------- 1 | Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans. 2 | 3 | Last year COVID-19 kept us apart. This year we are finally together again. 4 | 5 | Tonight, we meet as Democrats Republicans and Independents. But most importantly as Americans. 6 | 7 | With a duty to one another to the American people to the Constitution. 8 | 9 | And with an unwavering resolve that freedom will always triumph over tyranny. 10 | 11 | Six days ago, Russia’s Vladimir Putin sought to shake the foundations of the free world thinking he could make it bend to his menacing ways. But he badly miscalculated. 12 | 13 | He thought he could roll into Ukraine and the world would roll over. Instead he met a wall of strength he never imagined. 14 | 15 | He met the Ukrainian people. 16 | 17 | From President Zelenskyy to every Ukrainian, their fearlessness, their courage, their determination, inspires the world. 18 | 19 | Groups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland. 20 | 21 | In this struggle as President Zelenskyy said in his speech to the European Parliament “Light will win over darkness.” The Ukrainian Ambassador to the United States is here tonight. 22 | 23 | Let each of us here tonight in this Chamber send an unmistakable signal to Ukraine and to the world. 24 | 25 | Please rise if you are able and show that, Yes, we the United States of America stand with the Ukrainian people. 26 | 27 | Throughout our history we’ve learned this lesson when dictators do not pay a price for their aggression they cause more chaos. 28 | 29 | They keep moving. 30 | 31 | And the costs and the threats to America and the world keep rising. 32 | 33 | That’s why the NATO Alliance was created to secure peace and stability in Europe after World War 2. 34 | 35 | The United States is a member along with 29 other nations. 36 | 37 | It matters. American diplomacy matters. American resolve matters. 38 | 39 | Putin’s latest attack on Ukraine was premeditated and unprovoked. 40 | 41 | He rejected repeated efforts at diplomacy. 42 | 43 | He thought the West and NATO wouldn’t respond. And he thought he could divide us at home. Putin was wrong. We were ready. Here is what we did. 44 | 45 | We prepared extensively and carefully. 46 | 47 | We spent months building a coalition of other freedom-loving nations from Europe and the Americas to Asia and Africa to confront Putin. 48 | 49 | I spent countless hours unifying our European allies. We shared with the world in advance what we knew Putin was planning and precisely how he would try to falsely justify his aggression. 50 | 51 | We countered Russia’s lies with truth. 52 | 53 | And now that he has acted the free world is holding him accountable. 54 | 55 | Along with twenty-seven members of the European Union including France, Germany, Italy, as well as countries like the United Kingdom, Canada, Japan, Korea, Australia, New Zealand, and many others, even Switzerland. 56 | 57 | We are inflicting pain on Russia and supporting the people of Ukraine. Putin is now isolated from the world more than ever. 58 | 59 | Together with our allies –we are right now enforcing powerful economic sanctions. 60 | 61 | We are cutting off Russia’s largest banks from the international financial system. 62 | 63 | Preventing Russia’s central bank from defending the Russian Ruble making Putin’s $630 Billion “war fund” worthless. 64 | 65 | We are choking off Russia’s access to technology that will sap its economic strength and weaken its military for years to come. 66 | 67 | Tonight I say to the Russian oligarchs and corrupt leaders who have bilked billions of dollars off this violent regime no more. 68 | 69 | The U.S. Department of Justice is assembling a dedicated task force to go after the crimes of Russian oligarchs. 70 | 71 | We are joining with our European allies to find and seize your yachts your luxury apartments your private jets. We are coming for your ill-begotten gains. 72 | 73 | And tonight I am announcing that we will join our allies in closing off American air space to all Russian flights – further isolating Russia – and adding an additional squeeze –on their economy. The Ruble has lost 30% of its value. 74 | 75 | The Russian stock market has lost 40% of its value and trading remains suspended. Russia’s economy is reeling and Putin alone is to blame. 76 | 77 | Together with our allies we are providing support to the Ukrainians in their fight for freedom. Military assistance. Economic assistance. Humanitarian assistance. 78 | 79 | We are giving more than $1 Billion in direct assistance to Ukraine. 80 | 81 | And we will continue to aid the Ukrainian people as they defend their country and to help ease their suffering. 82 | 83 | Let me be clear, our forces are not engaged and will not engage in conflict with Russian forces in Ukraine. 84 | 85 | Our forces are not going to Europe to fight in Ukraine, but to defend our NATO Allies – in the event that Putin decides to keep moving west. 86 | 87 | For that purpose we’ve mobilized American ground forces, air squadrons, and ship deployments to protect NATO countries including Poland, Romania, Latvia, Lithuania, and Estonia. 88 | 89 | As I have made crystal clear the United States and our Allies will defend every inch of territory of NATO countries with the full force of our collective power. 90 | 91 | And we remain clear-eyed. The Ukrainians are fighting back with pure courage. But the next few days weeks, months, will be hard on them. 92 | 93 | Putin has unleashed violence and chaos. But while he may make gains on the battlefield – he will pay a continuing high price over the long run. 94 | 95 | And a proud Ukrainian people, who have known 30 years of independence, have repeatedly shown that they will not tolerate anyone who tries to take their country backwards. 96 | 97 | To all Americans, I will be honest with you, as I’ve always promised. A Russian dictator, invading a foreign country, has costs around the world. 98 | 99 | And I’m taking robust action to make sure the pain of our sanctions is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. 100 | 101 | Tonight, I can announce that the United States has worked with 30 other countries to release 60 Million barrels of oil from reserves around the world. 102 | 103 | America will lead that effort, releasing 30 Million barrels from our own Strategic Petroleum Reserve. And we stand ready to do more if necessary, unified with our allies. 104 | 105 | These steps will help blunt gas prices here at home. And I know the news about what’s happening can seem alarming. 106 | 107 | But I want you to know that we are going to be okay. 108 | 109 | When the history of this era is written Putin’s war on Ukraine will have left Russia weaker and the rest of the world stronger. 110 | 111 | While it shouldn’t have taken something so terrible for people around the world to see what’s at stake now everyone sees it clearly. 112 | 113 | We see the unity among leaders of nations and a more unified Europe a more unified West. And we see unity among the people who are gathering in cities in large crowds around the world even in Russia to demonstrate their support for Ukraine. 114 | 115 | In the battle between democracy and autocracy, democracies are rising to the moment, and the world is clearly choosing the side of peace and security. 116 | 117 | This is a real test. It’s going to take time. So let us continue to draw inspiration from the iron will of the Ukrainian people. 118 | 119 | To our fellow Ukrainian Americans who forge a deep bond that connects our two nations we stand with you. 120 | 121 | Putin may circle Kyiv with tanks, but he will never gain the hearts and souls of the Ukrainian people. 122 | 123 | He will never extinguish their love of freedom. He will never weaken the resolve of the free world. 124 | 125 | We meet tonight in an America that has lived through two of the hardest years this nation has ever faced. 126 | 127 | The pandemic has been punishing. 128 | 129 | And so many families are living paycheck to paycheck, struggling to keep up with the rising cost of food, gas, housing, and so much more. 130 | 131 | I understand. 132 | 133 | I remember when my Dad had to leave our home in Scranton, Pennsylvania to find work. I grew up in a family where if the price of food went up, you felt it. 134 | 135 | That’s why one of the first things I did as President was fight to pass the American Rescue Plan. 136 | 137 | Because people were hurting. We needed to act, and we did. 138 | 139 | Few pieces of legislation have done more in a critical moment in our history to lift us out of crisis. 140 | 141 | It fueled our efforts to vaccinate the nation and combat COVID-19. It delivered immediate economic relief for tens of millions of Americans. 142 | 143 | Helped put food on their table, keep a roof over their heads, and cut the cost of health insurance. 144 | 145 | And as my Dad used to say, it gave people a little breathing room. 146 | 147 | And unlike the $2 Trillion tax cut passed in the previous administration that benefitted the top 1% of Americans, the American Rescue Plan helped working people—and left no one behind. 148 | 149 | And it worked. It created jobs. Lots of jobs. 150 | 151 | In fact—our economy created over 6.5 Million new jobs just last year, more jobs created in one year 152 | than ever before in the history of America. 153 | 154 | Our economy grew at a rate of 5.7% last year, the strongest growth in nearly 40 years, the first step in bringing fundamental change to an economy that hasn’t worked for the working people of this nation for too long. 155 | 156 | For the past 40 years we were told that if we gave tax breaks to those at the very top, the benefits would trickle down to everyone else. 157 | 158 | But that trickle-down theory led to weaker economic growth, lower wages, bigger deficits, and the widest gap between those at the top and everyone else in nearly a century. 159 | 160 | Vice President Harris and I ran for office with a new economic vision for America. 161 | 162 | Invest in America. Educate Americans. Grow the workforce. Build the economy from the bottom up 163 | and the middle out, not from the top down. 164 | 165 | Because we know that when the middle class grows, the poor have a ladder up and the wealthy do very well. 166 | 167 | America used to have the best roads, bridges, and airports on Earth. 168 | 169 | Now our infrastructure is ranked 13th in the world. 170 | 171 | We won’t be able to compete for the jobs of the 21st Century if we don’t fix that. 172 | 173 | That’s why it was so important to pass the Bipartisan Infrastructure Law—the most sweeping investment to rebuild America in history. 174 | 175 | This was a bipartisan effort, and I want to thank the members of both parties who worked to make it happen. 176 | 177 | We’re done talking about infrastructure weeks. 178 | 179 | We’re going to have an infrastructure decade. 180 | 181 | It is going to transform America and put us on a path to win the economic competition of the 21st Century that we face with the rest of the world—particularly with China. 182 | 183 | As I’ve told Xi Jinping, it is never a good bet to bet against the American people. 184 | 185 | We’ll create good jobs for millions of Americans, modernizing roads, airports, ports, and waterways all across America. 186 | 187 | And we’ll do it all to withstand the devastating effects of the climate crisis and promote environmental justice. 188 | 189 | We’ll build a national network of 500,000 electric vehicle charging stations, begin to replace poisonous lead pipes—so every child—and every American—has clean water to drink at home and at school, provide affordable high-speed internet for every American—urban, suburban, rural, and tribal communities. 190 | 191 | 4,000 projects have already been announced. 192 | 193 | And tonight, I’m announcing that this year we will start fixing over 65,000 miles of highway and 1,500 bridges in disrepair. 194 | 195 | When we use taxpayer dollars to rebuild America – we are going to Buy American: buy American products to support American jobs. 196 | 197 | The federal government spends about $600 Billion a year to keep the country safe and secure. 198 | 199 | There’s been a law on the books for almost a century 200 | to make sure taxpayers’ dollars support American jobs and businesses. 201 | 202 | Every Administration says they’ll do it, but we are actually doing it. 203 | 204 | We will buy American to make sure everything from the deck of an aircraft carrier to the steel on highway guardrails are made in America. 205 | 206 | But to compete for the best jobs of the future, we also need to level the playing field with China and other competitors. 207 | 208 | That’s why it is so important to pass the Bipartisan Innovation Act sitting in Congress that will make record investments in emerging technologies and American manufacturing. 209 | 210 | Let me give you one example of why it’s so important to pass it. 211 | 212 | If you travel 20 miles east of Columbus, Ohio, you’ll find 1,000 empty acres of land. 213 | 214 | It won’t look like much, but if you stop and look closely, you’ll see a “Field of dreams,” the ground on which America’s future will be built. 215 | 216 | This is where Intel, the American company that helped build Silicon Valley, is going to build its $20 billion semiconductor “mega site”. 217 | 218 | Up to eight state-of-the-art factories in one place. 10,000 new good-paying jobs. 219 | 220 | Some of the most sophisticated manufacturing in the world to make computer chips the size of a fingertip that power the world and our everyday lives. 221 | 222 | Smartphones. The Internet. Technology we have yet to invent. 223 | 224 | But that’s just the beginning. 225 | 226 | Intel’s CEO, Pat Gelsinger, who is here tonight, told me they are ready to increase their investment from 227 | $20 billion to $100 billion. 228 | 229 | That would be one of the biggest investments in manufacturing in American history. 230 | 231 | And all they’re waiting for is for you to pass this bill. 232 | 233 | So let’s not wait any longer. Send it to my desk. I’ll sign it. 234 | 235 | And we will really take off. 236 | 237 | And Intel is not alone. 238 | 239 | There’s something happening in America. 240 | 241 | Just look around and you’ll see an amazing story. 242 | 243 | The rebirth of the pride that comes from stamping products “Made In America.” The revitalization of American manufacturing. 244 | 245 | Companies are choosing to build new factories here, when just a few years ago, they would have built them overseas. 246 | 247 | That’s what is happening. Ford is investing $11 billion to build electric vehicles, creating 11,000 jobs across the country. 248 | 249 | GM is making the largest investment in its history—$7 billion to build electric vehicles, creating 4,000 jobs in Michigan. 250 | 251 | All told, we created 369,000 new manufacturing jobs in America just last year. 252 | 253 | Powered by people I’ve met like JoJo Burgess, from generations of union steelworkers from Pittsburgh, who’s here with us tonight. 254 | 255 | As Ohio Senator Sherrod Brown says, “It’s time to bury the label “Rust Belt.” 256 | 257 | It’s time. 258 | 259 | But with all the bright spots in our economy, record job growth and higher wages, too many families are struggling to keep up with the bills. 260 | 261 | Inflation is robbing them of the gains they might otherwise feel. 262 | 263 | I get it. That’s why my top priority is getting prices under control. 264 | 265 | Look, our economy roared back faster than most predicted, but the pandemic meant that businesses had a hard time hiring enough workers to keep up production in their factories. 266 | 267 | The pandemic also disrupted global supply chains. 268 | 269 | When factories close, it takes longer to make goods and get them from the warehouse to the store, and prices go up. 270 | 271 | Look at cars. 272 | 273 | Last year, there weren’t enough semiconductors to make all the cars that people wanted to buy. 274 | 275 | And guess what, prices of automobiles went up. 276 | 277 | So—we have a choice. 278 | 279 | One way to fight inflation is to drive down wages and make Americans poorer. 280 | 281 | I have a better plan to fight inflation. 282 | 283 | Lower your costs, not your wages. 284 | 285 | Make more cars and semiconductors in America. 286 | 287 | More infrastructure and innovation in America. 288 | 289 | More goods moving faster and cheaper in America. 290 | 291 | More jobs where you can earn a good living in America. 292 | 293 | And instead of relying on foreign supply chains, let’s make it in America. 294 | 295 | Economists call it “increasing the productive capacity of our economy.” 296 | 297 | I call it building a better America. 298 | 299 | My plan to fight inflation will lower your costs and lower the deficit. 300 | 301 | 17 Nobel laureates in economics say my plan will ease long-term inflationary pressures. Top business leaders and most Americans support my plan. And here’s the plan: 302 | 303 | First – cut the cost of prescription drugs. Just look at insulin. One in ten Americans has diabetes. In Virginia, I met a 13-year-old boy named Joshua Davis. 304 | 305 | He and his Dad both have Type 1 diabetes, which means they need insulin every day. Insulin costs about $10 a vial to make. 306 | 307 | But drug companies charge families like Joshua and his Dad up to 30 times more. I spoke with Joshua’s mom. 308 | 309 | Imagine what it’s like to look at your child who needs insulin and have no idea how you’re going to pay for it. 310 | 311 | What it does to your dignity, your ability to look your child in the eye, to be the parent you expect to be. 312 | 313 | Joshua is here with us tonight. Yesterday was his birthday. Happy birthday, buddy. 314 | 315 | For Joshua, and for the 200,000 other young people with Type 1 diabetes, let’s cap the cost of insulin at $35 a month so everyone can afford it. 316 | 317 | Drug companies will still do very well. And while we’re at it let Medicare negotiate lower prices for prescription drugs, like the VA already does. 318 | 319 | Look, the American Rescue Plan is helping millions of families on Affordable Care Act plans save $2,400 a year on their health care premiums. Let’s close the coverage gap and make those savings permanent. 320 | 321 | Second – cut energy costs for families an average of $500 a year by combatting climate change. 322 | 323 | Let’s provide investments and tax credits to weatherize your homes and businesses to be energy efficient and you get a tax credit; double America’s clean energy production in solar, wind, and so much more; lower the price of electric vehicles, saving you another $80 a month because you’ll never have to pay at the gas pump again. 324 | 325 | Third – cut the cost of child care. Many families pay up to $14,000 a year for child care per child. 326 | 327 | Middle-class and working families shouldn’t have to pay more than 7% of their income for care of young children. 328 | 329 | My plan will cut the cost in half for most families and help parents, including millions of women, who left the workforce during the pandemic because they couldn’t afford child care, to be able to get back to work. 330 | 331 | My plan doesn’t stop there. It also includes home and long-term care. More affordable housing. And Pre-K for every 3- and 4-year-old. 332 | 333 | All of these will lower costs. 334 | 335 | And under my plan, nobody earning less than $400,000 a year will pay an additional penny in new taxes. Nobody. 336 | 337 | The one thing all Americans agree on is that the tax system is not fair. We have to fix it. 338 | 339 | I’m not looking to punish anyone. But let’s make sure corporations and the wealthiest Americans start paying their fair share. 340 | 341 | Just last year, 55 Fortune 500 corporations earned $40 billion in profits and paid zero dollars in federal income tax. 342 | 343 | That’s simply not fair. That’s why I’ve proposed a 15% minimum tax rate for corporations. 344 | 345 | We got more than 130 countries to agree on a global minimum tax rate so companies can’t get out of paying their taxes at home by shipping jobs and factories overseas. 346 | 347 | That’s why I’ve proposed closing loopholes so the very wealthy don’t pay a lower tax rate than a teacher or a firefighter. 348 | 349 | So that’s my plan. It will grow the economy and lower costs for families. 350 | 351 | So what are we waiting for? Let’s get this done. And while you’re at it, confirm my nominees to the Federal Reserve, which plays a critical role in fighting inflation. 352 | 353 | My plan will not only lower costs to give families a fair shot, it will lower the deficit. 354 | 355 | The previous Administration not only ballooned the deficit with tax cuts for the very wealthy and corporations, it undermined the watchdogs whose job was to keep pandemic relief funds from being wasted. 356 | 357 | But in my administration, the watchdogs have been welcomed back. 358 | 359 | We’re going after the criminals who stole billions in relief money meant for small businesses and millions of Americans. 360 | 361 | And tonight, I’m announcing that the Justice Department will name a chief prosecutor for pandemic fraud. 362 | 363 | By the end of this year, the deficit will be down to less than half what it was before I took office. 364 | 365 | The only president ever to cut the deficit by more than one trillion dollars in a single year. 366 | 367 | Lowering your costs also means demanding more competition. 368 | 369 | I’m a capitalist, but capitalism without competition isn’t capitalism. 370 | 371 | It’s exploitation—and it drives up prices. 372 | 373 | When corporations don’t have to compete, their profits go up, your prices go up, and small businesses and family farmers and ranchers go under. 374 | 375 | We see it happening with ocean carriers moving goods in and out of America. 376 | 377 | During the pandemic, these foreign-owned companies raised prices by as much as 1,000% and made record profits. 378 | 379 | Tonight, I’m announcing a crackdown on these companies overcharging American businesses and consumers. 380 | 381 | And as Wall Street firms take over more nursing homes, quality in those homes has gone down and costs have gone up. 382 | 383 | That ends on my watch. 384 | 385 | Medicare is going to set higher standards for nursing homes and make sure your loved ones get the care they deserve and expect. 386 | 387 | We’ll also cut costs and keep the economy going strong by giving workers a fair shot, provide more training and apprenticeships, hire them based on their skills not degrees. 388 | 389 | Let’s pass the Paycheck Fairness Act and paid leave. 390 | 391 | Raise the minimum wage to $15 an hour and extend the Child Tax Credit, so no one has to raise a family in poverty. 392 | 393 | Let’s increase Pell Grants and increase our historic support of HBCUs, and invest in what Jill—our First Lady who teaches full-time—calls America’s best-kept secret: community colleges. 394 | 395 | And let’s pass the PRO Act when a majority of workers want to form a union—they shouldn’t be stopped. 396 | 397 | When we invest in our workers, when we build the economy from the bottom up and the middle out together, we can do something we haven’t done in a long time: build a better America. 398 | 399 | For more than two years, COVID-19 has impacted every decision in our lives and the life of the nation. 400 | 401 | And I know you’re tired, frustrated, and exhausted. 402 | 403 | But I also know this. 404 | 405 | Because of the progress we’ve made, because of your resilience and the tools we have, tonight I can say 406 | we are moving forward safely, back to more normal routines. 407 | 408 | We’ve reached a new moment in the fight against COVID-19, with severe cases down to a level not seen since last July. 409 | 410 | Just a few days ago, the Centers for Disease Control and Prevention—the CDC—issued new mask guidelines. 411 | 412 | Under these new guidelines, most Americans in most of the country can now be mask free. 413 | 414 | And based on the projections, more of the country will reach that point across the next couple of weeks. 415 | 416 | Thanks to the progress we have made this past year, COVID-19 need no longer control our lives. 417 | 418 | I know some are talking about “living with COVID-19”. Tonight – I say that we will never just accept living with COVID-19. 419 | 420 | We will continue to combat the virus as we do other diseases. And because this is a virus that mutates and spreads, we will stay on guard. 421 | 422 | Here are four common sense steps as we move forward safely. 423 | 424 | First, stay protected with vaccines and treatments. We know how incredibly effective vaccines are. If you’re vaccinated and boosted you have the highest degree of protection. 425 | 426 | We will never give up on vaccinating more Americans. Now, I know parents with kids under 5 are eager to see a vaccine authorized for their children. 427 | 428 | The scientists are working hard to get that done and we’ll be ready with plenty of vaccines when they do. 429 | 430 | We’re also ready with anti-viral treatments. If you get COVID-19, the Pfizer pill reduces your chances of ending up in the hospital by 90%. 431 | 432 | We’ve ordered more of these pills than anyone in the world. And Pfizer is working overtime to get us 1 Million pills this month and more than double that next month. 433 | 434 | And we’re launching the “Test to Treat” initiative so people can get tested at a pharmacy, and if they’re positive, receive antiviral pills on the spot at no cost. 435 | 436 | If you’re immunocompromised or have some other vulnerability, we have treatments and free high-quality masks. 437 | 438 | We’re leaving no one behind or ignoring anyone’s needs as we move forward. 439 | 440 | And on testing, we have made hundreds of millions of tests available for you to order for free. 441 | 442 | Even if you already ordered free tests tonight, I am announcing that you can order more from covidtests.gov starting next week. 443 | 444 | Second – we must prepare for new variants. Over the past year, we’ve gotten much better at detecting new variants. 445 | 446 | If necessary, we’ll be able to deploy new vaccines within 100 days instead of many more months or years. 447 | 448 | And, if Congress provides the funds we need, we’ll have new stockpiles of tests, masks, and pills ready if needed. 449 | 450 | I cannot promise a new variant won’t come. But I can promise you we’ll do everything within our power to be ready if it does. 451 | 452 | Third – we can end the shutdown of schools and businesses. We have the tools we need. 453 | 454 | It’s time for Americans to get back to work and fill our great downtowns again. People working from home can feel safe to begin to return to the office. 455 | 456 | We’re doing that here in the federal government. The vast majority of federal workers will once again work in person. 457 | 458 | Our schools are open. Let’s keep it that way. Our kids need to be in school. 459 | 460 | And with 75% of adult Americans fully vaccinated and hospitalizations down by 77%, most Americans can remove their masks, return to work, stay in the classroom, and move forward safely. 461 | 462 | We achieved this because we provided free vaccines, treatments, tests, and masks. 463 | 464 | Of course, continuing this costs money. 465 | 466 | I will soon send Congress a request. 467 | 468 | The vast majority of Americans have used these tools and may want to again, so I expect Congress to pass it quickly. 469 | 470 | Fourth, we will continue vaccinating the world. 471 | 472 | We’ve sent 475 Million vaccine doses to 112 countries, more than any other nation. 473 | 474 | And we won’t stop. 475 | 476 | We have lost so much to COVID-19. Time with one another. And worst of all, so much loss of life. 477 | 478 | Let’s use this moment to reset. Let’s stop looking at COVID-19 as a partisan dividing line and see it for what it is: A God-awful disease. 479 | 480 | Let’s stop seeing each other as enemies, and start seeing each other for who we really are: Fellow Americans. 481 | 482 | We can’t change how divided we’ve been. But we can change how we move forward—on COVID-19 and other issues we must face together. 483 | 484 | I recently visited the New York City Police Department days after the funerals of Officer Wilbert Mora and his partner, Officer Jason Rivera. 485 | 486 | They were responding to a 9-1-1 call when a man shot and killed them with a stolen gun. 487 | 488 | Officer Mora was 27 years old. 489 | 490 | Officer Rivera was 22. 491 | 492 | Both Dominican Americans who’d grown up on the same streets they later chose to patrol as police officers. 493 | 494 | I spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safety every community deserves. 495 | 496 | I’ve worked on these issues a long time. 497 | 498 | I know what works: Investing in crime preventionand community police officers who’ll walk the beat, who’ll know the neighborhood, and who can restore trust and safety. 499 | 500 | So let’s not abandon our streets. Or choose between safety and equal justice. 501 | 502 | Let’s come together to protect our communities, restore trust, and hold law enforcement accountable. 503 | 504 | That’s why the Justice Department required body cameras, banned chokeholds, and restricted no-knock warrants for its officers. 505 | 506 | That’s why the American Rescue Plan provided $350 Billion that cities, states, and counties can use to hire more police and invest in proven strategies like community violence interruption—trusted messengers breaking the cycle of violence and trauma and giving young people hope. 507 | 508 | We should all agree: The answer is not to Defund the police. The answer is to FUND the police with the resources and training they need to protect our communities. 509 | 510 | I ask Democrats and Republicans alike: Pass my budget and keep our neighborhoods safe. 511 | 512 | And I will keep doing everything in my power to crack down on gun trafficking and ghost guns you can buy online and make at home—they have no serial numbers and can’t be traced. 513 | 514 | And I ask Congress to pass proven measures to reduce gun violence. Pass universal background checks. Why should anyone on a terrorist list be able to purchase a weapon? 515 | 516 | Ban assault weapons and high-capacity magazines. 517 | 518 | Repeal the liability shield that makes gun manufacturers the only industry in America that can’t be sued. 519 | 520 | These laws don’t infringe on the Second Amendment. They save lives. 521 | 522 | The most fundamental right in America is the right to vote – and to have it counted. And it’s under assault. 523 | 524 | In state after state, new laws have been passed, not only to suppress the vote, but to subvert entire elections. 525 | 526 | We cannot let this happen. 527 | 528 | Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. 529 | 530 | Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. 531 | 532 | One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. 533 | 534 | And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence. 535 | 536 | A former top litigator in private practice. A former federal public defender. And from a family of public school educators and police officers. A consensus builder. Since she’s been nominated, she’s received a broad range of support—from the Fraternal Order of Police to former judges appointed by Democrats and Republicans. 537 | 538 | And if we are to advance liberty and justice, we need to secure the Border and fix the immigration system. 539 | 540 | We can do both. At our border, we’ve installed new technology like cutting-edge scanners to better detect drug smuggling. 541 | 542 | We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers. 543 | 544 | We’re putting in place dedicated immigration judges so families fleeing persecution and violence can have their cases heard faster. 545 | 546 | We’re securing commitments and supporting partners in South and Central America to host more refugees and secure their own borders. 547 | 548 | We can do all this while keeping lit the torch of liberty that has led generations of immigrants to this land—my forefathers and so many of yours. 549 | 550 | Provide a pathway to citizenship for Dreamers, those on temporary status, farm workers, and essential workers. 551 | 552 | Revise our laws so businesses have the workers they need and families don’t wait decades to reunite. 553 | 554 | It’s not only the right thing to do—it’s the economically smart thing to do. 555 | 556 | That’s why immigration reform is supported by everyone from labor unions to religious leaders to the U.S. Chamber of Commerce. 557 | 558 | Let’s get it done once and for all. 559 | 560 | Advancing liberty and justice also requires protecting the rights of women. 561 | 562 | The constitutional right affirmed in Roe v. Wade—standing precedent for half a century—is under attack as never before. 563 | 564 | If we want to go forward—not backward—we must protect access to health care. Preserve a woman’s right to choose. And let’s continue to advance maternal health care in America. 565 | 566 | And for our LGBTQ+ Americans, let’s finally get the bipartisan Equality Act to my desk. The onslaught of state laws targeting transgender Americans and their families is wrong. 567 | 568 | As I said last year, especially to our younger transgender Americans, I will always have your back as your President, so you can be yourself and reach your God-given potential. 569 | 570 | While it often appears that we never agree, that isn’t true. I signed 80 bipartisan bills into law last year. From preventing government shutdowns to protecting Asian-Americans from still-too-common hate crimes to reforming military justice. 571 | 572 | And soon, we’ll strengthen the Violence Against Women Act that I first wrote three decades ago. It is important for us to show the nation that we can come together and do big things. 573 | 574 | So tonight I’m offering a Unity Agenda for the Nation. Four big things we can do together. 575 | 576 | First, beat the opioid epidemic. 577 | 578 | There is so much we can do. Increase funding for prevention, treatment, harm reduction, and recovery. 579 | 580 | Get rid of outdated rules that stop doctors from prescribing treatments. And stop the flow of illicit drugs by working with state and local law enforcement to go after traffickers. 581 | 582 | If you’re suffering from addiction, know you are not alone. I believe in recovery, and I celebrate the 23 million Americans in recovery. 583 | 584 | Second, let’s take on mental health. Especially among our children, whose lives and education have been turned upside down. 585 | 586 | The American Rescue Plan gave schools money to hire teachers and help students make up for lost learning. 587 | 588 | I urge every parent to make sure your school does just that. And we can all play a part—sign up to be a tutor or a mentor. 589 | 590 | Children were also struggling before the pandemic. Bullying, violence, trauma, and the harms of social media. 591 | 592 | As Frances Haugen, who is here with us tonight, has shown, we must hold social media platforms accountable for the national experiment they’re conducting on our children for profit. 593 | 594 | It’s time to strengthen privacy protections, ban targeted advertising to children, demand tech companies stop collecting personal data on our children. 595 | 596 | And let’s get all Americans the mental health services they need. More people they can turn to for help, and full parity between physical and mental health care. 597 | 598 | Third, support our veterans. 599 | 600 | Veterans are the best of us. 601 | 602 | I’ve always believed that we have a sacred obligation to equip all those we send to war and care for them and their families when they come home. 603 | 604 | My administration is providing assistance with job training and housing, and now helping lower-income veterans get VA care debt-free. 605 | 606 | Our troops in Iraq and Afghanistan faced many dangers. 607 | 608 | One was stationed at bases and breathing in toxic smoke from “burn pits” that incinerated wastes of war—medical and hazard material, jet fuel, and more. 609 | 610 | When they came home, many of the world’s fittest and best trained warriors were never the same. 611 | 612 | Headaches. Numbness. Dizziness. 613 | 614 | A cancer that would put them in a flag-draped coffin. 615 | 616 | I know. 617 | 618 | One of those soldiers was my son Major Beau Biden. 619 | 620 | We don’t know for sure if a burn pit was the cause of his brain cancer, or the diseases of so many of our troops. 621 | 622 | But I’m committed to finding out everything we can. 623 | 624 | Committed to military families like Danielle Robinson from Ohio. 625 | 626 | The widow of Sergeant First Class Heath Robinson. 627 | 628 | He was born a soldier. Army National Guard. Combat medic in Kosovo and Iraq. 629 | 630 | Stationed near Baghdad, just yards from burn pits the size of football fields. 631 | 632 | Heath’s widow Danielle is here with us tonight. They loved going to Ohio State football games. He loved building Legos with their daughter. 633 | 634 | But cancer from prolonged exposure to burn pits ravaged Heath’s lungs and body. 635 | 636 | Danielle says Heath was a fighter to the very end. 637 | 638 | He didn’t know how to stop fighting, and neither did she. 639 | 640 | Through her pain she found purpose to demand we do better. 641 | 642 | Tonight, Danielle—we are. 643 | 644 | The VA is pioneering new ways of linking toxic exposures to diseases, already helping more veterans get benefits. 645 | 646 | And tonight, I’m announcing we’re expanding eligibility to veterans suffering from nine respiratory cancers. 647 | 648 | I’m also calling on Congress: pass a law to make sure veterans devastated by toxic exposures in Iraq and Afghanistan finally get the benefits and comprehensive health care they deserve. 649 | 650 | And fourth, let’s end cancer as we know it. 651 | 652 | This is personal to me and Jill, to Kamala, and to so many of you. 653 | 654 | Cancer is the #2 cause of death in America–second only to heart disease. 655 | 656 | Last month, I announced our plan to supercharge 657 | the Cancer Moonshot that President Obama asked me to lead six years ago. 658 | 659 | Our goal is to cut the cancer death rate by at least 50% over the next 25 years, turn more cancers from death sentences into treatable diseases. 660 | 661 | More support for patients and families. 662 | 663 | To get there, I call on Congress to fund ARPA-H, the Advanced Research Projects Agency for Health. 664 | 665 | It’s based on DARPA—the Defense Department project that led to the Internet, GPS, and so much more. 666 | 667 | ARPA-H will have a singular purpose—to drive breakthroughs in cancer, Alzheimer’s, diabetes, and more. 668 | 669 | A unity agenda for the nation. 670 | 671 | We can do this. 672 | 673 | My fellow Americans—tonight , we have gathered in a sacred space—the citadel of our democracy. 674 | 675 | In this Capitol, generation after generation, Americans have debated great questions amid great strife, and have done great things. 676 | 677 | We have fought for freedom, expanded liberty, defeated totalitarianism and terror. 678 | 679 | And built the strongest, freest, and most prosperous nation the world has ever known. 680 | 681 | Now is the hour. 682 | 683 | Our moment of responsibility. 684 | 685 | Our test of resolve and conscience, of history itself. 686 | 687 | It is in this moment that our character is formed. Our purpose is found. Our future is forged. 688 | 689 | Well I know this nation. 690 | 691 | We will meet the test. 692 | 693 | To protect freedom and liberty, to expand fairness and opportunity. 694 | 695 | We will save democracy. 696 | 697 | As hard as these times have been, I am more optimistic about America today than I have been my whole life. 698 | 699 | Because I see the future that is within our grasp. 700 | 701 | Because I know there is simply nothing beyond our capacity. 702 | 703 | We are the only nation on Earth that has always turned every crisis we have faced into an opportunity. 704 | 705 | The only nation that can be defined by a single word: possibilities. 706 | 707 | So on this night, in our 245th year as a nation, I have come to report on the State of the Union. 708 | 709 | And my report is this: the State of the Union is strong—because you, the American people, are strong. 710 | 711 | We are stronger today than we were a year ago. 712 | 713 | And we will be stronger a year from now than we are today. 714 | 715 | Now is our moment to meet and overcome the challenges of our time. 716 | 717 | And we will, as one people. 718 | 719 | One America. 720 | 721 | The United States of America. 722 | 723 | May God bless you all. May God protect our troops. --------------------------------------------------------------------------------