From 0027845580ae22bc8c0ad8e8da9e441a1ea26d16 Mon Sep 17 00:00:00 2001 From: Dmitry Maslennikov Date: Mon, 5 Feb 2024 20:52:08 +0400 Subject: [PATCH] updated demo --- demo.ipynb | 103 +++++++++++++++-------------------------------------- 1 file changed, 28 insertions(+), 75 deletions(-) diff --git a/demo.ipynb b/demo.ipynb index f14a9fc..66f4a61 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -41,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -66,13 +66,13 @@ "text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n", "docs = text_splitter.split_documents(documents)\n", "\n", - "embeddings = OpenAIEmbeddings()\n", - "# embeddings = FastEmbedEmbeddings()" + "# embeddings = OpenAIEmbeddings()\n", + "embeddings = FastEmbedEmbeddings()" ] }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -80,7 +80,7 @@ "output_type": "stream", "text": [ "Pulling image containers.intersystems.com/intersystems/iris:2023.3\n", - "Container started: 4a2bb9f24e81\n", + "Container started: bd7acb4e7e13\n", "Waiting to be ready...\n" ] }, @@ -97,8 +97,14 @@ "import os\n", "from testcontainers.iris import IRISContainer\n", "\n", - "license_key = os.path.abspath(os.path.expanduser(\"~/iris.key\"))\n", - "image = 'containers.intersystems.com/intersystems/iris:2023.3'\n", + "# Enterprise version with iris.key placed in the user's home directory\n", + "# license_key = os.path.abspath(os.path.expanduser(\"~/iris.key\"))\n", + "# image = 'containers.intersystems.com/intersystems/iris:2023.3'\n", + "\n", + "# Community Edition\n", + "license_key = None\n", + "image = 'containers.intersystems.com/intersystems/iris-community:2023.3'\n", + "\n", "# image = 'iris:2024.1'\n", "container = IRISContainer(image, username=\"demo\", password=\"demo\", namespace=\"demo\", license_key=license_key)\n", "container.with_exposed_ports(1972, 52773)\n", @@ -111,7 +117,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -127,7 +133,17 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "ids=db.get()[\"ids\"]\n", + "db.delete(ids)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -137,72 +153,9 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 14, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "--------------------------------------------------------------------------------\n", - "Score: 0.1845943766979149\n", - "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. \n", - "\n", - "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. \n", - "\n", - "One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. \n", - "\n", - "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.\n", - "--------------------------------------------------------------------------------\n", - "--------------------------------------------------------------------------------\n", - "Score: 0.2172726844507349\n", - "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. \n", - "\n", - "And if we are to advance liberty and justice, we need to secure the Border and fix the immigration system. \n", - "\n", - "We can do both. At our border, we’ve installed new technology like cutting-edge scanners to better detect drug smuggling. \n", - "\n", - "We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers. \n", - "\n", - "We’re putting in place dedicated immigration judges so families fleeing persecution and violence can have their cases heard faster. \n", - "\n", - "We’re securing commitments and supporting partners in South and Central America to host more refugees and secure their own borders.\n", - "--------------------------------------------------------------------------------\n", - "--------------------------------------------------------------------------------\n", - "Score: 0.22621647141107482\n", - "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. \n", - "\n", - "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. \n", - "\n", - "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. \n", - "\n", - "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. \n", - "\n", - "So tonight I’m offering a Unity Agenda for the Nation. Four big things we can do together. \n", - "\n", - "First, beat the opioid epidemic.\n", - "--------------------------------------------------------------------------------\n", - "--------------------------------------------------------------------------------\n", - "Score: 0.22654453165838107\n", - "Tonight, I’m announcing a crackdown on these companies overcharging American businesses and consumers. \n", - "\n", - "And as Wall Street firms take over more nursing homes, quality in those homes has gone down and costs have gone up. \n", - "\n", - "That ends on my watch. \n", - "\n", - "Medicare is going to set higher standards for nursing homes and make sure your loved ones get the care they deserve and expect. \n", - "\n", - "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. \n", - "\n", - "Let’s pass the Paycheck Fairness Act and paid leave. \n", - "\n", - "Raise the minimum wage to $15 an hour and extend the Child Tax Credit, so no one has to raise a family in poverty. \n", - "\n", - "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.\n", - "--------------------------------------------------------------------------------\n" - ] - } - ], + "outputs": [], "source": [ "for doc, score in docs_with_score:\n", " print(\"-\" * 80)\n",