Spaces:
Running
Running
File size: 48,995 Bytes
b82f276 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | {
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "616e64bc-eb58-434c-a526-ff99d81e037d",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting openai\n",
" Using cached openai-1.64.0-py3-none-any.whl.metadata (27 kB)\n",
"Requirement already satisfied: anyio<5,>=3.5.0 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from openai) (4.2.0)\n",
"Requirement already satisfied: distro<2,>=1.7.0 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from openai) (1.9.0)\n",
"Requirement already satisfied: httpx<1,>=0.23.0 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from openai) (0.27.0)\n",
"Collecting jiter<1,>=0.4.0 (from openai)\n",
" Downloading jiter-0.8.2-cp312-cp312-win_amd64.whl.metadata (5.3 kB)\n",
"Requirement already satisfied: pydantic<3,>=1.9.0 in c:\\users\\sriram\\appdata\\roaming\\python\\python312\\site-packages (from openai) (2.10.6)\n",
"Requirement already satisfied: sniffio in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from openai) (1.3.0)\n",
"Requirement already satisfied: tqdm>4 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from openai) (4.66.5)\n",
"Requirement already satisfied: typing-extensions<5,>=4.11 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from openai) (4.11.0)\n",
"Requirement already satisfied: idna>=2.8 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from anyio<5,>=3.5.0->openai) (3.7)\n",
"Requirement already satisfied: certifi in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from httpx<1,>=0.23.0->openai) (2024.8.30)\n",
"Requirement already satisfied: httpcore==1.* in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from httpx<1,>=0.23.0->openai) (1.0.2)\n",
"Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
"Requirement already satisfied: annotated-types>=0.6.0 in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from pydantic<3,>=1.9.0->openai) (0.6.0)\n",
"Requirement already satisfied: pydantic-core==2.27.2 in c:\\users\\sriram\\appdata\\roaming\\python\\python312\\site-packages (from pydantic<3,>=1.9.0->openai) (2.27.2)\n",
"Collecting typing-extensions<5,>=4.11 (from openai)\n",
" Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)\n",
"Requirement already satisfied: colorama in c:\\users\\sriram\\anaconda3.1\\lib\\site-packages (from tqdm>4->openai) (0.4.6)\n",
"Using cached openai-1.64.0-py3-none-any.whl (472 kB)\n",
"Downloading jiter-0.8.2-cp312-cp312-win_amd64.whl (204 kB)\n",
"Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)\n",
"Installing collected packages: typing-extensions, jiter, openai\n",
" Attempting uninstall: typing-extensions\n",
" Found existing installation: typing_extensions 4.11.0\n",
" Uninstalling typing_extensions-4.11.0:\n",
" Successfully uninstalled typing_extensions-4.11.0\n",
"Successfully installed jiter-0.8.2 openai-1.64.0 typing-extensions-4.12.2\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"markitdown 0.0.1a4 requires puremagic, which is not installed.\n",
"markitdown 0.0.1a4 requires pydub, which is not installed.\n",
"python-pptx 1.0.2 requires XlsxWriter>=0.5.7, which is not installed.\n",
"streamlit 1.37.1 requires pillow<11,>=7.1.0, but you have pillow 11.1.0 which is incompatible.\n"
]
}
],
"source": [
"pip install openai"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "d7d7f4ad-43ce-4521-abac-0ae764de8b45",
"metadata": {},
"outputs": [],
"source": [
"import pickle"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "a26984df-16d9-4dc8-93e6-b920c4bc68c5",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The question of the meaning of life is one of the most profound and elusive questions humanity has ever pondered. It touches upon various disciplines, including philosophy, religion, spirituality, and science, each offering different perspectives.\n",
"\n",
"1. **Philosophical Perspectives**:\n",
" - **Existentialism**: Suggests that life has no inherent meaning, and it's up to each individual to create their own purpose.\n",
" - **Absurdism**: Posits that the human desire for meaning in a seemingly meaningless world is the root of absurdity, but in acknowledging this, we can find freedom to create our own meaning.\n",
" - **Hedonism**: Argues that the meaning of life is to seek pleasure and avoid pain, though this can vary from Epicureanism (moderate pleasures) to more extreme forms.\n",
" - **Stoicism**: Emphasizes living in accordance with reason and virtue, suggesting meaning is found in living a life of wisdom, self-control, and inner strength.\n",
"\n",
"2. **Religious and Spiritual Perspectives**:\n",
" - **Monotheistic Religions (e.g., Christianity, Islam, Judaism)**: Often suggest the meaning of life is to serve and worship God, follow divine commandments, and achieve salvation or a similar afterlife goal.\n",
" - **Eastern Religions (e.g., Buddhism, Hinduism)**: May propose the meaning of life is to achieve spiritual enlightenment, liberation from the cycle of rebirth (samsara), or to realize one's true nature.\n",
" - **Pagan and Indigenous Beliefs**: Can emphasize living in harmony with nature, honoring ancestors, and fulfilling one's role within the community and the natural world.\n",
"\n",
"3. **Scientific Perspectives**:\n",
" - **Biological**: From a purely biological standpoint, the meaning of life could be seen as the perpetuation of genes, ensuring the survival of one's species.\n",
" - **Psychological**: Suggests that meaning is derived from personal fulfillment, happiness, and the pursuit of one's passions and values.\n",
" - **Cosmological/Astronomical**: Might view life as a rare, perhaps unique, occurrence in the universe, with its meaning found in the exploration and understanding of the cosmos.\n",
"\n",
"4. **Personal and Subjective Meaning**:\n",
" - Ultimately, many people find the meaning of life through personal experiences, relationships, achievements, and the pursuit of passions. This can include love, family, career fulfillment, personal growth, and contributing to society in meaningful ways.\n",
"\n",
"In essence, the meaning of life is a deeply personal question that may have as many answers as there are people pondering it. It can evolve over time for an individual, influenced by experiences, beliefs, and the world around them. While there may not be a universally accepted answer, the search for meaning itself can be a profoundly enriching and meaningful journey."
]
}
],
"source": [
"from openai import OpenAI\n",
"\n",
"client = OpenAI(\n",
" base_url=\"https://openrouter.ai/api/v1\",\n",
" api_key=\"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\",\n",
")\n",
"\n",
"completion = client.chat.completions.create(\n",
" # extra_headers={\n",
" # \"HTTP-Referer\": \"<YOUR_SITE_URL>\", # Optional. Site URL for rankings on openrouter.ai.\n",
" # \"X-Title\": \"<YOUR_SITE_NAME>\", # Optional. Site title for rankings on openrouter.ai.\n",
" # },\n",
" model=\"nvidia/llama-3.1-nemotron-70b-instruct:free\",\n",
" messages=[\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": \"What is the meaning of life?\"\n",
" }\n",
" ],\n",
" temperature = 0,\n",
" stream = True,\n",
" max_tokens = 1024\n",
" \n",
" \n",
")\n",
"\n",
"for chunk in completion:\n",
" if chunk.choices[0].delta.content is not None:\n",
" print(chunk.choices[0].delta.content, end = '')"
]
},
{
"cell_type": "code",
"execution_count": 79,
"id": "047a75dc-e485-430a-91c2-a40e3b41710e",
"metadata": {},
"outputs": [],
"source": [
"def nemotron_llama(query, context):\n",
"\n",
" prompt_template = \"\"\"\n",
" you are an intelligent system who answers law related questions based on the provided context\n",
" Instructions:\n",
" - answer only from the context \n",
" - don't use your knowledge to answer the question\n",
" - do not mention in your response that you refered to a external context for answering user's question\n",
" - add citations to your answer like date and page number at the end of each sentences\n",
" here is an example:\n",
" user:What are the conditions under which a person of Indian origin residing outside India can be deemed a citizen of India?\n",
" system:\n",
" ## Conditions for Citizenship of Indian Origin Persons Residing Outside India\n",
"\n",
" A person of Indian origin residing outside India can be deemed a citizen of India if:\n",
" \n",
" 1. **Birth Requirement**: They, either of their parents, or any of their grandparents were born in India as defined in the Government of India Act, 1935 (as originally enacted).\n",
" 2. **Residency Requirement**: They are ordinarily residing in a country outside India as defined in that Act.\n",
" 3. **Registration by Diplomatic/Consular Representative**: They have been registered as a citizen of India by a diplomatic or consular representative of India in the country where they are residing.\n",
" 4. **Application Requirement**: They must apply for such registration in the prescribed form and manner, as determined by the Government of the Dominion of India or the Government of India.\n",
"\n",
" Reference:\n",
" **Title**:THE CONSTITUTION OF INDIA \n",
" page numbers:23,45,88\n",
"\n",
" - take the above as an example and follow the same structure\n",
" - take the Page Number and Date from the context to cite your answer\n",
" context:{}\n",
"\"\"\"\n",
" prompt_template = prompt_template.format(context)\n",
" client = OpenAI(\n",
" base_url=\"https://openrouter.ai/api/v1\",\n",
" api_key=\"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\",\n",
" )\n",
" \n",
" completion = client.chat.completions.create(\n",
" # extra_headers={\n",
" # \"HTTP-Referer\": \"<YOUR_SITE_URL>\", # Optional. Site URL for rankings on openrouter.ai.\n",
" # \"X-Title\": \"<YOUR_SITE_NAME>\", # Optional. Site title for rankings on openrouter.ai.\n",
" # },\n",
" model=\"nvidia/llama-3.1-nemotron-70b-instruct:free\",\n",
" messages=[\n",
" {\"role\":\"system\", \"content\":prompt_template},\n",
" {\"role\": \"user\",\"content\": query}\n",
" ],\n",
" temperature = 0,\n",
" stream = True,\n",
" max_tokens = 1024\n",
" \n",
" \n",
" )\n",
" \n",
" for chunk in completion:\n",
" if chunk.choices[0].delta.content is not None:\n",
" print(chunk.choices[0].delta.content, end = '')"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "e9df9256-a9e4-485b-a487-7de43d1a96c9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.9341315\n"
]
}
],
"source": [
"from transformers import AutoModel\n",
"from numpy.linalg import norm\n",
"\n",
"cos_sim = lambda a,b: (a @ b.T) / (norm(a)*norm(b))\n",
"model = AutoModel.from_pretrained('../../volumes/models/jina-embeddings-v2-base-en/', trust_remote_code=True) # trust_remote_code is needed to use the encode method\n",
"embeddings = model.encode(['How is the weather today?', 'What is the current weather like today?'])\n",
"print(cos_sim(embeddings[0], embeddings[1]))"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "d40317b0-2f1a-467c-add6-9815c863a087",
"metadata": {},
"outputs": [],
"source": [
"def get_embeddings(text:list):\n",
" embeddings = model.encode(text)\n",
" normalized_embeddings = embeddings/norm(embeddings[0])\n",
" return normalized_embeddings"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "cb0826fa-8556-4ffa-bbb8-a9ad747874d0",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index loaded successfully!\n",
"Number of vectors in the index: 404\n"
]
}
],
"source": [
"from retriever import vector_db_retriever"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "c4782457-890e-4af4-b8c2-e3720b600aa3",
"metadata": {},
"outputs": [],
"source": [
"with open(\"../../volumes/metadata/metadata.pkl\", \"rb\") as p:\n",
" metadata = pickle.load(p)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "c0fbd9e5-f076-4ecf-b260-7d336e6f7ec9",
"metadata": {},
"outputs": [],
"source": [
"ids = list(metadata.keys())"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "18e821a2-93dd-4b98-8f7d-3265e47231c7",
"metadata": {},
"outputs": [],
"source": [
"query = \" explain Seventh Amendment Act\"\n",
"query_embeddings = model.encode([query])"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "b9dbadac-f163-42c0-9af6-07f5e5e927d8",
"metadata": {},
"outputs": [],
"source": [
"result = vector_db_retriever(query_embeddings, 15)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "95388eab-453f-4dbf-87d3-2d966e5b32e7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"132"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result[0][0]"
]
},
{
"cell_type": "code",
"execution_count": 80,
"id": "2a695213-8725-484c-ae34-bf49451cd342",
"metadata": {},
"outputs": [],
"source": [
"def rag(query):\n",
" query_embeddings = model.encode([query])\n",
" result = vector_db_retriever(query_embeddings, 10)\n",
" indexes = result[0][0]\n",
" context = \"\"\n",
" for idx in indexes:\n",
" hash_id = ids[idx]\n",
" retrieved_results = metadata[hash_id]\n",
" context+=\"Title:\"+retrieved_results['title']+\"\\n\"+\"Date:\"+retrieved_results['date']+\"\\n\"+\"Page Number:\"+str(retrieved_results['page_no'])+\"\\n\"+\"Corpus:\"+retrieved_results['text']+\"\\n\\n\"\n",
" nemotron_llama(query, context)\n",
" print()\n",
" print(\"CONTEXT:\")\n",
" print(context)"
]
},
{
"cell_type": "code",
"execution_count": 81,
"id": "4bcf56ab-6412-4636-8769-d073195b5796",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"**Seventh Amendment Act, 1956: Key Provisions and Impacts**\n",
"\n",
"**Date:** November 1, 1956 (w.e.f.) [1]\n",
"**Page Numbers:** Various (referenced from THE CONSTITUTION OF INDIA 2022, May 2022)\n",
"**Relevant Sections:**\n",
"- **Article 15** (not directly provided in the given context, but amendments mentioned)\n",
"- **Article 16** (amendments mentioned in the context, Page Number: 39)\n",
"- **Article 224** (amended, Page Number: 133)\n",
"- **Article 368** (not directly provided, but related to amendment process)\n",
"- **Seventh Schedule** (amendments in List I and List II, Page Numbers: 347, 349)\n",
"\n",
"**Key Provisions and Impacts of the Seventh Amendment Act, 1956:**\n",
"\n",
"1. **Reorganization of States**: The most significant aspect of this amendment was the reorganization of states on a linguistic basis, leading to the merger of some states and the creation of new ones. This was achieved through changes in the First Schedule of the Constitution. [2]\n",
"\n",
"2. **Amendments to Article 16**:\n",
" - **Residence Requirement**: The amendment allowed for the prescription of residence requirements within a state or union territory for employment or appointment to an office under the government of, or any local or other authority within, that state or union territory (Article 16(3), Page 39) [3].\n",
"\n",
"3. **Amendments to Article 224**:\n",
" - **Appointment of Additional and Acting Judges**: The President, in consultation with the National Judicial Appointments Commission, was empowered to appoint duly qualified persons as additional judges of a High Court for a temporary period not exceeding two years, in case of a temporary increase in the business of the High Court or due to arrears of work (Article 224, Page 133) [4].\n",
"\n",
"4. **Seventh Schedule Amendments**:\n",
" - **List I (Union List)**: No direct references provided in the context, but typically, this list outlines subjects under the Union’s legislative jurisdiction.\n",
" - **List II (State List)**:\n",
" - **Entry 2**: Amended to include \"Police (including railway and village police) subject to the provisions of entry 2A of List I\" (Page 349) [5].\n",
" - **Entry 12**: Modified to exclude ancient and historical monuments and records declared by or under law made by Parliament to be of national importance (Page 349) [6].\n",
"\n",
"5. **Other Impacts**:\n",
" - The amendment also led to the abolition of the classifications of Part A, Part B, Part C, and Part D states, and the distinction between Part A and Part B states was removed, with all becoming a single category of states.\n",
" - The amendment to Article 246 redefined the legislative powers of the Union and the States.\n",
"\n",
"**References:**\n",
"- **Date and Page Numbers**: As per THE CONSTITUTION OF INDIA 2022, May 2022\n",
"- **Specific Amendments**:\n",
" - [1] Date: May 2022, Page Number: Not specified in the provided context.\n",
" - [2] Reorganization of States: Implied from the context, not directly quoted.\n",
" - [3] Article 16(3) Amendment: Page Number: 39\n",
" - [4] Article 224 Amendment: Page Number: 133\n",
" - [5] Seventh Schedule, List II, Entry 2: Page Number: 349\n",
" - [6] Seventh Schedule, List II, Entry 12: Page Number: 349\n",
"CONTEXT:\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:133\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Part VI.—The States) 102\n",
"222. Transfer of a Judge from one High Court to another. —(1) The \n",
"President may, 1[on the recommendation of the National Judicial Appointments \n",
"Commission referred to in article 124A], transfer a Judge from one High Court \n",
"to any other High Court 2***. \n",
"3[(2) When a Judge has been or is so transferred, he shall, during the \n",
"period he serves, after the commencement of the Constitution (Fifteenth \n",
"Amendment) Act, 1963, as a Judge of the other High Court, be entitled to \n",
"receive in addition to his salary such compensatory allowance as may be \n",
"determined by Parliament by law and, until so determined, such compensatory \n",
"allowance as the President may by order fix.] \n",
"223. Appointment of acting Chief Justice .—When the office of Chief \n",
"Justice of a High Court is vacant or when any such Chief Justice is, by reason \n",
"of absence or otherwise, unable to perform the duties of his office, the duties of \n",
"the office shall be performed by such one of the other Judges of the Court as \n",
"the President may appoint for the purpose. \n",
"4[224. Appointment of additional and acting Judges .—(1) If by \n",
"reason of any temporary increase in the business of a High Court or by reason \n",
"of arrears of work therein, it appears to the President that the number of the \n",
"Judges of that Court should be for the time being increased, 5[the President \n",
"may, in consultation with the National Judicial Appointments Commission, \n",
"appoint] duly qualified persons to be additional Judges of the Court for such \n",
"period not exceeding two years as he may specify. \n",
" (2) When any Judge of a High Court other than the Chief Justice is by \n",
"______________________________________________ \n",
"1. Subs. by the Constitution (Ninety-ninth Amendment) Act, 2014, s. 7, for \"after \n",
"consultation with the Chief Justice of India\" (w.e.f. 13-4-2015). This amendment has \n",
"been struck down by the Supreme Court in the case of Supreme Court Advocates-on-\n",
"Record Association and Another Vs. Union of India in its judgment dated 16-10-2015, \n",
"AIR 2016 SC 117. \n",
"2. The words \"within the territory of India\" omitted by the Constitution (Seventh \n",
"Amendment) Act, 1956, s. 14 (w.e.f. 1-11-1956). \n",
"3. Ins. by the Constitution (Fifteenth Amendment) Act, 1963, s. 5 (w.e.f. 5-10-1963). \n",
"Original cl. ( 2) was omitted by the Constitution (Seventh Amendment) Act, 1956, \n",
"s. 14 (w.e.f. 1-11-1956). \n",
"4. Subs. by the Constitution (Seventh Amendment) Act, 1956, s. 15 for art. 224 \n",
"(w.e.f. 1-11-1956). \n",
"5. Subs. by the Constitution (Ninety-ninth Amendment) Act, 2014, s. 8, for \"the \n",
"President may appoint\" (w.e.f. 13-4-2015). This amendment has been struck down, by \n",
"the Supreme Court in the case of Supreme Court Advocates-on-Record Association \n",
"and Another Vs. Union of India in its judgment, dated 16-10-2015, AIR 2016 SC 117. \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:279\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Part XXI. —Temporary, Transitional and Special Provisions) 247\n",
"Explanation I .—The expression “law in force” in this article shall \n",
"include a law passed or made by a Legislature or other competent authority in \n",
"the territory of India before the commencement of this Constitution and not \n",
"previously repealed, notwithstanding that it or parts of it may not be then in \n",
"operation either at all or in particular areas. \n",
"Explanation II .—Any law passed or made by a Legislature or other \n",
"competent authority in the territory of India which immediately before the \n",
"commencement of this Constitution had extra-territorial effect as well as effect \n",
"in the territory of India shall, subject to any such adaptations and modifications \n",
"as aforesaid, continue to have such extra-territorial effect. \n",
"Explanation III .—Nothing in this article shall be construed as continuing \n",
"any temporary law in force beyond the date fixed for its expiration or the date \n",
"on which it would have expired if this Constitution had not come into force. \n",
"Explanation IV. —An Ordinance promulgated by the Governor of a \n",
"Province under section 88 of the Government of India Act, 1935, and in force \n",
"immediately before the commencement of this Constitution shall, unless \n",
"withdrawn by the Governor of the corresponding State earlier, cease to operate \n",
"at the expiration of six weeks from the first meeting after such commencement \n",
"of the Legislative Assembly of that State functioning under clause (1) of article \n",
"382, and nothing in this article shall be construed as continuing any such \n",
"Ordinance in force beyond the said period. \n",
" 1[372A. Power of the President to adapt laws. —(1) For the purposes \n",
"of bringing the provisions of any law in force in India or in any part thereof, \n",
"immediately before the commencement of the Constitution (Seventh \n",
"Amendment) Act, 1956, into accord with the provisions of this Constitution as \n",
"amended by that Act, the President may by order made before the first day of \n",
"November, 1957, make such adaptations and modifications of the law, whether \n",
"by way of repeal or amendment, as may be necessary or expedient, and provide \n",
"that the law shall, as from such date as may be specified in the order, have \n",
"effect subject to the adaptations and modifications so made, and any such \n",
"adaptation or modification shall not be questioned in any court of law. \n",
"(2) Nothing in clause (1) shall be deemed to prevent a competent \n",
"Legislature or other competent authority from repealing or amending any law \n",
"adapted or modified by the President under the said clause.] \n",
" \n",
"______________________________________________ \n",
"1. Art.372A ins. by the Constitution (Seventh Amendment) Act, 1956, s. 23 \n",
" (w.e.f. 1-11-1956). \n",
" See the Adaptation of Laws Order of 1956 and 1957. \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:42\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Part III.—Fundamental Rights) 11\n",
"(6) Nothing in sub-clause ( g) of the said clause shall affect the operation \n",
"of any existing law in so far as it imposes, or prevent the State from making \n",
"any law imposing, in the interests of the general public, reasonable restrictions \n",
"on the exercise of the right conferred by the said sub-clause, and, in particular, \n",
"1[nothing in the said sub-clause shall affect the operation of any existing law in \n",
"so far as it relates to, or prevent the State from making any law relating to,— \n",
"(i) the professional or technical qualifications necessary for practising \n",
"any profession or carrying on any occupation, trade or business, or \n",
"(ii) the carrying on by the State, or by a corporation owned or \n",
"controlled by the State, of any trade, business, industry or service, \n",
"whether to the exclusion, complete or partial, of citizens or otherwise.] \n",
"20. Protection in respect of conviction for offences. —(1) No person \n",
"shall be convicted of any offence except for violation of a law in force at the \n",
"time of the commission of the Act charged as an offence, nor be subjected to a \n",
"penalty greater than that which might have been inflicted under the law in force \n",
"at the time of the commission of the offence. \n",
"(2) No person shall be prosecuted and punished for the same offence \n",
"more than once. \n",
"(3) No person accused of any offence shall be compelled to be a witness \n",
"against himself. \n",
"21. Protection of life and personal liberty. —No person shall be \n",
"deprived of his life or personal liberty except according to procedure \n",
"established by law. \n",
"2[21A. Right to education. —The State shall provide free and \n",
"compulsory education to all children of the age of six to fourteen years in such \n",
"manner as the State may, by law, determine.] \n",
"22. Protection against arrest and detention in certain cases. —(1) No \n",
"person who is arrested shall be detained in custody without being informed, as \n",
"soon as may be, of the grounds for such arrest nor shall he be denied the right \n",
"to consult, and to be defended by, a legal practitioner of his choice. \n",
"______________________________________________ \n",
"1. Subs. by the Constitution (First Amendment) Act, 1951, s. 3, for certain words \n",
"(w.e.f. 18-6-1951). \n",
"2 Ins. by the Constitution (Eighty-sixth Amendment) Act, 2002, s. 2 (w.e.f. 1-4-2010). \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:261\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Part XX. —Amendment of the Constitution) 229\n",
"the amendment shall also require to be ratified by the Legislatures of not less \n",
"than one-half of the States 1*** by resolutions to that effect passed by those \n",
"Legislatures before the Bill making provision for such amendment is presented \n",
"to the President for assent. \n",
"2[(3) Nothing in article 13 shall apply to any amendment made under this \n",
"article.] \n",
"3[(4) No amendment of this Constitution (including the provisions of \n",
"Part III) made or purporting to have been made under this article [whether before \n",
"or after the commencement of section 55 of the Constitution (Forty-second \n",
"Amendment) Act, 1976] shall be called in question in any court on any ground. \n",
" (5) For the removal of doubts, it is hereby declared that there shall be no \n",
"limitation whatever on the constituent power of Parliament to amend by way of \n",
"addition, variation or repeal the provisions of this Constitution under this article.] \n",
"______________________________________________ \n",
"1. The words and letters \"specified in Part A and Part B of the First Schedule\" omitted \n",
"by the Constitution (Seventh Amendment) Act, 1956, s. 29 and Sch. \n",
"(w.e.f. 1-11-1956). \n",
"2. Ins. by the Constitution (Twenty-fourth Amendment) Act, 1971, s. 3 (w.e.f. 5-11-1971). \n",
"3. Ins. by the Constitution (Forty-second Amendment) Act, 1976, s. 55 (w.e.f. 3-1-1977). \n",
"This section has been declared invalid by the Supreme Court in Minerva Mills Ltd. \n",
"and Others Vs. Union of India and Others AIR 1980 SC 1789. \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:273\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Part XXI. —Temporary, Transitional and Special Provisions) 241\n",
"shall be deemed to be illegal or void or ever to have become illegal or void \n",
"merely on the ground that the appointment, posting, promotion or transfer of \n",
"such person was not made in accordance with any law, then in force, providing \n",
"for any requirement as to residence within the State of Hyderabad or, as the \n",
"case may be, within any part of the State of Andhra Pradesh, in respect of such \n",
"appointment, posting, promotion or transfer. \n",
" (10) The provisions of this article and of any order made by the \n",
"President thereunder shall have effect notwithstanding anything in any other \n",
"provision of this Constitution or in any other law for the time being in force. \n",
"371E. Establishment of Central University in Andhra Pradesh.— \n",
"Parliament may by law provide for the establishment of a University in the \n",
"State of Andhra Pradesh.] \n",
"1[371F. Special provisions with respect to the State of Sikkim.—\n",
"Notwithstanding anything in this Constitution,— \n",
"(a) the Legislative Assembly of the State of Sikkim shall consist of \n",
"not less than thirty members; \n",
"(b) as from the date of commencement of the Constitution (Thirty-\n",
"sixth Amendment) Act, 1975 (hereafter in this article referred to as the \n",
"appointed day)— \n",
"(i) the Assembly for Sikkim formed as a result of the elections \n",
"held in Sikkim in April, 1974 with thirty-two members elected in the \n",
"said elections (hereinafter referred to as the sitting members) shall be \n",
"deemed to be the Legislative Assembly of the State of Sikkim duly \n",
"constituted under this Constitution; \n",
"(ii) the sitting members shall be deemed to be the members of \n",
"the Legislative Assembly of the State of Sikkim duly elected under \n",
"this Constitution; and \n",
"(iii) the said Legislative Assembly of the State of Sikkim shall \n",
"exercise the powers and perform the functions of the Legislative \n",
"Assembly of a State under this Constitution; \n",
"______________________________________________ \n",
"1. Art. 371 ins. by the Constitution (Thirty-sixth Amendment) Act, 1975, s. 3 \n",
" (w.e.f. 26-4-1975). \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:347\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Seventh Schedule) \n",
" 315\n",
"76. Audit of the accounts of the Union and of the States. \n",
"77. Constitution, organisation, jurisdiction and powers of the Supreme \n",
"Court (including contempt of such Court), and the fees taken therein; persons \n",
"entitled to practise before the Supreme Court. \n",
"78. Constitution and organisation 1[(including vacations)] of the High \n",
"Courts except provisions as to officers and servants of High Courts; persons \n",
"entitled to practise before the High Courts. \n",
"2[79. Extension of the jurisdiction of a High Court to, and exclusion of the \n",
"jurisdiction of a High Court from, any Union territory.] \n",
"80. Extension of the powers and jurisdiction of members of a police force \n",
"belonging to any State to any area outside that State, but not so as to enable the \n",
"police of one State to exercise powers and jurisdiction in any area outside that \n",
"State without the consent of the Government of the State in which such area is \n",
"situated; extension of the powers and jurisdiction of members of a police force \n",
"belonging to any State to railway areas outside that State. \n",
"81. Inter-State migration; inter-State quarantine. \n",
"82. Taxes on income other than agricultural income. \n",
"83. Duties of customs including export duties. \n",
"3[84. Duties of excise on the following goods manufactured or produced in \n",
"India, namely:— \n",
"(a) petroleum crude; \n",
"(b) high speed diesel; \n",
"(c) motor spirit (commonly known as petrol); \n",
"(d) natural gas; \n",
"(e) aviation turbine fuel; and \n",
"(f) tobacco and tobacco products.] \n",
"85. Corporation tax. \n",
"______________________________________________ \n",
"1. Ins. by the Constitution (Fifteenth Amendment) Act, 1963, s. 12 (with retrospective \n",
"effect). \n",
"2. Subs. by the Constitution (Seventh Amendment) Act, 1956, s. 29 and Sch. for entry 79 \n",
"(w.e.f. 1-11-1956). \n",
"3. Subs. by the Constitution (One Hundred and First Amendment) Act, 2016, s. 17( a)(i) \n",
"for entry 84 (w.e.f. 16-9-2016). \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:309\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Fifth Schedule) 277\n",
"Provided that if the number of representatives of the Scheduled Tribes in \n",
"the Legislative Assembly of the State is less than the number of seats in the \n",
"Tribes Advisory Council to be filled by such representatives, the remaining \n",
"seats shall be filled by other members of those tribes. \n",
"(2) It shall be the duty of the Tribes Advisory Council to advise on such \n",
"matters pertaining to the welfare and advancement of the Scheduled Tribes in \n",
"the State as may be referred to them by the Governor 1***. \n",
"(3) The Governor 2*** may make rules prescribing or regulating, as the \n",
"case may be,— \n",
"(a) the number of members of the Council, the mode of their \n",
"appointment and the appointment of the Chairman of the Council and of \n",
"the officers and servants thereof; \n",
"(b) the conduct of its meetings and its procedure in general; and \n",
"(c) all other incidental matters. \n",
"5. Law applicable to Scheduled Areas. —(1) Notwithstanding anything \n",
"in this Constitution, the Governor 1*** may by public notification direct that \n",
"any particular Act of Parliament or of the Legislature of the State shall not \n",
"apply to a Scheduled Area or any part thereof in the State or shall apply to a \n",
"Scheduled Area or any part thereof in the State subject to such exceptions and \n",
"modifications as he may specify in the notification and any direction given \n",
"under this sub-paragraph may be given so as to have retrospective effect. \n",
"(2) The Governor may make regulations for the peace and good \n",
"government of any area in a State which is for the time being a Scheduled Area. \n",
"In particular and without prejudice to the generality of the foregoing \n",
"power, such regulations may— \n",
"(a) prohibit or restrict the transfer of land by or among members \n",
"of the Scheduled Tribes in such area; \n",
"(b) regulate the allotment of land to members of the Scheduled \n",
"Tribes in such area; \n",
"______________________________________________ \n",
"1. The words \"or Rajpramukh, as the case may be\" omitted by the Constitution (Seventh \n",
"Amendment) Act, 1956, s. 29 and Sch. (w.e.f. 1-11-1956). \n",
"2. The words \"or Rajpramukh\" omitted by s. 29 and Sch., ibid. (w.e.f. 1-11-1956). \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:311\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Fifth Schedule) 279\n",
"(c) on any alteration of the boundaries of a State or on the \n",
"admission into the Union or the establishment of a new State, declare \n",
"any territory not previously included in any State to be, or to form part \n",
"of, a Scheduled Area; \n",
"1[(d) rescind, in relation to any State or States, any order or orders \n",
"made under this paragraph, and in consultation with the Governor of the \n",
"State concerned, make fresh orders redefining the areas which are to be \n",
"Scheduled Areas;] \n",
"and any such order may contain such incidental and consequential provisions as \n",
"appear to the President to be necessary and proper, but save as aforesaid, the \n",
"order made under sub-paragraph (1) of this paragraph shall not be varied by \n",
"any subsequent order. \n",
"PART D \n",
"AMENDMENT OF THE SCHEDULE \n",
"7. Amendment of the Schedule.— (1) Parliament may from time to time \n",
"by law amend by way of addition, variation or repeal any of the provisions of \n",
"this Schedule and, when the Schedule is so amended, any reference to this \n",
"Schedule in this Constitution shall be construed as a reference to such Schedule \n",
"as so amended. \n",
"(2) No such law as is mentioned in sub-paragraph (1) of this paragraph \n",
"shall be deemed to be an amendment of this Constitution for the purposes of \n",
"article 368. \n",
" \n",
" \n",
" \n",
"______________________________________________ \n",
"1. Ins. by the Fifth Schedule to the Constitution (Amendment) Act, 1976 (101 of 1976), \n",
"s. 2 (w.e.f. 7-9-1976). \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:349\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Seventh Schedule) \n",
" 317\n",
"List II—State List \n",
"1. Public order (but not including 1[the use of any naval, military or air \n",
"force or any other armed force of the Union or of any other force subject to the \n",
"control of the Union or of any contingent or unit thereof] in aid of the civil \n",
"power). \n",
"2[2. Police (including railway and village police) subject to the provisions \n",
"of entry 2A of List I.] \n",
"3. 3*** Officers and servants of the High Court; procedure in rent and \n",
"revenue courts; fees taken in all courts except the Supreme Court. \n",
"4. Prisons, reformatories, Borstal institutions and other institutions of a \n",
"like nature, and persons detained therein; arrangements with other States for the \n",
"use of prisons and other institutions. \n",
"5. Local government, that is to say, the constitution and powers of \n",
"municipal corporations, improvement trusts, districts boards, mining settlement \n",
"authorities and other local authorities for the purpose of local self-government \n",
"or village administration. \n",
"6. Public health and sanitation; hospitals and dispensaries. \n",
"7. Pilgrimages, other than pilgrimages to places outside India. \n",
"8. Intoxicating liquors, that is to say, the production, manufacture, \n",
"possession, transport, purchase and sale of intoxicating liquors. \n",
"9. Relief of the disabled and unemployable. \n",
"10. Burials and burial grounds; cremations and cremation grounds. \n",
"4[11* * * * *] \n",
"12. Libraries, museums and other similar institutions controlled or \n",
"financed by the State; ancient and historical monuments and records other than \n",
"those 5[declared by or under law made by Parliament] to be of national \n",
"importance. \n",
"______________________________________________ \n",
"1. Subs. by the Constitution (Forty-second Amendment) Act, 1976, s. 57, for certain \n",
"words (w.e.f. 3-1-1977). \n",
"2. Subs. by s. 57, for entry 2, ibid. (w.e.f. 3-1-1977). \n",
"3. Certain words omitted by s. 57, ibid. (w.e.f. 3-1-1977). \n",
"4. Entry 11 omitted by s. 57, ibid. (w.e.f. 3-1-1977). \n",
"5. Subs. by the Constitution (Seventh Amendment) Act, 1956, s. 27, for \"declared by \n",
"Parliament by law\" (w.e.f. 1-11-1956). \n",
"\n",
"Title:THE CONSTITUTION OF INDIA 2022\n",
"Date:May 2022\n",
"Page Number:39\n",
"Corpus:THE CONSTITUTION OF INDIA \n",
"(Part III.—Fundamental Rights) 8\n",
"Explanation .—For the purposes of this article and article 16, \n",
"\"economically weaker sections\" shall be such as may be notified by the State \n",
"from time to time on the basis of family income and other indicators of \n",
"economic disadvantage.] \n",
"16. Equality of opportunity in matters of public employment. —(1) \n",
"There shall be equality of opportunity for all citizens in matters relating to \n",
"employment or appointment to any office under the State. \n",
"(2) No citizen shall, on grounds only of religion, race, caste, sex, descent, \n",
"place of birth, residence or any of them, be ineligible for, or discriminated against \n",
"in respect of, any employment or office under the State. \n",
"(3) Nothing in this article shall prevent Parliament from making any law \n",
"prescribing, in regard to a class or classes of employment or appointment to an \n",
"office 1[under the Government of, or any local or other authority within, a State \n",
"or Union territory, any requirement as to residence within that State or Union \n",
"territory] prior to such employment or appointment. \n",
"(4) Nothing in this article shall prevent the State from making any \n",
"provision for the reservation of appointments or posts in favour of any \n",
"backward class of citizens which, in the opinion of the State, is not adequately \n",
"represented in the services under the State. \n",
"2[(4A) Nothing in this article shall prevent the State from making any \n",
"provision for reservation 3[in matters of promotion, with consequential \n",
"seniority, to any class] or classes of posts in the services under the State in \n",
"favour of the Scheduled Castes and the Scheduled Tribes which, in the opinion \n",
"of the State, are not adequately represented in the services under the State.] \n",
"4[(4B) Nothing in this article shall prevent the State from considering \n",
"any unfilled vacancies of a year which are reserved for being filled up in that \n",
"year in accordance with any provision for reservation made under clause (4) or \n",
"clause (4A) as a separate class of vacancies to be filled up in any succeeding \n",
"year or years and such class of vacancies shall not be considered together with \n",
"the vacancies of the year in which they are being filled up for determining the \n",
"ceiling of fifty per cent. reservation on total number of vacancies of that year.] \n",
"______________________________________________ \n",
"1. Subs. by the Constitution (Seventh Amendment) Act, 1956, s. 29 and Sch., for \"under \n",
"any State specified in the First Schedule or any local or other authority within its \n",
"territory, any requirement as to residence within that State\" (w.e.f. 1-11-1956). \n",
"2. Ins. by the Constitution (Seventy-seventh Amendment) Act, 1995, s. 2 (w.e.f. 17-6-1995). \n",
"3. Subs. by the Constitution (Eighty-fifth Amendment) Act, 2001, s. 2, for certain words \n",
"(retrospectively w.e.f. 17-6-1995). \n",
"4. Ins. by the Constitution (Eighty-first Amendment) Act, 2000, s. 2 (w.e.f. 9-6-2000). \n",
"\n",
"\n"
]
}
],
"source": [
"rag(query=\"explain Seventh Amendment Act\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a147573c-c49b-4646-b8bf-5eeccf4c6908",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "05351621-7081-4664-81a8-984468ddb113",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "187dee6f-c562-4c1e-901f-ebe10840a044",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "af1dc371-67a0-4e95-9888-08513d925906",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|