The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs: fix import path for `FlashrankRerank` example notebook (#19146)
Simon Stonedc4ce82dddc3
diff --git a/docs/docs/integrations/retrievers/flashrank-reranker.ipynb b/docs/docs/integrations/retrievers/flashrank-reranker.ipynbindex 01732e67f2..93697614cd 100644--- a/docs/docs/integrations/retrievers/flashrank-reranker.ipynb+++ b/docs/docs/integrations/retrievers/flashrank-reranker.ipynb@@ -28,17 +28,17 @@},"outputs": [],"source": [- "% pip install --upgrade --quiet flashrank\n",- "% pip install --upgrade --quiet faiss\n",+ "%pip install --upgrade --quiet flashrank\n",+ "%pip install --upgrade --quiet faiss\n","\n","# OR (depending on Python version)\n","\n",- "% pip install --upgrade --quiet faiss_cpu"+ "%pip install --upgrade --quiet faiss_cpu"]},{"cell_type": "code",- "execution_count": 13,+ "execution_count": 2,"metadata": {"collapsed": false,"jupyter": {@@ -73,7 +73,7 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 3,"metadata": {"collapsed": false,"jupyter": {@@ -90,7 +90,7 @@},{"cell_type": "code",- "execution_count": 15,+ "execution_count": 4,"metadata": {"collapsed": false,"jupyter": {@@ -247,14 +247,6 @@"----------------------------------------------------------------------------------------------------\n","Document 15:\n","\n",- "My plan to fight inflation will lower your costs and lower the deficit. \n",- "\n",- "17 Nobel laureates in economics say my plan will ease long-term inflationary pressures. Top business leaders and most Americans support my plan. And here’s the plan: \n",- "\n",- "First – cut the cost of prescription drugs. Just look at insulin. One in ten Americans has diabetes. In Virginia, I met a 13-year-old boy named Joshua Davis.\n",- "----------------------------------------------------------------------------------------------------\n",- "Document 16:\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",@@ -263,15 +255,15 @@"\n","There is so much we can do. Increase funding for prevention, treatment, harm reduction, and recovery.\n","----------------------------------------------------------------------------------------------------\n",- "Document 17:\n",+ "Document 16:\n","\n",- "So let’s not abandon our streets. Or choose between safety and equal justice. \n",+ "My plan to fight inflation will lower your costs and lower the deficit. \n","\n",- "Let’s come together to protect our communities, restore trust, and hold law enforcement accountable. \n",+ "17 Nobel laureates in economics say my plan will ease long-term inflationary pressures. Top business leaders and most Americans support my plan. And here’s the plan: \n","\n",- "That’s why the Justice Department required body cameras, banned chokeholds, and restricted no-knock warrants for its officers.\n",+ "First – cut the cost of prescription drugs. Just look at insulin. One in ten Americans has diabetes. In Virginia, I met a 13-year-old boy named Joshua Davis.\n","----------------------------------------------------------------------------------------------------\n",- "Document 18:\n",+ "Document 17:\n","\n","My plan will not only lower costs to give families a fair shot, it will lower the deficit. \n","\n",@@ -281,6 +273,14 @@"\n","We’re going after the criminals who stole billions in relief money meant for small businesses and millions of Americans.\n","----------------------------------------------------------------------------------------------------\n",+ "Document 18:\n",+ "\n",+ "So let’s not abandon our streets. Or choose between safety and equal justice. \n",+ "\n",+ "Let’s come together to protect our communities, restore trust, and hold law enforcement accountable. \n",+ "\n",+ "That’s why the Justice Department required body cameras, banned chokeholds, and restricted no-knock warrants for its officers.\n",+ "----------------------------------------------------------------------------------------------------\n","Document 19:\n","\n","I understand. \n",@@ -340,16 +340,25 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 5,"metadata": {"collapsed": false,"jupyter": {"outputs_hidden": false}},- "outputs": [],+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "[0, 5, 3]\n"+ ]+ }+ ],"source": [- "from langchain.retrievers import ContextualCompressionRetriever, FlashrankRerank\n",+ "from langchain.retrievers import ContextualCompressionRetriever\n",+ "from langchain.retrievers.document_compressors import FlashrankRerank\n","from langchain_openai import ChatOpenAI\n","\n","llm = ChatOpenAI(temperature=0)\n",@@ -379,7 +388,7 @@},{"cell_type": "code",- "execution_count": 20,+ "execution_count": 6,"metadata": {"collapsed": false,"jupyter": {@@ -399,29 +408,27 @@"----------------------------------------------------------------------------------------------------\n","Document 2:\n","\n",- "And tonight, I’m announcing that the Justice Department will name a chief prosecutor for pandemic fraud. \n",- "\n",- "By the end of this year, the deficit will be down to less than half what it was before I took office. \n",- "\n",- "The only president ever to cut the deficit by more than one trillion dollars in a single year. \n",+ "He met the Ukrainian people. \n","\n",- "Lowering your costs also means demanding more competition. \n",+ "From President Zelenskyy to every Ukrainian, their fearlessness, their courage, their determination, inspires the world. \n","\n",- "I’m a capitalist, but capitalism without competition isn’t capitalism. \n",+ "Groups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland. \n","\n",- "It’s exploitation—and it drives up prices.\n",+ "In this struggle as President Zelenskyy said in his speech to the European Parliament “Light will win over darkness.” The Ukrainian Ambassador to the United States is here tonight.\n","----------------------------------------------------------------------------------------------------\n","Document 3:\n","\n",- "As Ohio Senator Sherrod Brown says, “It’s time to bury the label “Rust Belt.” \n",+ "And tonight, I’m announcing that the Justice Department will name a chief prosecutor for pandemic fraud. \n","\n",- "It’s time. \n",+ "By the end of this year, the deficit will be down to less than half what it was before I took office. \n","\n",- "But with all the bright spots in our economy, record job growth and higher wages, too many families are struggling to keep up with the bills. \n",+ "The only president ever to cut the deficit by more than one trillion dollars in a single year. \n","\n",- "Inflation is robbing them of the gains they might otherwise feel. \n",+ "Lowering your costs also means demanding more competition. \n",+ "\n",+ "I’m a capitalist, but capitalism without competition isn’t capitalism. \n","\n",- "I get it. That’s why my top priority is getting prices under control.\n"+ "It’s exploitation—and it drives up prices.\n"]}],@@ -443,7 +450,7 @@},{"cell_type": "code",- "execution_count": 18,+ "execution_count": 7,"metadata": {"collapsed": false,"jupyter": {@@ -459,7 +466,7 @@},{"cell_type": "code",- "execution_count": 19,+ "execution_count": 8,"metadata": {"collapsed": false,"jupyter": {@@ -471,10 +478,10 @@"data": {"text/plain": ["{'query': 'What did the president say about Ketanji Brown Jackson',\n",- " 'result': \"The President said that Ketanji Brown Jackson is one of our nation's top legal minds and will continue Justice Breyer's legacy of excellence.\"}"+ " 'result': \"The President mentioned that Ketanji Brown Jackson is one of the nation's top legal minds and will continue Justice Breyer's legacy of excellence.\"}"]},- "execution_count": 19,+ "execution_count": 8,"metadata": {},"output_type": "execute_result"}@@ -500,7 +507,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython3",- "version": "3.10.12"+ "version": "3.12.2"}},"nbformat": 4,