diff --git a/03-Quering-AOpenAI.ipynb b/03-Quering-AOpenAI.ipynb index 4212b85a..32ed1233 100644 --- a/03-Quering-AOpenAI.ipynb +++ b/03-Quering-AOpenAI.ipynb @@ -735,7 +735,7 @@ { "data": { "text/markdown": [ - "El medicamento que se utiliza comúnmente para reducir la inflamación en los pulmones es un corticoide inhalado. Este tipo de medicamento ayuda a disminuir la inflamación en las vías respiratorias y puede ser recetado para tratar condiciones como el asma y la enfermedad pulmonar obstructiva crónica (EPOC). Es importante seguir las indicaciones de un médico para el uso adecuado de este tipo de medicamentos y para controlar cualquier efecto secundario que pueda presentarse." + "El medicamento que reduce la inflamación en los pulmones se llama corticoide inhalado. Este tipo de medicamento se usa comúnmente para tratar enfermedades respiratorias como el asma y la enfermedad pulmonar obstructiva crónica (EPOC). Los corticoides inhalados ayudan a reducir la inflamación en los pulmones y a aliviar los síntomas respiratorios. Es importante seguir las indicaciones de un médico para el uso adecuado de este medicamento." ], "text/plain": [ "" @@ -748,8 +748,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 45.9 ms, sys: 4.05 ms, total: 49.9 ms\n", - "Wall time: 2.32 s\n" + "CPU times: user 38.5 ms, sys: 7.78 ms, total: 46.3 ms\n", + "Wall time: 900 ms\n" ] } ], @@ -877,6 +877,56 @@ "print(\"Number of results:\",len(ordered_results))" ] }, + { + "cell_type": "code", + "execution_count": 14, + "id": "d9334b4b-a378-4d99-b04b-4762d35e8c0a", + "metadata": {}, + "outputs": [], + "source": [ + "top_docs = []\n", + "for key,value in ordered_results.items():\n", + " location = value[\"location\"] if value[\"location\"] is not None else \"\"\n", + " top_docs.append(Document(page_content=value[\"chunk\"], metadata={\"source\": location, \"score\":value[\"score\"]}))" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "ffed0ea2-1d21-477b-a6cd-20621589e204", + "metadata": {}, + "outputs": [], + "source": [ + "chain = (\n", + " DOCSEARCH_PROMPT # Passes the 4 variables above to the prompt template\n", + " | llm # Passes the finished prompt to the LLM\n", + " | StrOutputParser() # converts the output (Runnable object) to the desired output (string)\n", + ")\n", + "\n", + "answer = chain.invoke({\"question\": QUESTION, \"context\":top_docs})" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "32ba674f-4094-4d32-add4-761d1d79940f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Chloroquine is a medicine that has been found to reduce inflammation in the lungs. On human lung parenchymal explants, chloroquine concentration clinically achievable in the lung (100 μM) inhibited the lipopolysaccharide-induced release of TNF-α (by 76%), IL-6 (by 68%), CCL2 (by 72%) and CCL3 (by 67%)[1]. Additionally, chest irradiation using low doses of radiation therapy (RT) has been shown to mitigate lung inflammatory processes. It was found that low doses of RT significantly increased the percentage of Nerve- and airway-associated macrophages (NAMs) producing IL-10, leading to lung protection from inflammation[3]. Furthermore, the anti-inflammatory effects of glucocorticoids in the lungs of severe acute respiratory syndrome (SARS) patients have been studied. The corticosteroid dexamethasone (DEX) was found to decrease innate and Th1 cytokines in bronchoalveolar lavage (BAL) and serum in a porcine respiratory coronavirus (PRCV) infection model, suggesting potential local immunosuppression of immune responses in the lung and systemic Th1 cytokine-biased suppression[14].\\n\\nReferences:\\n1. https://doi.org/10.1093/cid/ciaa546\\n2. https://doi.org/10.1101/2020.05.11.077651\\n3. https://doi.org/10.1128/jvi.02190-07'" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "answer" + ] + }, { "cell_type": "code", "execution_count": 14, diff --git a/07-TabularDataQA.ipynb b/07-TabularDataQA.ipynb index e92dae83..7a987d82 100644 --- a/07-TabularDataQA.ipynb +++ b/07-TabularDataQA.ipynb @@ -85,16 +85,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "--2024-03-14 21:21:20-- https://covidtracking.com/data/download/all-states-history.csv\n", + "--2024-03-15 09:41:47-- https://covidtracking.com/data/download/all-states-history.csv\n", "Resolving covidtracking.com (covidtracking.com)... 104.21.64.114, 172.67.183.132, 2606:4700:3032::ac43:b784, ...\n", "Connecting to covidtracking.com (covidtracking.com)|104.21.64.114|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: unspecified [text/csv]\n", "Saving to: ‘./data/all-states-history.csv’\n", "\n", - "all-states-history. [ <=> ] 2.61M --.-KB/s in 0.08s \n", + "all-states-history. [ <=> ] 2.61M --.-KB/s in 0.05s \n", "\n", - "2024-03-14 21:21:21 (33.9 MB/s) - ‘./data/all-states-history.csv’ saved [2738601]\n", + "2024-03-15 09:41:48 (49.1 MB/s) - ‘./data/all-states-history.csv’ saved [2738601]\n", "\n" ] } diff --git a/09-BingChatClone.ipynb b/09-BingChatClone.ipynb index 44a1cdc8..b0d2c513 100644 --- a/09-BingChatClone.ipynb +++ b/09-BingChatClone.ipynb @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "c1fb79a3-4856-4721-988c-112813690a90", "metadata": {}, "outputs": [ @@ -34,7 +34,7 @@ "True" ] }, - "execution_count": 2, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } @@ -71,7 +71,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "258a6e99-2d4f-4147-b8ee-c64c85296181", "metadata": {}, "outputs": [], @@ -110,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "1380fb0d-3502-4fc0-b729-9bc46d5c9804", "metadata": {}, "outputs": [], @@ -143,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 10, "id": "d3d155ae-16eb-458a-b2ed-5aa9a9b84ed8", "metadata": {}, "outputs": [], @@ -182,7 +182,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 11, "id": "74b714b6-e6e6-492b-8434-6081a1ff183e", "metadata": {}, "outputs": [], @@ -200,7 +200,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 12, "id": "201d1f47-519e-40b3-80b2-2d29a494dd62", "metadata": {}, "outputs": [], @@ -230,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "id": "2c6cf721-76bb-47b6-aeeb-9ff4ff92b1f4", "metadata": {}, "outputs": [], @@ -248,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "id": "4bf377b4-0913-4695-bcf9-31629b2cf66f", "metadata": {}, "outputs": [ @@ -256,10 +256,10 @@ "data": { "text/plain": [ "[MyBingSearch(),\n", - " Tool(name='WebFetcher', description='useful to fetch the content of a url', func=)]" + " Tool(name='WebFetcher', description='useful to fetch the content of a url', func=)]" ] }, - "execution_count": 9, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -278,7 +278,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 15, "id": "fa949cea-c9aa-4529-a75f-61084ffffd7e", "metadata": {}, "outputs": [], @@ -345,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 17, "id": "ca948d67-6717-4843-b7ab-b13155aa8581", "metadata": {}, "outputs": [ @@ -353,32 +353,32 @@ "name": "stdout", "output_type": "stream", "text": [ - "Calling Tool: `Searcher` with input `{'query': 'number of job openings ADN Registered Nurse Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'ADN Registered Nurse job openings in Dallas, TX'}`\n", "---\n", - "Calling Tool: `Searcher` with input `{'query': 'average salary ADN Registered Nurse within 15 miles of Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'average salary for ADN Registered Nurse within 15 miles of Dallas, TX'}`\n", "---\n", - "Calling Tool: `Searcher` with input `{'query': 'number of job openings Occupational therapist assistant Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'Occupational therapist assistant job openings in Dallas, TX'}`\n", "---\n", - "Calling Tool: `Searcher` with input `{'query': 'average salary Occupational therapist assistant within 15 miles of Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'average salary for Occupational therapist assistant within 15 miles of Dallas, TX'}`\n", "---\n", - "Calling Tool: `Searcher` with input `{'query': 'number of job openings Dental Hygienist Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'Dental Hygienist job openings in Dallas, TX'}`\n", "---\n", - "Calling Tool: `Searcher` with input `{'query': 'average salary Dental Hygienist within 15 miles of Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'average salary for Dental Hygienist within 15 miles of Dallas, TX'}`\n", "---\n", - "Calling Tool: `Searcher` with input `{'query': 'number of job openings Graphic Designer Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'Graphic Designer job openings in Dallas, TX'}`\n", "---\n", - "Calling Tool: `Searcher` with input `{'query': 'average salary Graphic Designer within 15 miles of Dallas TX'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'average salary for Graphic Designer within 15 miles of Dallas, TX'}`\n", "---\n", - "### Job Openings and Average Salaries within 15 Miles of Dallas, TX\n", + "Here are the findings for the job openings and average salaries within 15 miles of Dallas, TX for the specified occupations:\n", "\n", - "| Occupation | Number of Job Openings | Average Salary | Source |\n", - "|---------------------------------|------------------------|-----------------|-----------------------------------------------------------------------------------------------|\n", - "| ADN Registered Nurse | 648 | $61,895 - $111,014 | [Indeed - Job Openings](https://www.indeed.com/q-RN-Adn-l-Dallas,-TX-jobs.html)
[Salary.com - Average Salary](https://www.salary.com/research/salary/general/registered-nurse-rn-salary/dallas-tx) |\n", - "| Occupational Therapist Assistant| 237 | $59,574 - $72,514 | [Indeed - Job Openings](https://www.indeed.com/q-Occupational-Therapist-Assistant-l-Dallas,-TX-jobs.html)
[Salary.com - Average Salary](https://www.salary.com/research/salary/listing/occupational-therapy-assistant-salary/dallas-tx) |\n", - "| Dental Hygienist | 348 | $72,752 - $92,065 | [Indeed - Job Openings](https://www.indeed.com/q-Dental-Hygientist-l-Dallas,-TX-jobs.html)
[Salary.com - Average Salary](https://www.salary.com/research/salary/benchmark/dental-hygienist-salary/dallas-tx) |\n", - "| Graphic Designer | 116 | $61,907 - $77,219 | [Glassdoor - Job Openings](https://www.glassdoor.com/Job/dallas-graphic-design-jobs-SRCH_IL.0,6_IC1139977_KO7,21.htm)
[Salary.com - Average Salary](https://www.salary.com/research/salary/recruiting/graphic-designer-salary/dallas-tx) |\n", + "| Occupation | Job Openings | Average Salary (per year) | Sources |\n", + "|--------------------------------|--------------|---------------------------|-----------------------------------------------------------------------------------------------|\n", + "| ADN Registered Nurse | 648 | $62,044 - $111,282 | [Indeed.com](https://www.indeed.com/q-RN-Adn-l-Dallas,-TX-jobs.html)
[Salary.com](https://www.salary.com/research/salary/general/registered-nurse-rn-salary/dallas-tx) |\n", + "| Occupational Therapist Assistant| 89 | $68,635 | [Indeed.com](https://www.indeed.com/q-Occuational-Therapy-Assistant-l-Dallas,-TX-jobs.html)
[Glassdoor](https://www.glassdoor.com/Salaries/dallas-occupational-therapy-assistant-salary-SRCH_IL.0,6_IM218_KO7,37.htm) |\n", + "| Dental Hygienist | 348 | $56,381 - $69,205 | [Indeed.com](https://www.indeed.com/q-Dental-Hygientist-l-Dallas,-TX-jobs.html)
[Salary.com](https://www.salary.com/research/salary/benchmark/dental-hygienist-salary/dallas-tx) |\n", + "| Graphic Designer | 88 | $56,041 | [Indeed.com](https://www.indeed.com/q-Graphic-Designer-l-Dallas,-TX-jobs.html)
[Glassdoor](https://www.glassdoor.com/Salaries/dallas-graphic-designer-salary-SRCH_IL.0,6_IM218_KO7,23.htm) |\n", "\n", - "These figures provide an overview of the job openings and average salaries for the specified occupations within 15 miles of Dallas, TX. Feel free to explore the sources for more detailed information." + "These findings provide an overview of the job openings and average salaries for each occupation within the specified area. If you need further details or additional information, feel free to ask!" ] } ], @@ -414,7 +414,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 18, "id": "ca910f71-60fb-4758-b4a9-757e37eb421f", "metadata": {}, "outputs": [ @@ -422,16 +422,24 @@ "name": "stdout", "output_type": "stream", "text": [ - "### Job Openings and Average Salaries within 15 Miles of Dallas, TX:\n", + "Here's a table with the findings for job openings and average salaries within 15 miles of Dallas, TX for the specified occupations:\n", + "\n", + "| Occupation | Job Openings | Average Salary | Sources |\n", + "|-------------------------------|--------------|-----------------|-------------------------------------------------------------------------------------------|\n", + "| ADN Registered Nurse | 648 | $35.52/hour | [Indeed](https://www.indeed.com/q-RN-Adn-l-Dallas,-TX-jobs.html) |\n", + "| | | | [ZipRecruiter](https://www.ziprecruiter.com/Salaries/ADN-Nurse-Salary-in-Dallas,TX) |\n", + "| | | | [Salary.com](https://www.salary.com/research/salary/hiring/rn-adn-salary/dallas-tx) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Job/dallas-adn-jobs-SRCH_IL.0,6_IC1139977_KO7,10.htm) |\n", + "| Occupational Therapist Asst. | 237 | $79,441/year | [Indeed](https://www.indeed.com/q-Occupational-Therapist-Assistant-l-Dallas,-TX-jobs.html) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Salaries/dallas-occupational-therapy-assistant-salary-SRCH_IL.0,6_IM218_KO7,37.htm) |\n", + "| Dental Hygienist | 296 | $97,851/year | [Indeed](https://www.indeed.com/q-Dental-Hygienist-l-Dallas,-TX-jobs.html) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Salaries/dallas-dental-hygienist-salary-SRCH_IL.0,6_IC1139977_KO7,23.htm) |\n", + "| Graphic Designer | 55 | $57,041/year | [Indeed](https://www.indeed.com/q-Graphic-Designer-l-Dallas,-TX-jobs.html) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Salaries/dallas-graphic-designer-salary-SRCH_IL.0,6_IM218_KO7,23.htm) |\n", "\n", - "| Occupation | Number of Job Openings | Average Salary | Source |\n", - "|-------------------------------|------------------------|-----------------|------------------------------------------------------------------------------------------|\n", - "| ADN Registered Nurse | 648 jobs | $41.19 per hour | [Indeed - RN Adn jobs](https://www.indeed.com/q-RN-Adn-l-Dallas,-TX-jobs.html) |\n", - "| Occupational Therapist Asst | 70 jobs | $65,964 | [Indeed - Occupational Therapy Assistant jobs](https://www.indeed.com/q-Occupational-Therapy-Assistant-l-Dallas,-TX-jobs.html) |\n", - "| Dental Hygienist | 194 jobs | $49.41 per hour | [Indeed - Dental Hygienist jobs](https://www.indeed.com/q-Dental-Hygienist-l-Dallas,-TX-jobs.html) |\n", - "| Graphic Designer | 41 jobs | $21.70 per hour | [Indeed - Graphic Designer jobs](https://www.indeed.com/q-Graphic-Designer-l-Dallas,-TX-jobs.html) |\n", + "These findings provide valuable insights into the job market and average salaries for each occupation within the specified location.\n", "\n", - "These figures provide an overview of the job openings and average salaries for each occupation within 15 miles of Dallas, TX. Feel free to explore the provided sources for more detailed information." + "Let me know if there's anything else I can assist you with!" ] } ], @@ -444,23 +452,31 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 19, "id": "25a410b2-9950-43f5-8f14-b333bdc24ff2", "metadata": {}, "outputs": [ { "data": { "text/markdown": [ - "### Job Openings and Average Salaries within 15 Miles of Dallas, TX:\n", + "Here's a table with the findings for job openings and average salaries within 15 miles of Dallas, TX for the specified occupations:\n", "\n", - "| Occupation | Number of Job Openings | Average Salary | Source |\n", - "|-------------------------------|------------------------|-----------------|------------------------------------------------------------------------------------------|\n", - "| ADN Registered Nurse | 648 jobs | USD 41.19 per hour | [Indeed - RN Adn jobs](https://www.indeed.com/q-RN-Adn-l-Dallas,-TX-jobs.html) |\n", - "| Occupational Therapist Asst | 70 jobs | USD 65,964 | [Indeed - Occupational Therapy Assistant jobs](https://www.indeed.com/q-Occupational-Therapy-Assistant-l-Dallas,-TX-jobs.html) |\n", - "| Dental Hygienist | 194 jobs | USD 49.41 per hour | [Indeed - Dental Hygienist jobs](https://www.indeed.com/q-Dental-Hygienist-l-Dallas,-TX-jobs.html) |\n", - "| Graphic Designer | 41 jobs | USD 21.70 per hour | [Indeed - Graphic Designer jobs](https://www.indeed.com/q-Graphic-Designer-l-Dallas,-TX-jobs.html) |\n", + "| Occupation | Job Openings | Average Salary | Sources |\n", + "|-------------------------------|--------------|-----------------|-------------------------------------------------------------------------------------------|\n", + "| ADN Registered Nurse | 648 | USD 35.52/hour | [Indeed](https://www.indeed.com/q-RN-Adn-l-Dallas,-TX-jobs.html) |\n", + "| | | | [ZipRecruiter](https://www.ziprecruiter.com/Salaries/ADN-Nurse-Salary-in-Dallas,TX) |\n", + "| | | | [Salary.com](https://www.salary.com/research/salary/hiring/rn-adn-salary/dallas-tx) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Job/dallas-adn-jobs-SRCH_IL.0,6_IC1139977_KO7,10.htm) |\n", + "| Occupational Therapist Asst. | 237 | USD 79,441/year | [Indeed](https://www.indeed.com/q-Occupational-Therapist-Assistant-l-Dallas,-TX-jobs.html) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Salaries/dallas-occupational-therapy-assistant-salary-SRCH_IL.0,6_IM218_KO7,37.htm) |\n", + "| Dental Hygienist | 296 | USD 97,851/year | [Indeed](https://www.indeed.com/q-Dental-Hygienist-l-Dallas,-TX-jobs.html) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Salaries/dallas-dental-hygienist-salary-SRCH_IL.0,6_IC1139977_KO7,23.htm) |\n", + "| Graphic Designer | 55 | USD 57,041/year | [Indeed](https://www.indeed.com/q-Graphic-Designer-l-Dallas,-TX-jobs.html) |\n", + "| | | | [Glassdoor](https://www.glassdoor.com/Salaries/dallas-graphic-designer-salary-SRCH_IL.0,6_IM218_KO7,23.htm) |\n", "\n", - "These figures provide an overview of the job openings and average salaries for each occupation within 15 miles of Dallas, TX. Feel free to explore the provided sources for more detailed information." + "These findings provide valuable insights into the job market and average salaries for each occupation within the specified location.\n", + "\n", + "Let me know if there's anything else I can assist you with!" ], "text/plain": [ "" @@ -491,7 +507,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 20, "id": "e925ee4a-d295-4815-9e8c-bd6999f48892", "metadata": {}, "outputs": [], @@ -504,7 +520,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 21, "id": "1f7c4e6d-03a8-47f8-b859-f7b397981a6d", "metadata": {}, "outputs": [ @@ -512,25 +528,23 @@ "name": "stdout", "output_type": "stream", "text": [ - "Calling Tool: `Searcher` with input `{'query': 'Nespresso coffee machine price site:target.com'}`\n", + "Calling Tool: `Searcher` with input `{'query': 'Nesspresso coffee machine price site:target.com'}`\n", "---\n", "Calling Tool: `Searcher` with input `{'query': 'Keurig coffee machine price site:target.com'}`\n", "---\n", - "### Nespresso Coffee Machine Price on Target.com:\n", - "- **Nespresso Only at**: $169.99 for VertuoPlus single-serve coffee maker and espresso machine.\n", - "- **Nespresso Essenza Mini Black Coffee Maker by Breville**: $179.99.\n", - "- **Nespresso Vertuo Pop+ Coffee Machine with Aeroccino by De'Longhi Pacific Blue ENV92AAE**: $179.99.\n", - "\n", - "You can find these Nespresso coffee machines at [Target - Nespresso Coffee Machines](https://www.target.com/s/nespresso+coffee+machines).\n", + "The price of Nesspresso coffee machines at Target varies based on the specific model. Here are a few examples:\n", + "- Nesspresso Vertuo Next Coffee Maker and Espresso Machine Bundle by DeLonghi - Gray: $229.99[1]\n", + "- Nesspresso VertuoPlus Coffee Maker and Espresso Machine by DeLonghi Black Matte: $199.99[2]\n", + "- Nesspresso Vertuo Pop+ Coffee Machine with Aeroccino Frother by De'Longhi Liquorice Black: $99.99 (on sale, regular price $129.99)[3]\n", "\n", - "### Keurig Coffee Machine Price on Target.com:\n", - "- **The Original Donut Shop Regular Keurig K-Cup Coffee Pods Medium Roast**: $10.99 each.\n", - "- **Keurig K-Supreme Plus Coffee Maker - Stainless Steel**: $219.99.\n", - "- **Keurig K-Duo Single-Serve & Carafe Coffee Maker**: Price not specified.\n", + "As for the Keurig coffee machines at Target, the prices are also model-specific:\n", + "- Keurig K-Classic Single-Serve K-Cup Pod Coffee Maker - K50: $89.99[4]\n", + "- Keurig K-Supreme Plus Coffee Maker - Stainless Steel: $219.99[5]\n", + "- Keurig K-Supreme SMART Single-Serve Coffee Maker with WiFi Compatibility: $129.99[6]\n", "\n", - "Explore more Keurig coffee machines at [Target - Keurig Coffee Makers](https://www.target.com/b/keurig/-/N-5uvm4).\n", + "These prices are based on the information available on the Target website. Keep in mind that prices may vary based on promotions, sales, and specific product features.\n", "\n", - "If you need more details or have any other questions, feel free to ask!" + "Let me know if there's anything else I can assist you with!" ] } ], diff --git a/11-Smart_Agent.ipynb b/11-Smart_Agent.ipynb index a81360c8..33732ecd 100644 --- a/11-Smart_Agent.ipynb +++ b/11-Smart_Agent.ipynb @@ -123,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "643d1650-6416-46fd-8b21-f5fb298ec063", "metadata": {}, "outputs": [], @@ -134,13 +134,18 @@ "COMPLETION_TOKENS = 2000\n", "\n", "# We can run the everything with GPT3.5, but try also GPT4 and see the difference in the quality of responses\n", - "# llm = AzureChatOpenAI(deployment_name=os.environ[\"GPT35_DEPLOYMENT_NAME\"], temperature=0.5, max_tokens=COMPLETION_TOKENS, streaming=True, callback_manager=cb_manager)\n", - "llm = AzureChatOpenAI(deployment_name=os.environ[\"GPT35_DEPLOYMENT_NAME\"], temperature=0, max_tokens=COMPLETION_TOKENS)" + "# You will notice that GPT3.5 is not as reliable.\n", + "\n", + "llm = AzureChatOpenAI(deployment_name=os.environ[\"GPT35_DEPLOYMENT_NAME\"], \n", + " temperature=0, max_tokens=COMPLETION_TOKENS)\n", + "\n", + "# Uncomment below if you want to see the answers streaming\n", + "# llm = AzureChatOpenAI(deployment_name=os.environ[\"GPT35_DEPLOYMENT_NAME\"], temperature=0.5, max_tokens=COMPLETION_TOKENS, streaming=True, callback_manager=cb_manager)\n" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "a6a4cc93-2dd6-45eb-ac5b-5af2d31809dd", "metadata": {}, "outputs": [], @@ -156,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "eafd5bf5-28ee-4edd-978b-384cce057257", "metadata": {}, "outputs": [], @@ -172,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "0f0ae466-aff8-4cdf-80d3-ef2c61867fc7", "metadata": {}, "outputs": [], @@ -186,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "78edb304-c4a2-4f10-8ded-936e9141aa02", "metadata": {}, "outputs": [], @@ -201,7 +206,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "b9d54cc5-41bc-43c3-a91d-12fc3a2446ba", "metadata": {}, "outputs": [], @@ -215,7 +220,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "65465173-92f6-489d-9b48-58d109c5723e", "metadata": {}, "outputs": [], @@ -229,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "1fe2b4a7-4053-4334-867f-e4c916e360b2", "metadata": {}, "outputs": [], @@ -293,7 +298,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "dc11cb35-8817-4dd0-b123-27f9eb032f43", "metadata": {}, "outputs": [ @@ -306,13 +311,18 @@ "Invoking: `docsearch` with `{'query': 'weather in Dallas today'}`\n", "\n", "\n", + "\n", + "Agent Action: \n", + "Invoking: `docsearch` with `{'query': 'current weather in Dallas'}`\n", + "\n", + "\n", "\n" ] }, { "data": { "text/markdown": [ - "I'm sorry, but I couldn't find the specific weather information for Dallas today. If you'd like, I can try to search for it again." + "I'm sorry, but I couldn't find the specific weather information for Dallas today. The documents I retrieved contain information about the relationship between weather and COVID-19, as well as the impact of weather on the transmission of infectious diseases. If you need specific weather information for Dallas, I recommend checking a reliable weather website or using a weather app for the most accurate and up-to-date details." ], "text/plain": [ "" @@ -329,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "473222f1-b423-49f3-98e7-ab70dcf47bd6", "metadata": {}, "outputs": [ @@ -359,27 +369,27 @@ "\n", "1. **Increased Severity**: Studies have shown that obesity is highly frequent among critically ill patients with COVID-19, and it remains difficult to elucidate the mechanisms by which COVID-19 severity is increased in the context of obesity[1].\n", "\n", - "2. **Cardiac Complications**: Hospitalized patients with COVID-19 who are obese are more likely to present cardiac complications, including myocarditis, arrhythmias, heart failure, and sudden death[1].\n", + "2. **Cardiac Complications**: Hospitalized patients with COVID-19 who are obese have presented cardiac complications, including myocarditis, arrhythmias, heart failure, and sudden death. Myocardial response in COVID-19 is closely associated with in-hospital mortality, indicating the impact of obesity on the severity of COVID-19[1].\n", "\n", - "3. **Risk of Severe Disease**: Obese patients with COVID-19 have increased odds of progressing to severe illness, and they tend to have symptoms such as cough and fever compared to non-obese patients[2].\n", + "3. **Risk of Severe Disease**: Obese patients with COVID-19 have increased odds of progressing to severe illness. They are at higher risk of developing severe symptoms and have a negative prognosis compared to non-obese patients[2].\n", "\n", - "4. **Impact on Mortality**: Two-thirds of people who developed serious or fatal COVID-19-related complications were overweight or obese, indicating the impact of obesity in seriously ill COVID-19 patients[3].\n", + "4. **Impact on Mortality**: Two-thirds of people who developed serious or fatal COVID-19-related complications were overweight or obese. Almost 72% of those in critical care units were either overweight or obese, highlighting the impact of obesity on seriously ill COVID-19 patients[3].\n", "\n", - "5. **Mechanistic Framework**: Adipose tissue in subjects with obesity may act as a reservoir for more extensive viral spread with increased shedding, immune activation, and cytokine amplification, leading to poor COVID-19 outcomes[4].\n", + "5. **Mechanistic Framework**: There is a theoretical mechanistic framework whereby adipose tissue in subjects with obesity may act as a reservoir for more extensive viral spread with increased shedding, immune activation, and cytokine amplification, leading to poor COVID-19 outcomes[4].\n", "\n", "### How Covid Affects Elderly People\n", "\n", "Elderly people are at a higher risk of more serious and possibly fatal illness associated with COVID-19. Here are some key findings from the retrieved documents:\n", "\n", - "1. **Mortality Risk**: The risk of mortality due to COVID-19 increases with age, with higher mortality rates observed in people in their 60s, 70s, and over 80s[5].\n", + "1. **Mortality Risk**: Mortality data indicates a risk of mortality of 3.6% for people in their 60s, which increases to 8.0% and 14.8% for people in their 70s and over 80s. This highlights the increased risk of mortality for elderly individuals[1].\n", "\n", - "2. **Severity and Incidence**: The current SARS-CoV-2 pandemic is affecting elderly people worldwide with greater incidence and severity, with a significant proportion of coronavirus hospitalizations corresponding to those over 60 years of age[6].\n", + "2. **Severity of Illness**: The current SARS-CoV-2 pandemic is affecting elderly people worldwide with greater incidence and severity. In Spain, 68% of all coronavirus hospitalizations correspond to those over 60 years of age[2].\n", "\n", - "3. **Risk Interactions Across Age Groups**: The risk of coronavirus infection among elderly people is significantly affected by other age groups, and protecting elderly people from coronavirus infection could reduce the risk of infection among themselves and other age groups[7].\n", + "3. **Risk Interactions Across Age Groups**: The risk of coronavirus infection among elderly people is significantly affected by other age groups. Protecting elderly people from coronavirus infection could reduce the risk of infection among themselves and ameliorate the risks of virus infection among other age groups[3].\n", "\n", - "4. **Complications**: Complications of COVID-19 have been particularly severe among older adults, emphasizing the need for pandemic preparedness in nursing homes and support programs for community-dwelling older adults[8].\n", + "4. **Complications**: Complications of COVID-19 have been particularly severe among older adults, emphasizing the need for pandemic preparedness in nursing homes and support programs for community-dwelling older adults[4].\n", "\n", - "These findings highlight the increased vulnerability of obese and elderly individuals to severe illness and complications associated with COVID-19.\n", + "These findings underscore the increased vulnerability of elderly individuals to severe illness and complications associated with COVID-19.\n", "\n", "For more detailed information, you can refer to the provided sources." ], @@ -398,7 +408,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "id": "46a5ed66-e7ff-43bd-829f-c028476d2593", "metadata": {}, "outputs": [ @@ -417,11 +427,11 @@ { "data": { "text/markdown": [ - "The \"Kidney Heist\" legend is a well-known urban legend that has circulated widely over the past fifteen years. The legend typically begins with the classic urban-legend opening: \"A friend of a friend...\" and involves a story about a person who wakes up in an ice-filled bathtub after being drugged, only to discover that one of their kidneys has been stolen. There are numerous versions of this legend, but they all share the core elements of the drugged drink, the ice-filled bathtub, and the kidney-theft punch line. The story is often set in a specific location, which varies depending on where it is told, adding localized details that lend credibility to the talesource.\n", + "The \"Kidney Heist\" legend is a well-known urban legend that has circulated widely over the past fifteen years. The legend typically begins with the classic urban-legend opening: \"A friend of a friend...\" and involves a story about a person who wakes up in an ice-filled bathtub after being drugged, only to discover that one of their kidneys has been stolen. There are numerous versions of this legend, but they all share three core elements: the drugged drink, the ice-filled bathtub, and the kidney-theft punch line. The story is often set in a specific location, which varies depending on where it is told, adding localized details that enhance its credibility and effectsource.\n", "\n", - "The legend is characterized by its unexpected outcome, concrete details, and emotional impact, making it memorable and easily retold. It is a story that sticks, as people understand it, remember it, and can retell it later. The vivid and concrete nature of the details in the story makes it seem more real and believable, contributing to its stickinesssource.\n", + "The legend is characterized by its vivid and concrete details, which make it memorable and easy to retell. It taps into emotions such as fear, disgust, and suspicion, and if believed to be true, it might change people's behavior, particularly in terms of accepting drinks from strangers. The story's stickiness and memorability make it a powerful example of how concrete and emotionally engaging stories can have a lasting impact on peoplesource.\n", "\n", - "The legend of the \"Kidney Heist\" is an example of a sticky idea, as it is both understandable and memorable, with a lasting impact on those who hear it. It serves as an illustration of how certain stories and ideas can be effectively communicated and retained, even without substantial resources to support themsource." + "The legend of the \"Kidney Heist\" is an example of a sticky idea that is understood, remembered, and has a lasting impact on people, even though it is not based on truth. It serves as an illustration of how certain stories, despite being false, can have a significant influence on people's perceptions and behaviorssource." ], "text/plain": [ "" @@ -438,7 +448,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "id": "03839591-553c-46a0-846a-1c4fb96bf851", "metadata": {}, "outputs": [ @@ -448,7 +458,7 @@ "text": [ "Tool: bing\n", "Agent Action: \n", - "Invoking: `Searcher` with `{'query': 'family member names of the current president of India'}`\n", + "Invoking: `Searcher` with `{'query': 'family members of the current president of India'}`\n", "\n", "\n", "\n" @@ -457,7 +467,7 @@ { "data": { "text/markdown": [ - "The current President of India is Droupadi Murmu. However, the search results did not provide specific information about the names of her family members. If you have any other questions or if there's anything else I can assist you with, feel free to ask!" + "The current President of India is Smt. Droupadi Murmu. However, the search results did not provide specific information about her family members. If you have any other questions or if there's anything else I can assist you with, feel free to ask!" ], "text/plain": [ "" @@ -485,7 +495,7 @@ "text": [ "Tool: csvfile\n", "Agent Action: \n", - "Invoking: `python_repl_ast` with `{'query': 'df.shape[0]'}`\n", + "Invoking: `python_repl_ast` with `{'query': 'len(df)'}`\n", "\n", "\n", "\n", @@ -502,7 +512,8 @@ "The file has 20,780 rows.\n", "\n", "Explanation:\n", - "I used the `shape` attribute of the DataFrame to get the number of rows. The first element of the shape attribute gives the number of rows, which is 20,780. This confirms the number of rows in the DataFrame." + "- Using the `len(df)` function, we obtained the total number of rows in the dataframe, which is 20,780.\n", + "- Additionally, using the `df.shape` attribute, we obtained the shape of the dataframe, which is (20780, 41). This confirms that the dataframe has 20,780 rows." ], "text/plain": [ "" @@ -539,10 +550,7 @@ "\n", "\n", "Agent Action: \n", - "Invoking: `sql_db_query` with `SELECT state, SUM(death) as total_deaths\n", - "FROM covidtracking\n", - "WHERE state IN ('CA', 'OR', 'WA') AND date LIKE '2020-07%'\n", - "GROUP BY state`\n", + "Invoking: `sql_db_query` with `SELECT state, SUM(death) as total_deaths FROM covidtracking WHERE state IN ('CA', 'OR', 'WA') AND date LIKE '2020-07%' GROUP BY state`\n", "\n", "\n", "\n" @@ -556,16 +564,18 @@ "- Oregon: 7,745 deaths\n", "- Washington: 44,440 deaths\n", "\n", - "Here's the SQL query I used to obtain the results:\n", + "Here's the SQL query I used to obtain this information:\n", "```sql\n", - "SELECT state, SUM(death) as total_deaths\n", - "FROM covidtracking\n", - "WHERE state IN ('CA', 'OR', 'WA') AND date LIKE '2020-07%'\n", + "SELECT state, SUM(death) as total_deaths \n", + "FROM covidtracking \n", + "WHERE state IN ('CA', 'OR', 'WA') AND date LIKE '2020-07%' \n", "GROUP BY state\n", "```\n", "\n", "Explanation:\n", - "I used the `covidtracking` table to filter the data for the states on the west coast (California, Oregon, and Washington) and for the month of July 2020. Then, I used the `SUM` function to calculate the total number of deaths for each state and grouped the results by state." + "1. I used the `covidtracking` table to filter the data for the states of California (CA), Oregon (OR), and Washington (WA).\n", + "2. I selected the total number of deaths (`SUM(death)`) for each state where the date is in July 2020 (`date LIKE '2020-07%'`).\n", + "3. I grouped the results by state to get the total deaths for each state." ], "text/plain": [ "" @@ -604,7 +614,7 @@ "print(random_number)\n", "```\n", "\n", - "This will output a random integer between 1 and 10. You can explore other functions provided by the `random` module to suit your specific needs." + "This will produce a random integer between 1 and 10. You can explore other functions in the `random` module to suit your specific needs." ], "text/plain": [ "" @@ -764,7 +774,9 @@ { "data": { "text/markdown": [ - "**bing**: The current President of France is Emmanuel Macron. He was re-elected as the President of the Republic on 24 April 2022 after a convincing victory in the presidential election. Emmanuel Macron is the eighth President of the Fifth Republic of France and has been in office since 2017. If you need more information, you can visit the official page of Emmanuel Macron at [Élysée](https://www.elysee.fr/en/emmanuel-macron) or refer to the [Wikipedia page](https://en.wikipedia.org/wiki/President_of_France) for more details about the President of France." + "**bing**: The current president of France is Emmanuel Macron. He was re-elected as the President of the Republic on 24 April 2022. Emmanuel Macron is the eighth President of the Fifth Republic of France and has been in office since 2017. If you need more information, you can visit the official website of the French Presidency at [Élysée](https://www.elysee.fr/en/emmanuel-macron).\n", + "\n", + "If you have any more questions or need further assistance, feel free to ask!" ], "text/plain": [ "" @@ -801,15 +813,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "Tool: bing\n", "Tool: docsearch\n", + "Tool: bing\n", "Agent Action: \n", - "Invoking: `Searcher` with `{'query': 'current exchange rate CLP to USD'}`\n", + "Invoking: `docsearch` with `{'query': 'CLP'}`\n", "\n", "\n", "\n", "Agent Action: \n", - "Invoking: `docsearch` with `{'query': 'CLP'}`\n", + "Invoking: `Searcher` with `{'query': 'CLP'}`\n", "\n", "\n", "\n" @@ -818,17 +830,17 @@ { "data": { "text/markdown": [ - "**docsearch**: The term \"CLP\" has multiple meanings and applications in different contexts. Here are some of the contexts in which \"CLP\" is mentioned:\n", + "**docsearch**: The term \"CLP\" can refer to different concepts based on the context. Here are some of the references related to \"CLP\" that I found:\n", "\n", - "1. **Constraint Logic Programming (CLP):** This refers to a powerful extension of conventional logic programming that incorporates constraint languages and constraint solving methods into logic programming languages. It involves the parametrization of a logic programming language with respect to a constraint language and a domain of computation, yielding soundness and completeness results for an operational semantics relying on a constraint solver for the employed constraint language[1].\n", + "1. **Constraint Logic Programming (CLP):** This refers to a powerful extension of conventional logic programming that involves the incorporation of constraint languages and constraint solving methods into logic programming languages. It was first introduced by Jaffar and Lassez in 1986 as a general framework for a logic programming language that is parametrized with respect to constraint language and a domain of computation, yielding soundness and completeness results for an operational semantics relying on a constraint solver for the employed constraint language[1].\n", "\n", - "2. **CLP(FD) - Constraint Logic Programming over Finite Domains:** This is an extension of logic programming where logical variables are assigned a domain, and relations between variables are described with constraints. It involves constraint propagation and maintaining consistency of constraints, such as node, interval, and arc consistency[2].\n", + "2. **CLP(FD) - Constraint Logic Programming over Finite Domains:** This is an extension of logic programming where logical variables are assigned a domain and relations between variables are described with constraints. A solution to a CLP(FD) program is a valuation of every variable in its own domain such that no constraint is falsified. Solutions are found using two mechanisms: propagation and enumeration. The goal of CLP(FD) is to generate a CLP(FD) constraint between the input and output variables of an imperative program[2].\n", "\n", - "3. **Recombinant Baculovirus-Generated Bluetongue Virus (BTV) Core-Like Particles (CLP):** In this context, CLP refers to core-like particles of the bluetongue virus, quantified using immunosorbent electron microscopy. The concentration of CLP in purified preparations and lysates of recombinant baculovirus-infected cells is determined using this technique[3].\n", + "3. **Relevance to Computer Science Research:** CLP has been extensively researched in the context of logic programming, constraint logic grammars, and their applications in computational linguistics. It involves the incorporation of constraint languages and constraint solving methods into logic programming languages, providing a powerful framework for various applications[3].\n", "\n", - "4. **Dynamic Inference of Likely Invariants using Daikon:** In the context of dynamic inference of likely invariants, CLP refers to Constraint Logic Programming on Finite Domains (CLP(FD)), which is used to validate likely invariants by translating an imperative program into a constraint logic programming system[4].\n", + "4. **Quantitative Constraint Logic Programming:** This refers to a formal semantics for quantitative inference in CLP based upon the simple and intuitive concepts of fuzzy set algebra. It provides a precise, yet simple formal semantics for quantitative inference in CLP and enables the use of the search technique of alpha-beta pruning for efficient disambiguation[3].\n", "\n", - "Given these diverse contexts, \"CLP\" can refer to Constraint Logic Programming, Constraint Logic Programming over Finite Domains, Recombinant Baculovirus-Generated Bluetongue Virus Core-Like Particles, and Dynamic Inference of Likely Invariants using Daikon. Each context has its own specific application and meaning." + "These references provide a comprehensive overview of the different aspects and applications of \"CLP\" in various domains." ], "text/plain": [ "" @@ -852,7 +864,17 @@ { "data": { "text/markdown": [ - "**bing**: The current exchange rate from Chilean Peso (CLP) to US Dollar (USD) is approximately 1 USD = 980.974 CLP[1]. This rate is for informational purposes and may vary when sending money. If you need further information, feel free to ask!" + "**bing**: The acronym \"CLP\" has various meanings in different contexts:\n", + "\n", + "1. **CLP Group**: CLP is a leading power company with operations in Hong Kong, Mainland China, India, Australia, and other regions. It provides energy solutions for a sustainable future and showcases its history and culture at CLP Pulse. [CLP Group Website](https://www.clpgroup.com/en/index.html)\n", + "\n", + "2. **CLP Power Hong Kong**: This is a subsidiary of CLP Holdings Limited, offering electricity to over 80% of Hong Kong's population. It also provides energy-saving tips, eco-friendly products, and online services such as eBill, PPS payment, and CLP TomorroVerse. [CLP Power Hong Kong Website](https://www.clp.com.hk/en/index)\n", + "\n", + "3. **Country Liberal Party (CLP)**: The Country Liberal Party of the Northern Territory, commonly known as the Country Liberals, is a center-right political party in Australia's Northern Territory. It operates in a two-party system with the Australian Labor Party (ALP) and contests federal elections as an affiliate of the Liberal Party of Australia and National Party of Australia. [Country Liberal Party - Wikipedia](https://en.wikipedia.org/wiki/Country_Liberal_Party)\n", + "\n", + "4. **EnergyAustralia and CLP**: There is also a mention of CLP in relation to EnergyAustralia, where it is stated that EnergyAustralia had contracted its generation in advance, ahead of the spike in wholesale prices, and then had to cover the contracts in the market at the higher spot rates because of the... [EnergyAustralia plunges to heavy loss, eyes partnerships - Financial Review](https://www.afr.com/companies/energy/energyaustralia-plunges-to-heavy-loss-20220808-p5b81k)\n", + "\n", + "These are the various meanings and contexts in which the acronym \"CLP\" is used. If you have a specific context in mind, please let me know!" ], "text/plain": [ "" @@ -984,7 +1006,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "session948 user56\n" + "session982 user355\n" ] } ], @@ -1045,7 +1067,7 @@ { "data": { "text/markdown": [ - "I'm an AI assistant named Jarvis, designed to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions. How can I assist you today?" + "I'm here to assist you with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions. My name is Jarvis, and I'm designed to be a helpful assistant for all your inquiries. How can I assist you today?" ], "text/plain": [ "" @@ -1071,13 +1093,13 @@ "text": [ "Tool: bing\n", "Agent Action: \n", - "Invoking: `Searcher` with `{'query': 'Italian restaurants downtown Chicago'}`\n", + "Invoking: `Searcher` with `{'query': 'Italian restaurants in downtown Chicago'}`\n", "\n", "\n", "\n", "Tool: bing\n", "Agent Action: \n", - "Invoking: `Searcher` with `{'query': 'sushi restaurants downtown Chicago'}`\n", + "Invoking: `Searcher` with `{'query': 'sushi restaurants in downtown Chicago'}`\n", "\n", "\n", "\n" @@ -1089,20 +1111,44 @@ "Here are some options for Italian and Sushi restaurants in downtown Chicago:\n", "\n", "### Italian Restaurants\n", - "1. **Madison Street Location** - This restaurant embodies historic Chicago dining, with a timeless ambiance and a menu that features fresh salads and satisfying appetizers. [OpenTable](https://www.opentable.com/cuisine/best-italian-restaurants-downtown-chicago-il)\n", - "2. **Sofi Restaurant** - A family-run Italian eatery offering a menu rich in homemade pasta, bolognese, and truffle risotto, complemented by a tranquil outdoor seating area. [Tripadvisor](https://www.tripadvisor.com/Restaurants-g35805-c26-zfn7778523-Chicago_Illinois.html)\n", - "3. **Top 10 Best Italian Restaurants Downtown in Chicago** - This list includes Volare Ristorante Italiano, Viaggio Ristorante & Lounge, Il Porcellino, La Scarola, Sapori Trattoria, Quartino Ristorante, Maggiano's Little Italy, Nonna Silvia's Trattoria & Pizzeria, Olio e Più, and Piccolo Sogno. [Yelp](https://www.yelp.com/search?find_desc=Italian+Restaurants+Downtown&find_loc=Chicago%2C+IL)\n", - "4. **Ummo** - This restaurant offers decadent items like pistachio-crusted lamb and ravioli with lobster-butter ragu, influenced by Italian, American, and other restaurants around the area. [Eater Chicago](https://chicago.eater.com/maps/best-italian-restaurants-in-chicago)\n", - "5. **Osteria Via Stato** - An authentic Italian restaurant in downtown Chicago's River North neighborhood featuring local, seasonal ingredients and a warm sense of hospitality. [Osteria Via Stato](https://www.osteriaviastato.com/)\n", + "1. **Sofi Restaurant**\n", + " - This family-run Italian eatery serves a menu rich in homemade pasta, bolognese, and truffle risotto, complemented by a tranquil outdoor seating area.\n", + " - [Tripadvisor - Italian Restaurants in Downtown / The Loop Chicago](https://www.tripadvisor.com/Restaurants-g35805-c26-zfn7778523-Chicago_Illinois.html)\n", + "\n", + "2. **The Fillmore**\n", + " - Located in the heart of Jeweler’s Row, the Madison Street location embodies historic Chicago dining, with a timeless ambiance and a menu featuring classic Italian dishes.\n", + " - [OpenTable - 116 Best Italian Restaurants In Downtown / Loop](https://www.opentable.com/cuisine/best-italian-restaurants-downtown-chicago-il)\n", + "\n", + "3. **Viaggio Ristorante & Lounge, Volare Ristorante Italiano, Piacere Mio, Il Porcellino, Nonna Silvia's Trattoria & Pizzeria, Sapori Trattoria, La Scarola, Maggiano's Little Italy, Quartino Ristorante, Monteverde**\n", + " - These are some of the top-rated Italian restaurants in downtown Chicago according to Yelp.\n", + " - [Yelp - TOP 10 BEST Italian Restaurants Downtown in Chicago, IL](https://www.yelp.com/search?find_desc=Italian+Restaurants+Downtown&find_loc=Chicago%2C+IL)\n", + "\n", + "4. **Monteverde**\n", + " - This West Loop eatery offers a variety of Italian dishes and is known for its chef-owner, Sarah Grueneberg.\n", + " - [Time Out - 35 Best Italian Restaurants in Chicago](https://www.timeout.com/chicago/restaurants/best-italian-restaurants-in-chicago-find-pasta-pizza-and-more)\n", "\n", "### Sushi Restaurants\n", - "1. **Blue Sushi Sake Grill** - Regarded as \"the best sushi restaurant in Chicago\" by multiple reviewers. Offers fresh, high-quality sushi, with favorites including the Truffle Salmon, Ceviche style Hirami, and Black Tuna Sashimi. [More Information](https://www.opentable.com/cuisine/best-sushi-restaurants-downtown-chicago-il)\n", - "2. **Eater Chicago** - Offers modern design and ever-changing menus, known for its innovative sushi offerings. [More Information](https://chicago.eater.com/maps/best-sushi-restaurants-chicago)\n", - "3. **Pokeworks** - Convenient location, clean, tidy, and friendly staff. Offers a variety of sushi and seafood options. [More Information](https://www.tripadvisor.com/Restaurants-g35805-c38-zfn7778523-Chicago_Illinois.html)\n", - "4. **Sushi Plus Rotary Sushi Bar** - Known for its unique rotary sushi bar experience and a wide variety of sushi options. [More Information](https://www.yelp.com/search?find_desc=sushi+downtown&find_loc=Chicago%2C+IL)\n", - "5. **KAI ZAN** - Highly rated for its creative and delicious sushi creations. Offers a diverse range of sushi options and dining experiences. [More Information](https://www.yelp.com/search?find_desc=sushi+restaurants+downtown&find_loc=Chicago%2C+IL)\n", + "1. **Blue Sushi Sake Grill**\n", + " - Known for its top-notch sushi cuisine, this restaurant is regarded as \"the best sushi restaurant in Chicago\" by multiple reviewers. It is praised for its fresh, high-quality sushi, with favorites including the Truffle Salmon, Ceviche style Hirami, and Black Tuna Sashimi.\n", + " - [OpenTable](https://www.opentable.com/cuisine/best-sushi-restaurants-downtown-chicago-il)\n", + "\n", + "2. **Pokeworks**\n", + " - A convenient location with friendly staff and a clean, tidy environment.\n", + " - [Tripadvisor](https://www.tripadvisor.com/Restaurants-g35805-c38-zfn7778523-Chicago_Illinois.html)\n", + "\n", + "3. **I Love Sushi**\n", + " - Known for its nice location, fast service, and friendly employees.\n", + " - [Tripadvisor](https://www.tripadvisor.com/Restaurants-g35805-c38-zfn7778523-Chicago_Illinois.html)\n", "\n", - "You can explore these options to find the perfect dining experience for you and your girlfriend tonight." + "4. **Sushi Plus Rotary Sushi Bar**\n", + " - An all-you-can-eat sushi restaurant.\n", + " - [Yelp](https://www.yelp.com/search?find_desc=sushi+downtown&find_loc=Chicago%2C+IL)\n", + "\n", + "5. **Kyōten**\n", + " - One of Chicago's most extensive (and expensive) omakase experiences, offering high-quality sushi.\n", + " - [Time Out](https://www.timeout.com/chicago/restaurants/the-best-sushi-in-chicago)\n", + "\n", + "These restaurants offer a range of Italian and sushi cuisine, so you can choose based on your preferences. Enjoy your dining experience in downtown Chicago!" ], "text/plain": [ "" @@ -1129,12 +1175,7 @@ "text": [ "Tool: bing\n", "Agent Action: \n", - "Invoking: `Searcher` with `{'query': 'Ummo restaurant Chicago sushi'}`\n", - "\n", - "\n", - "\n", - "Agent Action: \n", - "Invoking: `Searcher` with `{'query': 'best sushi restaurants in Chicago'}`\n", + "Invoking: `Searcher` with `{'query': 'Sushi Plus Rotary Sushi Bar Chicago'}`\n", "\n", "\n", "\n" @@ -1143,7 +1184,18 @@ { "data": { "text/markdown": [ - "I have provided information about Ummo, a contemporary Italian restaurant in Chicago. However, I couldn't find specific details about Ummo's sushi offerings. If you need more specific details about the sushi options at Ummo or any other information, feel free to ask!" + "I found some details about Sushi Plus Rotary Sushi Bar in Chicago. It has two locations:\n", + "\n", + "1. **Boystown Location**\n", + " - Facebook Page: [Sushi Plus Rotary Sushi Bar Boystown | Chicago IL - Facebook](https://www.facebook.com/sushipluschicago/)\n", + " - Yelp Page: [Sushi Plus Rotary Sushi Bar - Boystown - Yelp](https://www.yelp.com/biz/sushi-plus-rotary-sushi-bar-boystown-chicago)\n", + "\n", + "2. **Chinatown Location**\n", + " - Facebook Page: [Sushi Plus Rotary Sushi Bar Chinatown | Chicago IL - Facebook](https://www.facebook.com/sushipluschinatown/)\n", + " - Yelp Page: [Sushi Plus Rotary Sushi Bar - Chinatown - Yelp](https://www.yelp.ca/biz/sushi-plus-rotary-sushi-bar-chinatown-chicago)\n", + " - Restaurant Guru: [Sushi Plus Rotary Sushi Bar - Chinatown, 2131 S Archer Ave in Chicago ...](https://restaurantguru.com/Sushi-Rotary-Sushi-Bar-Chicago-2)\n", + "\n", + "You can explore these links for more information about the Sushi Plus Rotary Sushi Bar in Chicago. Enjoy your dining experience!" ], "text/plain": [ "" @@ -1154,7 +1206,7 @@ } ], "source": [ - "printmd(brain_agent_executor.invoke({\"question\": \"can you tell me more about restarant 4 on your list of sushi restaurants?\"}, config=config)[\"output\"])" + "printmd(brain_agent_executor.invoke({\"question\": \"can you tell me more about restaurant 4 on your list of sushi restaurants?\"}, config=config)[\"output\"])" ] }, { @@ -1173,16 +1225,16 @@ { "data": { "text/markdown": [ - "The formula for momentum in physics is given by the product of an object's mass and its velocity. Mathematically, it can be expressed as:\n", + "The formula for momentum in physics is given by the equation:\n", "\n", - "\\[ \\text{Momentum} = \\text{Mass} \\times \\text{Velocity} \\]\n", + "\\[ p = mv \\]\n", "\n", "Where:\n", - "- Momentum is measured in kilogram meters per second (kg m/s)\n", - "- Mass is measured in kilograms (kg)\n", - "- Velocity is measured in meters per second (m/s)\n", + "- \\( p \\) is the momentum\n", + "- \\( m \\) is the mass of the object\n", + "- \\( v \\) is the velocity of the object\n", "\n", - "This formula is a fundamental concept in physics and is used to describe the motion of objects." + "This formula shows that momentum is the product of an object's mass and its velocity." ], "text/plain": [ "" @@ -1217,17 +1269,17 @@ { "data": { "text/markdown": [ - "I have found several contexts in which \"CLP\" is mentioned:\n", + "I found multiple meanings and applications for the term \"CLP\" in different contexts. Here are some of the contexts in which \"CLP\" is mentioned:\n", "\n", - "1. **Constraint Logic Programming (CLP):** It is a powerful extension of conventional logic programming that incorporates constraint languages and constraint solving methods into logic programming languages.\n", + "1. **Constraint Logic Programming (CLP):** This refers to a powerful extension of conventional logic programming that incorporates constraint languages and constraint-solving methods into logic programming languages.\n", "\n", - "2. **CLP(FD) - Constraint Logic Programming over Finite Domains:** This is an extension of logic programming where logical variables are assigned a domain and relations between variables are described with constraints.\n", + "2. **CLP(FD) - Constraint Logic Programming over Finite Domains:** This is an extension of logic programming where logical variables are assigned a domain, and relations between variables are described with constraints.\n", "\n", - "3. **Recombinant Baculovirus-Generated Bluetongue Virus (BTV) Core-Like Particles (CLP):** CLP can also refer to core-like particles of the Bluetongue virus (BTV) that are generated by recombinant baculoviruses.\n", + "3. **Recombinant Baculovirus-Generated Bluetongue Virus (BTV) Core-Like Particles (CLP):** This refers to the use of immunosorbent electron microscopy to quantify recombinant baculovirus-generated bluetongue virus (BTV) core-like particles.\n", "\n", - "4. **Dynamic Inference of Likely Invariants using Daikon and CLP(FD):** CLP(FD) is used in the context of dynamic inference of likely invariants of a program using Daikon, a tool for dynamic detection of likely program invariants.\n", + "4. **Dynamic Inference of Likely Invariants using Daikon and CLP(FD):** This involves the use of Daikon, a tool for dynamic inference of likely invariants, to infer likely program invariants of a given program.\n", "\n", - "The specific meaning of \"CLP\" depends on the context in which it is used. If you have a specific context in mind, please provide more details so that I can offer a more precise explanation." + "Given these different contexts, it's important to specify the specific context or meaning of \"CLP\" that you are referring to." ], "text/plain": [ "" @@ -1262,11 +1314,15 @@ { "data": { "text/markdown": [ - "Constraint Logic Programming (CLP) is a powerful extension of conventional logic programming that involves the incorporation of constraint languages and constraint solving methods into logic programming languages. The name CLP was first introduced by Jaffar and Lassez in 1986 for a general framework of a logic programming language that is parameterized with respect to constraint language and a domain of computation. This framework yields soundness and completeness results for an operational semantics relying on a constraint solver for the employed constraint language.\n", + "Constraint Logic Programming (CLP) is a powerful extension of conventional logic programming that incorporates constraint languages and constraint-solving methods into logic programming languages. The name CLP was first introduced by Jaffar and Lassez in 1986 for a general framework of a logic programming language that is parameterized with respect to constraint language and a domain of computation. This framework yields soundness and completeness results for an operational semantics relying on a constraint solver for the employed constraint language [1](https://datasetsgptsmartsearch.blob.core.windows.net/arxivcs/pdf/0008/0008036v1.pdf?sv=2022-11-02&ss=b&srt=sco&sp=rl&se=2026-01-03T02:11:44Z&st=2024-01-02T18:11:44Z&spr=https&sig=ngrEqvqBVaxyuSYqgPVeF%2B9c0fXLs94v3ASgwg7LDBs%3D).\n", + "\n", + "CLP provides an operational treatment of various frameworks by embedding arbitrary logical languages into constraint logic programs. Definite clause specifications over such constraint languages then define grammars as constraint logic programs, i.e., as sets of axiomatic interpreted definite clauses. The prediction problem in this setting involves inferring an answer proving the implication to be a logical consequence of the program [1](https://datasetsgptsmartsearch.blob.core.windows.net/arxivcs/pdf/0008/0008036v1.pdf?sv=2022-11-02&ss=b&srt=sco&sp=rl&se=2026-01-03T02:11:44Z&st=2024-01-02T18:11:44Z&spr=https&sig=ngrEqvqBVaxyuSYqgPVeF%2B9c0fXLs94v3ASgwg7LDBs%3D).\n", + "\n", + "The approach of CLP is also discussed in the context of constraint logic grammars (CLGs), which are understood as grammars formulated by means of a suitable logical language that can be used as a constraint language in the CLP scheme. This connection provides an operational treatment of purely declaratively specified grammars, enabling a clear model-theoretic characterization of linguistic objects by specifying grammars as sets of descriptions from a suitable logical description language, called the constraint language [1](https://datasetsgptsmartsearch.blob.core.windows.net/arxivcs/pdf/0008/0008036v1.pdf?sv=2022-11-02&ss=b&srt=sco&sp=rl&se=2026-01-03T02:11:44Z&st=2024-01-02T18:11:44Z&spr=https&sig=ngrEqvqBVaxyuSYqgPVeF%2B9c0fXLs94v3ASgwg7LDBs%3D).\n", "\n", - "CLP provides an operational treatment of various frameworks by embedding arbitrary logical languages into constraint logic programs. Definite clause specifications over such constraint languages then define grammars as constraint logic programs, i.e., as sets of axiomatic interpreted definite clauses. The work on Constraint Logic Programming has also been extended to include constraint logic grammars, which express the connection between CLP and constraint-based grammars. CLGs are understood as grammars formulated by means of a suitable logical language, which can be used as a constraint language in the CLP scheme.\n", + "The operational properties of the CLP scheme are discussed in the formalism CUF, which offers the operational properties of the CLP scheme but gives up the connection to the model-theoretic specifications of the underlying feature-based grammars. Another approach is defined by Götz and Meurers, who define an explicit translation from a logical language close to that of King into constraint logic programs, preserving the prediction problem by generating a constraint logic program [1](https://datasetsgptsmartsearch.blob.core.windows.net/arxivcs/pdf/0008/0008036v1.pdf?sv=2022-11-02&ss=b&srt=sco&sp=rl&se=2026-01-03T02:11:44Z&st=2024-01-02T18:11:44Z&spr=https&sig=ngrEqvqBVaxyuSYqgPVeF%2B9c0fXLs94v3ASgwg7LDBs%3D).\n", "\n", - "This approach to Constraint Logic Programming provides a formal and operational framework for handling constraints and logical specifications within the context of logic programming, offering a powerful tool for linguistic knowledge representation and other related applications[1]." + "In summary, Constraint Logic Programming (CLP) is a powerful extension of conventional logic programming that incorporates constraint languages and constraint solving methods into logic programming languages, providing an operational treatment of various frameworks by embedding arbitrary logical languages into constraint logic programs [1](https://datasetsgptsmartsearch.blob.core.windows.net/arxivcs/pdf/0008/0008036v1.pdf?sv=2022-11-02&ss=b&srt=sco&sp=rl&se=2026-01-03T02:11:44Z&st=2024-01-02T18:11:44Z&spr=https&sig=ngrEqvqBVaxyuSYqgPVeF%2B9c0fXLs94v3ASgwg7LDBs%3D)." ], "text/plain": [ "" @@ -1302,7 +1358,7 @@ "\n", "\n", "Agent Action: \n", - "Invoking: `sql_db_query` with `SELECT SUM(death) FROM covidtracking WHERE state='TX' AND date LIKE '2020%'`\n", + "Invoking: `sql_db_query` with `SELECT SUM(death) as total_deaths FROM covidtracking WHERE state='TX' AND date LIKE '2020%'`\n", "\n", "\n", "\n" @@ -1311,7 +1367,7 @@ { "data": { "text/markdown": [ - "The total number of deaths due to COVID-19 in Texas in the year 2020 was 2,841,253." + "The total number of people who died of COVID in Texas in 2020 is 2,841,253. This information is based on the data from the `covidtracking` table, and it reflects the impact of the COVID-19 pandemic in Texas during that year." ], "text/plain": [ "" @@ -1356,7 +1412,7 @@ { "data": { "text/markdown": [ - "The total number of deaths due to COVID-19 in Texas from January 1, 2020, to December 31, 2020, is 27,437. This information is based on the \"deathIncrease\" column, which provides a more accurate count of the deaths attributed to COVID-19 during that period." + "The total number of deaths due to COVID-19 in Texas in 2020, based on the \"deathIncrease\" column, is 27,437. This data reflects the impact of the COVID-19 pandemic on the state of Texas during that year." ], "text/plain": [ "" @@ -1372,7 +1428,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 39, "id": "410d398b-d589-4352-8c42-2df5be173498", "metadata": {}, "outputs": [ @@ -1391,17 +1447,17 @@ { "data": { "text/markdown": [ - "I have found valuable insights from the document \"Boundaries: When to Say Yes, How to Say No to Take Control of Your Life\" that provide guidance on setting boundaries with kids:\n", + "I found some valuable insights from the document \"Boundaries: When to Say Yes, How to Say No to Take Control of Your Life\" that shed light on setting boundaries with kids. Here are some key points:\n", "\n", - "1. **Importance of Bonding Before Boundaries**: The document emphasizes that boundaries come after bonding. Children must have secure bonding before they can effectively learn to set boundaries and gain independence. Good connections naturally lead to the development of boundaries and the ability to move away from others.\n", + "1. **Developmental Aspect of Boundaries**: The document emphasizes that boundaries come after bonding. Children must have secure bonding before they can effectively learn to set boundaries and move away from others. Good connections naturally lead to the development of boundaries and independence.\n", "\n", - "2. **Instilling vs. Repairing Boundaries**: Early instilling of responsibility, limit setting, and delay of gratification in young children can lead to smoother later years of life. However, for parents of older children, boundary development may be met with more resistance, requiring more time and support from friends.\n", + "2. **Instilling vs. Repairing Boundaries**: Teaching responsibility, limit setting, and delay of gratification early on can lead to smoother later years of a child's life. The document suggests that the later parents start, the harder they and their children have to work on boundary development.\n", "\n", - "3. **Boundary Development in Children**: The work of boundary development in children is the work of learning responsibility. Teaching children the merits and limits of responsibility prepares them to take on the tasks of adulthood.\n", + "3. **Boundary Development in Children**: The work of boundary development in children is described as the work of learning responsibility. Teaching children the merits and limits of responsibility prepares them for adulthood tasks.\n", "\n", - "4. **Teaching Responsibility**: The document provides an example of how a child learned to take responsibility for himself through a slow transfer of qualities from the outside to the inside. Boundaries facilitated the process of having the child internalize things that were external to him.\n", + "4. **Boundary Needs of Children**: Boundaries play a crucial role in meeting important needs in children, such as self-protection. The document emphasizes that boundaries are designed to keep the good in and the bad out, and skills such as saying no, telling the truth, and maintaining physical distance need to be developed in the family structure to allow the child to take on the responsibility of self-protection.\n", "\n", - "These insights offer valuable guidance on the importance of setting boundaries with children and the developmental aspects associated with this processsource." + "These insights provide valuable perspectives on the importance of setting boundaries with kids and the developmental aspects involved in this process." ], "text/plain": [ "" @@ -1417,7 +1473,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 40, "id": "1fcd6749-b36d-4b5c-be9c-e2f02f34d230", "metadata": {}, "outputs": [ @@ -1444,21 +1500,28 @@ "text/markdown": [ "Based on the information gathered, here are some of the best and top-rated restaurants in downtown Seoul:\n", "\n", - "### Best Restaurants in Downtown Seoul\n", - "1. [Eater - The 38 Best Restaurants in Seoul, South Korea](https://www.eater.com/maps/best-seoul-restaurants-38) - This list provides a comprehensive guide to the best restaurants in Seoul, offering a diverse range of dining options.\n", - "2. [Tripadvisor - THE 10 BEST Restaurants in Seoul](https://www.tripadvisor.com/Restaurants-g294197-Seoul.html) - Tripadvisor offers a collection of top-rated restaurants in Seoul based on traveler reviews, allowing you to explore various cuisines, prices, and locations.\n", - "3. [TheKoreanGuide.com - 15 Best Restaurants in Seoul for Locals and Foreigners](https://thekoreanguide.com/best-restaurants-seoul/) - This guide features 15 of the best restaurants in Seoul, including Mingles Restaurant, known for its traditional and modern Korean cuisine.\n", - "4. [The Smart Local - 15 Restaurants In Seoul With The Best Unobstructed High Rise Views](https://thesmartlocal.com/read/korea-scenic-restaurants/) - THE PLACE Dining is highlighted as an Italian restaurant with stunning views of the N Seoul Tower, offering a unique dining experience with a 360-degree view of Seoul.\n", - "5. [Kimchimari.com - 9 Best Seoul Restaurants worth visiting](https://kimchimari.com/best-seoul-restaurants-2023/) - Woo Lae Oak 우래옥 is recommended as a must-visit restaurant, known for its historical significance and delicious cuisine.\n", - "\n", - "### Top-Rated Restaurants in Downtown Seoul\n", - "1. **Bar Cham** - This restaurant made the 2022 Asia’s 50 Best Bars list and offers various non-alcoholic cocktail options just as delicious as their alcoholic counterparts. Location: 34 Jahamun-ro 7-gil\n", - "2. **Gop - Mapo** - Known for offering the best grilled Korean meal in Seoul and is one of the best restaurants to try beef intestine. Location: Mapo\n", - "3. **Manjok Ohyang Jokbal City Hall** - Offers an authentic food experience with a focus on Korean cuisine. Location: City Hall\n", - "4. **Mingles Restaurant** - Cuisine: Korean (traditional and modern). Nestled near the Han River in the Gangnam-Gu district, Mingles Restaurant is one of the most popular eateries in Seoul, known for impeccable service and a focus on customer satisfaction.\n", - "5. **THE PLACE Dining** - An Italian restaurant with stunning views of the N Seoul Tower, offering a 360-degree view of Seoul with its window counter seating.\n", - "\n", - "These restaurants offer a diverse range of cuisines and dining experiences, making them excellent choices for a memorable dining experience in downtown Seoul." + "1. **Bar Cham**\n", + " - This restaurant made the 2022 Asia’s 50 Best Bars list and offers various non-alcoholic cocktail options just as delicious as their alcoholic counterparts.\n", + " - [More Info](https://www.eater.com/maps/best-seoul-restaurants-38)\n", + "\n", + "2. **Gop - Mapo**\n", + " - Known for offering the best grilled Korean meal in Seoul and is one of the best restaurants to try beef intestine.\n", + " - [More Info](https://www.tripadvisor.com/Restaurants-g294197-Seoul.html)\n", + "\n", + "3. **Mingles Restaurant**\n", + " - Cuisine: Korean (traditional and modern)\n", + " - Nestled near the Han River in the Gangnam-Gu district, Mingles Restaurant is one of the most popular eateries in Seoul, known for impeccable service and delicious food.\n", + " - [More Info](https://thekoreanguide.com/best-restaurants-seoul/)\n", + "\n", + "4. **THE PLACE Dining**\n", + " - An Italian restaurant with stunning views of the N Seoul Tower, offering a 360-degree view of Seoul with its window counter seating.\n", + " - [More Info](https://thesmartlocal.com/read/korea-scenic-restaurants/)\n", + "\n", + "5. **Woo Lae Oak 우래옥**\n", + " - This restaurant is worth visiting and is listed in the Michelin Guide 2023 Bib Gourmand. It offers a unique dining experience and is highly recommended.\n", + " - [More Info](https://kimchimari.com/best-seoul-restaurants-2023/)\n", + "\n", + "These restaurants offer a diverse range of cuisines and dining experiences, making them excellent choices for a memorable dining experience in downtown Seoul. Enjoy your dining experience!" ], "text/plain": [ "" @@ -1475,7 +1538,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 41, "id": "080cc28e-2130-4c79-ba7d-0ed702f0ea7a", "metadata": {}, "outputs": [ @@ -1489,16 +1552,16 @@ { "data": { "text/markdown": [ - "To trim the spaces from a sentence in JavaScript, you can use the `trim()` method. Here's an example:\n", + "You can use the `trim()` method in JavaScript to remove leading and trailing white spaces from a string. Here's an example:\n", "\n", "```javascript\n", "// Example of trimming spaces from a sentence in JavaScript\n", - "let sentence = \" Hello, world! \";\n", - "let trimmedSentence = sentence.trim();\n", + "const sentence = \" Hello, world! \";\n", + "const trimmedSentence = sentence.trim();\n", "console.log(trimmedSentence); // Output: \"Hello, world!\"\n", "```\n", "\n", - "In this example, the `trim()` method removes any leading and trailing whitespace from the string, resulting in the sentence \"Hello, world!\" without the extra spaces." + "In this example, the `trim()` method removes the leading and trailing spaces from the sentence, resulting in the output \"Hello, world!\"." ], "text/plain": [ "" @@ -1516,7 +1579,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 42, "id": "b82d20c5-4591-4d94-8af7-bae614685874", "metadata": {}, "outputs": [ @@ -1540,14 +1603,14 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 43, "id": "a5ded8d9-0bfe-4e16-be3f-382271c120a9", "metadata": {}, "outputs": [ { "data": { "text/markdown": [ - "You're welcome! If you have any more questions in the future, feel free to ask. Have a great day!" + "You're welcome! If you have any more questions or need further assistance, feel free to ask. Have a great day!" ], "text/plain": [ "" diff --git a/README.md b/README.md index 2c64e96a..6bb004d0 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,8 @@ The repo is made to teach you step-by-step on how to build a OpenAI-based Smart --- ## Demo -> :warning: **Warning:** Due to the high popularity of this repository, the site is temporarily down. We are currently seeking additional funding for the Azure Subscription to accommodate the increased traffic. -https://gptsmartsearch.azurewebsites.net/ +https://gptsmartsearchapp.azurewebsites.net/ --- diff --git a/apps/backend/backend.zip b/apps/backend/backend.zip index 7b35f6ab..1a9e17a5 100644 Binary files a/apps/backend/backend.zip and b/apps/backend/backend.zip differ diff --git a/apps/backend/bot.py b/apps/backend/bot.py index f1fe8ce2..1e081e56 100644 --- a/apps/backend/bot.py +++ b/apps/backend/bot.py @@ -107,11 +107,13 @@ async def on_message_activity(self, turn_context: TurnContext): max_tokens=1500, callback_manager=cb_manager, streaming=True) # Initialize our Tools/Experts - doc_indexes = ["cogsrch-index-files", "cogsrch-index-csv", "cogsrch-index-books"] + doc_indexes = ["cogsrch-index-files", "cogsrch-index-csv"] doc_search = DocSearchAgent(llm=llm, indexes=doc_indexes, k=6, reranker_th=1, sas_token=os.environ['BLOB_SAS_TOKEN'], + name="docsearch", + description="useful when the questions includes the term: docsearch", callback_manager=cb_manager, verbose=False) book_indexes = ["cogsrch-index-books"] @@ -119,13 +121,25 @@ async def on_message_activity(self, turn_context: TurnContext): book_search = DocSearchAgent(llm=llm, indexes=book_indexes, k=6, reranker_th=1, sas_token=os.environ['BLOB_SAS_TOKEN'], + name="booksearch", + description="useful when the questions includes the term: booksearch", callback_manager=cb_manager, verbose=False) - www_search = BingSearchAgent(llm=llm, k=5, callback_manager=cb_manager) - sql_search = SQLSearchAgent(llm=llm, k=30, callback_manager=cb_manager) - chatgpt_search = ChatGPTTool(llm=llm, callback_manager=cb_manager) + www_search = BingSearchAgent(llm=llm, k=10, callback_manager=cb_manager, + name="bing", + description="useful when the questions includes the term: bing") - tools = [doc_search, www_search, sql_search, chatgpt_search] + sql_search = SQLSearchAgent(llm=llm, k=30, callback_manager=cb_manager, + name="sqlsearch", + description="useful when the questions includes the term: sqlsearch", + verbose=False) + + chatgpt_search = ChatGPTTool(llm=llm, callback_manager=cb_manager, + name="chatgpt", + description="use for general questions, profile, greeting-like questions and when the questions includes the term: chatgpt", + verbose=False) + + tools = [doc_search, book_search, www_search, sql_search, chatgpt_search] agent = create_openai_tools_agent(llm, tools, CUSTOM_CHATBOT_PROMPT) agent_executor = AgentExecutor(agent=agent, tools=tools) @@ -158,7 +172,6 @@ async def on_message_activity(self, turn_context: TurnContext): await turn_context.send_activity(Activity(type=ActivityTypes.typing)) - # Please note below that running a non-async function like run_agent in a separate thread won't make it truly asynchronous. It allows the function to be called without blocking the event loop, but it may still have synchronous behavior internally. answer = brain_agent_executor.invoke({"question": input_text}, config=config)["output"] await turn_context.send_activity(answer) diff --git a/apps/frontend/azuredeploy-frontend.bicep b/apps/frontend/azuredeploy-frontend.bicep index 09ca487f..4fb79e1c 100644 --- a/apps/frontend/azuredeploy-frontend.bicep +++ b/apps/frontend/azuredeploy-frontend.bicep @@ -32,7 +32,7 @@ param resourceGroupSearch string = resourceGroup().name param azureSearchName string @description('Optional. The API version of the Azure Search.') -param azureSearchAPIVersion string = '2023-07-01-Preview' +param azureSearchAPIVersion string = '2023-10-01-preview' @description('Required. The name of the Azure OpenAI resource deployed previously.') param azureOpenAIName string @@ -42,10 +42,10 @@ param azureOpenAIName string param azureOpenAIAPIKey string @description('Optional. The model name of the Azure OpenAI.') -param azureOpenAIModelName string = 'gpt-4-32k' +param azureOpenAIModelName string = 'gpt-35-turbo-1106' @description('Optional. The API version of the Azure OpenAI.') -param azureOpenAIAPIVersion string = '2023-05-15' +param azureOpenAIAPIVersion string = '2023-12-01-preview' @description('Optional, defaults to resource group location. The location of the resources.') param location string = resourceGroup().location diff --git a/apps/frontend/azuredeploy-frontend.json b/apps/frontend/azuredeploy-frontend.json index 04103f9a..faa63b1a 100644 --- a/apps/frontend/azuredeploy-frontend.json +++ b/apps/frontend/azuredeploy-frontend.json @@ -70,7 +70,7 @@ }, "azureSearchAPIVersion": { "type": "string", - "defaultValue": "2023-07-01-Preview", + "defaultValue": "2023-10-01-preview", "metadata": { "description": "Optional. The API version of the Azure Search." } @@ -89,14 +89,14 @@ }, "azureOpenAIModelName": { "type": "string", - "defaultValue": "gpt-4-32k", + "defaultValue": "gpt-35-turbo-1106", "metadata": { "description": "Optional. The model name of the Azure OpenAI." } }, "azureOpenAIAPIVersion": { "type": "string", - "defaultValue": "2023-05-15", + "defaultValue": "2023-12-01-preview", "metadata": { "description": "Optional. The API version of the Azure OpenAI." } diff --git a/apps/frontend/frontend.zip b/apps/frontend/frontend.zip index 2911af0f..7157bb93 100644 Binary files a/apps/frontend/frontend.zip and b/apps/frontend/frontend.zip differ diff --git a/apps/frontend/pages/1_Search.py b/apps/frontend/pages/1_Search.py index fde6be73..0a486a31 100644 --- a/apps/frontend/pages/1_Search.py +++ b/apps/frontend/pages/1_Search.py @@ -4,9 +4,11 @@ import re import time import random +from operator import itemgetter from collections import OrderedDict from langchain_core.documents import Document from langchain_openai import AzureChatOpenAI +from langchain_core.output_parsers import StrOutputParser from utils import get_search_results from prompts import DOCSEARCH_PROMPT @@ -70,7 +72,7 @@ def clear_submit(): os.environ["OPENAI_API_VERSION"] = os.environ["AZURE_OPENAI_API_VERSION"] MODEL = os.environ.get("AZURE_OPENAI_MODEL_NAME") - llm = AzureChatOpenAI(deployment_name=MODEL, temperature=0.5, max_tokens=1000) + llm = AzureChatOpenAI(deployment_name=MODEL, temperature=0.5, max_tokens=1500) if button or st.session_state.get("submit"): if not query: @@ -103,16 +105,12 @@ def clear_submit(): with st.spinner(add_text): if(len(top_docs)>0): chain = ( - { - "context": top_docs, - "question": itemgetter("question") - } - | DOCSEARCH_PROMPT # Passes the 4 variables above to the prompt template + DOCSEARCH_PROMPT # Passes the 4 variables above to the prompt template | llm # Passes the finished prompt to the LLM | StrOutputParser() # converts the output (Runnable object) to the desired output (string) ) - answer = chain.invoke({"question": query}) + answer = chain.invoke({"question": query, "context":top_docs}) else: answer = {"output_text":"No results found" } @@ -123,7 +121,7 @@ def clear_submit(): with placeholder.container(): st.markdown("#### Answer") - st.markdown(answer["output_text"], unsafe_allow_html=True) + st.markdown(answer, unsafe_allow_html=True) st.markdown("---") st.markdown("#### Search Results") diff --git a/common/prompts.py b/common/prompts.py index 3b796505..5f1963eb 100644 --- a/common/prompts.py +++ b/common/prompts.py @@ -9,27 +9,26 @@ I have various plugins and tools at my disposal to answer your questions effectively. Here are the available options: -1. \U0001F310 **@bing**: This tool allows me to access the internet and provide current information from the web. +1. \U0001F310 **bing**: This tool allows me to access the internet and provide current information from the web. -2. \U0001F4A1 **@chatgpt**: With this tool, I can draw upon my own knowledge based on the data I was trained on. Please note that my training data goes up until 2021. +2. \U0001F4A1 **chatgpt**: With this tool, I can draw upon my own knowledge based on the data I was trained on. Please note that my training data goes up until 2021. -3. \U0001F50D **@docsearch**: This tool allows me to search a specialized search engine index. It includes 10,000 ArXiv computer science documents from 2020-2021 and 90,000 Covid research articles from the same years. +3. \U0001F50D **docsearch**: This tool allows me to search a specialized search engine index. It includes 10,000 ArXiv computer science documents from 2020-2021 and 90,000 Covid research articles from the same years. -4. \U0001F4D6 **@booksearch**: This tool allows me to search on 5 specific books: Rich Dad Poor Dad, Made to Stick, Azure Cognitive Search Documentation, Fundamentals of Physics and Boundaries. +4. \U0001F4D6 **booksearch**: This tool allows me to search on 5 specific books: Rich Dad Poor Dad, Made to Stick, Azure Cognitive Search Documentation, Fundamentals of Physics and Boundaries. -5. \U0001F4CA **@sqlsearch**: By utilizing this tool, I can access a SQL database containing information about Covid cases, deaths, and hospitalizations in 2020-2021. +5. \U0001F4CA **sqlsearch**: By utilizing this tool, I can access a SQL database containing information about Covid cases, deaths, and hospitalizations in 2020-2021. From all of my sources, I will provide the necessary information and also mention the sources I used to derive the answer. This way, you can have transparency about the origins of the information and understand how I arrived at the response. To make the most of my capabilities, please mention the specific tool you'd like me to use when asking your question. Here's an example: ``` -@bing, who is the daughter of the President of India? -@chatgpt, how can I read a remote file from a URL using pandas? -@docsearch, Does chloroquine really works against covid? -@booksearch, tell me the legend of the stolen kidney in the book "Made To Stick" -@sqlsearch, how many people died on the West Coast in 2020? -@apisearch, in UK how many people died of covid percentage wise based on its population? +bing, who is the daughter of the President of India? +chatgpt, how can I read a remote file from a URL using pandas? +docsearch, Does chloroquine really works against covid? +booksearch, tell me the legend of the stolen kidney in the book "Made To Stick" +sqlsearch, how many people died on the West Coast in 2020? ``` Feel free to ask any question and specify the tool you'd like me to utilize. I'm here to assist you! @@ -322,9 +321,9 @@ BING_PROMPT_PREFIX = CUSTOM_CHATBOT_PREFIX + """ -## About your ability to gather and present information: +## On your ability to gather and present information: - **You must always** perform web searches when the user is seeking information (explicitly or implicitly), regardless of your internal knowledge or information. -- **You must Always** perform at least 3 and up to 5 searches in a single conversation turn before reaching the Final Answer. You should never search the same query more than once. +- **You Always** perform at least 3 and up to 5 searches in a single conversation turn before reaching the Final Answer. You should never search the same query more than once. - You can visit links/websites using the WebFetcher tool for up-to-date information. - You can also use the WebFetcher tool to visit the top links from the Searches if you need to double click on those links and get a comprehensive answer. - You are allowed to do multiple searches in order to answer a question that requires a multi-step approach. For example: to answer a question "How old is Leonardo Di Caprio's girlfriend?", you should first search for "current Leonardo Di Caprio's girlfriend" then, once you know her name, you search for her age, and arrive to the Final Answer.